Login  Register

A problem of ROI coordiantes shifting by using getXCoordinates

Posted by jiajian shen on Jul 12, 2008; 4:04pm
URL: http://imagej.273.s1.nabble.com/A-problem-of-ROI-coordiantes-shifting-by-using-getXCoordinates-tp3695612.html

 Hi All,

I am writing a pluginfilter, which needs get PolygonRoi coordinates from a
selected ROI.  Here is the code:

 Roi roi_1=imp.getRoi();
 PolygonRoi pr = (PolygonRoi)roi_1;
 int[] xarr = pr.getXCoordinates();
 int[] yarr = pr.getYCoordinates();

I found that the xarr and yarr cooridateds read by the code are
shifted compared with the initial ROI, although the shape is the same.  The
initial ROI is in the center of the image window.  However, the code reading
ROI shifted to the top left corner of the image window.  Anyone knows the
possible reason of this shift?  What is the right way to read the Roi
coordinates?

Thanks a lot,
Jiajian