how to get multi-point Z coordinates

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

how to get multi-point Z coordinates

Leroy Olivier
Hello,

I have a Z stack with a multi-point selection.
Points are in different slices.
To get X and Y coordinates of all points is easy with getSelectionCoordinates(x, y) macro function.
But I don't know how to get the Z coordinates.
Any idea ?

Olivier

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: how to get multi-point Z coordinates

Wayne Rasband-2
> On Oct 18, 2019, at 5:04 AM, Leroy Olivier <[hidden email]> wrote:
>
> Hello,
>
> I have a Z stack with a multi-point selection.
> Points are in different slices.
> To get X and Y coordinates of all points is easy with getSelectionCoordinates(x, y) macro function.
> But I don't know how to get the Z coordinates.
> Any idea ?

The latest ImageJ daily build (1.52r48) adds the Roi.getPointPosition(index) macro function, which returns the stack position of the point with the specified index. Here is an example:

   for (i=0; i<Roi.size; i++)
      print(i+" "+Roi.getPointPosition(i));

-wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: how to get multi-point Z coordinates

CARL Philippe (LBP)
Dear Wayne,
How are you doing?
Don't you rather want to call this new macro method: Roi.getStackPosition(i)
or something similar which would make it a little bit more self explaining?
I guess this the macro method corresponding to the ij.gui.Roi.java getPosition() method, or am I wrong?
Have a nice week-end.
Kindest regards,
Philippe

----- Mail original -----
De: "Wayne Rasband" <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Dimanche 20 Octobre 2019 07:25:09
Objet: Re: how to get multi-point Z coordinates

> On Oct 18, 2019, at 5:04 AM, Leroy Olivier <[hidden email]> wrote:
>
> Hello,
>
> I have a Z stack with a multi-point selection.
> Points are in different slices.
> To get X and Y coordinates of all points is easy with getSelectionCoordinates(x, y) macro function.
> But I don't know how to get the Z coordinates.
> Any idea ?

The latest ImageJ daily build (1.52r48) adds the Roi.getPointPosition(index) macro function, which returns the stack position of the point with the specified index. Here is an example:

   for (i=0; i<Roi.size; i++)
      print(i+" "+Roi.getPointPosition(i));

-wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: how to get multi-point Z coordinates

Wayne Rasband-2
> On Oct 20, 2019, at 6:35 AM, CARL Philippe (LBP) <[hidden email]> wrote:
>
> Dear Wayne,
> How are you doing?
> Don't you rather want to call this new macro method: Roi.getStackPosition(i)
> or something similar which would make it a little bit more self explaining?

The new Roi.getPointPosition(index) macro function corresponds to the PointRoi.getPointPosition(index) method. It is needed because each point in a point selection can have a different position. For other types of selection, use the new Roi.getPosition(channel,slice,frame) function.

The macro functions added in ImageJ 1.52r are described at

     http://wsr.imagej.net/developer/macro/functions.html

To find them, search for "Requires 1.52r".

-wayne

> I guess this the macro method corresponding to the ij.gui.Roi.java getPosition() method, or am I wrong?
> Have a nice week-end.
> Kindest regards,
> Philippe
>
> ----- Mail original -----
> De: "Wayne Rasband" <[hidden email]>
> À: "imagej" <[hidden email]>
> Envoyé: Dimanche 20 Octobre 2019 07:25:09
> Objet: Re: how to get multi-point Z coordinates
>
>> On Oct 18, 2019, at 5:04 AM, Leroy Olivier <[hidden email]> wrote:
>>
>> Hello,
>>
>> I have a Z stack with a multi-point selection.
>> Points are in different slices.
>> To get X and Y coordinates of all points is easy with getSelectionCoordinates(x, y) macro function.
>> But I don't know how to get the Z coordinates.
>> Any idea ?
>
> The latest ImageJ daily build (1.52r48) adds the Roi.getPointPosition(index) macro function, which returns the stack position of the point with the specified index. Here is an example:
>
>   for (i=0; i<Roi.size; i++)
>      print(i+" "+Roi.getPointPosition(i));
>
> -wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: how to get multi-point Z coordinates

CARL Philippe (LBP)
Dear Wayne,
Thanks a lot for these detailled explanations.
I guess I checked the following link:
https://raw.githubusercontent.com/imagej/imagej1/master/ij/macro/Functions.java
before the updates had been added and your indicated link is different from the following one:
https://imagej.nih.gov/ij/developer/macro/functions.html
Have a nice end of week-end.
Kindest regards,
Philippe

----- Mail original -----
De: "Wayne Rasband" <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Dimanche 20 Octobre 2019 19:50:56
Objet: Re: how to get multi-point Z coordinates

> On Oct 20, 2019, at 6:35 AM, CARL Philippe (LBP) <[hidden email]> wrote:
>
> Dear Wayne,
> How are you doing?
> Don't you rather want to call this new macro method: Roi.getStackPosition(i)
> or something similar which would make it a little bit more self explaining?

The new Roi.getPointPosition(index) macro function corresponds to the PointRoi.getPointPosition(index) method. It is needed because each point in a point selection can have a different position. For other types of selection, use the new Roi.getPosition(channel,slice,frame) function.

The macro functions added in ImageJ 1.52r are described at

     http://wsr.imagej.net/developer/macro/functions.html

To find them, search for "Requires 1.52r".

-wayne

> I guess this the macro method corresponding to the ij.gui.Roi.java getPosition() method, or am I wrong?
> Have a nice week-end.
> Kindest regards,
> Philippe
>
> ----- Mail original -----
> De: "Wayne Rasband" <[hidden email]>
> À: "imagej" <[hidden email]>
> Envoyé: Dimanche 20 Octobre 2019 07:25:09
> Objet: Re: how to get multi-point Z coordinates
>
>> On Oct 18, 2019, at 5:04 AM, Leroy Olivier <[hidden email]> wrote:
>>
>> Hello,
>>
>> I have a Z stack with a multi-point selection.
>> Points are in different slices.
>> To get X and Y coordinates of all points is easy with getSelectionCoordinates(x, y) macro function.
>> But I don't know how to get the Z coordinates.
>> Any idea ?
>
> The latest ImageJ daily build (1.52r48) adds the Roi.getPointPosition(index) macro function, which returns the stack position of the point with the specified index. Here is an example:
>
>   for (i=0; i<Roi.size; i++)
>      print(i+" "+Roi.getPointPosition(i));
>
> -wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: how to get multi-point Z coordinates

Leroy Olivier
Dear Carl and Wayne,

newImage("Untitled", "16-bit black", 512, 256, 1);
setForegroundColor(255, 255, 255);
ms=100;
makeRectangle(35, 34, 87, 6);
run("Fill", "slice");
run("Select None");
makeRectangle(70, 34, 8, 58);
run("Fill", "slice");
wait(ms);
makeRectangle(94, 52, 10, 76);
run("Fill", "slice");
makeRectangle(87, 95, 64, 3);
run("Fill", "slice");
makeRectangle(115, 58, 10, 77);
run("Fill", "slice");
wait(ms);
makePolygon(191,54,212,140,200,140,181,62,163,143,147,141,174,42);
run("Fill", "slice");
makeRectangle(139, 109, 75, 8);
run("Fill", "slice");
wait(ms);
makePolygon(235,47,246,47,262,110,272,43,285,46,273,140,253,139,239,73,238,147,223,144);
run("Fill", "slice");
wait(ms);
makePolygon(302,32,291,146,307,145,315,26);
run("Fill", "slice");
makePolygon(299,72,359,28,365,40,311,83,355,123,344,138,299,87);
run("Fill", "slice");
wait(ms);
makePolygon(100,165,118,163,105,189,142,185,135,159,152,156,175,229,152,245,31,251,36,213,46,213,50,235,146,224,139,194,82,204);
run("Fill", "slice");
wait(ms);
makePolygon(216,167,196,232,222,248,273,253,291,169,258,160,216,156,226,180,278,179,261,234,228,234,212,222,231,165);
run("Fill", "slice");
wait(ms);
makePolygon(307,166,322,163,330,225,361,221,350,153,377,146,393,241,302,252);
run("Fill", "slice");
wait(ms);
makePolygon(487,14,453,17,452,123,480,124,503,14);
run("Fill", "slice");
makePolygon(448,175,471,173,468,224,435,212);
run("Fill", "slice");
run("Select None");
wait(ms);
for(i=0;i<5;i++)
{
        run("Invert");
        wait(ms);
}







-----Message d'origine-----
De : ImageJ Interest Group [mailto:[hidden email]] De la part de CARL Philippe (LBP)
Envoyé : dimanche 20 octobre 2019 21:20
À : [hidden email]
Objet : Re: how to get multi-point Z coordinates

Dear Wayne,
Thanks a lot for these detailled explanations.
I guess I checked the following link:
https://raw.githubusercontent.com/imagej/imagej1/master/ij/macro/Functions.java
before the updates had been added and your indicated link is different from the following one:
https://imagej.nih.gov/ij/developer/macro/functions.html
Have a nice end of week-end.
Kindest regards,
Philippe

----- Mail original -----
De: "Wayne Rasband" <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Dimanche 20 Octobre 2019 19:50:56
Objet: Re: how to get multi-point Z coordinates

> On Oct 20, 2019, at 6:35 AM, CARL Philippe (LBP) <[hidden email]> wrote:
>
> Dear Wayne,
> How are you doing?
> Don't you rather want to call this new macro method: Roi.getStackPosition(i)
> or something similar which would make it a little bit more self explaining?

The new Roi.getPointPosition(index) macro function corresponds to the PointRoi.getPointPosition(index) method. It is needed because each point in a point selection can have a different position. For other types of selection, use the new Roi.getPosition(channel,slice,frame) function.

The macro functions added in ImageJ 1.52r are described at

     http://wsr.imagej.net/developer/macro/functions.html

To find them, search for "Requires 1.52r".

-wayne

> I guess this the macro method corresponding to the ij.gui.Roi.java getPosition() method, or am I wrong?
> Have a nice week-end.
> Kindest regards,
> Philippe
>
> ----- Mail original -----
> De: "Wayne Rasband" <[hidden email]>
> À: "imagej" <[hidden email]>
> Envoyé: Dimanche 20 Octobre 2019 07:25:09
> Objet: Re: how to get multi-point Z coordinates
>
>> On Oct 18, 2019, at 5:04 AM, Leroy Olivier <[hidden email]> wrote:
>>
>> Hello,
>>
>> I have a Z stack with a multi-point selection.
>> Points are in different slices.
>> To get X and Y coordinates of all points is easy with getSelectionCoordinates(x, y) macro function.
>> But I don't know how to get the Z coordinates.
>> Any idea ?
>
> The latest ImageJ daily build (1.52r48) adds the Roi.getPointPosition(index) macro function, which returns the stack position of the point with the specified index. Here is an example:
>
>   for (i=0; i<Roi.size; i++)
>      print(i+" "+Roi.getPointPosition(i));
>
> -wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html