Image Processing Toolbox User's Guide Previous page   Next Page

Adding Navigation Aids to a GUI

The toolbox includes several modular tools that you can use to add navigation aids to a GUI application:

The Scroll Panel is the primary navigation tool; it is a prerequisite for the other navigation tools. When you display an image in a Scroll Panel, the tool displays only a portion of the image, if it is too big to fit into the figure window. When only a portion of the image is visible, the Scroll Panel adds horizontal and vertical scroll bars, to enable viewing of the parts of the image that are not currently visible.

Once you create a Scroll Panel, you can optionally add the other modular navigation tools: the Overview tool and the Magnification tool. The Overview tool displays a view of the entire image, scaled to fit, with a rectangle superimposed over it that indicates the part of the image that is currently visible in the scroll panel. The Magnification Box displays the current magnification of the image and can be used to change the magnification.

The following sections provide more details.

Understanding Scroll Panels

When you display an image in a scroll panel, it changes the object hierarchy of your displayed image. This diagram illustrates the typical object hierarchy for an image displayed in an axes object in a figure object.

The following figure shows this object hierarchy.

Object Hierarchy of Image Displayed in a Figure

When you call the imscrollpanel function to put the target image in a scrollable window, this object hierarchy changes. For example, this code adds a scroll panel to an image displayed in a figure window, specifying the parent of the scroll panel and the target image as arguments. The example suppresses the figure window toolbar and menu bar because they are not compatible with the scroll panel navigation tools.

The following figure shows the object hierarchy after the call to imscrollpanel. Note how imscrollpanel inserts new objects (shaded in gray) into the hierarchy between the figure object and the axes object containing the image.

Object Hierarchy of Image Displayed in Scroll Panel

The following figure shows how these graphics objects appear in the scrollable image as it displayed on the screen.

Components of a Scroll Panel

Example: Building a Navigation GUI for Large Images

If your work typically requires that you view large images, you might want to create a custom image display function that includes the modular navigation tools.

This example creates a tool that accepts an image as an argument and displays the image in a scroll panel with an Overview tool and a Magnification box.

To use the tool, pass it a large image that is already in the MATLAB workspace.

The tool opens a figure window, displaying the image in a scroll panel with the other modular navigation tools: the Overview tool and the Magnification Box tool.

Custom Image Display Tool with Navigation Aids

Previous page  Example: Building a Pixel Information GUI Making Connections for Interactivity Next page

© 1994-2005 The MathWorks, Inc.