Make Binary

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

Make Binary

Krs5
Dear Wayne and list,

I think I found a bug in the "Make Binary" function.

The macro code below shows the problem.

setBackgroundColor(255, 255, 255);
setForegroundColor(0, 0, 0);
run("Clown (14K)");
makeRectangle(24, 30, 106, 122);
roiManager("Add");
run("Clear Outside");
setForegroundColor(0, 0, 0);
run("Fill", "slice");
run("Select None");
run("Duplicate...", "title=test");
setOption("BlackBackground", false);
run("Make Binary");
selectWindow("clown.jpg");
roiManager("Select", 0);
run("Create Mask");

Check result. Now run

roiManager("Delete");
run("Clown (14K)");
makeRectangle(32, 22, 256, 154);
roiManager("Add");
run("Clear Outside");
setForegroundColor(0, 0, 0);
run("Fill", "slice");
run("Select None");
run("Duplicate...", "title=test2");
setOption("BlackBackground", false);
run("Make Binary");
selectWindow("clown-1.jpg");
roiManager("Select", 0);
run("Create Mask");

The second run("Make Binary"); seems to select the wrong area. It is related to the size of the area selected. If larger than 50% it gets inverted. The manual states at page 112: " Note that for non-thresholded images and stacks Make Binary and Convert to Mask behave similarly"

Also the same Mask window is used for both run("Create Mask");

Best wishes

Kees


Dr Ir K.R. Straatman
Senior Experimental Officer
Advanced Imaging Facility
Centre for Core Biotechnology Services
University of Leicester
http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif 

ImageJ workshops 23 and 24 May; visit https://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif/workshops/imagej-workshops-May-2016

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