Hi @SarenT,
Something that seems to work:
imp = IJ.getImage()
# this tells the canvas to show the part of the image that
# is 280 by 280 pixels wide, and starting at (200, 200)
imp.getCanvas().setSourceRect( Rectangle( 200, 200, 280, 280) )
imp.draw() # Have to tell the canvas to redraw itself
Older information
The ImageCanvas class has functions that sound like they would do what you want, but they’re “protected”, meaning we can’t call them from the “outside”.
I thought that maybe doing imp.getCanvas().zoomOut(x, y)
followed by imp.getCanvas().zoomIn(x, y)
, could do it, but it doesn’t behave the way I’d expect. (here imp
is a variable of type ImagePlus
).
Can’t dig into this further now, maybe someone else knows.
John
Edit: found an answer