Skip to content

Conversation

@vvihorev
Copy link
Contributor

Problem

Non-axial DICOM files with extracted views and at least one mask annotation break during export in nifti format. We need to know which is the primary_plane for non-axial files in Darwin Py to export them properly. The primary_plane (not axial) determined by the volumetric extractor is not stored in annotation files.

DICOM files uploaded without exporting views have one slot. If the file is non-axial this slot would have the primary plane in the plane map in metadata e.g. plane_map: {"0": "CORONAL"}.

However, files uploaded with views exported have three slots, and always have plane_map: {"0.1": "AXIAL", "0.2": "CORONAL", "0.3": "SAGITTAL"}. Taking the plane name from the first slot is incorrect, and we need to know which plane is the primary one explicitly.

PR to support primary_plane storage in annotations on the backend

Solution

We get primary_plane from medical metadata of DICOM annotation files. We use this primary_plane set by the volumetric extractor instead of the plane of the first slot to populate volumes from raster layer during nifti export.

Changelog

Use primary_plane from medical metadata of DICOM annotation files to populate volumes from raster layer during nifti export

Copilot AI review requested due to automatic review settings April 23, 2025 16:30
@linear
Copy link

linear bot commented Apr 23, 2025

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the nifti export process to correctly determine the primary_plane for non-axial DICOM files by reading the value from the medical metadata instead of relying solely on the plane_map.

  • Updated primary_plane retrieval to check medical metadata first.
  • Retained fallback and legacy handling to ensure backward compatibility.

@vvihorev vvihorev changed the title Get primary_plane from medical metadata of the slot [DAR-6479][External] Get primary_plane from medical metadata of the slot during nifti export Apr 23, 2025
@vvihorev vvihorev merged commit 80e0152 into master Apr 24, 2025
24 checks passed
@vvihorev vvihorev deleted the dar-6479-bug-nifti-exports-not-working-on-non-axial-files branch April 24, 2025 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants