Getting XY coordinates for a plugin

Posted by kt7 on
URL: http://imagej.273.s1.nabble.com/Getting-XY-coordinates-for-a-plugin-tp5018040.html

Hi all,
Stumped again so I am trying to get the coordinates enclosed by a ROI determined using the analyze particles function. Below I have code that I wrote to save the actual ROI. I would really like to save the ROI as a csv of X, Y coordinates. This plugin is run with a headless mode so it can not use the window selection tools because there are no open windows.

RoiManager roiManager = new RoiManager();
IJ.run(imp1, "Analyze Particles...", "size=" + minCellSize + "-" + maxCellSize + " exclude include add");
roiManager = RoiManager.getInstance();
Roi[] roiM = roiManager.getRoisAsArray();
for (int z = 0; z < roiM.length; z++) {
        IJ.run("ROI Manager...", "");
        Roi roi1=roiManager.getRoi(z);
        RoiEncoder.save(roi1, "path/here.roi");
}

Thanks,
Kyle