Viewers icon indicating copy to clipboard operation
Viewers copied to clipboard

[Bug] Image slices are displayed in reverse order, if we switch from common layout to 2D MPR for some specific data

Open arul-trenser opened this issue 8 months ago • 1 comments

Describe the Bug

For certain datasets https://viewer.ohif.org/viewer?StudyInstanceUIDs=1.2.826.0.1.3680043.2.1125.1.11608962641993666019702920539307840, switching from the common layout to the 2D MPR view results in image slices being displayed in reverse order.

Steps to Reproduce

  1. Launch the viewer with https://viewer.ohif.org/viewer?StudyInstanceUIDs=1.2.826.0.1.3680043.2.1125.1.11608962641993666019702920539307840
  2. Observe the slice order / Draw an annotation
  3. Switch to 2D MPR mode
  4. Now check the slice order / Click the annotation check the slice no in the viewer and in the measurement panel

The current behavior

The slice order is observed to be reversed when

https://github.com/user-attachments/assets/6d2821d6-a179-44d8-8c8b-4cddda46dd0a

The expected behavior

The slice order is expected to be maintained without inversion when switching from the common layout to the 2D MPR view.

OS

Windows 11

Node version

v18.19.0

Browser

Chrome v136.0.7103.93

arul-trenser avatar May 08 '25 04:05 arul-trenser

Root cause: In DICOM images, the patient's anatomical position should go to positive values towards the superior direction. However, the head side is recorded in negative direction with this particular data. VTK reorders the volume slices based on patient orientation and leads to an unexpected reordering of slices when switching to 2D MPR mode in the OHIF viewer.

Fixed this issue by reordering the stack images similar to volume viewport ordering when the slices have necessary metadata like ImagePositionPatient/ImageOrientationPatient etc. For other images without the necessary metadata, we can continue ordering stack images with instance numbers and created a PR #5022.

@sedghi Could you please look into the PR?

arul-trenser avatar May 08 '25 07:05 arul-trenser