Login  Register

Re: Coordinates of points along drawn line

Posted by ERIC on Oct 29, 2014; 2:21pm
URL: http://imagej.273.s1.nabble.com/Coordinates-of-points-along-drawn-line-tp5010224p5010225.html

Hi Evgeny,
 From the ImageJ mail list : https://list.nih.gov/cgi-bin/wa.exe?A0=IMAGEJ

Wayne's answer to the same question.

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

Eric Denarier
Grenoble Institut des Neurosciences
Inserm U836
Chemin Fortuné Ferrini
38700 La Tronche
France


Tél :33 (0)4 56 52 05 38
Fax :33 (0)4 56 52 06 57

http://neurosciences.ujf-grenoble.fr/

Le 29/10/2014 14:28, Galimov, Evgeny a écrit :

> Dear Image J users,
>
>
> My name is Evgeniy Galimov, from UCL.
>
> I would like to ask is it possible somehow to obtain coordinates of all pixels situated along the line which I drew using freehand line tool?
>
> [cid:82F514EA-C71F-4AC3-8046-ACC5D28789FC]
>
> Thank you very much in advance,
>
> With the best wishes,
>
> Evgeniy
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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