Login  Register

plugin - thresholding a 32-bit image

Posted by Ben Tupper on Sep 16, 2008; 9:59pm
URL: http://imagej.273.s1.nabble.com/plugin-thresholding-a-32-bit-image-tp3695053.html

Hello,

IJ version 1.41k

I am perplexed by the behavior of the setThreshold method for a  
FloatProcessor class.  I have a 32-bit image that  I would like to  
threshold to values of "threshLaplace" and greater.  In my code  
snippet below I have created a duplicate of the original 32-bit  
image. When I show the thresholded image (mhMaskIp) I expect to see  
the red/black arrangement I see when I use the menu commands.  But I  
don't.  Instead I see a copy of the original.


     //create the MH mask
     //this shows where the MH is GE threshLaplace
     mhMaskImp = new ImagePlus("MH-Mask",mhIp.duplicate());
     mhMaskIp = mhMaskImp.getProcessor();
     mhMaskIp.setThreshold( (double) threshLaplace, 1000000.0,  
FloatProcessor.RED_LUT);
     mhMaskImp.show();

Ultimately, I would like to have the original and the masked images  
(as byte is OK) without having to show them.

Thanks and cheers,
Ben