This is a static copy of a profile reportHome
imshow (1 call, 0.234 sec)
Generated 15-Mar-2007 12:02:00 using real time.
M-function in file C:\Program Files\MATLAB71\toolbox\images\imuitools\imshow.m
[Copy to new window for comparing multiple runs]
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
201 | initSize(hh,initial_mag/100,is... | 1 | 0.094 s | 40.0% |  |
151 | [cdata, cdatamapping, clim, ma... | 1 | 0.063 s | 26.7% |  |
192 | single_image = isSingleImageDe... | 1 | 0.031 s | 13.3% |  |
186 | hh = basicImageDisplay(fig_han... | 1 | 0.016 s | 6.7% |  |
171 | fig_handle = ancestor(ax_handl... | 1 | 0.016 s | 6.7% |  |
Other lines & overhead | | | 0.016 s | 6.7% |  |
Totals | | | 0.234 s | 100% | |
Children (called functions)
M-Lint results
No M-Lint messages.Coverage results
[ Show coverage for parent directory ]
Total lines in file | 226 |
Non-code lines (comments, blank lines) | 178 |
Code lines (lines that can run) | 48 |
Code lines that did run | 30 |
Code lines that did not run | 18 |
Coverage (did run/can run) | 62.50 % |
Function listing
time calls line
1 function h=imshow(varargin)
2 %IMSHOW Display image.
3 % IMSHOW(I) displays the grayscale image I.
4 %
5 % IMSHOW(I,[LOW HIGH]) displays the grayscale image I, specifying the display
6 % range for I in [LOW HIGH]. The value LOW (and any value less than LOW)
7 % displays as black, the value HIGH (and any value greater than HIGH) displays
8 % as white. Values in between are displayed as intermediate shades of gray,
9 % using the default number of gray levels. If you use an empty matrix ([]) for
10 % [LOW HIGH], IMSHOW uses [min(I(:)) max(I(:))]; that is, the minimum value in
11 % I is displayed as black, and the maximum value is displayed as white.
12 %
13 % IMSHOW(RGB) displays the truecolor image RGB.
14 %
15 % IMSHOW(BW) displays the binary image BW. IMSHOW displays pixels with the
16 % value 0 (zero) as black and pixels with the value 1 as white.
17 %
18 % IMSHOW(X,MAP) displays the indexed image X with the colormap MAP.
19 %
20 % IMSHOW(FILENAME) displays the image stored in the graphics file FILENAME.
21 % The file must contain an image that can be read by IMREAD or
22 % DICOMREAD. IMSHOW calls IMREAD or DICOMREAD to read the image from the file,
23 % but does not store the image data in the MATLAB workspace. If the file
24 % contains multiple images, the first one will be displayed. The file must be
25 % in the current directory or on the MATLAB path.
26 %
27 % HIMAGE = IMSHOW(...) returns the handle to the image object created by
28 % IMSHOW.
29 %
30 % IMSHOW(...,PARAM1,VAL1,PARAM2,VAL2,...) displays the image, specifying
31 % parameters and corresponding values that control various aspects of the
32 % image display. Parameter names can be abbreviated, and case does not matter.
33 %
34 % Parameters include:
35 %
36 % 'DisplayRange' Two-element vector [LOW HIGH] that controls the
37 % display range of a grayscale image. See above
38 % for more details about how to set [LOW HIGH].
39 %
40 % Including the parameter name is optional, except
41 % when the image is specified by a filename.
42 % The syntax IMSHOW(I,[LOW HIGH]) is equivalent to
43 % IMSHOW(I,'DisplayRange',[LOW HIGH]).
44 % The parameter name must be specified when
45 % using IMSHOW with a filename, as in the syntax
46 % IMSHOW(FILENAME,'DisplayRange'[LOW HIGH]).
47 %
48 % 'InitialMagnification' A numeric scalar value, or the text string 'fit',
49 % that specifies the initial magnification used to
50 % display the image. When set to 100, the image is
51 % displayed at 100% magnification. When set to
52 % 'fit' IMSHOW scales the entire image to fit in
53 % the window.
54 %
55 % On initial display, the entire image is visible.
56 % If the magnification value would create an image
57 % that is too large to display on the screen,
58 % IMSHOW warns and displays the image at the
59 % largest magnification that fits on the screen.
60 %
61 % By default, the initial magnification is set to
62 % the value returned by
63 % IPTGETPREF('ImshowInitialMagnification').
64 %
65 % If the image is displayed in a figure with its
66 % 'WindowStyle' property set to 'docked', then
67 % IMSHOW warns and displays the image at the
68 % largest magnification that fits in the figure.
69 %
70 % 'XData' Two-element vector that establishes a
71 % nondefault spatial coordinate system by
72 % specifying the image XData. The value can
73 % have more than 2 elements, but only the first
74 % and last elements are actually used.
75 %
76 % 'YData' Two-element vector that establishes a
77 % nondefault spatial coordinate system by
78 % specifying the image YData. The value can
79 % have more than 2 elements, but only the first
80 % and last elements are actually used.
81 %
82 % Class Support
83 % -------------
84 % A truecolor image can be uint8, uint16, single, or double. An indexed image
85 % can be logical, uint8, single, or double. A grayscale image can be uint8,
86 % uint16, int16, single, or double. A binary image is of class logical.
87 %
88 % If your grayscale image is single or double, the default display range is
89 % [0 1]. If your image's data range is much larger or smaller than the default
90 % display range, you may need to experiment with setting the display range to
91 % see features in the image that would not be visible using the default
92 % display range. For all grayscale images having integer types, the default
93 % display range is [intmin(class(I)) intmax(class(I))].
94 %
95 % If your image is int16 or single, the CData in the resulting image
96 % object will be double. For all other classes, the CData matches the
97 % input image class.
98 %
99 % Related Toolbox Preferences
100 % ---------------------------
101 % You can use the IPTSETPREF function to set several toolbox preferences that
102 % modify the behavior of IMSHOW:
103 %
104 % - 'ImshowBorder' controls whether IMSHOW displays the image with a border
105 % around it.
106 %
107 % - 'ImshowAxesVisible' controls whether IMSHOW displays the image with the
108 % axes box and tick labels.
109 %
110 % - 'ImshowInitialMagnification' controls the initial magnification for
111 % image display, unless you override it in a particular call by
112 % specifying IMSHOW(...,'InitialMagnification',INITIAL_MAG).
113 %
114 % For more information about these preferences, see the reference entry for
115 % IPTSETPREF.
116 %
117 % Remarks
118 % -------
119 % IMSHOW is the toolbox's fundamental image display function, optimizing
120 % figure, axes, and image object property settings for image display. IMTOOL
121 % provides all the image display capabilities of IMSHOW but also provides
122 % access to several other tools for navigating and exploring images, such as
123 % the Pixel Region tool, Image Information tool, and the Adjust Contrast
124 % tool. IMTOOL presents an integrated environment for displaying images and
125 % performing some common image processing tasks.
126 %
127 % Examples
128 % --------
129 % % Display an image from a file
130 % imshow('board.tif')
131 %
132 % % Display an indexed image
133 % [X,map] = imread('trees.tif');
134 % imshow(X,map)
135 %
136 % % Display a grayscale image
137 % I = imread('cameraman.tif');
138 % imshow(I)
139 %
140 % % Display a grayscale image, adjust the diplay range
141 % h = imshow(I,[0 80]);
142 %
143 % See also IMREAD, IMTOOL, IPTGETPREF, IPTSETPREF, SUBIMAGE, TRUESIZE,
144 % WARP, IMAGE, IMAGESC.
145
146 % Copyright 1993-2005 The MathWorks, Inc.
147 % $Revision: 1.1.8.4 $ $Date: 2005/05/27 14:06:06 $
148
1 149 varargin_translated = preParseInputs(varargin{:});
150
0.06 1 151 [cdata, cdatamapping, clim, map, xdata, ydata, ...
152 initial_mag, style] = ...
153 imageDisplayParseInputs(varargin_translated{:});
154
1 155 if isempty(initial_mag)
0.02 1 156 initial_mag = iptgetpref('ImshowInitialMagnification');
157 else
158 initial_mag = checkInitialMagnification(initial_mag,{'fit'},...
159 mfilename,'INITIAL_MAG', ...
160 []);
161 end
162
1 163 new_figure = isempty(get(0,'CurrentFigure')) | ...
164 strcmp(get(get(0,'CurrentFigure'), 'NextPlot'), 'new');
165
1 166 if (new_figure)
167 fig_handle = figure('Visible', 'off');
168 ax_handle = axes('Parent', fig_handle);
1 169 else
1 170 ax_handle = newplot;
0.02 1 171 fig_handle = ancestor(ax_handle,'figure');
1 172 end
173
174
1 175 do_fit = strcmp(initial_mag,'fit');
1 176 if isempty(style)
1 177 style = get(fig_handle,'WindowStyle');
1 178 end
1 179 if ~do_fit && strcmp(style,'docked')
180 wid = sprintf('Images:%s:magnificationMustBeFitForDockedFigure',mfilename);
181 warning(wid,'%s%s','The initial magnification of the image is set to',...
182 ' ''fit'' in a docked figure.');
183 do_fit = true;
184 end
185
0.02 1 186 hh = basicImageDisplay(fig_handle,ax_handle,...
187 cdata,cdatamapping,clim,map,xdata,ydata);
1 188 set(get(ax_handle,'Title'),'Visible','on');
1 189 set(get(ax_handle,'XLabel'),'Visible','on');
1 190 set(get(ax_handle,'YLabel'),'Visible','on');
191
0.03 1 192 single_image = isSingleImageDefaultPos(fig_handle, ax_handle);
193
194
1 195 if single_image && do_fit && isBorderTight
196 % Have the image fill the figure.
197 set(ax_handle, 'Units', 'normalized', 'Position', [0 0 1 1]);
198 axes_moved = true;
199
1 200 elseif single_image && ~do_fit
0.09 1 201 initSize(hh,initial_mag/100,isBorderTight)
< 0.01 1 202 axes_moved = true;
203
204 else
205 axes_moved = false;
206
207 end
208
1 209 if axes_moved
210 % The next line is so that a subsequent plot(1:10) goes back
211 % to the default axes position.
1 212 set(fig_handle, 'NextPlot', 'replacechildren');
1 213 end
214
< 0.01 1 215 if (nargout > 0)
216 % Only return handle if caller requested it.
217 h = hh;
218 end
219
1 220 if (new_figure)
221 set(fig_handle, 'Visible', 'on');
222 end
223
1 224 end % imshow
225
226 %------------------------------------------------------------------------------
Other subfunctions in this file are not included in this listing.