Make binary with manual threshold

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Make binary with manual threshold

Glen MacDonald-2
There seems to have been a change in behavior with Fiji for creating a binary image through a macro.

this worked 2 years ago :
        setThreshold(mn,255);
        run("Make Binary", "black”);
but now it only sets the threshold without the red overlay or creating a binary image.

I need to set a stack to binary using a computed threshold, not with any of the automatic threshold routines.  
thanks,

Glen MacDonald
        Core for Communication Research
Virginia Merrill Bloedel Hearing Research Center
        Cellular Morphology Core
Center on Human Development and Disability
Box 357923
University of Washington
Seattle, WA 98195-7923  USA
(206) 616-4156
[hidden email]

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Make binary with manual threshold

Rasband, Wayne (NIH/NIMH) [E]
> On Oct 24, 2014, at 1:07 PM, Glen MacDonald <[hidden email]> wrote:
>
> There seems to have been a change in behavior with Fiji for creating a binary image through a macro.
>
> this worked 2 years ago :
> setThreshold(mn,255);
> run("Make Binary", "black”);
> but now it only sets the threshold without the red overlay or creating a binary image.

This works in the latest ImageJ daily build ( (1.49k2), except that the “black” option is ignored. Macros should explicitly set the “Black background” flag, as in this example:

   run("Dot Blot (7K)");
   setOption("BlackBackground", true);
   run("Make Binary");

> I need to set a stack to binary using a computed threshold, not with any of the automatic threshold routines.  
> thanks,

You can do this in the daily build. Here is an example:

   run("Fly Brain (1MB)");
   run("8-bit");
   setOption("BlackBackground", true);
   for (i=nSlices; i>0; i--) {
      setSlice(i);
      getRawStatistics(n, mean);
      setThreshold(mean, 255);
      //print(i, mean);
      run("Make Binary", "slice");
   }

-wayne

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