Posted by
Michael Schmid on
Oct 14, 2013; 9:02am
URL: http://imagej.273.s1.nabble.com/Strange-results-after-Fit-Spline-tp5005151p5005158.html
Hi Norbert,
the way how spline fitting works in ImageJ is the following:
There are two splines, one for the x coordinates and one for the y coordinates, each as a function of point number.
You can see the x spline if you change the y coordinates to
yy = newArray(10, 20, 30, 40);
As there are two independent splines for x and y, the x values stay unchanged if the y values collapse to a single value, as in your example.
A fundamental change to how the splines work might break established procedures or macros, so I would tend to leave this unchanged.
Michael
________________________________________________________________
On Oct 12, 2013, at 22:51, Norbert Vischer wrote:
> Hello All,
>
> The "Fit Spline" algorithm gives strange results for segmented lines consisting of long and short segments. The macro below is an extreme example: Four points are arranged as straight horizontal line, thus one would expect that fitting a straight line would not change anything.
> However, the fitting procedure extends the line with U-turns: the measured length jumps from 201 to 300.3 pix, and the profile (which automatically employs fitting) includes two peaks that are not on the line.
>
> Meanwhile I found out that I can avoid the problem by uncommenting the line containing "Interpolate". But possibly ImageJ could avoid such unexpected behaviour in the first place.
> By the way, the problem above also occurs if an end-point is recorded twice (replace 101 by 100 in the demo).
>
> Norbert
>
>
>
> close("spline-test");
> newImage("spline-test", "8-bit ramp", 500, 500, 1);
> makeRectangle(80, 50, 4, 100);
> changeValues(0, 255, 255);
>
> xx = newArray(100, 101, 300, 301);
> yy = newArray(90, 90, 90, 90);
> makeSelection("polyline", xx, yy);
> waitForUser;
> run("Set Measurements...", "perimeter");
> run("Clear Results");
>
> run("Measure");
> //run("Interpolate", "interval=0.1");
> run("Measure");
>
> run("Fit Spline");
> run("Measure");
> run("Plot Profile");
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html