Hi
I have an image from which I created a mask. On the mask I run analyze particles to find the ROI’s. I want to select the ROI’s on the image and then measure the statistics. So far it seems to be working, but when I try to save the results to a csv file only 1 row is saved, but I would like to have all results saved.
Here’s a snippet of the code
RoiManager roiManager = RoiManager.getInstance();
if (roiManager == null) roiManager = new RoiManager();invisible
IJ.run("Set Measurements...", "area mean min centroid perimeter redirect=None decimal=3");
IJ.run(mask, "Analyze Particles...", "clear add stack");
roiManager.runCommand(image, "Measure");
IJ.saveAs("Results", "c:\\temp\\results.csv");
Now results.csv only contains 1 row with results. But in the console output I see the whole table, so I has been computed correctly.
I tried adding
roiManager.runCommand(image, "Deselect");
roiManager.runCommand(image, "Measure");
(I read that deselecting the ROI’s is identical to selecting all ROI’s)
or
roiManager.runCommand(image, "Select All");
roiManager.runCommand(image, "Measure");
But that didnt change anything. I
tried (de)selecting ROI’s using the functions roiManager.deselect() and roiManager.setSelectedIndexes(roiManager.getSelectedIndexes()) but the result is the same.
I also tried using the ResultsTable
ResultsTable rt = ResultsTable.getResultsTable();
rt.save("c:\\temp\\results.csv");
But still just 1 row is saved. Again rt contains all the rows, but somehow when saving only 1 row is saved.
Note: If I remove roiManager.runCommand(image, “Measure”); from the first snippet, then all results are saved, but this are the mask results, not the image results.
Note2: I am using Fiji 1.53c
Someone understands what I’m doing wrong?
Thanks
Ashgard