diff --git a/darwin/cli_functions.py b/darwin/cli_functions.py index 95b1daf3f..5f04c2ab8 100644 --- a/darwin/cli_functions.py +++ b/darwin/cli_functions.py @@ -1185,7 +1185,9 @@ def dataset_convert( output_dir = Path(output_dir) output_dir.mkdir(parents=True, exist_ok=True) - export_annotations(parser, [annotations_path], output_dir) + export_annotations( + parser, [annotations_path], output_dir, split_sequences=(format != "nifti") + ) except ExporterNotFoundError: _error( f"Unsupported export format: {format}, currently supported: {export_formats}" diff --git a/darwin/exporter/formats/nifti.py b/darwin/exporter/formats/nifti.py index 396f49743..4b9b89ca1 100644 --- a/darwin/exporter/formats/nifti.py +++ b/darwin/exporter/formats/nifti.py @@ -93,7 +93,7 @@ def export( try: medical_metadata = slot.metadata legacy = not medical_metadata.get("handler") == "MONAI" # type: ignore - plane_map = medical_metadata.get("plane_map", {slot_name: "AXIAL"}) + plane_map = medical_metadata.get("plane_map") or {slot_name: "AXIAL"} primary_plane = medical_metadata.get( "primary_plane", plane_map.get(slot_name, "AXIAL") ) diff --git a/e2e_tests/cli/test_convert.py b/e2e_tests/cli/test_convert.py index 863b6c0cc..2cfe32e5b 100644 --- a/e2e_tests/cli/test_convert.py +++ b/e2e_tests/cli/test_convert.py @@ -6,7 +6,7 @@ import pytest import xml.etree.ElementTree as ET -from e2e_tests.helpers import assert_cli, run_cli_command +from e2e_tests.helpers import assert_cli, compare_directories, run_cli_command class TestExportCli: @@ -17,37 +17,6 @@ class TestExportCli: def config(self) -> None: assert self.data_path.exists(), "Data path does not exist, tests cannot run" - def compare_directories(self, path: Path, expected_path: Path) -> None: - """ - Compare two directories recursively - """ - assert path.exists() and expected_path.exists() - assert path.is_dir() and expected_path.is_dir() - - for file in path.iterdir(): - if file.is_dir(): - # Recursively compare directories - self.compare_directories(file, expected_path / file.name) - else: - if file.name.startswith("."): - # Ignore hidden files - continue - - # Compare files - with file.open("rb") as f: - content = f.read() - - with Path(expected_path / file.name).open("rb") as f: - expected_content = f.read() - - if content != expected_content: - print(f"Expected file: {expected_path / file.name}") - print(f"Expected Content: \n{expected_content}") - print("---------------------") - print(f"Actual file: {file}") - print(f"Actual Content: \n{content}") - assert False, f"File {file} does not match expected file" - @pytest.mark.parametrize( "format, input_path, expectation_path", [ @@ -70,6 +39,11 @@ def compare_directories(self, path: Path, expected_path: Path) -> None: data_path / "nifti-multislot/from", data_path / "nifti-multislot/to", ), + ( + "nifti", + data_path / "nifti-multi-segment/from", + data_path / "nifti-multi-segment/to", + ), ( "instance_mask", data_path / "instance_mask/from", @@ -112,7 +86,7 @@ def test_darwin_convert( ) self.patch_format(format, tmp_path) assert_cli(result, 0) - self.compare_directories(expectation_path, tmp_path) + compare_directories(expectation_path, tmp_path) def patch_format(self, format: str, path: Path) -> None: """ diff --git a/e2e_tests/cli/test_full_cycle.py b/e2e_tests/cli/test_full_cycle.py index 09cad16c9..089a1f99a 100644 --- a/e2e_tests/cli/test_full_cycle.py +++ b/e2e_tests/cli/test_full_cycle.py @@ -1,8 +1,14 @@ import os import shutil +import time from pathlib import Path -from e2e_tests.helpers import assert_cli, run_cli_command, export_release +from e2e_tests.helpers import ( + SERVER_WAIT_TIME, + assert_cli, + run_cli_command, + export_release, +) from e2e_tests.objects import E2EDataset, ConfigValues from e2e_tests.cli.test_import import compare_annotations_export from e2e_tests.cli.test_push import extract_and_push @@ -125,6 +131,104 @@ def test_full_cycle_images( ) +def test_full_cycle_nifti( + local_dataset: E2EDataset, + config_values: ConfigValues, +): + """ + This test performs the following steps: + - 1: Registers a set of DICOM files from external storage to a dataset + - 2: Imports mask annotations + - 3: Creates and pulls a release of the dataset + - 4: Deletes all items from the dataset + - 5: Pushes and imports the pulled files & annotations to the dataset + - 6: Deletes locally pulled copies of the dataset files + - 7: Creates and pulls a new release of the dataset + - 8: Assert that the pulled data is as expected + + It is designed to catch errors that may arise from changes to exported Darwin JSON + """ + item_type = "multi_segment_nifti" + annotation_format = "darwin" + first_release_name = "first_release" + second_release_name = "second_release" + pull_dir = Path( + f"{Path.home()}/.darwin/datasets/{config_values.team_slug}/{local_dataset.slug}" + ) + annotations_import_dir = ( + Path(__file__).parents[1] / "data" / "import" / "nifti_multi_segment" + ) + source_files = [ + "axial_RPI_pixdim_1.0_1.0_1.0", + "coronal_LAS_pixdim_0.1_0.2_0.5", + "sagittal_LPI_pixdim_0.1_0.2_0.5", + ] + + expected_filepaths = [f"{pull_dir}/images/{file}.dcm" for file in source_files] + + # Populate the dataset with items and annotations + local_dataset.register_read_only_items(config_values, item_type) + time.sleep(SERVER_WAIT_TIME) + + result = run_cli_command( + f"darwin dataset import {local_dataset.name} {annotation_format} {annotations_import_dir}" + ) + assert_cli(result, 0) + + # Pull a first release of the dataset + original_release = export_release( + annotation_format, local_dataset, config_values, release_name=first_release_name + ) + result = run_cli_command( + f"darwin dataset pull {local_dataset.name}:{original_release.name}" + ) + assert_cli(result, 0) + + # Delete all items in the dataset + local_dataset.delete_items(config_values) + + # Push and import the pulled files and annotations to the dataset + result = run_cli_command( + f"darwin dataset push {local_dataset.name} {pull_dir}/images --preserve-folders" + ) + assert_cli(result, 0) + # we are uploading 3 DICOM images which need to be extracted asynchronously + time.sleep(SERVER_WAIT_TIME * 3) + + result = run_cli_command( + f"darwin dataset import {local_dataset.name} {annotation_format} {pull_dir}/releases/{first_release_name}/annotations" + ) + assert_cli(result, 0) + + # Delete local copies of the dataset files for the dataset + shutil.rmtree(f"{pull_dir}/images") + + # Pull a second release of the dataset + new_release = export_release( + annotation_format, + local_dataset, + config_values, + release_name=second_release_name, + ) + result = run_cli_command( + f"darwin dataset pull {local_dataset.name}:{new_release.name}" + ) + assert_cli(result, 0) + + # Check that all expected files have been downloaded + all_filepaths = list(pull_dir.rglob("*")) + for expected_file in expected_filepaths: + assert Path(expected_file) in all_filepaths + + # Check that all downloaded annotations are as expected + compare_annotations_export( + Path(f"{pull_dir}/releases/{first_release_name}/annotations"), + Path(f"{pull_dir}/releases/{second_release_name}/annotations"), + item_type, + unzip=False, + ) + + def test_full_cycle_video( local_dataset: E2EDataset, config_values: ConfigValues, diff --git a/e2e_tests/data/convert/nifti-multi-segment/from/axial_RPI_pixdim_1.0_1.0_1.0.json b/e2e_tests/data/convert/nifti-multi-segment/from/axial_RPI_pixdim_1.0_1.0_1.0.json new file mode 100644 index 000000000..7c64e0c0b --- /dev/null +++ b/e2e_tests/data/convert/nifti-multi-segment/from/axial_RPI_pixdim_1.0_1.0_1.0.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/e2e_tests/data/convert/nifti-multi-segment/from/coronal_LAS_pixdim_0.1_0.2_0.5.json b/e2e_tests/data/convert/nifti-multi-segment/from/coronal_LAS_pixdim_0.1_0.2_0.5.json new file mode 100644 index 000000000..e42e9e8d3 --- /dev/null +++ b/e2e_tests/data/convert/nifti-multi-segment/from/coronal_LAS_pixdim_0.1_0.2_0.5.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": "coronal_LAS_pixdim_0.1_0.2_0.5.dcm", + "path": "/", + "source_info": { + "item_id": "0197ee1d-591e-7d19-bb01-65d27fb0bcdd", + "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-7d19-bb01-65d27fb0bcdd" + }, + "slots": [ + { + "type": "dicom", + "slot_name": "0", + "width": 128, + "height": 128, + "fps": null, + "thumbnail_url": "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/thumbnail?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "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/bbf2147d-e328-4a93-a624-90f9c474a071?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f" + } + ], + "frame_count": 16, + "frame_urls": [ + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/0?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/1?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/2?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/3?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/4?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/5?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/6?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/7?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/8?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/9?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/10?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/11?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/12?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/13?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/14?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/15?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f" + ], + "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": {} + } + }, + "global_sub_types": {}, + "id": "0a8b3cfb-d6ff-427a-8b3e-a31410f10331", + "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": "0e845870-995b-4cb7-982e-741c1e54109e", + "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": { + "0a8b3cfb-d6ff-427a-8b3e-a31410f10331": 1, + "0e845870-995b-4cb7-982e-741c1e54109e": 2 + }, + "total_pixels": 16384 + } + } + }, + "id": "1af4d613-c4c4-41cd-a53a-2e8905f90b95", + "name": "__raster_layer__", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 0, + 16 + ] + ], + "slot_names": [ + "0" + ] + } + ], + "properties": [] +} \ No newline at end of file diff --git a/e2e_tests/data/convert/nifti-multi-segment/from/sagittal_LPI_pixdim_0.1_0.2_0.5.json b/e2e_tests/data/convert/nifti-multi-segment/from/sagittal_LPI_pixdim_0.1_0.2_0.5.json new file mode 100644 index 000000000..b757dee96 --- /dev/null +++ b/e2e_tests/data/convert/nifti-multi-segment/from/sagittal_LPI_pixdim_0.1_0.2_0.5.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": "sagittal_LPI_pixdim_0.1_0.2_0.5.dcm", + "path": "/", + "source_info": { + "item_id": "0197ee1d-5920-c9f8-017f-987b38e38f5f", + "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-5920-c9f8-017f-987b38e38f5f" + }, + "slots": [ + { + "type": "dicom", + "slot_name": "0", + "width": 128, + "height": 128, + "fps": null, + "thumbnail_url": "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/thumbnail?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "source_files": [ + { + "file_name": "sagittal_LPI_pixdim_0.1_0.2_0.5.dcm", + "url": "https://darwin.v7labs.com/api/v2/teams/v7-john/uploads/54adbf48-0129-44ea-978c-313aeb35627b?token=4ca42b77-ad16-42ce-82e1-e9c762085012" + } + ], + "frame_count": 16, + "frame_urls": [ + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/0?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/1?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/2?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/3?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/4?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/5?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/6?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/7?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/8?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/9?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/10?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/11?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/12?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/13?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/14?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/15?token=4ca42b77-ad16-42ce-82e1-e9c762085012" + ], + "metadata": { + "handler": "MONAI", + "shape": [ + 1, + 16, + 128, + 128 + ], + "SeriesInstanceUID": "1.2.826.0.1.3680043.8.498.16951377570626244557338024182864652772", + "affine": "[[-1.0, 0.0, 0.0, 15.0], [0.0, -0.1, 0.0, 0.0], [0.0, 0.0, -0.25, 0.0], [0.0, 0.0, 0.0, 1.0]]", + "colorspace": "RG16", + "original_affine": [ + [ + "0.0", + "0.0", + "1.0", + "0.0" + ], + [ + "-0.1", + "0.0", + "0.0", + "0.0" + ], + [ + "0.0", + "-0.25", + "0.0", + "0.0" + ], + [ + "0.0", + "0.0", + "0.0", + "1.0" + ] + ], + "pixdim": "(1.0, 0.1, 0.25)", + "plane_map": { + "0": "SAGITTAL" + }, + "primary_plane": "SAGITTAL" + } + } + ] + }, + "annotations": [ + { + "frames": { + "15": { + "keyframe": true, + "mask": {} + } + }, + "global_sub_types": {}, + "id": "2d12dc2e-5cc5-4bb7-89ce-5f010fc0f184", + "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": "97117be2-ae2e-4431-bcd3-5dd724121489", + "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, + 2088, + 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, + 11832 + ], + "mask_annotation_ids_mapping": { + "2d12dc2e-5cc5-4bb7-89ce-5f010fc0f184": 1, + "97117be2-ae2e-4431-bcd3-5dd724121489": 2 + }, + "total_pixels": 16384 + } + } + }, + "id": "c41d3017-793b-41f8-b9be-fa95d2e505ef", + "name": "__raster_layer__", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 0, + 16 + ] + ], + "slot_names": [ + "0" + ] + } + ], + "properties": [] +} \ No newline at end of file diff --git a/e2e_tests/data/convert/nifti-multi-segment/to/axial_RPI_pixdim_1.0_1.0_1.0/0/axial_RPI_pixdim_1.0_1.0_1_Segments_m.nii.gz b/e2e_tests/data/convert/nifti-multi-segment/to/axial_RPI_pixdim_1.0_1.0_1.0/0/axial_RPI_pixdim_1.0_1.0_1_Segments_m.nii.gz new file mode 100644 index 000000000..3feaf827d Binary files /dev/null and b/e2e_tests/data/convert/nifti-multi-segment/to/axial_RPI_pixdim_1.0_1.0_1.0/0/axial_RPI_pixdim_1.0_1.0_1_Segments_m.nii.gz differ diff --git a/e2e_tests/data/convert/nifti-multi-segment/to/axial_RPI_pixdim_1.0_1.0_1.0/0/axial_RPI_pixdim_1.0_1.0_1_mask1_m.nii.gz b/e2e_tests/data/convert/nifti-multi-segment/to/axial_RPI_pixdim_1.0_1.0_1.0/0/axial_RPI_pixdim_1.0_1.0_1_mask1_m.nii.gz new file mode 100644 index 000000000..8a3ec61ae Binary files /dev/null and b/e2e_tests/data/convert/nifti-multi-segment/to/axial_RPI_pixdim_1.0_1.0_1.0/0/axial_RPI_pixdim_1.0_1.0_1_mask1_m.nii.gz differ diff --git a/e2e_tests/data/convert/nifti-multi-segment/to/axial_RPI_pixdim_1.0_1.0_1.0/0/axial_RPI_pixdim_1.0_1.0_1_mask2_m.nii.gz b/e2e_tests/data/convert/nifti-multi-segment/to/axial_RPI_pixdim_1.0_1.0_1.0/0/axial_RPI_pixdim_1.0_1.0_1_mask2_m.nii.gz new file mode 100644 index 000000000..6952c3979 Binary files /dev/null and b/e2e_tests/data/convert/nifti-multi-segment/to/axial_RPI_pixdim_1.0_1.0_1.0/0/axial_RPI_pixdim_1.0_1.0_1_mask2_m.nii.gz differ diff --git a/e2e_tests/data/convert/nifti-multi-segment/to/coronal_LAS_pixdim_0.1_0.2_0.5/0/coronal_LAS_pixdim_0.1_0.2_0_Segments_m.nii.gz b/e2e_tests/data/convert/nifti-multi-segment/to/coronal_LAS_pixdim_0.1_0.2_0.5/0/coronal_LAS_pixdim_0.1_0.2_0_Segments_m.nii.gz new file mode 100644 index 000000000..cf9b81479 Binary files /dev/null and b/e2e_tests/data/convert/nifti-multi-segment/to/coronal_LAS_pixdim_0.1_0.2_0.5/0/coronal_LAS_pixdim_0.1_0.2_0_Segments_m.nii.gz differ diff --git a/e2e_tests/data/convert/nifti-multi-segment/to/coronal_LAS_pixdim_0.1_0.2_0.5/0/coronal_LAS_pixdim_0.1_0.2_0_mask1_m.nii.gz b/e2e_tests/data/convert/nifti-multi-segment/to/coronal_LAS_pixdim_0.1_0.2_0.5/0/coronal_LAS_pixdim_0.1_0.2_0_mask1_m.nii.gz new file mode 100644 index 000000000..062d84533 Binary files /dev/null and b/e2e_tests/data/convert/nifti-multi-segment/to/coronal_LAS_pixdim_0.1_0.2_0.5/0/coronal_LAS_pixdim_0.1_0.2_0_mask1_m.nii.gz differ diff --git a/e2e_tests/data/convert/nifti-multi-segment/to/coronal_LAS_pixdim_0.1_0.2_0.5/0/coronal_LAS_pixdim_0.1_0.2_0_mask2_m.nii.gz b/e2e_tests/data/convert/nifti-multi-segment/to/coronal_LAS_pixdim_0.1_0.2_0.5/0/coronal_LAS_pixdim_0.1_0.2_0_mask2_m.nii.gz new file mode 100644 index 000000000..69127b8eb Binary files /dev/null and b/e2e_tests/data/convert/nifti-multi-segment/to/coronal_LAS_pixdim_0.1_0.2_0.5/0/coronal_LAS_pixdim_0.1_0.2_0_mask2_m.nii.gz differ diff --git a/e2e_tests/data/convert/nifti-multi-segment/to/sagittal_LPI_pixdim_0.1_0.2_0.5/0/sagittal_LPI_pixdim_0.1_0.2_0_Segments_m.nii.gz b/e2e_tests/data/convert/nifti-multi-segment/to/sagittal_LPI_pixdim_0.1_0.2_0.5/0/sagittal_LPI_pixdim_0.1_0.2_0_Segments_m.nii.gz new file mode 100644 index 000000000..72dc750d4 Binary files /dev/null and b/e2e_tests/data/convert/nifti-multi-segment/to/sagittal_LPI_pixdim_0.1_0.2_0.5/0/sagittal_LPI_pixdim_0.1_0.2_0_Segments_m.nii.gz differ diff --git a/e2e_tests/data/convert/nifti-multi-segment/to/sagittal_LPI_pixdim_0.1_0.2_0.5/0/sagittal_LPI_pixdim_0.1_0.2_0_mask1_m.nii.gz b/e2e_tests/data/convert/nifti-multi-segment/to/sagittal_LPI_pixdim_0.1_0.2_0.5/0/sagittal_LPI_pixdim_0.1_0.2_0_mask1_m.nii.gz new file mode 100644 index 000000000..c0dda9437 Binary files /dev/null and b/e2e_tests/data/convert/nifti-multi-segment/to/sagittal_LPI_pixdim_0.1_0.2_0.5/0/sagittal_LPI_pixdim_0.1_0.2_0_mask1_m.nii.gz differ diff --git a/e2e_tests/data/convert/nifti-multi-segment/to/sagittal_LPI_pixdim_0.1_0.2_0.5/0/sagittal_LPI_pixdim_0.1_0.2_0_mask2_m.nii.gz b/e2e_tests/data/convert/nifti-multi-segment/to/sagittal_LPI_pixdim_0.1_0.2_0.5/0/sagittal_LPI_pixdim_0.1_0.2_0_mask2_m.nii.gz new file mode 100644 index 000000000..c9c482017 Binary files /dev/null and b/e2e_tests/data/convert/nifti-multi-segment/to/sagittal_LPI_pixdim_0.1_0.2_0.5/0/sagittal_LPI_pixdim_0.1_0.2_0_mask2_m.nii.gz differ diff --git a/e2e_tests/data/import/nifti_multi_segment/axial_RPI_pixdim_1.0_1.0_1.0.json b/e2e_tests/data/import/nifti_multi_segment/axial_RPI_pixdim_1.0_1.0_1.0.json new file mode 100644 index 000000000..7c64e0c0b --- /dev/null +++ b/e2e_tests/data/import/nifti_multi_segment/axial_RPI_pixdim_1.0_1.0_1.0.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/e2e_tests/data/import/nifti_multi_segment/coronal_LAS_pixdim_0.1_0.2_0.5.json b/e2e_tests/data/import/nifti_multi_segment/coronal_LAS_pixdim_0.1_0.2_0.5.json new file mode 100644 index 000000000..e42e9e8d3 --- /dev/null +++ b/e2e_tests/data/import/nifti_multi_segment/coronal_LAS_pixdim_0.1_0.2_0.5.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": "coronal_LAS_pixdim_0.1_0.2_0.5.dcm", + "path": "/", + "source_info": { + "item_id": "0197ee1d-591e-7d19-bb01-65d27fb0bcdd", + "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-7d19-bb01-65d27fb0bcdd" + }, + "slots": [ + { + "type": "dicom", + "slot_name": "0", + "width": 128, + "height": 128, + "fps": null, + "thumbnail_url": "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/thumbnail?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "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/bbf2147d-e328-4a93-a624-90f9c474a071?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f" + } + ], + "frame_count": 16, + "frame_urls": [ + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/0?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/1?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/2?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/3?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/4?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/5?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/6?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/7?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/8?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/9?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/10?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/11?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/12?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/13?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/14?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/b33547f6-c281-4766-97cf-1623f00353f5/sections/15?token=971b08d7-a0d7-4d95-a22f-f1f7429b207f" + ], + "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": {} + } + }, + "global_sub_types": {}, + "id": "0a8b3cfb-d6ff-427a-8b3e-a31410f10331", + "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": "0e845870-995b-4cb7-982e-741c1e54109e", + "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": { + "0a8b3cfb-d6ff-427a-8b3e-a31410f10331": 1, + "0e845870-995b-4cb7-982e-741c1e54109e": 2 + }, + "total_pixels": 16384 + } + } + }, + "id": "1af4d613-c4c4-41cd-a53a-2e8905f90b95", + "name": "__raster_layer__", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 0, + 16 + ] + ], + "slot_names": [ + "0" + ] + } + ], + "properties": [] +} \ No newline at end of file diff --git a/e2e_tests/data/import/nifti_multi_segment/sagittal_LPI_pixdim_0.1_0.2_0.5.json b/e2e_tests/data/import/nifti_multi_segment/sagittal_LPI_pixdim_0.1_0.2_0.5.json new file mode 100644 index 000000000..b757dee96 --- /dev/null +++ b/e2e_tests/data/import/nifti_multi_segment/sagittal_LPI_pixdim_0.1_0.2_0.5.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": "sagittal_LPI_pixdim_0.1_0.2_0.5.dcm", + "path": "/", + "source_info": { + "item_id": "0197ee1d-5920-c9f8-017f-987b38e38f5f", + "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-5920-c9f8-017f-987b38e38f5f" + }, + "slots": [ + { + "type": "dicom", + "slot_name": "0", + "width": 128, + "height": 128, + "fps": null, + "thumbnail_url": "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/thumbnail?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "source_files": [ + { + "file_name": "sagittal_LPI_pixdim_0.1_0.2_0.5.dcm", + "url": "https://darwin.v7labs.com/api/v2/teams/v7-john/uploads/54adbf48-0129-44ea-978c-313aeb35627b?token=4ca42b77-ad16-42ce-82e1-e9c762085012" + } + ], + "frame_count": 16, + "frame_urls": [ + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/0?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/1?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/2?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/3?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/4?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/5?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/6?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/7?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/8?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/9?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/10?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/11?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/12?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/13?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/14?token=4ca42b77-ad16-42ce-82e1-e9c762085012", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/c160652a-9d74-4a27-91f5-158bd68eab2c/sections/15?token=4ca42b77-ad16-42ce-82e1-e9c762085012" + ], + "metadata": { + "handler": "MONAI", + "shape": [ + 1, + 16, + 128, + 128 + ], + "SeriesInstanceUID": "1.2.826.0.1.3680043.8.498.16951377570626244557338024182864652772", + "affine": "[[-1.0, 0.0, 0.0, 15.0], [0.0, -0.1, 0.0, 0.0], [0.0, 0.0, -0.25, 0.0], [0.0, 0.0, 0.0, 1.0]]", + "colorspace": "RG16", + "original_affine": [ + [ + "0.0", + "0.0", + "1.0", + "0.0" + ], + [ + "-0.1", + "0.0", + "0.0", + "0.0" + ], + [ + "0.0", + "-0.25", + "0.0", + "0.0" + ], + [ + "0.0", + "0.0", + "0.0", + "1.0" + ] + ], + "pixdim": "(1.0, 0.1, 0.25)", + "plane_map": { + "0": "SAGITTAL" + }, + "primary_plane": "SAGITTAL" + } + } + ] + }, + "annotations": [ + { + "frames": { + "15": { + "keyframe": true, + "mask": {} + } + }, + "global_sub_types": {}, + "id": "2d12dc2e-5cc5-4bb7-89ce-5f010fc0f184", + "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": "97117be2-ae2e-4431-bcd3-5dd724121489", + "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, + 2088, + 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, + 11832 + ], + "mask_annotation_ids_mapping": { + "2d12dc2e-5cc5-4bb7-89ce-5f010fc0f184": 1, + "97117be2-ae2e-4431-bcd3-5dd724121489": 2 + }, + "total_pixels": 16384 + } + } + }, + "id": "c41d3017-793b-41f8-b9be-fa95d2e505ef", + "name": "__raster_layer__", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 0, + 16 + ] + ], + "slot_names": [ + "0" + ] + } + ], + "properties": [] +} \ No newline at end of file diff --git a/e2e_tests/data/push/multi_segment_nifti.zip b/e2e_tests/data/push/multi_segment_nifti.zip new file mode 100644 index 000000000..5ec5f3964 Binary files /dev/null and b/e2e_tests/data/push/multi_segment_nifti.zip differ diff --git a/e2e_tests/helpers.py b/e2e_tests/helpers.py index 4346339a7..493e957b7 100644 --- a/e2e_tests/helpers.py +++ b/e2e_tests/helpers.py @@ -1,3 +1,4 @@ +from pathlib import Path from subprocess import run from time import sleep from typing import Optional, Union, Sequence @@ -170,7 +171,7 @@ def wait_until_items_processed( Waits until all items in a dataset have finished processing before attempting to upload annotations. Raises a `TimeoutError` if the process takes longer than the specified timeout. """ - sleep_duration = 10 + sleep_duration = SERVER_WAIT_TIME api_key = config_values.api_key team_slug = config_values.team_slug base_url = config_values.server @@ -295,3 +296,35 @@ def exclude_annotations_of_type( for annotation in annotations if annotation.annotation_class.annotation_type != annotation_type ] + + +def compare_directories(path: Path, expected_path: Path) -> None: + """ + Compare two directories recursively + """ + assert path.exists() and expected_path.exists() + assert path.is_dir() and expected_path.is_dir() + + for file in path.iterdir(): + if file.is_dir(): + # Recursively compare directories + compare_directories(file, expected_path / file.name) + else: + if file.name.startswith("."): + # Ignore hidden files + continue + + # Compare files + with file.open("rb") as f: + content = f.read() + + with Path(expected_path / file.name).open("rb") as f: + expected_content = f.read() + + if content != expected_content: + print(f"Expected file: {expected_path / file.name}") + print(f"Expected Content: \n{expected_content}") + print("---------------------") + print(f"Actual file: {file}") + print(f"Actual Content: \n{content}") + assert False, f"File {file} does not match expected file" diff --git a/e2e_tests/objects.py b/e2e_tests/objects.py index ab405af60..6d1877473 100644 --- a/e2e_tests/objects.py +++ b/e2e_tests/objects.py @@ -467,6 +467,125 @@ def get_read_only_registration_payload( "name": "multi_slotted_dicom_item", }, ], + "multi_segment_nifti": [ + { + "path": path or "/", + "name": "axial_RPI_pixdim_1.0_1.0_1.0.dcm", + "slots": [ + { + "slot_name": "0", + "type": "dicom", + "storage_key": "darwin-py/dicoms/axial_RPI_pixdim_1.0_1.0_1.0.dcm", + "storage_thumbnail_key": "data/darwin-py/dicoms/axial_RPI_pixdim_1.0_1.0_1.0.dcm/uploads/a176ce30-4a3e-48db-a33a-01af311726ee/thumbnails/000000000.jpg", + "file_name": "axial_RPI_pixdim_1.0_1.0_1.0.dcm", + "sections": [ + { + "section_index": i + 1, + "height": 128, + "width": 128, + "storage_hq_key": f"data/darwin-py/dicoms/axial_RPI_pixdim_1.0_1.0_1.0.dcm/uploads/a176ce30-4a3e-48db-a33a-01af311726ee/hq_sections/{i:09}.png", + "storage_lq_key": f"data/darwin-py/dicoms/axial_RPI_pixdim_1.0_1.0_1.0.dcm/uploads/a176ce30-4a3e-48db-a33a-01af311726ee/lq_sections/{i:09}.png", + } + for i in range(16) + ], + "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", + }, + }, + ], + }, + { + "path": path or "/", + "name": "coronal_LAS_pixdim_0.1_0.2_0.5.dcm", + "slots": [ + { + "slot_name": "0", + "type": "dicom", + "storage_key": "darwin-py/dicoms/coronal_LAS_pixdim_0.1_0.2_0.5.dcm", + "storage_thumbnail_key": "data/darwin-py/dicoms/coronal_LAS_pixdim_0.1_0.2_0.5.dcm/uploads/120c999b-230e-4bdd-a833-93fe6b3a3a30/thumbnails/000000000.jpg", + "file_name": "coronal_LAS_pixdim_0.1_0.2_0.5.dcm", + "sections": [ + { + "section_index": i + 1, + "height": 128, + "width": 128, + "storage_hq_key": f"data/darwin-py/dicoms/coronal_LAS_pixdim_0.1_0.2_0.5.dcm/uploads/120c999b-230e-4bdd-a833-93fe6b3a3a30/hq_sections/{i:09}.png", + "storage_lq_key": f"data/darwin-py/dicoms/coronal_LAS_pixdim_0.1_0.2_0.5.dcm/uploads/120c999b-230e-4bdd-a833-93fe6b3a3a30/lq_sections/{i:09}.png", + } + for i in range(16) + ], + "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", + }, + }, + ], + }, + { + "path": path or "/", + "name": "sagittal_LPI_pixdim_0.1_0.2_0.5.dcm", + "slots": [ + { + "slot_name": "0", + "type": "dicom", + "storage_key": "darwin-py/dicoms/sagittal_LPI_pixdim_0.1_0.2_0.5.dcm", + "storage_thumbnail_key": "data/darwin-py/dicoms/sagittal_LPI_pixdim_0.1_0.2_0.5.dcm/uploads/8d69ef65-db0f-45ab-827e-23faa4871519/thumbnails/000000000.jpg", + "file_name": "sagittal_LPI_pixdim_0.1_0.2_0.5.dcm", + "sections": [ + { + "section_index": i + 1, + "height": 128, + "width": 128, + "storage_hq_key": f"data/darwin-py/dicoms/sagittal_LPI_pixdim_0.1_0.2_0.5.dcm/uploads/8d69ef65-db0f-45ab-827e-23faa4871519/hq_sections/{i:09}.png", + "storage_lq_key": f"data/darwin-py/dicoms/sagittal_LPI_pixdim_0.1_0.2_0.5.dcm/uploads/8d69ef65-db0f-45ab-827e-23faa4871519/lq_sections/{i:09}.png", + } + for i in range(16) + ], + "metadata": { + "handler": "MONAI", + "shape": [1, 16, 128, 128], + "SeriesInstanceUID": "1.2.826.0.1.3680043.8.498.16951377570626244557338024182864652772", + "affine": "[[-1.0, 0.0, 0.0, 15.0], [0.0, -0.1, 0.0, 0.0], [0.0, 0.0, -0.25, 0.0], [0.0, 0.0, 0.0, 1.0]]", + "colorspace": "RG16", + "original_affine": [ + ["0.0", "0.0", "1.0", "0.0"], + ["-0.1", "0.0", "0.0", "0.0"], + ["0.0", "-0.25", "0.0", "0.0"], + ["0.0", "0.0", "0.0", "1.0"], + ], + "pixdim": "(1.0, 0.1, 0.25)", + "plane_map": {"0": "SAGITTAL"}, + "primary_plane": "SAGITTAL", + }, + }, + ], + }, + ], } return { "items": items[item_type], # type: ignore