Login  Register

Auto Threshold

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Auto Threshold

bds81175
9 posts
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.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Auto Threshold

Gabriel Landini
1783 posts
On Thursday 07 Mar 2013 22:22:59 bds81175 wrote:
> 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.

Maybe the Binary Option for black background is set differently in each
machine.
Maybe one image uses an inverted LUT.

Cheers
Gabriel

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

Re: Auto Threshold

Rasband, Wayne (NIH/NIMH) [E]
1064 posts
In reply to this post by bds81175
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
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Auto Threshold

bds81175
9 posts
This was it:  setOption("BlackBackground",true)

Thanks Wayne!