2D views and 3D model transformation


In Slicer, it is possible to display a 3D model aligned with 2D slices view in sagittal, coronal, and axial view.


I am trying to achieve the same visualization in the external software by exporting the model and 2d views generated by Slicer.

Is it possible to obtain the original pose of 3D model w.r.t sagital, coronal, and axial plane?

Many thanks

Yes, you can select the view using the popup controller. Also you can switch to parallel projection mode if needed:


Thanks Pieper for the reference. I have taken a look on it. But, i did not manage to find any function that allow me to access the information of relative transformation between planes (Axial, Sagittal, Coronal) and 3D model.

I wonder if you could give more hint on how to access numerical value of the transformation matrix (either manually or programmatically)?

Many thanks

Transformation matrix can be accessed using GetSliceToRAS method of the slice node.

sliceViewName = slicer.app.layoutManager().sliceViewNames()[0]
sliceToRAS = slicer.app.layoutManager().sliceWidget(sliceViewName).sliceLogic().GetSliceNode().GetSliceToRAS()

You can also change the default slice orientations.

1 Like

Thanks again Andras.

I’ve been trying to understand the API to access the transformation matrix of the 3D model w.r.t to RAS but with no luck.

could you give me any clue?


SliceToRAS returns a VTKMatrix4x4 that defines the slice plane’s position (4th column of the matrix) and slice vertical and horizontal axis directions (1st and 2nd column).

Hi Andras,

Yes, from the snippet code that you have provided, I am able to get the transformation matrix of the planes (axial, sagittal, and coronal). This time, I am trying to understand that given the 3D model is generated in the 3D view, I want to obtain the transformation matrix of the 3D model with respect to RAS coordinate system.

Many thanks

Hi Dedy

For obtaining the transformation matrix of the 3D view, you will have to access the vtkMRMLCameraNode of the 3D view and then get the position and orientation of the vtk camera.

Hope that helps.


1 Like

By default, the model is not transformed. If you have a transform applied to the node then you can get the transform using modelNode.GetParentTransformNode(). If you applied linear transform(s) then you can then get the combined transformation matrix using transformNode.GetMatrixTransformToWorld(matrix). If the transformation chain contains non-linear transforms as well then you can get it using transformNode.GetTransformToWorld(transform).

1 Like