Autothreshold B&W displays inverse

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

Autothreshold B&W displays inverse

Mike Cowperthwaite
(Using 1.43g)
When using Adjust|Threshold with "B&W" display mode, the thresholded
image shown is the inverse of what you get when you click "Apply."  This
is true regardless of the setting of "Dark background" checkbox.

It is very confusing!  I can't believe it's intentional.  Could this be
fixed, please?

--
Mike Cowperthwaite
Lathrop Engineering, San Jose CA
Reply | Threaded
Open this post in threaded view
|

Re: Autothreshold B&W displays inverse

Wayne Rasband
On Oct 7, 2009, at 8:06 PM, Mike Cowperthwaite wrote:

> (Using 1.43g)
> When using Adjust|Threshold with "B&W" display mode, the thresholded
> image shown is the inverse of what you get when you click "Apply."  
> This
> is true regardless of the setting of "Dark background" checkbox.
>
> It is very confusing!  I can't believe it's intentional.  Could this  
> be
> fixed, please?

"Apply" in the Threshold window converts the image to binary using the  
Process>Binary>Convert to Mask command. The background (non-threshold)  
color used is determined by the "Black background" setting in the  
Process>Binary>Options dialog box. You can get an exact representation  
of the "B&W" mode window by using the Image>Flatten command in v1.43h,  
or Plugins>Utilities>Capture Image in earlier versions of ImageJ.

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: Autothreshold B&W displays inverse

Mike Cowperthwaite
On 10-Oct-09 4:16 am, Wayne Rasband wrote:

> On Oct 7, 2009, at 8:06 PM, Mike Cowperthwaite wrote:
>
>> (Using 1.43g)
>> When using Adjust|Threshold with "B&W" display mode, the thresholded
>> image shown is the inverse of what you get when you click "Apply." This
>> is true regardless of the setting of "Dark background" checkbox.
>>
>> It is very confusing! I can't believe it's intentional. Could this be
>> fixed, please?
>
> "Apply" in the Threshold window converts the image to binary using the
> Process>Binary>Convert to Mask command. The background (non-threshold)
> color used is determined by the "Black background" setting in the
> Process>Binary>Options dialog box. You can get an exact representation
> of the "B&W" mode window by using the Image>Flatten command in v1.43h,
> or Plugins>Utilities>Capture Image in earlier versions of ImageJ.

Wayne, thanks for pointing out the Binary Options setting.  I now
understand the issue better, but I still think there's a problem that
needs fixing.  Having the image invert when you click Apply violates the
Law of Least Astonishment.

For the purposes of Make Binary, I generally want the Binary Option
"Black Background" to be ON.  This converts my (black-background)
greyscale image into white features on a black background, with a
standard, non-inverting LUT: exactly what I expect.  Changing that
setting to OFF inverts the image only by inverting the LUT; the pixel
values remain the same.  (Inverting via LUT may or may not be the best
approach here; I don't want to change this, but I would change the UI of
Binary Options somehow to explicitly mention that the setting *is* the LUT.)

So, assuming "Black Background" is ON and the result LUT will be the
standard, non-inverting LUT:

If you Threshold a greyscale image with "Dark background" checked, the
Red display is sensible (red features against a black background) and
the B&W display is not -- it shows black features against a white
background.  When I click Apply in the Red display mode, I get the
expected results: the low end is forced to black, the red turns white.
When I click Apply in the B&W display mode, I get the originally-desired
results: the white turns black and the black turns white.

The problem is the appearance used in B&W display mode, not in the
results of the Apply.  Assuming that's handled with a LUT, I think you
should just reverse the B&W Display LUT.  Basically, whatever appears
RED in Red mode should appear WHITE in B&W mode.  It's just that simple.


Separately from that, I question whether a result with an "Inverting
LUT" (i.e., Binary Option "Black Background" is OFF) should ever be
generated when Thresholding.  I think the Binary Option "Black
Background" should be internally held to ON for any thresholding action
(display *or* image conversion).

--
Mike Cowperthwaite
Lathrop Engineering, San Jose CA
Reply | Threaded
Open this post in threaded view
|

Re: Autothreshold B&W displays inverse

Wayne Rasband
On Oct 12, 2009, at 3:51 PM, Mike Cowperthwaite wrote:

> On 10-Oct-09 4:16 am, Wayne Rasband wrote:
>> On Oct 7, 2009, at 8:06 PM, Mike Cowperthwaite wrote:
>>
>>> (Using 1.43g)
>>> When using Adjust|Threshold with "B&W" display mode, the thresholded
>>> image shown is the inverse of what you get when you click "Apply."  
>>> This
>>> is true regardless of the setting of "Dark background" checkbox.
>>>
>>> It is very confusing! I can't believe it's intentional. Could this  
>>> be
>>> fixed, please?
>>
>> "Apply" in the Threshold window converts the image to binary using  
>> the
>> Process>Binary>Convert to Mask command. The background (non-
>> threshold)
>> color used is determined by the "Black background" setting in the
>> Process>Binary>Options dialog box. You can get an exact  
>> representation
>> of the "B&W" mode window by using the Image>Flatten command in  
>> v1.43h,
>> or Plugins>Utilities>Capture Image in earlier versions of ImageJ.
>
> Wayne, thanks for pointing out the Binary Options setting.  I now
> understand the issue better, but I still think there's a problem that
> needs fixing.  Having the image invert when you click Apply violates  
> the
> Law of Least Astonishment.

Thanks to Gabriel Landini, this bug is fixed in the 1.43i daily build.

-wayne

> For the purposes of Make Binary, I generally want the Binary Option
> "Black Background" to be ON.  This converts my (black-background)
> greyscale image into white features on a black background, with a
> standard, non-inverting LUT: exactly what I expect.  Changing that
> setting to OFF inverts the image only by inverting the LUT; the pixel
> values remain the same.  (Inverting via LUT may or may not be the best
> approach here; I don't want to change this, but I would change the  
> UI of
> Binary Options somehow to explicitly mention that the setting *is*  
> the LUT.)
>
> So, assuming "Black Background" is ON and the result LUT will be the
> standard, non-inverting LUT:
>
> If you Threshold a greyscale image with "Dark background" checked, the
> Red display is sensible (red features against a black background) and
> the B&W display is not -- it shows black features against a white
> background.  When I click Apply in the Red display mode, I get the
> expected results: the low end is forced to black, the red turns white.
> When I click Apply in the B&W display mode, I get the originally-
> desired
> results: the white turns black and the black turns white.
>
> The problem is the appearance used in B&W display mode, not in the
> results of the Apply.  Assuming that's handled with a LUT, I think you
> should just reverse the B&W Display LUT.  Basically, whatever appears
> RED in Red mode should appear WHITE in B&W mode.  It's just that  
> simple.
>
>
> Separately from that, I question whether a result with an "Inverting
> LUT" (i.e., Binary Option "Black Background" is OFF) should ever be
> generated when Thresholding.  I think the Binary Option "Black
> Background" should be internally held to ON for any thresholding  
> action
> (display *or* image conversion).
>
> --
> Mike Cowperthwaite
> Lathrop Engineering, San Jose CA