On Apr 2, 2014, at 10:59 AM, Christophe Leterrier wrote:
> Hi,
>
> I wonder how to get the coordinates along a straight line selection spaced
> 1-pixel apart?
Use the Edit>Selection>Interpolate command or the Roi#getInterpolatedPolygon() method.
> For a polyline I use fitSplineForStraightening() on the roi, which is (I
> guess) equivalent to run("Fit Spline", "straighten"); and then retrieve the
> coordinates. This works fine, but it does not work with straight lines (I
> get an error asking for a polyline or polygon).
>
> I then tried to use getInterpolatedPolygon(1, true) on a straight line,
> then retrieve the .xpoints and .ypoints of the FloatPolygon, but the length
> is not consistent. For a straight line of length 101 pixels, it gives me
> 161 coordinates instead of 101.
Are you looking at the x and y array sizes of the interpolated polygon? The arrays will normally be larger than the number of coordinates. This JavaScript
line = new Line(43, 99, 132, 51);
p = line.getInterpolatedPolygon(1, true);
print("length: "+line.getLength());
print("points: "+p.npoints);
print("array size: "+p.xpoints.length);
outputs
length: 101.12
points: 102
array size: 151
-wayne
> I need this because I want to process a straight line profile, detect a
> feature (let's say the maximum), and then plot the coordinates of thois
> feature back on the image (ie from the distance along the profile, get back
> to the coordinate of the point on the image).
>
>
> Thanks for your help,
>
> Christophe
>
> --
> Christophe Leterrier
> Researcher
> Axonal Domains Architecture Team
> CRN2M CNRS UMR 7286
> Aix Marseille University, France
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html