Rotation matrix from the Transform Module

Operating system: windows 7
Slicer version: 4.8.1
Expected behavior:
Actual behavior:
I create a needle model to insert it to a specific region in my 3D model in slicer. This way, the position of the needle tip and the orientation of the needle is important. The desired pose of the needle is obtained by the translation and rotation part of the transform module (the needle model is defined as the transformed i.e the active transform is applied to it.)
The problem is that:
First: if i save the txt.file of the linear transform and load it in matlab, it can be undestood that the rotation part is not really the rotation matrix i.e the inverse and the traspose are not equal.
(I convert the matrix from the LPS to RAS and the one that i load in matlab is exactly the same as seen in slicer)
Second: The result is not the same as i use the invert in slicer in comparison to the inverse of the matrix from matlab.

I would be appreciated if anyone could help me…

See this topic for explanation and solution: Saving Linear Transformation Matrix

Thanks Mr. Lasso.
Actually i saw the topic and i use it for the conversion to have the same rotation matrix in matlab. But i don’t want to use the Matlab bridge extension. I need to know which euler-angles the Slicer rotation matrix is based on?

You don’t need to use the entire extension but just use the few lines of code that inverts axes and the matrix.

Euler angles are not well suited for representing arbitrary orientations (suffers from gimbal lock and there are multiple parametrizations for the same orientation). I would recommend using orientation matrix or quaternion representation.

Actually, i’m working on a robotic project and i should define the orientation of my tool.
this way i want to know how the transformation module creates the rotation part based on the degrees which can be defined by the users?

Slicer stores transformation as a 4x4 homogeneous transformation matrix, you can use this to compute robot joint coordinates from this matrix (inverse kinematics).

I think that i misunderstood your previous request.
i found that the slicer works on Quaternions based on the Euler angles defined by users.

In Matlab, This could be obtained by converting the transformation matrix of slicer to the Quaternion definition and then find the Euler angles of the related Quaternion.
Thanks a lot from your guidance…