[Insight-users] Problem on the function BSplineInterpolationWeightFunction::Evaluate()

Rui Xu qdruixu at gmail.com
Thu Nov 17 01:53:35 EST 2005


Hello, all.

I find a problem on the function

void BSplineInterpolationWeightFunction::Evaluate(const
ContinuousIndexType & index, WeightsType & weights, IndexType &
startIndex) const

The calculation of the startIndex may be not correct. I think the
right calculation should be startIndex[j] =
floor(index[j])-floor(SplineOrder / 2) or
startIndex[j] = ceil(index[j]-(SplineOrder+1)/2)),
but not startIndex[j] = floor(index[j] -  SplineOrder/2).

Taking a 1D situation for example.

Assuming the spline order is 3, and the ContinouseIndex is index = 3.4.

if using startIndex[j] = floor(index[j] -  SplineOrder/2)

the startIndex should be 1. And the whole indices should be 1 2 3 4.

If these indices are subsituted into the Bspline Function

s(x) = sigma(Ci*B(x-i)) where Ci is the control point, B() is the
3-order BSpline Kernel, i = 1,2,3,4 and x = 3.4

the Bspline kernel can be sampled on the positions 2.4, 1.4, 0.4,
-0.6, But another sampling position -1.6  is lost.

Since the 3-order Bspline kernel can only have values from -2 to +2.
So the sampling positions 1.4, 0.4, -0.6, -1.6 are more important,
and the sampling on 2.4 is actually useless.

However, if using the calsulation startIndex[j] =
floor(index[j])-floor(SplineOrder / 2)
or startIndex[j] = ceil(index[j]-(SplineOrder+1)/2)).

the correct sampling position 1.4, 0.4, -0.6 and -1.6 can be obtained.

So guys, how do you think about it?

Best Regards!

Xu Rui


More information about the Insight-users mailing list