Windowing an Image without cloning it

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

Windowing an Image without cloning it

Johannes Hermen
Hi,

Does anybody knows a way to "window" an ImagePlus, without creating a new
Image every time?
By now I am do this like that:

------------------------------------------------------------------
Imageplus image;
ImageProcessor imageProcessor;

this.imageProcessor = image.getProcessor();
this.imageProcessor.setMinAndMax(windowMin, windowMax);
this.image = new ImagePlus("ResultImage", this.imageProcessor);
-------------------------------------------------------------------

This way is very CPU and Memory consuming, as I have to copy the image
every time.

Thanks in advance

  Johannes
-----------------------------------------------------------------
ImageJ User and Developer Conference
Please visit: http://imagejconf.tudor.lu
-----------------------------------------------------------------
Johannes Hermen  -  Ingenieur de Recherche
[hidden email]
-----------------------------------------------------------------
CRP Henri Tudor  http://www.santec.tudor.lu
29, Avenue John F. Kennedy
L-1855 Luxembourg
-----------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Windowing an Image without cloning it

Wayne Rasband
> Does anybody knows a way to "window" an ImagePlus, without
> creating a new  Image every time?
> By now I am do this like that:
>
> ------------------------------------------------------------------
> Imageplus image;
> ImageProcessor imageProcessor;
>
> this.imageProcessor = image.getProcessor();
> this.imageProcessor.setMinAndMax(windowMin, windowMax);
> this.image = new ImagePlus("ResultImage", this.imageProcessor);
> -------------------------------------------------------------------
>
> This way is very CPU and Memory consuming, as I have to
> copy the image every time.

The Brightness/Contrast and Window/Level tools in ImageJ "window"  
this way:

     ImagePlus imp;
     ImageProcessor ip;

     ip = imp.getProcessor();
     ip.setMinAndMax(windowMin, windowMax);
     imp.updateAndDraw();

The souce code for these tools is at:

   http://rsb.info.nih.gov/ij/developer/source/ij/plugin/frame/ 
ContrastAdjuster.java.html

-wayne