showImage - displays an image in a convenient way. showImage(img) - displays image in a new window img can be of any numerical type or a logical, and it must have two (gray-scale) or three (RGB) dimensions. img can be an Image structure (see initializeImage). The image is scaled appropriately. showImage(img,title) Rename the figure window to title. showImage(img,...,doNormalize) If doNormalize is 1, the image is maximum-normalized (default: 0). h = showImage(...) returns the handle of the figure. See also displayImage, displayMap, displayMaps, initializeImage, dataStructures.
0001 % showImage - displays an image in a convenient way. 0002 % 0003 % showImage(img) - displays image in a new window 0004 % img can be of any numerical type or a logical, and it 0005 % must have two (gray-scale) or three (RGB) dimensions. 0006 % img can be an Image structure (see initializeImage). 0007 % The image is scaled appropriately. 0008 % 0009 % showImage(img,title) 0010 % Rename the figure window to title. 0011 % 0012 % showImage(img,...,doNormalize) 0013 % If doNormalize is 1, the image is maximum-normalized 0014 % (default: 0). 0015 % 0016 % h = showImage(...) 0017 % returns the handle of the figure. 0018 % 0019 % See also displayImage, displayMap, displayMaps, initializeImage, dataStructures. 0020 0021 % This file is part of the SaliencyToolbox - Copyright (C) 2006-2008 0022 % by Dirk B. Walther and the California Institute of Technology. 0023 % See the enclosed LICENSE.TXT document for the license agreement. 0024 % More information about this project is available at: 0025 % http://www.saliencytoolbox.net 0026 0027 function h = showImage(img,varargin) 0028 0029 title = []; 0030 doNormalize = 0; 0031 for i = 1:length(varargin) 0032 if (isstr(varargin{i})) 0033 title = varargin{i}; 0034 else 0035 doNormalize = varargin{i}; 0036 end 0037 end 0038 0039 if (isa(img,'struct')) 0040 if (~any(isnan(img.filename)) & (length(title) == 0)) 0041 title = img.filename; 0042 end 0043 hh = showImage(loadImage(img),title,doNormalize); 0044 else 0045 if isempty(title) 0046 hh = figure; 0047 else 0048 hh = figure('Name',title,'NumberTitle','off'); 0049 end 0050 displayImage(img,doNormalize); 0051 end 0052 0053 if (nargout > 0) 0054 h = hh; 0055 end