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.
Function | Description |
---|
setMagnification
| Set the magnification of the target image in units of screen pixels per
image pixel.
new_mag is a scalar magnification
factor.
|
getMagnification
| Return the current magnification factor of the target image in units of
screen pixels per image pixel.
Multiply mag by 100 to convert to percentage. For
example if mag is 2 , then the magnification
is 200%. |
setMagnificationAndCenter
| Change the magnification and make the point with
(x,y) coordinate
(cx ,cy ) in the target image appear in the
center of the scroll panel. This operation is equivalent to a simultaneous zoom
and recenter.
|
findFitMag
| Return the magnification factor that would make the target image just fit
in the scroll panel.
|
setVisibleLocation
| Move the target image so that the specified location is visible, and
update the scroll bars.
|
getVisibleLocation
| Return the location of the currently visible portion of the target
image.
loc is a vector [xmin
ymin] .
|
getVisibleImageRect
| Return the current visible portion of the image.
r is a rectangle [xmin ymin width
height] .
|
addNewMagnificationCallback
| Add the function handle fcn to the list of
new-magnification callback functions.
Whenever the scroll panel magnification changes, each function in the
list is called with the syntax:
mag is a scalar magnification factor.
The return value, id , is used only with
removeNewMagnificationCallback . |
removeNewMagnificationCallback
| Remove the corresponding function from the new-magnification callback
list.
id is the identifier returned by
addNewMagnificationCallback .
|
addNewLocationCallback
| Add the function handle fcn to the list of
new-location callback functions.
Whenever the scroll panel location changes, each function in the list
is called with the syntax:
loc is [xmin
ymin] .
The return value, id , is used only
with removeNewLocationCallback . |
removeNewLocationCallback
| Remove the corresponding function from the new-location callback
list.
id is the identifier returned by
addNewLocationCallback .
|
replaceImage
| api.replaceImage(...,PARAM1,VAL1,PARAM2,VAL2,...)
replaces the image displayed in the scroll panel.
By default, the new image data is displayed centered, at 100%
magnification. The image handle is unchanged. The parameters you can
specify include many of the parameters supported by imshow , including
'Colormap' , 'DisplayRange' , and
'InitialMagnification' . In addition, you can use the
'PreserveView' parameter to preserve the current
magnification and centering of the image during replacement. Specify the logical
scalar True to preserve current centering and
magnification. |