imtool - Image Tool

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 a new Image Tool 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.

imtool(I,[low high]) displays the grayscale image I, 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. imtool uses the default number of gray levels. If you use an empty matrix ([]) for [low high], imtool 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.

imtool(BW) displays the binary image BW. Pixel values of 0display as black; pixel values of 1 display as white.

imtool(X,map) displays the indexed image X with colormap map.

imtool(filename) displays the image contained in the graphics file filename. The file must contain an image that can be read by imread or dicomread. imtool calls imread or dicomread to read the image from the file, but the image data is not stored in the MATLAB® workspace. 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 imtool. close(Hfigure) closes the Image Tool.

imtool close all closes all image tools.

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.

Parameter

Value

'Colormap'

2–D, real, m-by-3 matrix specifying the colormap to use for the figure's colormap property. Use this parameter to view grayscale images in false color. If you specify an empty colormap ([]), imtool ignores this parameter.

'DisplayRange'

Two-element vector [LOW HIGH] that controls the display range of a grayscale image. See the imtool(I,[low high]) syntax for more details about how to set this parameter.

    Note   Including the parameter name is optional, except when the image is specified by a filename. The syntax imtool(I,[LOW HIGH]) is equivalent to imtool(I,'DisplayRange',[LOW HIGH]). However, the 'DisplayRange' parameter must be specified when calling imtool with a filename, as in the syntax imtool(filename,'DisplayRange',[LOW HIGH]).

'InitialMagnification'

One of two text strings: 'adaptive' or 'fit' or a numeric scalar value that specifies the initial magnification used to display the image.

When set to 'adaptive', the entire image is visible on initial display. If the image is too large to display on the screen, imtool displays the image at the largest magnification that fits on the screen.

When set to 'fit', imtool scales the entire image to fit in the window.

When set to a numeric value, the value specifies the magnification as a percentage. For example, if you specify 100, the image is displayed at 100% magnification (one screen pixel for each image pixel).

    Note   When the image aspect ratio is such that less than one pixel would be displayed in either dimension at the requested magnification, imtool issues a warning and displays the image at 100%.

By default, the initial magnification parameter is set to the value returned by iptgetpref('ImtoolInitialMagnification').

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.

Related Toolbox Preferences

You can use the 'ImtoolInitialMagnification' preference to control the initial magnification for image display. Use the iptsetpref function to set the this toolbox preference. You can override this toolbox preference by specifying the 'InitialMagnification' parameter when you call imtool, as follows:

imtool(...,'InitialMagnification',initial_mag).

For more information about toolbox preferences, see the reference page for the iptsetpref function.

Remarks

imshow is the toolbox's fundamental image display function, optimizing figure, axes, and image object property settings for image display. imtool 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. imtool presents an integrated environment for displaying images and performing some common image processing tasks.

Examples

Display an image from a file.

imtool('board.tif')

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)

See Also

getimage, imageinfo, imcontrast, imdisplayrange, imdistline, imgetfile, imoverview, impixelinfo, impixelregion, imread, imshow, iptgetpref, ipticondir, iptsetpref, iptwindowalign

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS