[vtkusers] Problem rotating vtkImageSlice

David Gobbi david.gobbi at gmail.com
Sun Aug 28 12:50:50 EDT 2016


Hi Frank,

It looks like you are doing a data transformation when you should be doing
a view transformation.  Don't rotate the actor if your goal is to rotate
the view.  When you rotate the actor, you are changing the relationship
between data coordinates and world coordinates.

If you want a sagittal view, then you can rotate the view by moving the VTK
camera.  The mapper has a method SliceFacesCameraOn() that can be used to
make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or
less.  Large inlined images make your email hard to read on my system (I
wish that gmail would auto-shrink oversized inlined images, but
unfortunately it displays them full-size, even if they're several times the
size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <rickfrank at me.com> wrote:

> Hi David,
>
> Thanks for the reply. I'm still a bit confused about what I've tried and
> why it doesn't work....
>
> So, I have 3 slice views and in the screenshot the Axial View is lined up
> appropriately (image position patient is in the correct place, and each
> slice is in correct place etc) with the world coordinates by using the
> image reslice axis and camera etc to align the DICOM coordinates and the
> VTK World coordinates.
>
> I now want to orient the sagittal slice so that it aligns with the world
> coordinates.
>
> (see screen shots)
>
>
> I believe I need to rotate the slice (if I could rotate the actor) about Z
> 90 CCW and then about its new X 0- degrees and then move the camera about
> world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM
> aligned with the World Coordinates.
>
> I tried various parameters for the resliceMapper->SetSlicePlane() but the
> slice just dissapears off screen somewhere so I must be getting sometime
> wrong.
>
> How would I use the SetSlicePlane to achieve this?
>
> Thanks
>
> Rick
>
> On Aug 27, 2016, at 02:51 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>
> You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
> perhaps its behavior will better suit your requirements.
>
>
> On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <david.gobbi at gmail.com>
> wrote:
>
>> Hi Rick,
>>
>> You're seeing this because you are doing an out-of-plane rotation on an
>> image that has only one slice.  The rotation is around the image origin,
>> which (in this case) is at the bottom-left corner of the image.
>>
>> The vtkImageResliceMapper has a SetSlicePlane() method:
>> http://www.vtk.org/Wiki/VTK/Image_Rendering_Classes#vtkImageResliceMapper
>> You must rotate this SlicePlane when you rotate the vtkImageSlice.
>>
>>  - David
>>
>>
>>
>> On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <rickfrank at me.com> wrote:
>>
>>> Hi,
>>>
>>> If I build the example
>>>
>>> VTK/Examples/Cxx/Images/ImageSlice
>>> and add
>>>
>>>  imageSlice->RotateX(1);
>>>
>>> Which should, I think, rotate the image actor about its X axis by 1
>>> degree, I instead get
>>>
>>>
>>> which seems incorrect.
>>>
>>> I can rotate about Z.
>>>
>>> Is there something I'm not doing correctly, or is this a bug?
>>>
>>> I also tried RotateWXYZ(1,1,0,0) and get the same result.
>>>
>>> This is VTK 7
>>>
>>> Thanks
>>>
>>> Rick
>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160828/025e62d2/attachment.html>


More information about the vtkusers mailing list