[vtkusers] Sliced image position

Jothybasu Selvaraj jothybasu at gmail.com
Fri Jul 13 10:12:15 EDT 2012


Hi guys,

I am trying to slice a vtkImaegData in axial, sag and coronal orientations.

I am using vtkImageReslice for doing this

I am using the below code for doing coronal slicing, but the image
actor stays always at the origin instead of moving to the slices
position.

I think I am doing something wrong with the matrices.

Can anyone point out what's wrong?

/ Matrix for  sagittal
       static double coronalElements[16] = {
           1, 0,0, 0,
           0, 0,1, 0,
           0,-1, 0, 0,
           0, 0, 0, 1 };


      // Set the slice orientation
        vtkSmartPointer<vtkMatrix4x4> resliceAxes =
          vtkSmartPointer<vtkMatrix4x4>::New();
        resliceAxes->DeepCopy(coronalElements);
        resliceAxes->SetElement(0, 3,0 );
        resliceAxes->SetElement(1, 3,sliceNo);
        resliceAxes->SetElement(2, 3,0 );

        // Extract a slice in the desired orientation
        vtkSmartPointer<vtkImageReslice> reslice =
          vtkSmartPointer<vtkImageReslice>::New();
        reslice->AddInput(imgData);
        reslice->SetOutputDimensionality(2);
        reslice->SetResliceAxes(resliceAxes);
        reslice->SetInterpolationModeToCubic();

Thanks

-- 
Jothybasu Selvaraj
PhD Student
University of Liverpool
UK



More information about the vtkusers mailing list