[vtkusers] vtkImageSlice and vtkImageReslice Mapper

David Gobbi david.gobbi at gmail.com
Mon Nov 5 13:41:34 EST 2012


Hi Sahithya,

When you say "coronal and sagittal planes" do you mean that you have a
single coronal or sagittal slice that you have loaded?  If so, then
use vtkImageSlice->SetUserMatrix() to set the orientation of your
images within the world coordinate system (i.e. to specify whether the
original image slices were axial, coronal, sagittal, or oblique).
Axial images use the identity matrix. For other images, I use this
matrix:

 ux vx wx px
 uy vy wy py
 uz vz wz pz
 0  0  0  1

Here, ux, uy, uz, vx, vy, vz is from the "ImageOrientationPatient" and
w = cross_product(u,v).  And px, py, pz is from
"ImagePositionPatient".  This assumes that the images are oriented
top-to-bottom (the way DICOM images are stored on disk), in contrast
to the bottom-to-top orientation that VTK typically uses.  So for your
images, you might have to do some experimentation to find the correct
matrix to use.

On Mon, Nov 5, 2012 at 11:18 AM, Sahithya Wintrich
<s.prakash at csuohio.edu> wrote:
> Hello David,
>
> Thank you for the tip! That code worked with axial and oblique planes.
> However, coronal and sagittal planes do not get displayed with the code from
> the example. Any pointers on why this may be?
>
> Sahithya
>
>
> On Fri, Nov 2, 2012 at 6:03 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>
>> 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