|Image Processing Toolbox User's Guide|
Specifying the Parent of a Modular Tool
When you create a modular tool, in addition to specifying the target image, you can optionally specify the object that you want to be the parent of the tool. By specifying the parent, you determine where the tool appears on your screen. Using this syntax of the modular tool creation functions, you can add the tool to the figure window containing the target image, open the tool in a separate figure window, or create some other combination.
Specifying the parent is optional; the modular tools all have a default behavior. Some of the smaller tools, such as the Pixel Information tool, use the parent of the target image as their parent, inserting themselves in the same figure window as the target image. Other modular tools, such as the Pixel Region tool or the Overview tool, open in separate figures of their own.
Tools With Separate Creation Functions
Two of the tools, the Pixel Region tool and the Overview tool, have a separate creation function to provide this capability. Their primary creation functions,
impixelregion, open the tools in a separate figure window. To specify a different parent, you must use the
|Note The Overview tool and the Pixel Region tool provide additional capabilities when created in their own figure windows. For example, both tools include zoom buttons that are not part of their uipanel versions.|
Example: Embedding the Pixel Region Tool in an Existing Figure
This example shows the default behavior when you create the Pixel Region tool using the
impixelregion function. The tool opens in a separate figure window, as shown in the following figure.
himage = imshow('pout.tif') hpixelinfopanel = impixelinfo(himage) hdrangepanel = imdisplayrange(himage) hpixreg = impixelregion(himage)
Target Image with Pixel Region Tool in Separate Window (Default)
To embed the Pixel Region tool in the same window as the target image, you must specify the handle of the target image's parent figure as the parent of the Pixel Region tool when you create it.
The following example creates a figure and an axes object, getting handles to both objects. The example needs these handles to perform some repositioning of the objects in the figure to ensure their visibility. See Positioning the Modular Tools in a GUI for more information. The example then creates the modular tools, specifying the figure containing the target image as the parent of the Pixel Region tool. Note that the example uses the
impixelregionpanel function to create the tool.
hfig = figure; hax = axes('units','normalized','position',[0 .5 1 .5]); himage = imshow('pout.tif') hpixelinfopanel = impixelinfo(himage) hdrangepanel = imdisplayrange(himage) hpixreg = impixelregionpanel(hfig,himage) set(hpixreg, 'Units','normalized','Position',[0 .08 1 .4])
The following figure shows the Pixel Region embedded in the same figure as the target image.
Target Image with Embedded Pixel Region Tool
|Specifying the Target Image||Positioning the Modular Tools in a GUI|
© 1994-2005 The MathWorks, Inc.