[vtkusers] Zoom Question

David Gobbi david.gobbi at gmail.com
Thu Nov 13 13:33:58 EST 2008


Hi Paulo,

The documentation for SetZSlice() is pretty bad.  When it says "not
the same as on the hard drive" what it really means is this:

- The "Z" direction in VTK does not always correspond to the Slice
direction in the original files
- Even when the VTK Z direction and the slice direction are the same,
when you read an image into VTK, it resets the Z indexing so that it
starts at zero.  So if you read slices 3-12 from disk, you end up with
Z indexes 0-9 in VTK.

I'm not sure which one of the items above is causing the SetZSlice()
method to do something unexpected for you.  Usually I use
vtkImageReslice to extract the slice that I want, as in the
Examples/ImageProcessing/Cxx/ImageSlicing.cxx, by calling
reslice->SetOutputDimensionality(2) to make reslice extract just a
single slice, and by using reslice->SetResliceAxes() to choose the
slice position and orientation.

The trick with ImageReslice is that it expects you to select slice
positions using physical data coordinates (i.e. millimetre positions)
instead of using (I,J,K) pixel indices.

  David



On Thu, Nov 13, 2008 at 4:50 AM, Paulo Henrique Junqueira Amorim
<paulojamorim at gmail.com> wrote:
> Hi,
>
> How can I change the slice in vtkImageActor ?
>
> I am trying to use the image_actor.SetZSlice (10), but does not change the
> piece, it seems that the manual says it is not on the slices that are in HD.
>
>
> Regards,
> Paulo Amorim
>
>
>
> 2008/11/11 David Gobbi <david.gobbi at gmail.com>
>>
>> Hi Paulo,
>>
>> It is impossible to zoom a 2D actor.  Instead, you have to magnify the
>> image before it goes to the vtkImageMapper.  To zoom by an integer
>> factor, you can use something like vtkImageMagnify to enlarge the
>> image and then vtkImageClip to crop the image to the desired size.
>>
>> You might find it easier to use vtkImageActor, though, since
>> vtkImageActor is a 3D actor and you can just zoom the camera.
>>
>>    David
>>
>>
>> On Tue, Nov 11, 2008 at 1:28 PM, Paulo Henrique Junqueira Amorim
>> <paulojamorim at gmail.com> wrote:
>> > Hi,
>> >
>> > How do I zoom into a vtkActor2D with vtkImageMapper?
>> >
>> > The vtkCamera only works with 3D.
>> >
>> >
>> > Regards,
>> > Paulo Amorim
>> > _______________________________________________
>> > This is the private VTK discussion list.
>> > Please keep messages on-topic. Check the FAQ at:
>> > http://www.vtk.org/Wiki/VTK_FAQ
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.vtk.org/mailman/listinfo/vtkusers
>> >
>> >
>
>



More information about the vtkusers mailing list