BSpline fitting parametrization

(Tim Evain) #1

Hello guys,

I’m trying to do BSpline fitting to estimate vessel centerlines given some user points.
I use the BSplineScatteredDataPointSetToImageFilter and it gives good results in most cases.
But when the parametric points are almost aligned (~ representing a straight line), the fitting tend to return a very wavy fit that really overestimate the path.
I’ve tried with varying spline order and level parameters but I’ve failed to make it works properly.
For comparison I’ve used the vtk cardinal spline fitting and it seems to give better results, but I don’t understand why.

Here an example of my problem (given points with linear interpolation ; itk fitting ; vtk fitting):
GivenPoints SplineApprox vtkspline

Here a working case (given points ; itk fitting):
GivenPoints2 SplineApprox2

Is it an implementation problem or should I be able to get a good fit?


(Matt McCormick) #2

Hi Tim,

From the screenshots (nice! :ok_hand:) it looks like reducing the spline order may help.

The get a curve that is realistic by utiliizing the image content, the ITKMinimalPathExtraction module may be useful.


CC: @ntustison

(Nick Tustison) #3

Hi Tim,

How many control points and fitting levels did you specify for the top, middle figure?


(Tim Evain) #4

Hello Nick!

This is obtained with 4 controls points and 10 levels.

(@matt.mccormick, I’ve tried reducing the order, but that was unsuccessful)


(Nick Tustison) #5

For three data points, a cubic spline and 10 fitting levels (starting with four control points) is definitely overkill. Since you’re doubling the spline resolution at each level, you’re ending up with 2^10 = 1024 piecewise splines which is causing the above results.

(Tim Evain) #6

When I try lowering the level depth and/or the spline order, it worsen the fit (except when going to first order).
This configuration can also give seemingly nice results with few points, as this case, hence my puzzling :
GivenPoints3 SplineApprox3

I’ll fiddle a bit more with parameters to see if I can achieve a consistent behavior for my needs, before switching to something else.

In any case, many thanks for the hints Nick!


(Nick Tustison) #7

Another relevant issue of which you need to be aware is something that is particular to this specific fitting approach. The original formulation of Lee et al. (cited in the class) allows one to handle scattered data unlike other approaches (e.g., least squares). The drawback is that the default “fitting value” is zero, or at least that’s the best way to describe it. So you’re going to get a fundamentally different fit if the centroid of the points is zero vs. if the centroid in 3-D space is far from 0. All that being said, when I fit a curve using this class, I subtract the centroid from each data point before fitting and then add that centroid value to all sampled data points after fitting but before using the curve values.

(Tim Evain) #8


This is definitely a good advice: centering the point set has greatly improved my results! :smiley:
Here is the first presented case now.

Thanks a million for your help.