[vtkusers] vtkImageSlice and vtkImageReslice Mapper

David Gobbi david.gobbi at gmail.com
Fri Nov 2 18:03:09 EDT 2012


Hi Sahithya,

The following example comes with the VTK source code:

VTK/ImageProcessing/Python/ImageInteractorReslice.py

Note that you cannot use SetSlicePlane() together with
SliceFacesCameraOn() and SliceAtFocalPointOn(),
because when the latter two methods are used, the slice
plane will be automatically set from the camera parameters
and any value you set with SetSlicePlane() will be ignored.

 - David


On Fri, Nov 2, 2012 at 3:39 PM, Sahithya Wintrich <s.prakash at csuohio.edu> wrote:
> Hello,
>
> I am new to VTK and visualization in general. I am trying to extract a 2D
> slice from a 3D volume. The classes I use are as follows:
>
> vtkImageReader - reads the stack of 2D CT images
> vtkVolumeTextureMapper2D - Maps the volume
>
> in order to get a slice defined by a vtkPlane with origin and normal
> corresponding to the slice of interest, I use:
>
>     mapper = vtkImageResliceMapper::New();
>     mapper->SetInputConnection(
> reader->GetOuputPort());
>     mapper->SetSlicePlane(plane);
>
>     slice = vtkImageSlice::New();
>     slice->SetMapper(mapper);
>
>     renderer->AddViewProp(slice);
>
> I understand that the vtkImageSlice is a 3D prop and I tried using
> suggestions to change the position and focal point of the camera. However,
> this is still displayed in a 3D space. I need to display this as a 2D slice
> with a correct view (for oblique slices as well) and prevent the user from
> rotating the slice.
>
> Any help would be greatly appreciated!
>
> Sahithya



More information about the vtkusers mailing list