apparrilla
(Angel R Piñera)
January 5, 2020, 3:34pm
1
I´ve been trying to manage camera rotation around a focal point but I can´t find the right parameter to send.
RotateAround needs RASAxis and bool or angle. I have test without succes
camera = slicer.mrmlScene.GetNodeByID(‘vtkMRMLCameraNode1’)
camera.RotateAround(‘R’,20)
and
camera = slicer.mrmlScene.GetNodeByID(‘vtkMRMLCameraNode1’)
camera.RotateAround(0,20)
TypeError: ambiguous call, multiple overloaded methods match the arguments
Same problem as with “RotateTo”
I´ve found enums for parameters but I don´t know how to use them:
Thanks on advance!
lassoan
(Andras Lasso)
January 5, 2020, 6:59pm
2
Camera always rotates around the camera’s focal point. If you want to rotate around a different point then probably the easiest is to compute the new camera position, focal point, and ViewUp vector and set them in the camera.
apparrilla
(Angel R Piñera)
January 5, 2020, 7:24pm
3
I’m looking for exactly this camera behavior by I can’t make it work from those methods. I’m sure I’m doing something wrong with syntaxis…
lassoan
(Andras Lasso)
January 5, 2020, 8:22pm
4
Which behavior you are referring to? What would you like to achieve?
VTK’s built-in camera rotation methods can only rotate around the focal point, which is the position the camera looks at (in the center of the field of view).
apparrilla
(Angel R Piñera)
January 5, 2020, 8:45pm
5
I want to look at something (fiducial point for example) from any position and rotate camera 180º in all axes to see it from de opposite side.
Something like:
def LookAtFiducial(self, currentFid):
position = [0,0,0]
self.fiducial = self.fiducialNode()
self.fiducial.GetNthFiducialPosition(currentFid,position)
camera = slicer.mrmlScene.GetNodeByID(‘vtkMRMLCameraNode1’)
camera.SetFocalPoint(*position)
camera.SetPosition(position[0]+100,position[1]-200,position[2]+50)
def RotateOpposite(self)
camera = slicer.mrmlScene.GetNodeByID(‘vtkMRMLCameraNode1’)
camera.RotateAround(‘R’,180) / camera.RotateTo(position[0]-100,position[1]+200,position[2]-50)
lassoan
(Andras Lasso)
January 5, 2020, 10:01pm
6
To look at a point from the other side, mirror the camera position on the focal point position (cp_new = cp_old + 2 * (fp-cp_old)).
1 Like