Rotation/translation of vtk 3D image with interpolation (python)
<p>I have 2 matrix:</p>

<pre><code>#for example
rotation = matrix([[ 0.61782155,  0.78631834,  0.        ],
            [ 0.78631834, -0.61782155,  0.        ],
            [ 0.        ,  0.        , -1.        ]])
translation = matrix([[-0.33657291],
            [ 1.04497454],
            [ 0.        ]])
vtkinputpath = "/hello/world/vtkfile.vtk"
vtkoutputpath = "/hello/world/vtkrotatedfile.vtk"
interpolation = "linear"
</code></pre>

<p>I have a vtk file which contains 3D image and I want to create a function in python to rotate/translate with interpolation it.</p>

<pre><code>import vtk

def rotate(vtkinputpath, vtkoutputpath, rotation, translation, interpolation):
  ...
</code></pre>

<p>I'm trying to take inspiration from <a href="https://github.com/imagescience/TransformJ/blob/master/src/main/java/transformj/TJ_Rotate.java" rel="nofollow">the transformJ plugin sources</a> (see <a href="http://www.imagescience.org/meijering/software/transformj/rotate/" rel="nofollow">here to understand how it works</a>)</p>

<p>I wanted to use vtk.vtkTransform but I don't really understand how it works: these <a href="http://www.programcreek.com/python/example/12960/vtk.vtkTransform" rel="nofollow">examples</a> are not close enough of what I want to do. This is what I did with that:</p>

<pre><code>reader = vtk.vtkXMLImageDataReader()
reader.SetFileName(vtkinputpath)
reader.Update()
transform = reader.vtkTransform()
transform.RotateX(rotation[0])
transform.RotateY(rotation[1])
transform.RotateZ(rotation[2])
transform.Translate(translation[0], translation[1], translation[2])
#and I don't know how I can choose the parameter of the interpolation
</code></pre>

<p>But that cannot work...
I saw <a href="http://www.vtk.org/Wiki/VTK/Examples/Python/RotationAroundLine" rel="nofollow">here</a> that the function RotateWXYZ() exists:</p>

<pre><code># create a transform that rotates the cone
transform = vtk.vtkTransform()
transform.RotateWXYZ(45,0,1,0)
transformFilter=vtk.vtkTransformPolyDataFilter()
transformFilter.SetTransform(transform)
transformFilter.SetInputConnection(source.GetOutputPort())
transformFilter.Update()
</code></pre>

<p>But I don't understand what the lines do.
My main problem is that I cannot find the vtk documentation for Python...</p>

<p>Can you advise me a documentation website for vtk in Python ? Or can you explain me at least how vtktransform (rotateWXYZ()) work ?
Please, I'm totally lost, nothing works.</p>