Login  Register

Re: threshold questions

Posted by Ben Tupper on Aug 05, 2008; 10:45am
URL: http://imagej.273.s1.nabble.com/threshold-questions-tp3695457p3695458.html

Hello,

On Aug 5, 2008, at 4:14 AM, Johannes Breu wrote:

> Hello,
>
> I have 2 threshold questions:
>
> 1) I threshold images, convert them into mask (8 bit image) an  
> multiply
> them. The product I measure  by Measurement. While doing the  
> multiplication
> I have the choice between an 32 bit image and no 32 bit image. What  
> is the
> advantage of a 32 bit image?
> I always thought one pixel is multiplied by another pixel (same  
> location) so
> the product is 1 or 0. Why should this change the bit format (form  
> 8 to 32)?
>

You are right, you likely don't need to convert the input images to  
32-bit floats if you are multiplying masks.  However, if you try to  
operate on two non-mask images the result may fail in the 0-255 byte  
values available to 8-bit math- hence the option to convert to 32-bit  
floats which are good in the range +/- 10^39.  For example the ratio  
of two images could yield pixel values from the very small to  
infinity.  There is more on this at http://rsb.info.nih.gov/ij/docs/ 
menus/process.html#calculator


> 2) If I threshold an image by using the menu the image is different  
> from my
> macro. So I am a bit worried how to control and check for the  
> conditions.
> For instance my macro is like this:
>
> setThreshold(1000,4095);
> // run ("Threshold...");
> run ("Convert to mask");
>
> If its done via the menu automatically
> setAutoThreshold ();
> // run("Threshold");
> is done (according to the Macro recorder).
> If I use the set command successively it looks different from the  
> macro.
> Even if I do a reset step before. So I am irritated how to find the  
> right
> threshold if I am not able to translate the procedure (done via the  
> menu)
> into macro conditions.
>

Hmmm.   I am using ImageJ v1.41f and I have recorded the following  
using menus including "Image > Adjust > Threshold..."

run("M51 Galaxy (177K, 16-bits)");
setAutoThreshold();
//run("Threshold...");
setThreshold(991, 10106);


It is true that setAutoThreshold() command is run as soon as the  
threshold window appears, but I was able to use the sliders to adjust  
and set my own threshold to override the automatic one.  I saved the  
above as a macro and the result is the same.  Have you tried using  
the sliders and set button in the threshold tool window?

Cheers,
Ben

Ben Tupper
Bigelow Laboratory for Ocean Science
180 McKown Point Road
POB 475
West Boothbay Harbor, ME 04575