Rotation around y axe

Hi, I’m using SlicerVirtualReality with HTC Vive Pro.
I wish to rotate my scene and an object around its axis “y” to have a circular view of my object.
I can not do it using the controllers.
Is it possible ? Can you help me ?
Alex

Hi Alex,
If you play with python code, it’s easy to do it.

  slicer.util.setSliceViewerLayers(background = imgNode)
  transform = [ ]
  rot_angle = 45
  transform = vtk.vtkTransform()
  transform.RotateWXYZ(0, rot_angle,  0, 1)  
  transformNode = slicer.mrmlScene.AddNode(slicer.vtkMRMLTransformNode())
  transformNode.ApplyTransform(transform)
  imgNode.SetAndObserveTransformNodeID(transformNode.GetID())

Hope it helps.

1 Like

Do you mean it is inconvenient to rotate the scene around using two-handed gestures, or you don’t know how to rotate the scene?

Yes, it is inconvenient using two handed gestures.

I tried to make several movements with controllers but I can only rotate around the Z axis (the object turns as needles).

I would like to rotate it around the y axis (horizontal movement)

Have you tried both these methods?

  • rotating the scene (using two-handed gestures; making the object non-selectable in Data module to ensure that you don’t accidentally grab the object)
  • rotating the object (grab the object by reaching inside with one hand, rotating it, then taking over to the other hand to rotate it further)

You can also rotate the object to a view that you would like to see in virtual reality and click “Set virtual reality view to match reference view” button on the toolbar.

Thanks for your answer.

Yes, i have already tried these methods.

I wish to be able to see my scene of face then rotation to see it in right profile but also to be able to see it from below. The goal is to have a rotation in traveling.
The actual manipulation that I make only allows me to turn the scene like clockwise.

Sorry, for me it is still not clear what would you like to achieve. Can you send a video of your virtual reality view so that we can see what you do now, and annotate a few still frames so that we can understand what would you like to do differently?

Hello, I just want to do a horizontal or vertical rotation like this in Slicer Virtual Reality using the controllers.

Alex

Le ven. 8 nov. 2019 à 14:03, Andras Lasso via 3D Slicer Community slicer@discoursemail.com a écrit :

(Attachment Rotation.mov is missing)

The attachment did not come through. Please try to upload via the web interface of discourse.

In virtual reality view, you can rotate the object or rotate the world (move around the object). Rotating the object around its own center is easier to implement: you can apply a linear transform and set the desired rotation matrix in it.

Thank you very much. I tried to make a rotation of object but it is not around its axis but of the center of the rest of the skull.

Here is a video of what I get and what I want for virtual reality : https://filedn.com/lMEY7FuuJRLkh9f4Jtgk5ez/Test%20zygomatic%20bone.mov.

How to do ?

Alex

Le dim. 10 nov. 2019 à 13:58, Andras Lasso via 3D Slicer Community slicer@discoursemail.com a écrit :

You can construct a transformation matrix that rotates around an arbitrary point by multiplying 3 transforms: translate center of rotation to origin, rotate, translate origin to center of rotation.

Thanks for your answer. I do not know how to create an arbitrary point of rotation and then do the 3 proposed transformations. Is there a tutorial to do this type of transformation?

Alex

Le jeu. 14 nov. 2019 à 15:55, Andras Lasso via 3D Slicer Community slicer@discoursemail.com a écrit :

Hello mr Lasso, I have not managed to find a solution to change the point of rotation in arbitrary position and make the transformations. Can you tell if there is a tutorial available.

I thank you in advance

See for example these pages:

I’ve now added an example script in the script repository for rotating about arbitrary centerpoint - see details here: Transform and rotation