Set Magnification and Display Location of New Image

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

Set Magnification and Display Location of New Image

Richard VanMetter
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.

Thanks

Rich
Reply | Threaded
Open this post in threaded view
|

Re: Set Magnification and Display Location of New Image

Rasband, Wayne (NIH/NIMH) [E]
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