[vtkusers] Using new image rendering classes

Jothybasu Selvaraj jothybasu at gmail.com
Fri Jul 13 05:56:57 EDT 2012


Hi all,

I have just started using new imaeg rendering classes in vtk5.10. I
want to extract a slice in axial orientation and I am finding it hard.

I am using a vtkPlane as shown in the below code to extract the slice
(-20 in world coords) but it seems to slice in image coords. I don't
want slicing with mouse.

For other orientations the image are black. I tried different
interaction mode (2D, 3D).

if someonw could add an example on how to slice with vtkPlane , it
would be great!



vtkSmartPointer<vtkInteractorStyleImage>style=
                vtkSmartPointer<vtkInteractorStyleImage>::New();
        style->SetInteractionModeToImage3D();
        renderWindowInteractor->SetInteractorStyle(style);
        renderWindow->SetInteractor(renderWindowInteractor);

        // Create a plane to cut
        vtkSmartPointer<vtkPlane> plane =
                vtkSmartPointer<vtkPlane>::New();
        plane->SetOrigin(0,0,-20);
        plane->SetNormal(0,0,1);

        vtkSmartPointer<vtkImageResliceMapper>sm=
                vtkSmartPointer<vtkImageResliceMapper>::New();
        sm->SetInputConnection(imgReader->GetOutputPort());
        //sm->SliceFacesCameraOn();
        //sm->SliceAtFocalPointOn();
        sm->SetSlicePlane(plane);
        sm->BorderOff();
        sm->AutoAdjustImageQualityOn();

Thanks

--
Jothybasu Selvaraj
PhD Student
University of Liverpool
UK



More information about the vtkusers mailing list