[vtkusers] using both SetResliceTransform and SetResliceAxes

Clément D. clement.douarre at gmail.com
Wed Jun 28 12:12:30 EDT 2017


Hello everyone, new to VTK, etc etc.

I wish to extract a  2D slice from a 3D volume, and then translate this
slicing in the volume, following the axis of the slice

So say I declare my slice this way (code is in Python) :

-------------------------------------------
oblique = vtk.vtkMatrix4x4()
#Some oblique matrix, vectors are in fact normalised but here I just put
random numbers for this example
oblique.DeepCopy((0.3, 0   , 0   , 10,
                  0  , 0.28, 0   , 10,
                  0.8, 0   , 0.97, 10,
                  0  , 0   , 0   , 1))

slice=vtk.vtkImageReslice() #create the slice object
slice.SetOutputExtent(0, 5, 0, 5, 0, 0)
slice.SetOutputOrigin(-0.5 * 5, -0.5 * 5, 0)

slice.SetResliceAxes(oblique) #set the resliceAxes matrix to it
-----------------------------------------------

So far so good, I get a slice oriented along the oblique matrix. It gets
trickier when I want to translate it.
Bear in mind that I would like a translation *along the axis of the oblique
matrix* and not in world coordinates.
I.E. i would like to translate along vectors (0.3,0,0.8), (0,0.28,0) and
(0,0,0.97) (vectors of the oblique matrix)

So if I do this :

-------------------------------------------
transformation = vtk.vtkTransform();
slice.SetResliceTransform(transformation)
transformation.Translate(1,0,0)
slice.Update()
-------------------------------------------

I would expect reading documentation on setResliceTransform that my slice
would move along one of these axis (the Z axis here).
Because my understanding of setResliceTransform and setResliceAxes being
used together is that the latter is used to set up a grid upon which the
former will then act (so translating will "slide" along the axes of
setResliceAxes)
However, I do not observe this behaviour (I don't really how the slice is
moving, but certainly not in the axes of oblique), did I get something
wrong ?

Many thanks,
Clément
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170628/9be0e7ce/attachment.html>


More information about the vtkusers mailing list