Getting x,y coordinates of the multi-point tool

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting x,y coordinates of the multi-point tool

Jose Guzman
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
Reply | Threaded
Open this post in threaded view
|

Re: Getting x,y coordinates of the multi-point tool

Jerome Mutterer-3
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
>
Reply | Threaded
Open this post in threaded view
|

Re: Getting x,y coordinates of the multi-point tool

Stephan Saalfeld
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
Reply | Threaded
Open this post in threaded view
|

Re: Getting x,y coordinates of the multi-point tool

BenTupper
Hi,

On Feb 21, 2012, at 3:34 AM, Stephan Saalfeld wrote:

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
Reply | Threaded
Open this post in threaded view
|

Re: Getting x,y coordinates of the multi-point tool

Jose Guzman
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
>
Ben, this is a very good idea. Your pluging is doing much of what I
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
Reply | Threaded
Open this post in threaded view
|

Re: Getting x,y coordinates of the multi-point tool

Jose Guzman
In reply to this post by Stephan Saalfeld
On 21/02/12 09:34, Stephan Saalfeld wrote:
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
Reply | Threaded
Open this post in threaded view
|

Re: Getting x,y coordinates of the multi-point tool

dscho
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