Login  Register

Re: Set Magnification and Display Location of New Image

Posted by Rasband, Wayne (NIH/NIMH) [E] on May 19, 2011; 3:55am
URL: http://imagej.273.s1.nabble.com/Set-Magnification-and-Display-Location-of-New-Image-tp3684543p3684544.html

On May 18, 2011, at 4:55 PM, Richard VanMetter wrote:

> I am image processing an existing (original) image.
>
> I create a new ImagePlus for the results of the processing. I would like
> to display the new ImagePlus at the same location and magnification as
> the original image, which has been zoomed and panned prior to applying
> the plugin.
>
> Are there methods that would help me accomplish this? I have perused
> methods for ImagePlus, ImageCanvas and ImageWindow without finding  
> anything that appears to help.
>
> Any suggestions would be appreciated.

Probably the easiest solution would be to create a two image stack containing both the original and processed images. Here is a JavaScript example:

  imp = IJ.openImage("http://imagej.nih.gov/ij/images/boats.gif");
  imp.show();
  IJ.run("Set... ", "zoom=400");
  imp2 = imp.duplicate();
  IJ.run(imp2, "Find Edges", "slice");
  stack = imp.getStack();
  stack.addSlice("edges", imp2.getProcessor());
  imp.setStack(stack);
  imp.setSlice(2);

-wayne