[vtkusers] vtkImageReslice

David Gobbi dgobbi at irus.rri.ca
Wed Jan 30 04:13:42 EST 2002


Hi Julio,

Just a brief comment about this code:

>   sagittal_transform = vtkTransform::New();
>   sagittal_transform->RotateX(0);
>   sagittal_transform->RotateY(-90);
>   sagittal_transform->RotateZ(0);
> // end sagittal transform

...
>   sagittal_reslice->SetResliceTransform(sagittal_transform);

Setting up slice orientation via Rotate is not a good idea,
since 'RotateY(-90)' gives a rotation of approximately -90
degrees due to numerical error.

My advice is to actually set the elements of the matrix directly,
so that you get a perfect permutation matrix:

sagittal_reslice->SetResliceAxesDirectionCosines(0, 1, 0,
                                                 0, 0, 1,
                                                 1, 0  0);

The VTK 3.2 version of vtkImageReslice doesn't have the
'SetResliceAxesDirectionCosines' method but setting the matrix
elements is very straighforward.

There can be a huge difference in the speed of vtkImageReslice
if you have a rotation of 'approximately' 90 degrees compared
to a rotation of 'exactly' 90 degrees.

 - David

>>> t = vtkTransform()
>>> t.RotateY(-90)
>>> print t.GetMatrix()
[...]
  Elements:
    1.5702e-16 0 -1 0
    0 1 0 0
    1 0 1.5702e-16 0
    0 0 0 1

--
  David Gobbi, MSc                       dgobbi at irus.rri.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario

------------------------------------------------------------
On Wed, 30 Jan 2002, JULIO DANIEL wrote:

> this a code for vtkimageReslice and vtkImageViewer
[...]




More information about the vtkusers mailing list