f1oNae
(F1o Nae)
December 5, 2022, 9:12am
1
When I set the position of cameras,I found that the 3dview disappeared if the position of camera was a little far from the origin.I must interact with the 3dview so that I can get the image,but it will change the picture.
cam1 = slicer.mrmlScene.GetNodeByID("vtkMRMLCameraNode1")
cam1.SetPosition(0,800,0)
cam2 = slicer.mrmlScene.GetNodeByID("vtkMRMLCameraNode2")
cam2.SetPosition(0,1200,0)
cam3 = slicer.mrmlScene.GetNodeByID("vtkMRMLCameraNode3")
cam3.SetPosition(0,1700,0)
It’s strange.Can you do me a favour?What’s wrong with this?
How can i solve it?
@f1oNae , after setting the position of the camera, you need to re-compute the clipping range (for reference https://github.com/Slicer/Slicer/blob/a5f75351073ef62fd6198d9480d86c0009d70f9b/Libs/MRML/Core/vtkMRMLCameraNode.h#L114-L119 )
In python, you could simply do something like this:
cam1 = slicer.mrmlScene.GetNodeByID("vtkMRMLCameraNode1")
cam1.SetPosition(0,800,0)
cam1.ResetClippingRange()
cam2 = slicer.mrmlScene.GetNodeByID("vtkMRMLCameraNode2")
cam2.SetPosition(0,1200,0)
cam2.ResetClippingRange()
cam3 = slicer.mrmlScene.GetNodeByID("vtkMRMLCameraNode3")
cam3.SetPosition(0,1700,0)
cam3.ResetClippingRange()
1 Like