|Image Processing Toolbox User's Guide|
Positioning the Modular Tools in a GUI
When you create the modular tools, they have default positioning behavior. For example, the
impixelinfo function creates the tool as a uipanel object that is the full width of the figure window, positioned in the lower left corner of the target image figure window.
Because the modular tools are constructed from standard Handle Graphics objects, such as uipanel objects, you can use properties of the objects to change their default positioning or other characteristics.
For example, in Specifying the Parent of a Modular Tool, when the Pixel Region tool was embedded in the same figure window as the target image, the example had to reposition both the image object and the Pixel Region tool uipanel object to make them both visible in the figure window.
Specifying the Position with a Position Vector
To specify the position of a modular tool or other graphics object, set the value of the
Position property of the object. As the value of this property, you specify a four-element position vector
[left bottom width height], where
bottom specify the distance from the lower left corner of the parent container object, such as a figure. The
height specify the dimensions of the object.
When you use a position vector, you can specify the units of the values in the vector by setting the value of the
Units property of the object. To allow better resizing behavior, use normalized units because they specify the relative position, not the exact location in pixels. See the reference page for the Handle Graphics object for more details.
For example, when you first create an embedded Pixel Region tool in a figure, it appears to take over the entire figure because, by default, the position vector is set to
[0 0 1 1], in normalized units. This position vector tells the tool to align itself with the bottom left corner of its parent and fill the entire object. To accommodate the image and the Pixel Information tool and Display Range tools, change the position of the Pixel Region tool in the lower half of the figure window, leaving room at the bottom for the Pixel Information and Display Range tools. Here is the position vector for the Pixel Region tool.
To accommodate the Pixel Region tool, reposition the target image so that it fits in the upper half of the figure window, using the following position vector. To reposition the image, you must specify the
Position property of the axes object that contains it; image objects do not have a
|Specifying the Parent of a Modular Tool||Example: Building a Pixel Information GUI|
© 1994-2005 The MathWorks, Inc.