-
Notifications
You must be signed in to change notification settings - Fork 47
[DAR-6239][External] Fix nifti export for multi slotted items #1063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DAR-6239][External] Fix nifti export for multi slotted items #1063
Conversation
There was a problem hiding this 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 fixes the issue with nifti export for multi-slotted items by iterating over all DICOM slots and generating a separate output volume for each mask.
- Updated test fixtures to include a multi-slotted dicom payload in e2e_tests/objects.py.
- Added proper error handling for export responses in e2e_tests/helpers.py and new tests for multi-slotted items in the CLI tests.
- Modified JSON parsing (_parse_darwin_v2) in darwin/utils/utils.py to support an additional slot_index parameter and adjust filenames accordingly.
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| e2e_tests/objects.py | Added multi_slotted_dicom payload with two DICOM slots for testing. |
| e2e_tests/helpers.py | Added response.raise_for_status() to ensure export errors are caught immediately. |
| e2e_tests/cli/test_import.py | Added a new test for importing annotations from multi-slotted DICOM items. |
| e2e_tests/cli/test_convert.py | Extended test cases to cover new nifti multislot conversion. |
| darwin/utils/utils.py | Modified parse_darwin_json and _parse_darwin_v2 to support per-slot parsing and adjusted filename generation. |
Files not reviewed (1)
- e2e_tests/data/import/multi_slotted_annotations_with_dicom_slots/multi_slotted_dicom_item.json: Language not supported
Comments suppressed due to low confidence (1)
darwin/utils/utils.py:612
- [nitpick] In _parse_darwin_v2, annotations are filtered by checking if annotation.slot_names[0] equals the current slot's name. This may unintentionally omit annotations that are associated with multiple slots; please verify that this behavior is intentional.
annotations = [
e2e_tests/data/import/multi_slotted_annotations_with_dicom_slots/multi_slotted_dicom_item.json
Show resolved
Hide resolved
…lti-slotted-items
umbertoDifa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Problem
When a multi-slot item containing multiple DICOM slots is exported as a nifti volume, only the first slot is exported.
Solution
Iterate over all slots when exporting a file. If there are more than one slot, create a separate
AnnotationFilefor each slot, thus generating a separate output volume for each mask in each slot.Changelog
Fix nifti export broken for multi-slotted items