[Insight-developers] bug in BSplineDeformableTransform?
Tomáš Kazmar
Tomash.Kazmar at seznam.cz
Tue Mar 18 18:12:16 EDT 2008
Hi all,
recently i tried to use second order b-splines to warp images and
the results contained sharp steps (~were not smooth). I am not sure
whether I do something wrong. Has anybody used it successfully?
It seems to me that there is an error in
BSplineInterpolatingWeightFunction in combination with
BSplineKernelFunction. The first uses kernel in the range -1..2 and
the second defines the support as -1.5..1.5.
Should I report it as a bug? There is a simple patch but once more
I am not sure whether I use it the right way.
Here is the relevant part of code:
const unsigned int SplineOrder = 2;
typedef itk::BSplineDeformableTransform<float, Dimension, SplineOrder> TransformType;
TransformType::Pointer bsplineTransform = TransformType::New();
typedef TransformType::RegionType RegionType;
RegionType bsplineRegion;
RegionType::SizeType size;
const unsigned int nodesOutsideImage = SplineOrder;
const unsigned int nodesInsideImage = 4;
const unsigned int numberOfGridNodes = nodesInsideImage + nodesOutsideImage;
size.Fill( numberOfGridNodes );
bsplineRegion.SetSize( size );
typedef TransformType::SpacingType SpacingType;
SpacingType spacing;
spacing[0] = 1.0 * floor( (width-1) / (double)(nodesInsideImage-1) );
spacing[1] = 1.0 * floor( (height-1) / (double)(nodesInsideImage-1) );
typedef TransformType::OriginType OriginType;
OriginType origin;
origin[0] = 0.0 - spacing[0];
origin[1] = 0.0 - spacing[1];
bsplineTransform->SetGridSpacing( spacing );
bsplineTransform->SetGridOrigin( origin );
bsplineTransform->SetGridRegion( bsplineRegion );
Regards,
Tomas
More information about the Insight-developers
mailing list