Login  Register

How to retrieve float Images from a float stack

Posted by gerrit on Jun 02, 2010; 2:06pm
URL: http://imagej.273.s1.nabble.com/How-to-retrieve-float-Images-from-a-float-stack-tp3688091.html

I'm writing a plugin and like to get images from a stack.
The stack is float, but I'm not able to get float images out of it.

Here is some sample code extracted from my application:

                    IJ.run("LSM Reader", "open="+dirname + System.getProperty("file.separator") + children[i]);
                    ImagePlus imp = IJ.getImage();
                    IJ.run(imp, "Split Channels", "");
                    IJ.selectWindow("C1-"+children[i]);
                    ImagePlus blueimp = IJ.getImage();
                    IJ.run("32-bit", "");

                    IJ.selectWindow("C2-"+children[i]);
                    ImagePlus yellowimp = IJ.getImage();
                    IJ.run("32-bit", "");

C1 and C2 are 32 bit !!

                    ImageStack bluestack = blueimp.getStack();
.....................

                        blueip = bluestack.getProcessor(slice);
                        Rectangle roi = blueip.getRoi();

                        ImageProcessor fblueip = new FloatProcessor(roi.width, roi.height);
                        fblueip = blueip.convertToFloat();
                         ..............
                        ImagePlus testim = NewImage.createFloatImage("RatioIm",roi.width, roi.height, 1, NewImage.FILL_BLACK);

                        testim.setImage(fblueip.getBufferedImage());
                        testim.show();

This gives me an 8 bit image.

Thanks,
Gerrit

--------------------------------------------------
dr. ing. G (Gerrit) Polder
Wageningen UR, Biometris
P.O.Box 100, 6700 AC Wageningen, the Netherlands
http://www.biometris.wur.nl/UK/Staff/Gerrit+Polder/
email: [hidden email]
phone: +31.317.480751