[Insight-users] SetOutputDirection in ResampleImageFilter

Laurent PAUL Laurent.Paul at orto.ucl.ac.be
Wed Oct 25 04:19:49 EDT 2006



Hi users,

I'd want to resample a volume, changing his orientation. Images I have are
not Axial but slightly moved (cos values: 0.998/0/0.00432).
So I use ResampleImageFilter and his SetOutputDirection method.
It works great, transform is computed and the volume is rotated.

My problem is that origin moved too. So, the resulting volume begins with
about 4 black slices and thus it lacks 4 slices at the end of the volume.
I tried to transform the origin but don't managed.

This is what I did:

  ResampleFilter->SetDefaultPixelValue( 100 );
  ResampleFilter->SetOutputSpacing( Image->GetSpacing());
  ResampleFilter->SetOutputDirection(NewDirection);
  ResampleFilter->SetSize( Image->GetLargestPossibleRegion().GetSize() );
  ResampleFilter->SetInput(Image);
  ResampleFilter->SetOutputOrigin(ResampleFilter->GetTransform()->TransformPoint(Image->GetOrigin()));

I think the origin isn't transformed because when SetOutputOrigin is
called, the transform isn't computed yet. So nothing happens for the
origin.

Since slices aren't very far to be Axial, I think I don't need to add
slices to my volume (I work with dicom images, so it is simpler to keep
the number of images in term of DicomDictionary). It appears that I just
need to transform the origin.

How to?

Thanks a lot!

Laurent.



More information about the Insight-users mailing list