Re: applying a binary as a selection

Posted by Gabriel Landini on
URL: http://imagej.273.s1.nabble.com/applying-a-binary-as-a-selection-tp3703129p3703132.html

On Sunday 09 April 2006 12:23, michael shaffer wrote:
>   Pardon my ignorance, but I fail to see how these methods would expose to
> the binary thresholding ONLY selected pixels.  For example, other softwares
> have demonstrated that simply converting non-selected pixels to black or
> white biases the histogram the thresholding works with(?)

I probably misunderstood what you want to do.
Can you explain a bit better what do you mean by:

> However, I first need to threshold regions that are both darker and
> brighter (step#1, e.g., other phases and surface defects) than what is to be
> exposed to the binary thresholding (step#2).

Is it "masking"?
I do not think that IJ can do that straight away for thresholding (please
correct me if I am wrong).  

You can, however, divide the procedure into:
(assume white is "yes", black is "no")
threshold regions which are darker, save it to an image
threshold regions which are brighter, save it to another image

then:
darker ADD (or OR) brighter = regions which are brighter or darker.

and subtract it from the original image (so you are left with the areas which
are not-brighter-or-darker, i.e. the non-zero areas)

Now you want to threshold this result. Depending on the histogram method, you
may have to force the thresholding procedure to ignore the black pixels. (You
will have to include this in the code yourself).

BTW, this would be a handy option to have in the built-in threshold plugin
(Ignore black, and Ignore white check boxes which just set to 0 the histo[0]
and histo[255] before submitting the histogram to the thresholding routine.

I hope it helps,

G.