This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Magnification box for scroll panel


hbox = immagbox(hparent,himage)


hbox = immagbox(hparent,himage) creates a Magnification box for the image displayed in a scroll panel created by imscrollpanel. hparent is a handle to the figure or uipanel object that will contain the Magnification box. himage is a handle to the target image (the image in the scroll panel). immagbox returns hbox, which is a handle to the Magnification box uicontrol object

A Magnification box is an editable text box uicontrol that contains the current magnification of the target image. When you enter a new value in the magnification box, the magnification of the target image changes. When the magnification of the target image changes for any reason, the magnification box updates the magnification value.

API Functions

A Magnification box contains a structure of function handles, called an API. You can use the functions in this API to manipulate magnification box. To retrieve this structure, use the iptgetapi function.

api = iptgetapi(hbox)

The API for the Magnification box includes the following function.




Sets the magnification in units of screen pixels per image pixel.


where new_mag is a scalar magnification factor. Multiply new_mag by 100 to get percent magnification. For example if you call setMagnification(2), the magnification box will show '200%'.


Add a magnification box to a scrollable image. Because the toolbox scrollable navigation is incompatible with standard MATLAB® figure window navigation tools, the example suppresses the toolbar and menu bar in the figure window. The example positions the scroll panel in the figure window to allow room for the magnification box.

hFig = figure('Toolbar','none',...
hIm = imshow('pears.png'); 
hSP = imscrollpanel(hFig,hIm);
            'Position',[0 .1 1 .9])

hMagBox = immagbox(hFig,hIm);
pos = get(hMagBox,'Position');
set(hMagBox,'Position',[0 0 pos(3) pos(4)])

Change the magnification of the image in the scroll panel, using the scroll panel API function setMagnification. Notice how the magnification box updates.

apiSP = iptgetapi(hSP);

Introduced before R2006a

Was this topic helpful?