Displayed XY range

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Displayed XY range

Jean Ollion
Hello,

sometimes not all the XY range of an image is displayed in the image window
(for instance when this zoom magnification is high enough). How is it
possible to access to the displayed range (ie : Xmin, Xmax, Ymin, Ymax)
from java code, and also to modify it (without changing the zoom
magnification) also from java code
Thanks a lot,
Jean

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Displayed XY range

Rasband, Wayne (NIH/NIMH) [E]
> On Oct 23, 2015, at 7:15 AM, Jean Ollion <[hidden email]> wrote:
>
> Hello,
>
> sometimes not all the XY range of an image is displayed in the image window
> (for instance when this zoom magnification is high enough). How is it
> possible to access to the displayed range (ie : Xmin, Xmax, Ymin, Ymax)
> from java code, and also to modify it (without changing the zoom
> magnification) also from java code

You can get the displayed range by calling the ImageCanvas.getSrcRect() method. You can modify the range by modifying the SrcRect and redrawing the image. Here is a JavaScript example:

  img = IJ.openImage("http://imagej.nih.gov/ij/images/NileBend.jpg");
  img.show();
  IJ.run(img, "View 100%", "");
  ic = img.getCanvas();
  srcRect = ic.getSrcRect();
  print(srcRect);
  IJ.wait(2000);
  srcRect.x = 400;
  srcRect.y = 370;
  img.draw();
  IJ.wait(2000);
  srcRect.x = 700;
  srcRect.y = 700;
  img.draw();

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html