Dynamic Annotation Issues with Reslice Cursor in VTK MPR Views

Problem Statement

I’m implementing dynamic orientation labels (A/P/I/S/L/R) for reslice cursors in multi-planar reconstruction (MPR) views (axial, coronal, sagittal). The labels should update during rotations, with specific defaults:

  • Axial: Top = A (Anterior), Bottom = P (Posterior), Right = R, Left = L
  • Coronal: Top = S (Superior), Bottom = I (Inferior), Right = R, Left = L
  • Sagittal: Top = S, Bottom = I, Right = A, Left = P

After rotations (especially small ones), labels become incorrect or flip unexpectedly. For example when I rotate the reslicecursorwidget in Axial(About 3 degree):

  1. Coronal view shows as

Top Label: I
Bottom Label: S
Right Label: L
Left Label: R

Instead of exact as,

Top Label: S
Bottom Label: I
Right Label: R
Left Label: L

  1. Only when rotating the coronal’s reslicecursorwidget, the expected labels is been gettiing in Axial and Sagittal views
  2. Firstly my MPR inspired from the fourpaneviewer, it had some flipping issue in MPR and I managed through the introducing SetNormal and setXViewup,setYViewup,setZViewup for the reslicecursor…Even I commented those portions also, I getting the same result for the orientations(As issues)
  3. When I clicking over the cursor without rotating at its default conditions, all the exact orientations labels is getting all the views(Axial/Coronal/Sagittal)

Current Approach

  1. Extract Directions from vtkMatrix4x4 of the reslice cursor:
double xDir[3] = {mat->GetElement(0,0), mat->GetElement(1,0), mat->GetElement(2,0)};
double yDir[3] = {mat->GetElement(0,1), mat->GetElement(1,1), mat->GetElement(2,1)};
  1. Compute Edge Vectors per view:
  • Sagittal:
    • topEdge = +yDir (Superior)
    • rightEdge = +xDir (Anterior)
  • Axial:
    • topEdge = -yDir (Anterior)
    • rightEdge = +xDir (Right)
  • Coronal:
    • topEdge = -yDir (Superior)
    • rightEdge = +xDir (Right)
  1. Annotation Logic uses a threshold (22.5°) to decide between single or combined labels

What I’m Looking for any suggestions from existing examples/event­-driven approach or alternative ideas. Thanks in advance for any pointers, code samples, or best practices you can share!

@lassoan @dgobbi @LucasGandel @mwestphal @ben.boeckel @pieper