Login  Register

Re: Odd Create Selection Behavior

Posted by Michael Schmid on Mar 04, 2015; 2:38pm
URL: http://imagej.273.s1.nabble.com/Odd-Create-Selection-Behavior-tp5011870p5011872.html

Hi Burri,

this problem occurs only with 'Black Background' in Process>Binary>Options.

The inconsistency is due to a hidden threshold:
- After setAutoThreshold and "Convert to Mask", the threshold is still active (but invisible), range 255-255, making the blobs the foreground object.
- The Median filter, like (almost) all PlugInFilters, removes the invisible threshold.

In principle, a clean solution would be "Create Selection" depending on the 'Black Background'. Unfortunately changing this can break existing macros.

So, the only good way out that I see is either working with with 'Black Background'=off or specifying the threshold before each time you use "Create Selection"

Michael
________________________________________________________________
On Mar 4, 2015, at 14:56, Burri Olivier wrote:

> My apologies, I wrote my email in a reply to the wrong thread. Apologies again
>
> Here it is in a proper subject....
>
> Hi all,
>
> Odd behavior here. If you run the following code, you will notice that after
> the median filter operation, the create selection outputs the inverse of the
> selection. I tried looking into the rankfilters code but could not find where
> this behavior could come from...
>
> The problem is "Solved" if we invert the LUT, even though nothing was done
> to it.
>
> So I thought that somehow the image was flagged as having an  inverted LUT,
> but checking for that gave no change...
>
> I also looked into the ThresholdToSelection.java code to see if it was using
> some property or other, but to no avail...
>
> If anyone has any thoughts, that would be great...
>
> run("Blobs (25K)");
> setAutoThreshold("Huang");
> run("Convert to Mask");
> run("Create Selection");
> Roi.setName("Before Median");
> roiManager("Add");
> print("Inverting LUT: ", is("Inverting LUT")); run("Select None");
> run("Median...", "radius=4"); run("Create Selection"); Roi.setName("After
> Median"); roiManager("Add"); print("Inverting LUT: ", is("Inverting LUT"));
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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