[Insight-users] (no subject)

itk@stmoser.ch itk at stmoser . ch
Tue, 26 Aug 2003 00:47:47 +0200 (MEST)


Hi

I have a function that transforms a 3D itkImage with an affine
transform. It worked fine until I changed the interpolator to a cubic
BSpline. Now the filter output is all set to the default value of the
interpolator. Do I forget any configurations?

Thanks, Stephan

itkUtility::Short3DImageTypePointer itkUtility::
AffineTransform3D(itkUtility::Short3DImageTypePointer img,
		  itkUtility::ResampleImageFilterTypePointer filter,
		  vnl_matrix<double> m4x4, const double* newSpacing)
{
  typedef itk::AffineTransform<double> TransformType;
  typedef TransformType::ParametersType ParametersType;
  TransformType::Pointer transform = TransformType::New();
  ...

  // before:
  typedef itk::LinearInterpolateImageFunction<Short3DImageType, double>
    InterpolationType;
  InterpolationType::Pointer interpolator = InterpolationType::New();
  filter->SetInterpolator(interpolator);

  // now, not working anymore:
  typedef itk::BSplineInterpolateImageFunction<Short3DImageType, double,
    double> InterpolationType;
  InterpolationType::Pointer interpolator = InterpolationType::New();
  interpolator->SetSplineOrder(3);
  filter->SetInterpolator(interpolator);


  ..
  filter->SetSize(size);
  filter->SetOutputOrigin(newOrigin);
  filter->SetOutputSpacing(newSpacing);
  filter->SetDefaultPixelValue(10000);
  filter->Update();
  return filter->GetOutput();
}