How to limit to threshold for measurement in a macro
Posted by BrianBL on Jul 21, 2015; 7:50pm
URL: http://imagej.273.s1.nabble.com/How-to-limit-to-threshold-for-measurement-in-a-macro-tp5013681.html
Hi,
I am trying to write a macro to do some measurements that is limited to thresholded regions. I know I can do it manually by checking Menu -> Analyze->Set Measurements->Limit to Threshold and then Menu-> Analyze -> Measure. However, when I tried to do this in a macro, it does not work.
Here is the macro.
setOption("Limit to Threshold", true);
setThreshold(50,255);
List.setMeasurements;
area = List.getValue("Area");
mean = List.getValue("Mean");
//getRawStatistics(area, mean);
//getStatistics(area, mean);
print(area, mean);
resetThreshold;
setOption("Limit to Threshold", false);
The output values are different from manual measurements. I also tried getRawStatistics and getStatistics. No luck.
So it seems that this setting setOption("Limit to Threshold", true) does not affect the behavior of these measurements in a macro. Or did I do something wrong? Is there a solution?
Any suggestion are appreciated.