# Compute the transformation based on selected local coordinate system

Hi 3DSlicer community,

I have a question about computing the transformation matrix for a desired local coordinate system. To be more specific, I have two 3D models, one is a 3D model in its original position, the second is the transformed 3D model using an unknown rigid body transformation. My main goal is to compute the translation and rotation based on the local coordinate system of the 3D model. The local coordinate system can be computed based on the prior knowledge from the 3D model. Basically, I want the rotation angles in terms of yaw, pitch, and roll computed based on the local coordinate axes and the origin which is the center of the mass of the model.

Let’s assume that I have the local coordinate axes and the center of the mass of the object. Is it possible to compute the yaw, pitch, and roll angles based on the desired local coordinate axes?
My original idea was to compute the transformation using the fiducial registration module based on predefined landmarks. Then to decompose it based on the desired local coordinate axes. However, I am not sure if it is the best way to do it or if there is some easier way to do it directly in the 3DSlicer?

Fiducial registration wizard module can compute the transform that you can directly apply to the “From” model. See additional registration options here: Registration — 3D Slicer documentation

Dear Andras,

Thanks for your reply. I think my question is a bit different from what fiducial registration wizard is computing. Please correct me if I am wrong. I have a desired coordinate system in 3D (please check the below image, here the desired coordinate system is x’y’z’ in green color, and the transformed object has is represented as the red vectors). I am interested in computing both translation and rotation values (yaw, pitch, roll) between red and green vectors. I want to compute these values with respect to the x’y’z’ and not just transfer the green coordinate to the red one. I would assume both translation and rotation should be decomposed with respect to the x’y’z’.