I am trying to uniformly expand multiple polygonal ROI of microscopy images by changing the x,y coordinates of existing ROI. I was able to expand or increase the area of ROI by changing the x,y coordinates in .csv files (generated from .roi files). To upload these new ROI in ROI Manager, I need to convert .csv files to .roi format but I don’t know how to convert these .csv files to .roi. I greatly appreciate your help in solving this problem.
The following example macro creates an ROI, makes a table from the x,y coordinates, saves the table as a .csv file, closes the table, opens the .csv file as a table and converts the table into an ROI.
newImage("Untitled", "8-bit black", 500, 500, 1); makePolygon(142,132,206,89,265,163,185,178); Roi.getCoordinates(xpoints, ypoints); Roi.remove; Table.create("ROI Points"); Table.setColumn("X", xpoints); Table.setColumn("Y", ypoints); path = getDir("downloads")+"roipoints.csv"; Table.save(path); close("ROI Points"); Table.open(path); xpoints = Table.getColumn("X"); ypoints = Table.getColumn("Y"); makeSelection("polygon", xpoints, ypoints);
Thanks a lot Dr. Wayne. It’s working like magic.