Skull / Skin of head segmentation rotation

So I have this segmentation of the skin of a head, I also have the skull (not displayed here). Does anyone have an intelligent way to rotate it so that is is positioned correctly - by correctly I essentially mean rotated so that the eyes fall on an equal, horizontal plane. You can see in the image the head is rotated slightly in the CT and I essentially want it straightened.

Thank you!!

Just to confirm, because you posted in the development category (but I don’t find any clue about this in your text), do you want to do this automatically using Python code?

Yes I would like to do this automatically through python development. I am writing a script and would like this feature implemented so that it auto rotates the head to the so that it lines up with the orthogonal planes.

I was hoping someone might have a good way to do this as I couldn’t find much.

The only thing that occurs to me is to try to run TotalSegmentator (or other model that works for the head), get the eyeball centers and do a rotation around the AP axis.

If I use a semi-automated approach where I place at least 2 fiducials on the corner of the eye and the nasion, do you think this would be sufficient?

Also how might I do the rotation through python?

Thank you for all the input!

Absolutely.

You can fit a plane on the points, calculate its normal, construct a transformation matrix so that the plane normal is the new IS axis, then set the transform node containing this matrix to the volume as parent.