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