I have encountered a problem with "Fill" and "Clear Outside" in a macro.

What I want to do is to create a ROI on each slice in a stack based on fitting 
around the outline of a thresholded object,
and fill inside and clear outside to create a mask, leaving an overlay of the 
selection.

The problem is that "Fill" fills with the background color instead of the 
foreground color. It fills correctly on the first selected slice.
The problem does not occur if either the "Fill" or "Clear Outside" command is 
removed. It also does not occur if done manually via the GUI.

The following macro reproduces the problem:

close("*t1*");
run("T1 Head (16-bits)");
run("8-bit");
setSlice(nSlices/2);
setAutoThreshold("IJ_IsoData dark no-reset");
Color.setForeground("white");
Color.setBackground("black");
for (s = 50; s <= 100; s++) {
                setSlice(s);
                run("Create Selection");
                if (selectionType >= 0) {
                               run("Fit Ellipse");
                               run("Clear Outside", "slice");
                               run("Fill", "slice");            //bug? this 
fills with black, except for on slice 50
                }
                Overlay.addSelection("red");
                Overlay.setPosition(s);
}
setSlice(nSlices/2);
resetThreshold;
Roi.remove;


I am on Windows 10/64 using the latest daily build under Java 8 jre.

Stein

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

Reply via email to