function disp(imgmodel)
%DISP Display method for imagemodel objects.
%   DISP(IMGMODEL) prints a description of the imagemodel IMGMODEL to the
%   command window.
%
%   See also IMAGEMODEL, IMAGEMODEL/DISPLAY.

%   Copyright 1993-2004 The MathWorks, Inc.  
%   $Revision: 1.1.8.1 $  $Date: 2004/08/10 01:49:37 $

if length(imgmodel) > 1
  s = size(imgmodel);
  str = sprintf('%dx',s);
  str(end)=[];
  fprintf('%s array of IMAGEMODEL objects\n',str);

else

  propNames = { 'ClassType',...
                'DisplayRange',...
                'ImageHeight',...
                'ImageType',...
                'ImageWidth'};
  
  if ~strcmp(getImageType(imgmodel),'indexed')
    propNames{end+1} = 'MinIntensity';
    propNames{end+1} = 'MaxIntensity';              
  else
    propNames{end+1} = 'MinIndex';
    propNames{end+1} = 'MaxIndex';              
  end

  nprops = length(propNames);
  propVal = cell(1,nprops);
  
  for k = 1 : nprops
    name = propNames{k};
    switch name
     case 'ClassType'
      getPropVal= @getClassType;
     case 'DefaultPixelInfoString';
      getPropVal= @getDefaultPixelInfoString;
     case 'DefaultPixelRegionString';
      getPropVal= @getDefaultPixelRegionString;
     case 'DisplayRange';
      getPropVal= @getDisplayRange;
     case 'ImageHeight'
      getPropVal = @getImageHeight;
     case 'ImageType';
      getPropVal= @getImageType;
     case 'ImageWidth';
      getPropVal= @getImageWidth;
     case {'MinIntensity','MinIndex'}
      getPropVal= @getMinIntensity;
     case {'MaxIntensity','MaxIndex'}
      getPropVal= @getMaxIntensity;
    end
    
    propVal{k} = getPropVal(imgmodel);
  end
  
  fprintf('IMAGEMODEL object accessing an image with these properties:\n\n',...
          imgmodel.ImageHandle);
  disp(cell2struct(propVal,propNames,2))
end
