Re: Problem with Threshold/ Possible to threshold only a selection or ROI?
Posted by
Kingpin on
URL: http://imagej.273.s1.nabble.com/Problem-with-Threshold-Possible-to-threshold-only-a-selection-or-ROI-tp3683304p3683305.html
Found a way.
Not the smartest one, but it works:
for(i=1;i<=number_squares;i++)
{
roiManager("Select", i-1);
getStatistics(area, mean, min, max);
setThreshold(mean, max);
getSelectionBounds(x,y,w,h);
x=x+w/2;
y=y+h/2;
doWand(x,y);
run("To Bounding Box");
getSelectionBounds(x,y,w,h);
x=x+w/2;
y=y+h/2;
call("ij.Prefs.set", "qa.Re"+i+"x",x);
call("ij.Prefs.set", "qa.Re"+i+"y",y);
resetThreshold();
}
roiManager("Show None");
selectWindow("ROI Manager");
run("Close");

If anyone knows a better way, please comment ^^