Login  Register

Re: Auto Threshold

Posted by Rasband, Wayne (NIH/NIMH) [E] on Mar 07, 2013; 11:42pm
URL: http://imagej.273.s1.nabble.com/Auto-Threshold-tp5002055p5002058.html

On Mar 7, 2013, at 5:22 PM, bds81175 wrote:

> I'm using a Huang autoThreshold in a macro that I need to distribute to
> multiple computers and some users are experiencing inverted results from the
> threshold.  It's pretty simple:  it's an 8-bit image and I call this
> function:
> function thresholdHuang() {
> setAutoThreshold("Huang dark");
> run("Convert to Mask");
> }
>
> On my PC I get black (0) holes with white (255) surface.  On the users PC I
> get the exact opposite.  What am I doing wrong?  It's got to be something
> stupid/simple.

Add

  setOption("BlackBackground",true)

to the beginning of the macro or function. This will set the Process>Binary>Options "Black background" flag. Starting with ImageJ 1.47m, this line of code is generated by the recorder when you use the Process>Binary>Convert to Mask command.

-wayne

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