[Insight-users] VersorRigid3DTransform Scaling Problem

Tahir Mansoori tahir.mansoori at gmail.com
Mon Aug 21 09:57:39 EDT 2006


Hi,

I am using VersorRigid3DTransform to rotate 3D volume. The physical
spacing is 212 X 212 X 392 um. I am rotating volume around Y-Axis by
90 degrees.

This is a very simple case because input spacing 212 X 212 X 392 um
will be changed to output spacing of 392X212X212.

But if I rotate volume first around Z axis 45 degrees and then around
X axis 65 degrees, then output spacing need to be calculated by
applying this transform to a cube having dimensions 212 X 212 X 392
um.

  TransformType::Pointer  transform = TransformType::New();
  typedef TransformType::VersorType  VersorType;
  typedef VersorType::VectorType     VectorType;

  VersorType     rotation;
  VectorType     axis;

  axis[0] = 0;
  axis[1] = 1;
  axis[2] = 0;

  const double angle = 1.571; // 90 degrees

  rotation.Set(  axis, angle  );

  transform->SetRotation( rotation );

  ResampleFilterType::Pointer resampler = ResampleFilterType::New();

  resampler->SetTransform( transform );
  resampler->SetInput( fixedImageReader->GetOutput() );

  FixedImageType::Pointer fixedImage = fixedImageReader->GetOutput();

  resampler->SetSize(    fixedImage->GetLargestPossibleRegion().GetSize() );
  resampler->SetOutputOrigin(  fixedImage->GetOrigin() );
** resampler->SetOutputSpacing( fixedImage->GetSpacing() );
  resampler->SetDefaultPixelValue( 255 );

The line marked with ** does not work if spacing along all dimensions
is not equal or rotation angles are not multiple of pi/2.

If there any function or transform in itk to calculate output scaling.

Tahir Mansoori


More information about the Insight-users mailing list