slice information for individual points in ROI

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

slice information for individual points in ROI

Kenneth Sloan-3
Context: Java plugin (not a macro)

I have a stack displayed in a StackWindow.  I would like to use the multi-point tool to specify a small collection of
points (probably 3 in all).  The points may be located in separate slices.  That is, I want x,y,z information about each
individual point.

I see by using "Measure" that this information appears in the Results table.  I do not know how to access this information
in a Java plugin.  I can easily get x,y - but I don't know how to get z (the slice #)

Any hints?

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.

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

Re: slice information for individual points in ROI

Marcel.
This post was updated on .
Hello Kenneth,

you can get the "Slice" column information from the ResultsTable. For the
following example the stack and measurements must be available:

import ij.IJ;
import ij.measure.ResultsTable;
import ij.plugin.PlugIn;

public class MultiPointResults implements PlugIn {

        public void run(String arg) {
                IJ.run("Measure");
                ResultsTable rt = ResultsTable.getResultsTable();
                for (int i = 0; i < rt.size(); i++) {
                        System.out.println(rt.getValue("Slice", i));
                }
                ResultsTable.getResultsWindow().close(false);

        }
}

The other values (your coordinates) can be extracted by the given table
column name.
In this example I close the Results Table dialog after the measurements!




--
Sent from: http://imagej.1557.x6.nabble.com/

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

Re: slice information for individual points in ROI

Jerome Mutterer-3
Hi Kenneth

next to Marcel's suggestion, you could also use:

roi.getZPosition();

see: https://github.com/imagej/imagej1/blob/master/ij/gui/Roi.java#L1748

Sincerely,

Jerome.



2018-07-31 9:51 GMT+02:00 Marcel. <[hidden email]>:

> Hello Kenneth,
>
> you can get the "Slice" column information from the ResultsTable. For the
> following example the stack and measurements must be available:
>
> import ij.IJ;
> import ij.measure.ResultsTable;
> import ij.plugin.PlugIn;
>
> public class MultiPointResults implements PlugIn {
>
>         public void run(String arg) {
>                 IJ.run("Measure");
>                 ResultsTable rt = ResultsTable.getResultsTable();
>                 for (int i = 0; i < rt.size(); i++) {
>                         System.out.println(rt.getValue("Slice", i));
>                 }
>                 ResultsTable.getResultsWindow().close(false);
>
>         }
> }
>
> The other values (your coordinates) can be extracted by the given tbale
> column name.
> In this example I close the Results Table dialog after the measurements!
>
>
>
>
> --
> Sent from: http://imagej.1557.x6.nabble.com/
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
Jerome Mutterer
CNRS - Institut de biologie moléculaire des plantes
12, rue du Général Zimmer
67084 Strasbourg Cedex
www.ibmp.cnrs.fr

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

Re: slice information for individual points in ROI

Kenneth Sloan-3
Jerome - does getZPisition work if the points in the selection are in
different slices? If not, I may be able to use single points.

My limited experimentation shows a Results table with a separate slice
value for each point , but the Name (suggested in an old thread) shows the
same slice for every point (looks like the slice of the last point
selected).

Multipoint (in different slices) would be ideal but I think I can make
single point selections work.

Thanks very much for the help. I could not find getValue(“Slice”) in the
docs
On Tue, Jul 31, 2018 at 04:10 Jerome Mutterer <
[hidden email]> wrote:

> Hi Kenneth
>
> next to Marcel's suggestion, you could also use:
>
> roi.getZPosition();
>
> see: https://github.com/imagej/imagej1/blob/master/ij/gui/Roi.java#L1748
>
> Sincerely,
>
> Jerome.
>
>
>
> 2018-07-31 9:51 GMT+02:00 Marcel. <[hidden email]>:
>
> > Hello Kenneth,
> >
> > you can get the "Slice" column information from the ResultsTable. For the
> > following example the stack and measurements must be available:
> >
> > import ij.IJ;
> > import ij.measure.ResultsTable;
> > import ij.plugin.PlugIn;
> >
> > public class MultiPointResults implements PlugIn {
> >
> >         public void run(String arg) {
> >                 IJ.run("Measure");
> >                 ResultsTable rt = ResultsTable.getResultsTable();
> >                 for (int i = 0; i < rt.size(); i++) {
> >                         System.out.println(rt.getValue("Slice", i));
> >                 }
> >                 ResultsTable.getResultsWindow().close(false);
> >
> >         }
> > }
> >
> > The other values (your coordinates) can be extracted by the given tbale
> > column name.
> > In this example I close the Results Table dialog after the measurements!
> >
> >
> >
> >
> > --
> > Sent from: http://imagej.1557.x6.nabble.com/
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
>
>
> --
> Jerome Mutterer
> CNRS - Institut de biologie moléculaire des plantes
> 12, rue du Général Zimmer
> 67084 Strasbourg Cedex
> www.ibmp.cnrs.fr
>
> --
> 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: slice information for individual points in ROI

Jerome Mutterer-3
PointRoi extends PolygonRoi so you can get x and y from the PolygonRoi and
slice position from PointRoi, like this:
First put a multipoint roi in the roi manager with points on different
slices, then:

    RoiManager rm = RoiManager.getInstance2();
    Roi r = rm.getRoi(0);
    if (r.getType()==Roi.POINT)  {
      PointRoi pr = (PointRoi) r;
      IJ.log("count:"+pr.getCount(0));
      for (int i = 0;i<pr.getCount(0);i++) {
        IJ.log ("point_"+i
            +",x="+pr.getPolygon().xpoints[i]
            +",y="+pr.getPolygon().ypoints[i]
            +",z="+pr.getPointPosition(i)
            );
      }
    }

Sincerely,

Jerome.



2018-07-31 16:09 GMT+02:00 Kenneth R Sloan <[hidden email]>:

> Jerome - does getZPisition work if the points in the selection are in
> different slices? If not, I may be able to use single points.
>
> My limited experimentation shows a Results table with a separate slice
> value for each point , but the Name (suggested in an old thread) shows the
> same slice for every point (looks like the slice of the last point
> selected).
>
> Multipoint (in different slices) would be ideal but I think I can make
> single point selections work.
>
> Thanks very much for the help. I could not find getValue(“Slice”) in the
> docs
> On Tue, Jul 31, 2018 at 04:10 Jerome Mutterer <
> [hidden email]> wrote:
>
> > Hi Kenneth
> >
> > next to Marcel's suggestion, you could also use:
> >
> > roi.getZPosition();
> >
> > see: https://github.com/imagej/imagej1/blob/master/ij/gui/Roi.java#L1748
> >
> > Sincerely,
> >
> > Jerome.
> >
> >
> >
> > 2018-07-31 9:51 GMT+02:00 Marcel. <[hidden email]>:
> >
> > > Hello Kenneth,
> > >
> > > you can get the "Slice" column information from the ResultsTable. For
> the
> > > following example the stack and measurements must be available:
> > >
> > > import ij.IJ;
> > > import ij.measure.ResultsTable;
> > > import ij.plugin.PlugIn;
> > >
> > > public class MultiPointResults implements PlugIn {
> > >
> > >         public void run(String arg) {
> > >                 IJ.run("Measure");
> > >                 ResultsTable rt = ResultsTable.getResultsTable();
> > >                 for (int i = 0; i < rt.size(); i++) {
> > >                         System.out.println(rt.getValue("Slice", i));
> > >                 }
> > >                 ResultsTable.getResultsWindow().close(false);
> > >
> > >         }
> > > }
> > >
> > > The other values (your coordinates) can be extracted by the given tbale
> > > column name.
> > > In this example I close the Results Table dialog after the
> measurements!
> > >
> > >
> > >
> > >
> > > --
> > > Sent from: http://imagej.1557.x6.nabble.com/
> > >
> > > --
> > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > >
> >
> >
> >
> > --
> > Jerome Mutterer
> > CNRS - Institut de biologie moléculaire des plantes
> > 12, rue du Général Zimmer
> > 67084 Strasbourg Cedex
> > www.ibmp.cnrs.fr
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
Jerome Mutterer
CNRS - Institut de biologie moléculaire des plantes
12, rue du Général Zimmer
67084 Strasbourg Cedex
www.ibmp.cnrs.fr

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