imtool
Syntax
imtool
imtool(I)
imtool(I,[low high])
imtool(RGB)
imtool(BW)
imtool(X,map)
imtool(filename)
hfigure = imtool(...)
imtool close all
imtool(...,param1,val1,param2,val2,...)
Description
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 image 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 [low high]
. The value low
(and any value less than low
) is displayed as black, the value high
(and 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 ([]
) for [low high]
, 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 truecolor image RGB
in the Image Viewer.
imtool(BW)
displays the binary image BW
in the Image Viewer. Pixel values of 0
display as black; pixel values of 1
display as white.
imtool(X,map)
displays the indexed image X
with colormap map
in the Image Viewer.
imtool(filename)
displays the image contained in the graphics file filename
in the Image Viewer. The file must contain an image that can be read by imread
or dicomread
or a reduced resolution dataset (R-Set) created by rsetwrite
. 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 hfigure
, a handle to the figure created by the Image Viewer. close(Hfigure)
closes the Image Viewer.
imtool close all
closes all open Image Viewers.
imtool(...,param1,val1,param2,val2,...)
displays the image, specifying parameters and corresponding values that control various aspects of the image display. The following table lists all imshow
parameters. Parameter names can be abbreviated, and case does not matter.
Class Support
A truecolor image can be uint8
, uint16
, single
, or double
. An indexed image can be logical
, uint8
, single
, or double
. A grayscale image can be uint8
, uint16
, int16
, single
, or double
. A binary image must be logical
. A binary image is of class logical.
For all grayscale images having integer types, the default display range is [intmin(class(I)) intmax(class(I))]
.
For grayscale images of class single
or double
, the default display range is [0 1]
. If the data range of a single
or double
image 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.
Large Data Support
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.
Related Toolbox Preferences
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 with iptsetpref
. The Image Viewer preferences include:
-
'ImtoolInitialMagnification'
controls the initial magnification for image display. To override this toolbox preference, specify the'InitialMagnification'
parameter when you callimtool
, as follows: -
'ImtoolStartWithOverview'
controls 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 iptprefs
.
Examples
Display an image from a file.
Display an indexed image.
Display a grayscale image.
Display a grayscale image, adjusting the display range.
Tips
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 ofimshow
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 tasks.
You can access the Image Viewer through the Apps tab. Navigate to the Image Processing and Computer Vision group and select Image Viewer.