Aligning local coordinate system with RAS

Hello everyone. I have several CT scans which are all positioned differently. It is not important to align them with each other but it is very important for me that I use the local coordinate system for the measurements. How can I make sure that the axes which I have defined as local X Y and Z are actually being used for this purpose?

E.g I want to measure distance of every point of one segment from the centroid reference plane to the articular surface of the bone. How can I make sure that csv file exported uses my X Y and Z?

Million thanks in advance

if you think that the body in 3D slicer has different position and orientation than your defined cordinate system I would do these:

a) Find the origin/centroid of the local cordinate system (LCS) of the body
b) Find the unit basis vectors of the LCS (one way to do this is computing the bounding box/use any reference plane like length or normals)

and then compare the two (your defined LCS vs LCS of the body in 3D slicer).

If they dont match, then you can apply a transformation. You can apply this transformation after or before exporting.