Image Viewer app
hfigure = imtool(...)
imtool close all
imtool opens the Image Viewer
app in an empty state. Use the File menu
options Open or Import
from Workspace to choose an image for display.
imtool(I) displays the grayscale
I in the Image Viewer.
imtool(I,[low high]) displays
the grayscale image
I in the Image Viewer, specifying
the display range for
I in the vector
high]. The value
low (and any value less
low) is displayed as black, the value
any value greater than
high) is displayed as white.
Values in between are displayed as intermediate shades of gray. The
Image Viewer uses the default number of gray levels. If you use an
empty matrix (
the Image Viewer uses
[min(I(:)) max(I(:))]; the
minimum value in
I is displayed as black, and the
maximum value is displayed as white.
imtool(RGB) displays the
RGB in the Image Viewer.
imtool(BW) displays the
BW in the Image Viewer. Pixel values
0 display as black; pixel values of
imtool(X,map) displays the
X with colormap
the Image Viewer.
the image contained in the graphics file
the Image Viewer. The file must contain an image that can be read
dicomread or a
reduced resolution dataset (R-Set) created by
If the file contains multiple images, the first one is displayed.
The file must be in the current directory or on the MATLAB® path.
hfigure = imtool(...) returns
a handle to the figure created by the Image Viewer.
the Image Viewer.
imtool close all closes
all open Image Viewers.
the image, specifying parameters and corresponding values that control
various aspects of the image display. The following table lists all
Parameter names can be abbreviated, and case does not matter.
2-D, real, m-by-3 matrix specifying
the colormap to use for the figure's
One of two text strings:
When set to
When set to a numeric value, the value specifies the magnification as a percentage. For example, if you specify 100, the Image Viewer displays the image at 100% magnification (one screen pixel for each image pixel).
By default, the initial magnification parameter is set
to the value returned by
A truecolor image can be
double. An indexed image can be
double. A grayscale image can be
double. A binary image must be
A binary image is of class logical.
For all grayscale images having integer types, the default display
For grayscale images of class
the default display range is
If the data range of a
is much larger or smaller than the default display range, you might
need to experiment with setting the display range to see features
in the image that would not be visible using the default display range.
To view very large TIFF or NITF images that will not fit into
memory, you can use
rsetwrite to create a reduced
resolution dataset (R-Set) viewable in the Image Viewer. R-Sets can
also improve performance of the Image Viewer for large images that
fit in memory.
The following tools can be used with an R-Set: Overview, Zoom, Pan, Image Information, and Distance. Other tools, however, will not work with an R-Set. You cannot use the Pixel Region, Adjust Contrast, Crop Image, and Window/Level tools. Please note that the Pixel Information tool displays only the x and y coordinates of a pixel and not the associated intensity, index, or [R G B] values.
You can use the Image Processing Preferences dialog box to set
toolbox preferences that modify the behavior of the Image Viewer.
To access the dialog, select File > Preferences in the MATLAB desktop
or Image Viewer menu. Also, you can set preferences programmatically
iptsetpref. The Image
Viewer preferences include:
the initial magnification for image display. To override this toolbox
preference, specify the
when you call
imtool, as follows:
whether the Overview tool opens automatically when you open an image
using the Image Viewer. Possible values:
true— Overview tool opens when you
open an image.
false}— Overview tool does not open
when you open an image. This is the default behavior.
For more information about these preferences, see
Display an image from a file.
Display an indexed image.
[X,map] = imread('trees.tif'); imtool(X,map)
Display a grayscale image.
I = imread('cameraman.tif'); imtool(I)
Display a grayscale image, adjusting the display range.
h = imtool(I,[0 80]); close(h)
imshow is the toolbox's fundamental image
display function, optimizing figure, axes, and image object property
settings for image display. The Image Viewer provides all the image
display capabilities of
imshow but also provides
access to several other tools for navigating and exploring images,
such as the Pixel Region tool, Image Information tool, and the Adjust
Contrast tool. The Image Viewer presents an integrated environment
for displaying images and performing some common image processing
You can access the Image Viewer through the Apps tab. Navigate to the Image Processing and Computer Vision group and select Image Viewer.