I have the following image and ROI file.test_gap_area.roi.zip (274 Bytes)
If I use manual steps:
Open Image ROI Manager > Select "Test Gap Area" Edit > Clear Outside Image > Crop Analyze > Measure
I get the following result for mean:
But when I use this code:
from ij.plugin.frame import RoiManager from ij import IJ main_path = "/Users/pdubois/Desktop/" # Set up input ROI file gap_roi_file = main_path + "test_gap_area.roi.zip" image_file_name = main_path + "test.png" # Begin processing each image gap_rm = RoiManager() gap_rm.runCommand("Open", gap_roi_file) print(image_file_name) imp = IJ.openImage(image_file_name) imp.show() gap_rm.select(0) IJ.run(imp, "Clear Outside", "") IJ.run(imp, "Auto Crop", "") IJ.run(imp, "Measure", "")
I get this result:
What’s wrong with my code. What should I do to get consistent result with the steps, i.e.
for it to yield 104.996 as mean value?