I have created a cylinderSource = vtk.vtkCylinderSource()
and then a cylindermodel = slicer.vtkMRMLModelNode()
and “linked together” with cylindermodel.SetAndObservePolyData(cylinderSource.GetOutput())
then i created a cylindermodelDisplay = slicer.vtkMRMLModelDisplayNode()
set all the colors and so on and “linked together” with
slicer.mrmlScene.AddNode(cylindermodelDisplay) cylindermodel.SetAndObserveDisplayNodeID(cylindermodelDisplay.GetID())
all nice.
Now i have 2 points in space and between them multiple points (which i have their position) and i wanted to put all those nice cylinder in that direction between the 2 points and rotated accordingly, so it looks like a long rod.
i created a cylinderTS = slicer.vtkMRMLTransformNode()
so my cylindermodel
can associate with it later.
I created a cylinderTransform = vtk.vtkTransform()
so i can rotate my cylinderTS
and i associated them with cylinderTS.SetAndObserveMatrixTransformToParent(cylinderTransform.GetMatrix())
But i don’t know how to rotate in the same direciton of the “line” between the two points. I tried to use cylinderTransform.RotateWXYZ()
but i don’t know the axis of rotation.
I had an idea.
I just create a vtkline, i can associate a slicer.vtkMRMLModelNode()
and then i can get the angle, the local axis… but i noticed that from a slicer.vtkMRMLModelNode()
i can’t retrieve a slicer.vtkMRMLTransformNode()
and neither a matrix4x4…
Someone can suggest me any ideas?