Bug in Create Selection: selects entire image area as opposed to smaller region

I’m finding an odd behavior in the “Create Selection” call for ImageJ1.x functionality. My workflow was fine before upgrading to the most recent version 1.52m (previous version worked, 1.51t).

For example… I want to select/measure an area within a ROI of the image. You can see what I mean by executing this minimal working example code:

run("Blobs (25K)");
setAutoThreshold("Default");
//run("Threshold...");
run("Create Mask");
// now I only want to measure the total blob area within this oval
makeOval(105, 103, 42, 33);
run("Invert");
run("Clear Outside");
run("Select None");
run("Invert");
run("Create Selection");
roiManager("Add");
roiManager("Measure");

Then this is my selected ROI:

And this is the area measured:

Which is the entire area of the image - minus the area of the region I’m actually interested in: 65024 - 64536 = 488 (in pixels)

If you invert that mask and then Create Selection… you get the correct area measured (even though the binary values are the opposite as they should be):


*Note: this is setting aside the issue with lost scaling information… (linked below)

What am I missing here? Perhaps this is another bug in addition to the recent update bug found for ‘create mask’ scaling issue? @Wayne??

1 Like

This regression is fixed in the ImageJ 1.52o1 daily build.

I noticed that the example macro fails if “Black background” is enabled or the background color is not set to black. The following version does not have these problems and it removes two run(“Invert”) statements.

run("Blobs (25K)");
setOption("BlackBackground", false);
setAutoThreshold("Default");
run("Create Mask");
makeOval(105, 103, 42, 33);
setBackgroundColor(255,255,255);  //white
run("Clear Outside");  
run("Create Selection");
run("Measure");
1 Like

Thank you again @Wayne !!!