Image Processing Toolbox User's Guide |
Scroll panel for interactive image navigation
Syntax
Description
hpanel = imscrollpanel(hparent, himage)
creates a scroll panel containing the target image (the image to be navigated).. himage
is a handle to the target image. hparent
is a handle to the figure or uipanel that will contain the new scroll panel. hpanel
is the handle to the scroll panel, which is a uipanel object.
A scroll panel makes an image scrollable. If the size or magnification makes an image too large to display in a figure on the screen, the scroll panel displays a portion of the image at 100% magnification (one screen pixel represents one image pixel). The scroll panel adds horizontal and vertical scroll bars to enable navigation around the image.
imscrollpanel
changes the object hierarchy of the target image. Instead of the familiar figure->axes->image object hierarchy, imscrollpanel
inserts several uipanel and uicontrol objects between the figure and the axes object.
API functions
A scroll panel contains a structure of function handles, called an API. You can use the functions in this API to manipulate the scroll panel. To retrieve this structure, use the iptgetapi
function, as in the following example.
This table lists the scroll panel API functions, in the order they appear in the structure.
Note
Scrollbar navigation as provided by imscrollpanel
is incompatible with the default MATLAB figure navigation buttons (pan, zoom in, zoom out). The corresponding menu items and toolbar buttons should be removed in a custom GUI that includes a scrollable uipanel created by imscrollpanel
.
When you run imscrollpanel
, it appears to take over the entire figure because, by default, an hpanel object has 'Units'
set to 'normalized'
and 'Position'
set to [0 0 1 1]
. If you want to see other children of hparent
while using your new scroll panel, you must manually set the 'Position'
property of hpanel
.
Example
This example creates a scroll panel with a magnification box and an overview tool.
hFig = figure('Toolbar','none',... 'Menubar','none'); hIm = imshow('saturn.png'); hSP = imscrollpanel(hFig,hIm); set(hSP,'Units','normalized',... 'Position',[0 .1 1 .9])
hMagBox = immagbox(hFig,hIm); pos = get(hMagBox,'Position'); set(hMagBox,'Position',[0 0 pos(3) pos(4)]) imoverview(hIm)
See also
immagbox
, imoverview
, imoverviewpanel
, imtool
, iptgetapi
imrotate | imshow |
© 1994-2005 The MathWorks, Inc.