MRP Orientation and setting camera roll issue

I would not recommend using roll-pitch-yaw parametrization for specifying slice view orientations for medical imaging due to ambiguities (the same orientation can be represented multiple ways) and gimbal lock issue.

Instead, using homogeneous transformation matrices is an excellent way to specify view orientation. You can generate the transformation matrix by writing the direction vector of the horizontal and vertical axes in the first two columns of the matrix and write the cross product in the third column.

Note that you don’t need to invent and implement all these from scratch. For example, we have shared lots of tools for cardiac echocardiography in 3D Slicer’s SlicerHeart extension (free, open-source, restriction-free software). You can import 4D ultrasound, CT, or MRI images and visualize the image sequence in 2D and 3D (we probably already implemented what you are trying to figure out), but we go way beyond that and offer many analysis, modeling, and simulation tools (define annulus curve, papillary muscles, coaptation surface, segment leaflets - manually or fully automatic AI models, compute metrics, simulate various device placement procedure - from simple stents and closure devices to robotic catheters, biomechanical modeling, etc. We are working on many projects and continuously releasing tools (we release the source code along with all papers that we publish).