Login  Register

Re: how to resize an image / how to call an imagej-function in source code

Posted by Albert Cardona on Jan 24, 2006; 4:25pm
URL: http://imagej.273.s1.nabble.com/how-to-resize-an-image-how-to-call-an-imagej-function-in-source-code-tp3703960p3703961.html

Marko,

Use the ImageProcessor class resize(int new_width, int new_height) method,
such as:

ImagePlus imp_big = WindowManager.getCurrentImage();
ImageProcessor ip_big = imp_big.getProcessor();
ip_big.setInterpolate(true);
ImageProcessor ip_small = resize(320, 256);
ImagePlus small = new ImagePlus("small", ip_small);
small.show();

Of course you can write the above in a much compact manner, and there's not
much need to setup interpolation when scaling down. That's up to your style
and requirements.

Albert

--
Albert Cardona
Molecular Cell Developmental Biology
University of California Los Angeles
Tel +1 310 2067376
Programming: http://www.pensament.net/java/
Research: http://www.mcdb.ucla.edu/Research/Hartenstein/
Web design: http://www.pixelets.com