I have the following code:
from ij.plugin.frame import RoiManager from ij.measure import ResultsTable from ij import IJ roi_file = "RoiSet_test.zip" image_path = "./" rm = RoiManager() rm.runCommand("Open", roi_file) n = rm.getCount() i = -1 for roi in rm: i = i + 1 roi_name = roi.getName() image_file = image_path + roi_name + ".png" imp = IJ.openImage(image_file) imp.show() # Select area based on ROI rm.select(i) # Measure it IJ.run(imp, "Measure", ""); # It breaks here, where I tried to get the value of Mean column bg_intensity = ResultsTable.getValue("Mean",i ) # we want to process 1st ROI only as example hence break here. break
What I tried to do is to loop over the ROI list.
Measure the area based on the position defined in the ROI coordinate.
Mean value as
bg_intensity variable, this is done by getting the value from the Result table.
As noted above the code failed on this line
bg_intensity =ResultsTable.getValue("Mean",i, i )
What’s the right way to do it?
I get the following error:
TypeError: getValue(): self arg can't be coerced to ij.measure.ResultsTable