Extracting coordinates and values along a line

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

Extracting coordinates and values along a line

Ryan Jansen
Hello all,

Bit of a newbie question here - I'm trying to extract pixel coordinates and
gray values along a segmented line from an image - it seems like this
information is accessed when the profile plot is generated, but I can't
seem to find how to pull it from there.  Any suggestions on how to do this,
or can you point me towards some relevant documentation?  I feel like I'm
missing something obvious here.

Thank you,
Ryan Jansen
[hidden email]
M.S. Astronautical Engineering
Viterbi School of Engineering
University of Southern California

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

Re: Extracting coordinates and values along a line

Neil Fazel
Just click "List" on the Profile Plot.

Neil

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

Re: Extracting coordinates and values along a line

Ryan Jansen
Perhaps I'm missing something - when I do that, the table I get is two
columns, with the distance along the profile in the first column, and the
gray value in the second.  What I'd like to be able to extract are the
pixel coordinates that the profile plot is sampling at.

Thanks for replying!

Ryan Jansen
[hidden email]
M.S. Astronautical Engineering
Viterbi School of Engineering
University of Southern California


On Sat, Mar 8, 2014 at 12:06 PM, Neil Fazel <[hidden email]>wrote:

> Just click "List" on the Profile Plot.
>
> Neil
>
>

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

Re: Extracting coordinates and values along a line

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Ryan Jansen
On Mar 7, 2014, at 5:01 PM, Ryan Jansen wrote:

> Hello all,
>
> Bit of a newbie question here - I'm trying to extract pixel coordinates and
> gray values along a segmented line from an image - it seems like this
> information is accessed when the profile plot is generated, but I can't
> seem to find how to pull it from there.  Any suggestions on how to do this,
> or can you point me towards some relevant documentation?  I feel like I'm
> missing something obvious here.

Here is a macro that demonstrates how to extract pixel coordinates and gray values along a segmented line

  run("Blobs (25K)");
  makeLine(80,108,84,113,89,113);
  run("To Selection");  // Image>Zoom>To Selection
  run("Interpolate", "interval=1"); // Edit>Selection>Interpolate
  getSelectionCoordinates(x, y);
  for (i=0; i<x.length; i++)
    print(i, d2s(x[i],2), d2s(y[i],2), d2s(getPixel(x[i],y[i]),2));

Replace the last two lines with

  for (i=0; i<x.length; i++) {
    ix=round(x[i]);
    iy=round(y[i]);
    print(i, ix, iy, getPixel(ix,iy));
  }

to get integer coordinates and values.

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