# Consider having defined “origin” (a 3d array point), “axis1” (a 3d array axis), “alpha” (a float)
# Rotation process
transform1 = vtk.vtkTransform()
transform1.Translate(-origin[0], -origin[1], -origin[2])
transform1.RotateWXYZ(np.degrees(alpha), axis1[0], axis1[1], axis1[2])
transform1.Translate(origin[0], origin[1], origin[2])
# Apply the rotation on axis1
volumeNode.ApplyTransform(transform1)
# Save a scene view
sceneView = slicer.mrmlScene.CreateNodeByClass(‘vtkMRMLSceneViewNode’)
sceneView.SetScene(slicer.mrmlScene)
sceneView.SetName(‘View_1’)
slicer.mrmlScene.AddNode(sceneView)
sceneView.StoreScene()
# Recover the original volume by applying inverse transformation
inverseTransform1 = transform1.GetInverse()
volumeNode.ApplyTransform(inverseTransform1)
With the code snipped above, I have some issues storing my volume at a certain state in a view.
When I try to apply a first transformation, then take a view, and revert the transformation, the view doesn’t save the transformed state, but only the reverted state.
Can someone explain me why and help me find a solution ?