Bug, and, Bug or Feature?

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

Bug, and, Bug or Feature?

Fred Damen
Greetings,

After I upgraded to test the Recorder Bug, I noticed that the "Convert to
Mask" in one of my plugins was functioning differently.  I do not suspect the
upgrade, as I downgraded and retested and had the same results; albeit, as
this was the last thing I did before discovering the issue...

Test file:
File->Open Samples->T1 Head
Image->Duplicate (only current slice)

First the bug:
Running the code below, the new image window (maskimp) is Windowed/Leveled
differently from the original window (imp). With section 1 commented out and
section 2 uncommented (w/wo duplicate) the bug is not seen.

The bug/feature:
Running the "Convert To Mask" either using Section 4 or through the GUI gives
different results depending on the current window/leveling.  Is this a feature
that can be turned on/off?, if so how (in plugin)?  How to debug?, i.e., where
are these config/options stored?  Can these files be erased and will ImageJ
automatically create these config files if they do not exist?

Note:
Running my plugin, that I discovered this issue in, on other computers, with
the same code and data files, this issue is not seen.


Fred

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.frame.*;


public class UGH implements PlugIn {

        public void run(String arg) {
/* Section 1 */
         ImagePlus imp = IJ.getImage();
         ImagePlus maskimp =
SubHyperstackMaker.makeSubhyperstack(imp,"1","1-"+imp.getNSlices(),"1").duplicate();
/* Section 2 */
//        ImagePlus maskimp = IJ.getImage().duplicate();
/* Section 3 */
         maskimp.show();
/* Section 4 */
//        Prefs.blackBackground = false;
//         IJ.run(maskimp, "Convert to Mask", "");
        }

}

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

Re: Bug, and, Bug or Feature?

Gabriel Landini
On Tuesday, 20 November 2018 18:22:52 GMT [hidden email] wrote:
> Greetings,
>
> After I upgraded to test the Recorder Bug, I noticed that the "Convert to
> Mask" in one of my plugins was functioning differently.

Maybe you have not set the threshold before converting to mask?
I think you need to do that.

Cheers

Gabriel

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

Re: Bug, and, Bug or Feature?

Wayne Rasband-2
In reply to this post by Fred Damen
> On Nov 20, 2018, at 1:22 PM, Fred Damen <[hidden email]> wrote:
>
> Greetings,
>
> After I upgraded to test the Recorder Bug, I noticed that the "Convert to
> Mask" in one of my plugins was functioning differently.  I do not suspect the
> upgrade, as I downgraded and retested and had the same results; albeit, as
> this was the last thing I did before discovering the issue…

With 16 and 32 bit images that are not thresholded, the output of “Convert to Mask” depends on the display range (aka window/level), and the makeSubhyperstack() method in your example changes the display range. You can work around this problem by either setting the threshold using something like

 IJ.setAutoThreshold(imp, "IsoData dark”);

or by reseting the display range using

 imp.resetDisplayRange();

-wayne


> Test file:
> File->Open Samples->T1 Head
> Image->Duplicate (only current slice)
>
> First the bug:
> Running the code below, the new image window (maskimp) is Windowed/Leveled
> differently from the original window (imp). With section 1 commented out and
> section 2 uncommented (w/wo duplicate) the bug is not seen.
>
> The bug/feature:
> Running the "Convert To Mask" either using Section 4 or through the GUI gives
> different results depending on the current window/leveling.  Is this a feature
> that can be turned on/off?, if so how (in plugin)?  How to debug?, i.e., where
> are these config/options stored?  Can these files be erased and will ImageJ
> automatically create these config files if they do not exist?
>
> Note:
> Running my plugin, that I discovered this issue in, on other computers, with
> the same code and data files, this issue is not seen.
>
>
> Fred
>
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import ij.plugin.*;
> import ij.plugin.frame.*;
>
>
> public class UGH implements PlugIn {
>
> public void run(String arg) {
> /* Section 1 */
>         ImagePlus imp = IJ.getImage();
>         ImagePlus maskimp =
> SubHyperstackMaker.makeSubhyperstack(imp,"1","1-"+imp.getNSlices(),"1").duplicate();
> /* Section 2 */
> //        ImagePlus maskimp = IJ.getImage().duplicate();
> /* Section 3 */
>         maskimp.show();
> /* Section 4 */
> //        Prefs.blackBackground = false;
> //         IJ.run(maskimp, "Convert to Mask", "");
> }
>
> }

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