Seeking Guidance on Changing Coordinate Systems

I’m currently working with the ResliceCursorWidget example available on this webpage: ResliceCursorWidget Example. While using this widget, I’ve encountered a directional issue in different views (coronal, axial, and sagittal).

In the coronal view, scrolling forward causes the DICOM slice to change from anterior to posterior, and scrolling backward changes it from posterior to anterior. The coronal slider behaves as expected.

In the axial view, scrolling forward changes the direction from inferior to superior, while scrolling backward changes it from superior to inferior. The axial slider also behaves correctly.

However, in the sagittal view, scrolling forward changes the direction from right to left, and scrolling backward changes it from left to right. Unfortunately, there’s an issue with the sagittal slider, as it moves in the reverse direction.

During my research, I stumbled upon information that the ITK toolkit uses the LPS coordinate system, whereas 3D Slicer and other medical software use the RAS coordinate system. You can find more details on this topic here: Medical Image Coordinates

Please refer to the video for better understanding.

I would greatly appreciate any guidance or suggestions on how to resolve this directional issue. Your insights would be invaluable in helping me overcome this challenge.
@finetjul @Sebastien_Jourdain @Forrest @cory.quammen @pieper @will.schroeder

you might want to consider flipping the orienttion of the sagittal plane in the widget state.

Could you provide some more context? @finetjul

@finetjul I’m looking for a bit more clarification on how flipping the orientation of the sagittal plane in the widget state might help with the issue I’m facing. Any additional details or insights would be greatly appreciated. Thanks!

Solved!

// Fix for Sagittal View Direction
// In the ResliceCursorWidget, the sagittal view initially had reversed scrolling behavior,
// with forward scrolling changing the direction from right to left, and backward scrolling from left to right.
// This was due to a coordinate system mismatch, with ITK using the LPS coordinate system and 3D Slicer using RAS.
// To correct this, we flipped the orientation of the sagittal plane in the widget state by
// setting the normal vector of the sagittal plane to [-1, 0, 0]. Default is [1, 0, 0]. 
this.initialPlanesState = { ...this.widgetState.getPlanes() };
this.initialPlanesState["4"]["normal"] = [-1, 0, 0];
this.widgetState.setPlanes({ ...this.initialPlanesState });
1 Like