From 071bd28934c06f4003f763bee5e88f6ef103ed02 Mon Sep 17 00:00:00 2001 From: Jo-Byr Date: Thu, 3 Jul 2025 16:02:53 +0200 Subject: [PATCH 1/5] Add multi-segment nifti export support Modify nifti exporter to create an additional nifti file that contains all segments of the annotated volume --- darwin/exporter/formats/nifti.py | 13 +- .../coronal_LAS_pixdim_0.1_0.2_0.5.json | 257 ++++++++++++++++++ .../nifti/multi_segment/ground_truth.nii.gz | Bin 0 -> 670 bytes .../exporter/formats/export_darwin_test.py | 37 ++- 4 files changed, 305 insertions(+), 2 deletions(-) create mode 100644 tests/darwin/data/nifti/multi_segment/coronal_LAS_pixdim_0.1_0.2_0.5.json create mode 100644 tests/darwin/data/nifti/multi_segment/ground_truth.nii.gz diff --git a/darwin/exporter/formats/nifti.py b/darwin/exporter/formats/nifti.py index 396f49743..b7c80854c 100644 --- a/darwin/exporter/formats/nifti.py +++ b/darwin/exporter/formats/nifti.py @@ -58,13 +58,18 @@ class Volume: primary_plane: str +# Unique ID and file suffix for the "All segments" volume +multi_segments_label = "0" +multi_segments_name = "Segments" + + def export( annotation_files: Iterable[dt.AnnotationFile], output_dir: Path, ) -> None: """ Exports the given ``AnnotationFile``\\s into nifti format inside of the given - ``output_dir``. Deletes everything within ``output_dir/masks`` before writting to it. + ``output_dir``. Deletes everything within ``output_dir/masks`` before writing to it. Parameters ---------- @@ -146,6 +151,8 @@ def export( for ann in slot_annotations if ann.annotation_class.annotation_type == "mask" } + # Add a unique ID for the "All segments" volume + mask_id_to_classname[multi_segments_label] = multi_segments_name raster_output_volumes = build_output_volumes( slot, class_names_to_export=list(mask_id_to_classname.values()), @@ -497,6 +504,10 @@ def populate_output_volumes_from_raster_layer( volume[class_name].pixel_array = np.where( multilabel_volume == global_id, 1, volume[class_name].pixel_array ) + elif mask_id == multi_segments_label: + # Unique ID for "All segments": + volume = output_volumes[series_instance_uid] + volume[multi_segments_name].pixel_array = multilabel_volume return volume diff --git a/tests/darwin/data/nifti/multi_segment/coronal_LAS_pixdim_0.1_0.2_0.5.json b/tests/darwin/data/nifti/multi_segment/coronal_LAS_pixdim_0.1_0.2_0.5.json new file mode 100644 index 000000000..13e182cb1 --- /dev/null +++ b/tests/darwin/data/nifti/multi_segment/coronal_LAS_pixdim_0.1_0.2_0.5.json @@ -0,0 +1,257 @@ +{ + "version": "2.0", + "schema_ref": "https://darwin-public.s3.eu-west-1.amazonaws.com/darwin_json/2.0/schema.json", + "item": { + "name": "coronal_LAS_pixdim_0.1_0.2_0.5.dcm", + "path": "/", + "source_info": { + "item_id": "01951442-3873-46c2-7373-30e56050d853", + "dataset": { + "name": "dicom_test_data", + "slug": "dicom_test_data", + "dataset_management_url": "https://darwin.v7labs.com/datasets/1643259/dataset-management" + }, + "team": { + "name": "V7 John", + "slug": "v7-john" + }, + "workview_url": "https://darwin.v7labs.com/workview?dataset=1643259&item=01951442-3873-46c2-7373-30e56050d853" + }, + "slots": [ + { + "type": "dicom", + "slot_name": "0", + "width": 128, + "height": 128, + "fps": null, + "thumbnail_url": "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/thumbnail?token=642eedac-c980-4747-8dca-cba51e52dec1", + "source_files": [ + { + "file_name": "coronal_LAS_pixdim_0.1_0.2_0.5.dcm", + "url": "https://darwin.v7labs.com/api/v2/teams/v7-john/uploads/100f98aa-6917-42a0-891e-bdd692950e49?token=642eedac-c980-4747-8dca-cba51e52dec1" + } + ], + "frame_count": 16, + "frame_urls": [ + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/0?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/1?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/2?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/3?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/4?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/5?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/6?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/7?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/8?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/9?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/10?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/11?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/12?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/13?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/14?token=642eedac-c980-4747-8dca-cba51e52dec1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b9d93da4-37dc-4af4-825e-41b9899bf799/sections/15?token=642eedac-c980-4747-8dca-cba51e52dec1" + ], + "metadata": { + "handler": "MONAI", + "shape": [ + 1, + 128, + 16, + 128 + ], + "SeriesInstanceUID": "1.2.826.0.1.3680043.8.498.10392093638286046303269310577715221690", + "affine": "[[-0.1, 0.0, 0.0, 0.0], [0.0, -1.0, 0.0, 0.0], [0.0, 0.0, -0.25, 31.75], [0.0, 0.0, 0.0, 1.0]]", + "colorspace": "RG16", + "original_affine": [ + [ + "-0.1", + "0.0", + "0.0", + "0.0" + ], + [ + "0.0", + "0.0", + "-1.0", + "0.0" + ], + [ + "0.0", + "0.25", + "0.0", + "0.0" + ], + [ + "0.0", + "0.0", + "0.0", + "1.0" + ] + ], + "pixdim": "(0.1, 1.0, 0.25)", + "plane_map": { + "0": "CORONAL" + }, + "primary_plane": "CORONAL" + } + } + ] + }, + "annotations": [ + { + "frames": { + "15": { + "keyframe": true, + "mask": {} + } + }, + "id": "cce036e7-dcc2-46de-ab71-4e20beb94459", + "interpolate_algorithm": "linear-1.1", + "name": "mask1", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 15, + 16 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "15": { + "keyframe": true, + "mask": {} + } + }, + "id": "beffc847-da35-4937-b4a1-a1e16994cfc8", + "interpolate_algorithm": "linear-1.1", + "name": "mask2", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 15, + 16 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "15": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 6184, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 7736 + ], + "mask_annotation_ids_mapping": { + "81b795d7-0f12-4951-a2dc-0bd06af0aa6e": 1, + "dec395da-9478-476e-921e-4a4750ba413f": 2 + }, + "total_pixels": 16384 + } + } + }, + "id": "7fe1310e-8a4d-457c-815a-e34276366d0d", + "name": "__raster_layer__", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 0, + 16 + ] + ], + "slot_names": [ + "0" + ] + } + ], + "properties": [] +} \ No newline at end of file diff --git a/tests/darwin/data/nifti/multi_segment/ground_truth.nii.gz b/tests/darwin/data/nifti/multi_segment/ground_truth.nii.gz new file mode 100644 index 0000000000000000000000000000000000000000..5e0eddacbb2f3e8d969e7d73bee1d66db519b132 GIT binary patch literal 670 zcmb2|=3oE=?ziU;@-`VTI9zPvc_25>rXqxI-9sL^ISZ6`HY766ImW6Z82G4_#YW&> z_ADpwhWb;77^ZLFGVCoqaqD9ElF4ps-j(k4f30}-(|6nJkFVF+JvsgV%exAZ-J52< zG}>moq%Zn+#P;t|$zONoTkYOF?{k{<&;Lvin@7pv9|C7Q?TXIKt^51y>+9?5 Date: Wed, 9 Jul 2025 10:04:45 +0200 Subject: [PATCH 2/5] Fix pixel offset in test data and add tests Fix pixel offset in anisotropic test data Add sagittal and axial test data --- .../axial_RPI_pixdim_1.0_1.0_1.0/darwin.json | 259 ++++++++++++++++++ .../ground_truth.nii.gz | Bin 0 -> 653 bytes .../darwin.json} | 58 ++-- .../ground_truth.nii.gz | Bin .../darwin.json | 259 ++++++++++++++++++ .../ground_truth.nii.gz | Bin 0 -> 664 bytes .../exporter/formats/export_darwin_test.py | 62 +++-- 7 files changed, 582 insertions(+), 56 deletions(-) create mode 100644 tests/darwin/data/nifti/multi_segment/axial_RPI_pixdim_1.0_1.0_1.0/darwin.json create mode 100644 tests/darwin/data/nifti/multi_segment/axial_RPI_pixdim_1.0_1.0_1.0/ground_truth.nii.gz rename tests/darwin/data/nifti/multi_segment/{coronal_LAS_pixdim_0.1_0.2_0.5.json => coronal_LAS_pixdim_0.1_0.2_0.5/darwin.json} (71%) rename tests/darwin/data/nifti/multi_segment/{ => coronal_LAS_pixdim_0.1_0.2_0.5}/ground_truth.nii.gz (100%) create mode 100644 tests/darwin/data/nifti/multi_segment/sagittal_LPI_pixdim_0.1_0.2_0.5/darwin.json create mode 100644 tests/darwin/data/nifti/multi_segment/sagittal_LPI_pixdim_0.1_0.2_0.5/ground_truth.nii.gz diff --git a/tests/darwin/data/nifti/multi_segment/axial_RPI_pixdim_1.0_1.0_1.0/darwin.json b/tests/darwin/data/nifti/multi_segment/axial_RPI_pixdim_1.0_1.0_1.0/darwin.json new file mode 100644 index 000000000..7c64e0c0b --- /dev/null +++ b/tests/darwin/data/nifti/multi_segment/axial_RPI_pixdim_1.0_1.0_1.0/darwin.json @@ -0,0 +1,259 @@ +{ + "version": "2.0", + "schema_ref": "https://darwin-public.s3.eu-west-1.amazonaws.com/darwin_json/2.0/schema.json", + "item": { + "name": "axial_RPI_pixdim_1.0_1.0_1.0.dcm", + "path": "/", + "source_info": { + "item_id": "0197ee1d-591e-a61b-82e2-e6f1e5c30cf2", + "dataset": { + "name": "dicom_test_data_new", + "slug": "dicom_test_data_new", + "dataset_management_url": "https://darwin.v7labs.com/datasets/1856922/dataset-management" + }, + "team": { + "name": "V7 John", + "slug": "v7-john" + }, + "workview_url": "https://darwin.v7labs.com/workview?dataset=1856922&item=0197ee1d-591e-a61b-82e2-e6f1e5c30cf2" + }, + "slots": [ + { + "type": "dicom", + "slot_name": "0", + "width": 128, + "height": 128, + "fps": null, + "thumbnail_url": "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/thumbnail?token=590de404-3490-4dde-90f9-d13136b0d14f", + "source_files": [ + { + "file_name": "axial_RPI_pixdim_1.0_1.0_1.0.dcm", + "url": "https://darwin.v7labs.com/api/v2/teams/v7-john/uploads/d4f4e7cd-e8a8-407f-9ff3-0a1f3298c84c?token=590de404-3490-4dde-90f9-d13136b0d14f" + } + ], + "frame_count": 16, + "frame_urls": [ + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/0?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/1?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/2?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/3?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/4?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/5?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/6?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/7?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/8?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/9?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/10?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/11?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/12?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/13?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/14?token=590de404-3490-4dde-90f9-d13136b0d14f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/243d7c36-d767-4e3c-adb0-44324ebd14fe/sections/15?token=590de404-3490-4dde-90f9-d13136b0d14f" + ], + "metadata": { + "handler": "MONAI", + "shape": [ + 1, + 128, + 128, + 16 + ], + "SeriesInstanceUID": "1.2.826.0.1.3680043.8.498.37180825650614764423282910493086149224", + "affine": "[[-1.0, 0.0, 0.0, 127.0], [0.0, -1.0, 0.0, 0.0], [0.0, 0.0, -1.0, 15.0], [0.0, 0.0, 0.0, 1.0]]", + "colorspace": "RG16", + "original_affine": [ + [ + "1.0", + "0.0", + "0.0", + "0.0" + ], + [ + "0.0", + "-1.0", + "0.0", + "0.0" + ], + [ + "0.0", + "0.0", + "1.0", + "0.0" + ], + [ + "0.0", + "0.0", + "0.0", + "1.0" + ] + ], + "pixdim": "(1.0, 1.0, 1.0)", + "plane_map": { + "0": "AXIAL" + }, + "primary_plane": "AXIAL" + } + } + ] + }, + "annotations": [ + { + "frames": { + "15": { + "keyframe": true, + "mask": {} + } + }, + "global_sub_types": {}, + "id": "02c693fa-97f5-4a3c-9c45-e1d9eebb0731", + "interpolate_algorithm": "linear-1.1", + "name": "mask1", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 15, + 16 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "15": { + "keyframe": true, + "mask": {} + } + }, + "global_sub_types": {}, + "id": "d212f8a6-8e09-4901-a44b-77745626edc9", + "interpolate_algorithm": "linear-1.1", + "name": "mask2", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 15, + 16 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "15": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 2104, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 1, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 96, + 2, + 32, + 0, + 11816 + ], + "mask_annotation_ids_mapping": { + "02c693fa-97f5-4a3c-9c45-e1d9eebb0731": 1, + "d212f8a6-8e09-4901-a44b-77745626edc9": 2 + }, + "total_pixels": 16384 + } + } + }, + "id": "a15c3b3e-89af-4733-b6c7-10f01e2c0b57", + "name": "__raster_layer__", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 0, + 16 + ] + ], + "slot_names": [ + "0" + ] + } + ], + "properties": [] +} \ No newline at end of file diff --git a/tests/darwin/data/nifti/multi_segment/axial_RPI_pixdim_1.0_1.0_1.0/ground_truth.nii.gz b/tests/darwin/data/nifti/multi_segment/axial_RPI_pixdim_1.0_1.0_1.0/ground_truth.nii.gz new file mode 100644 index 0000000000000000000000000000000000000000..be0895e8903618749dfe854a37224cb063fcdddc GIT binary patch literal 653 zcmb2|=3oE=?ziX9avm~}Xn459s-e1~h>3sQLms&~3d%bj!;Swg?ClCzA?G#kxpKfI zhfi_I5f9|b6rWnQSe#p3`|q-6Zrt3^?mj8i|>{13wQqa$A9VLY4dljS!wfd zuig9EMc0>Z{(o!tx4E@3`E@nXKr0jU9-WwJ_4n7;*Vos_@Bg>+Yq)ayt1n Date: Thu, 10 Jul 2025 16:10:48 +0200 Subject: [PATCH 3/5] Add multi-label nifti import test Add test ensuring correct import of multi-label nifti file, by asserting no error is produced in the process, and that the number of unique values in the produced array is coherent with the nifti file --- .../darwin/importer/formats/import_nifti_test.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/darwin/importer/formats/import_nifti_test.py b/tests/darwin/importer/formats/import_nifti_test.py index 11632ec58..44bdbb4dc 100644 --- a/tests/darwin/importer/formats/import_nifti_test.py +++ b/tests/darwin/importer/formats/import_nifti_test.py @@ -610,3 +610,18 @@ def test_parse_path_nifti_without_legacy_scaling(): parsed_annotation, decimal_places=4 ) assert expected_annotation_rounded == parsed_annotation_rounded + + +def test_image_annotation_nifti_multi_label(): + root_dir = Path("tests/darwin/data/nifti/multi_segment") + for subdir in root_dir.iterdir(): + if not subdir.is_dir(): + continue + print(subdir) + + nifti_file_path = subdir.joinpath("ground_truth.nii.gz") + nifti_image = nib.load(nifti_file_path) + data_array = process_nifti(nifti_image) + + # Assert correct conversion with presence of 3 values (background and 2 labels) + assert data_array is not None and len(np.unique(data_array)) == 3 From ef78db4b1f28aa46eba7d01ed57242ee103aea33 Mon Sep 17 00:00:00 2001 From: Valentin Vikhorev Date: Thu, 24 Jul 2025 16:29:13 +0200 Subject: [PATCH 4/5] black formatting --- tests/darwin/exporter/formats/export_darwin_test.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/darwin/exporter/formats/export_darwin_test.py b/tests/darwin/exporter/formats/export_darwin_test.py index 395606a19..b3e2f2e0a 100644 --- a/tests/darwin/exporter/formats/export_darwin_test.py +++ b/tests/darwin/exporter/formats/export_darwin_test.py @@ -154,15 +154,13 @@ def test_multi_segment_nifti_export(): if not subdir.is_dir(): continue print(subdir) - + ground_truth_path = subdir.joinpath("ground_truth.nii.gz") darwin_json_path = subdir.joinpath("darwin.json") target_output_directory = subdir.joinpath("output") volume_name = subdir.parts[-1] target_output_path = target_output_directory.joinpath( - "darwin", - "0", - f"{volume_name[:-2]}_Segments_m.nii.gz" + "darwin", "0", f"{volume_name[:-2]}_Segments_m.nii.gz" ) try: From c734056d89497cea13171ff13ca4be4418ece02b Mon Sep 17 00:00:00 2001 From: Valentin Vikhorev Date: Thu, 24 Jul 2025 16:58:22 +0200 Subject: [PATCH 5/5] Drop print statements --- tests/darwin/exporter/formats/export_darwin_test.py | 1 - tests/darwin/importer/formats/import_nifti_test.py | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/darwin/exporter/formats/export_darwin_test.py b/tests/darwin/exporter/formats/export_darwin_test.py index b3e2f2e0a..1c61ee8cd 100644 --- a/tests/darwin/exporter/formats/export_darwin_test.py +++ b/tests/darwin/exporter/formats/export_darwin_test.py @@ -153,7 +153,6 @@ def test_multi_segment_nifti_export(): for subdir in root_dir.iterdir(): if not subdir.is_dir(): continue - print(subdir) ground_truth_path = subdir.joinpath("ground_truth.nii.gz") darwin_json_path = subdir.joinpath("darwin.json") diff --git a/tests/darwin/importer/formats/import_nifti_test.py b/tests/darwin/importer/formats/import_nifti_test.py index 44bdbb4dc..41dc0cb33 100644 --- a/tests/darwin/importer/formats/import_nifti_test.py +++ b/tests/darwin/importer/formats/import_nifti_test.py @@ -617,7 +617,6 @@ def test_image_annotation_nifti_multi_label(): for subdir in root_dir.iterdir(): if not subdir.is_dir(): continue - print(subdir) nifti_file_path = subdir.joinpath("ground_truth.nii.gz") nifti_image = nib.load(nifti_file_path)