Re: how to apply theshholds ot image

Posted by Michael Schmid on
URL: http://imagej.273.s1.nabble.com/how-to-apply-theshholds-ot-image-tp5019448p5019449.html

Hi Aryeh,

if you have an 8-bit image you can apply the current threshold with
   imp = IJ.getImage();
   IJ.run(imp, "Convert to Mask", "");

(here it is written the Javascript or Python way)

You can find out with Plugins>Macros>Record; set the Recorder to
'JavaScript'.

Michael
________________________________________________________________

On 27/09/2017 20:20, Aryeh Weiss wrote:

> After I run:
>
> ip.setThreshold(stats.mean-multiplier*stats.stdDev,
> 2**imp.getBitDepth(), ImageProcessor.RED_LUT)
>
> I have the thresholds associated with the image. I even see the correct
> overlay.
> However, I cannot figure how to apply these thresholds to the image in
> order to create a binary image.
>
> IJ.run(imp, "Convert to Mask", " background=Dark black")
>
> applies one of the automatic threshholding methods, (even though I
> removed that option from the argument list).
>
> I tried also, ip.setBinaryThreshold(), but it does not appear to do what
> I want (I am not quite sure what it does)
>
> How are thresholds used to create a binary image?
>
> Thanks again in advance
> --aryeh
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html