Hi everybody!
I need to write a pluging in ImageJ to calculate the all the distances between 4-8 points in an image (or collage of images). For that, I realized that I could simply take the (x,y) coordinates of the multi-point tool. Does anybody of you how to access the X,Y coordinates of these points? Thanks in advance Jose |
Hi Jose,
you can try this: Roi roi = imp.getRoi(); Polygon p = roi.getPolygon(); for (int i=0; i<p.npoints; i++) IJ.log("X:"+p.xpoints[i]+",Y:"+p.ypoints[i]); Sincerely, Jerome On 21 February 2012 09:11, Jose Guzman <[hidden email]> wrote: > Hi everybody! > > I need to write a pluging in ImageJ to calculate the all the distances > between 4-8 points in an image (or collage of images). For that, I realized > that I could simply take the (x,y) coordinates of the multi-point tool. > > Does anybody of you how to access the X,Y coordinates of these points? > > Thanks in advance > > Jose > |
In reply to this post by Jose Guzman
IJ.getImage().getRoi().getFloatPolygon().xpoints
IJ.getImage().getRoi().getFloatPolygon().ypoints http://rsbweb.nih.gov/ij/developer/api/ij/IJ.html#getImage%28%29 http://rsbweb.nih.gov/ij/developer/api/ij/ImagePlus.html#getRoi%28%29 http://rsbweb.nih.gov/ij/developer/api/ij/gui/Roi.html#getFloatPolygon%28%29 http://rsbweb.nih.gov/ij/developer/api/ij/process/FloatPolygon.html Best, Stephan On Tue, 2012-02-21 at 09:11 +0100, Jose Guzman wrote: > Hi everybody! > > I need to write a pluging in ImageJ to calculate the all the distances > between 4-8 points in an image (or collage of images). For that, I > realized that I could simply take the (x,y) coordinates of the > multi-point tool. > > Does anybody of you how to access the X,Y coordinates of these points? > > Thanks in advance > > Jose |
Hi,
On Feb 21, 2012, at 3:34 AM, Stephan Saalfeld wrote: > IJ.getImage().getRoi().getFloatPolygon().xpoints > IJ.getImage().getRoi().getFloatPolygon().ypoints > > http://rsbweb.nih.gov/ij/developer/api/ij/IJ.html#getImage%28%29 > > http://rsbweb.nih.gov/ij/developer/api/ij/ImagePlus.html#getRoi%28%29 > > http://rsbweb.nih.gov/ij/developer/api/ij/gui/Roi.html#getFloatPolygon%28%29 > > http://rsbweb.nih.gov/ij/developer/api/ij/process/FloatPolygon.html > > Best, > Stephan > > Once you have the points in hand, you can adapt the Graph_ plugin to do the distance computations between the locations. http://rsb.info.nih.gov/ij/plugins/graph/index.html Cheers, Ben > > > On Tue, 2012-02-21 at 09:11 +0100, Jose Guzman wrote: >> Hi everybody! >> >> I need to write a pluging in ImageJ to calculate the all the distances >> between 4-8 points in an image (or collage of images). For that, I >> realized that I could simply take the (x,y) coordinates of the >> multi-point tool. >> >> Does anybody of you how to access the X,Y coordinates of these points? >> >> Thanks in advance >> >> Jose |
On 21/02/12 17:55, Ben Tupper wrote:
> Hi, > > On Feb 21, 2012, at 3:34 AM, Stephan Saalfeld wrote: > >> IJ.getImage().getRoi().getFloatPolygon().xpoints >> IJ.getImage().getRoi().getFloatPolygon().ypoints >> >> http://rsbweb.nih.gov/ij/developer/api/ij/IJ.html#getImage%28%29 >> >> http://rsbweb.nih.gov/ij/developer/api/ij/ImagePlus.html#getRoi%28%29 >> >> http://rsbweb.nih.gov/ij/developer/api/ij/gui/Roi.html#getFloatPolygon%28%29 >> >> http://rsbweb.nih.gov/ij/developer/api/ij/process/FloatPolygon.html >> >> Best, >> Stephan >> >> > Once you have the points in hand, you can adapt the Graph_ plugin to do the distance computations between the locations. > > http://rsb.info.nih.gov/ij/plugins/graph/index.html > > Cheers, > Ben > wanted to calculate for my images (small networks of neurons). For the moment I simply need to calculate euclidean distances between all nodes of a graph. Thanks for your help Jose >> >> On Tue, 2012-02-21 at 09:11 +0100, Jose Guzman wrote: >>> Hi everybody! >>> >>> I need to write a pluging in ImageJ to calculate the all the distances >>> between 4-8 points in an image (or collage of images). For that, I >>> realized that I could simply take the (x,y) coordinates of the >>> multi-point tool. >>> >>> Does anybody of you how to access the X,Y coordinates of these points? >>> >>> Thanks in advance >>> >>> Jose |
In reply to this post by Stephan Saalfeld
On 21/02/12 09:34, Stephan Saalfeld wrote:
> IJ.getImage().getRoi().getFloatPolygon().xpoints > IJ.getImage().getRoi().getFloatPolygon().ypoints > > http://rsbweb.nih.gov/ij/developer/api/ij/IJ.html#getImage%28%29 > > http://rsbweb.nih.gov/ij/developer/api/ij/ImagePlus.html#getRoi%28%29 > > http://rsbweb.nih.gov/ij/developer/api/ij/gui/Roi.html#getFloatPolygon%28%29 > > http://rsbweb.nih.gov/ij/developer/api/ij/process/FloatPolygon.html > This was a nice piece of advice! However, I found some problems when trying to convert these values in real distances. My scale is =1.33 pixels per um, but I cannot get this value in Java. I guess I am doing something wrong: import ij.measure.Calibration.*; // in run() Calibration ct = new Calibration(imp); // to get the calibration of the image? ct.getXUnit(); # returns pixel but it should be um Thanks in advance Jose > Best, > Stephan > > > > > On Tue, 2012-02-21 at 09:11 +0100, Jose Guzman wrote: >> Hi everybody! >> >> I need to write a pluging in ImageJ to calculate the all the distances >> between 4-8 points in an image (or collage of images). For that, I >> realized that I could simply take the (x,y) coordinates of the >> multi-point tool. >> >> Does anybody of you how to access the X,Y coordinates of these points? >> >> Thanks in advance >> >> Jose |
Hi Jose,
On Wed, 22 Feb 2012, Jose Guzman wrote: > Calibration ct = new Calibration(imp); // to get the calibration of the > image? The question mark is merited. The way to get the calibration of an ImagePlus is to call its getCalibration method: http://fiji.sc/javadoc/ij/ImagePlus.html#getCalibration%28%29 Ciao, Johannes |
Free forum by Nabble | Edit this page |