diff --git a/darwin/exporter/formats/nifti.py b/darwin/exporter/formats/nifti.py index 5faaa47c1..396f49743 100644 --- a/darwin/exporter/formats/nifti.py +++ b/darwin/exporter/formats/nifti.py @@ -9,6 +9,8 @@ from rich.console import Console from rich.theme import Theme +from darwin.utils.utils import get_annotations_in_slot + def _console_theme() -> Theme: return Theme( @@ -76,97 +78,108 @@ def export( sends output volumes, image_id and output_dir to the write_output_volume_to_disk function """ - video_annotations = list(annotation_files) - for video_annotation in video_annotations: - slot_name = video_annotation.slots[0].name - try: - medical_metadata = video_annotation.slots[0].metadata - legacy = not medical_metadata.get("handler") == "MONAI" # type: ignore - plane_map = medical_metadata.get("plane_map", {slot_name: "AXIAL"}) - primary_plane = medical_metadata.get( - "primary_plane", plane_map.get(slot_name, "AXIAL") - ) - except (KeyError, AttributeError): - legacy = True - primary_plane = "AXIAL" - - image_id = check_for_error_and_return_imageid(video_annotation, output_dir) + for annotation_file in annotation_files: + slot_map = {slot.name: slot for slot in annotation_file.slots} + image_id = check_for_error_and_return_imageid(annotation_file, output_dir) if not isinstance(image_id, str): continue - polygon_class_names = [ - ann.annotation_class.name - for ann in video_annotation.annotations - if ann.annotation_class.annotation_type == "polygon" - ] - # Check if there are any rasters in the annotation, these are created with a _m suffix - # in addition to those created from polygons. - annotation_types = [ - a.annotation_class.annotation_type for a in video_annotation.annotations - ] - mask_present = "raster_layer" in annotation_types and "mask" in annotation_types - output_volumes = build_output_volumes( - video_annotation, - class_names_to_export=polygon_class_names, - from_raster_layer=False, - mask_present=mask_present, - primary_plane=primary_plane, - ) - slot_map = {slot.name: slot for slot in video_annotation.slots} - polygon_annotations = [ - ann - for ann in video_annotation.annotations - if ann.annotation_class.annotation_type == "polygon" - ] - if polygon_annotations: - populate_output_volumes_from_polygons( - polygon_annotations, slot_map, output_volumes, legacy=legacy + + for slot in annotation_file.slots: + slot_name = slot.name + slot_annotations = get_annotations_in_slot( + slot_name, annotation_file.annotations ) - write_output_volume_to_disk( - output_volumes, - image_id=image_id, - output_dir=output_dir, - legacy=legacy, - filename=video_annotation.filename, - ) - # Need to map raster layers to SeriesInstanceUIDs - if mask_present: - mask_id_to_classname = { - ann.id: ann.annotation_class.name - for ann in video_annotation.annotations - if ann.annotation_class.annotation_type == "mask" - } - raster_output_volumes = build_output_volumes( - video_annotation, - class_names_to_export=list(mask_id_to_classname.values()), - from_raster_layer=True, + + try: + medical_metadata = slot.metadata + legacy = not medical_metadata.get("handler") == "MONAI" # type: ignore + plane_map = medical_metadata.get("plane_map", {slot_name: "AXIAL"}) + primary_plane = medical_metadata.get( + "primary_plane", plane_map.get(slot_name, "AXIAL") + ) + except (KeyError, AttributeError): + legacy = True + primary_plane = "AXIAL" + + polygon_class_names = [ + ann.annotation_class.name + for ann in slot_annotations + if ann.annotation_class.annotation_type == "polygon" + ] + # Check if there are any rasters in the annotation, these are created with a _m suffix + # in addition to those created from polygons. + annotation_types = [ + a.annotation_class.annotation_type for a in slot_annotations + ] + mask_present = ( + "raster_layer" in annotation_types and "mask" in annotation_types + ) + output_volumes = build_output_volumes( + slot, + class_names_to_export=polygon_class_names, + from_raster_layer=False, + mask_present=mask_present, primary_plane=primary_plane, ) - - # This assumes only one raster_layer annotation. If we allow multiple raster layers per annotation file we need to change this. - raster_layer_annotation = [ + polygon_annotations = [ ann - for ann in video_annotation.annotations - if ann.annotation_class.annotation_type == "raster_layer" - ][0] - if raster_layer_annotation: - populate_output_volumes_from_raster_layer( - annotation=raster_layer_annotation, - mask_id_to_classname=mask_id_to_classname, - slot_map=slot_map, - output_volumes=raster_output_volumes, - primary_plane=primary_plane, + for ann in slot_annotations + if ann.annotation_class.annotation_type == "polygon" + ] + if polygon_annotations: + populate_output_volumes_from_polygons( + polygon_annotations, slot_map, output_volumes, legacy=legacy ) write_output_volume_to_disk( - raster_output_volumes, + output_volumes, image_id=image_id, output_dir=output_dir, legacy=legacy, - filename=video_annotation.filename, + item_name=annotation_file.path.stem, + slot_name=slot.name, + filename=slot.source_files[0].file_name, ) + # Need to map raster layers to SeriesInstanceUIDs + if mask_present: + mask_id_to_classname = { + ann.id: ann.annotation_class.name + for ann in slot_annotations + if ann.annotation_class.annotation_type == "mask" + } + raster_output_volumes = build_output_volumes( + slot, + class_names_to_export=list(mask_id_to_classname.values()), + from_raster_layer=True, + primary_plane=primary_plane, + ) + + # This assumes only one raster_layer annotation. If we allow multiple raster layers per annotation file we need to change this. + raster_layer_annotation = [ + ann + for ann in slot_annotations + if ann.annotation_class.annotation_type == "raster_layer" + ][0] + if raster_layer_annotation: + populate_output_volumes_from_raster_layer( + annotation=raster_layer_annotation, + mask_id_to_classname=mask_id_to_classname, + slot_map=slot_map, + output_volumes=raster_output_volumes, + primary_plane=primary_plane, + ) + write_output_volume_to_disk( + raster_output_volumes, + image_id=image_id, + output_dir=output_dir, + legacy=legacy, + item_name=annotation_file.path.stem, + slot_name=slot.name, + filename=slot.source_files[0].file_name, + ) def build_output_volumes( - video_annotation: dt.AnnotationFile, + slot: dt.Slot, from_raster_layer: bool = False, class_names_to_export: List[str] = None, mask_present: Optional[bool] = False, @@ -177,7 +190,7 @@ def build_output_volumes( Parameters ---------- - video_annotation : dt.AnnotationFile + annotation_file : dt.AnnotationFile The ``AnnotationFile``\\s to be exported. from_raster_layer : bool Whether the output volumes are being built from raster layers or not @@ -196,21 +209,20 @@ def build_output_volumes( # Builds a map of class to integer, if its a polygon we use the class name as is # for the mask annotations we append a suffix _m to ensure backwards compatibility - output_volumes = {} - for slot in video_annotation.slots: - slot_metadata = slot.metadata - assert slot_metadata is not None - series_instance_uid = slot_metadata.get( - "SeriesInstanceUID", "SeriesIntanceUIDNotProvided" - ) - # Builds output volumes per class - volume_dims, pixdims, affine, original_affine = process_metadata(slot.metadata) - if not mask_present and not class_names_to_export: - class_names_to_export = [ - "" - ] # If there are no annotations to export, we still need to create an empty volume - - output_volumes[series_instance_uid] = { + slot_metadata = slot.metadata + assert slot_metadata is not None + series_instance_uid = slot_metadata.get( + "SeriesInstanceUID", "SeriesIntanceUIDNotProvided" + ) + # Builds output volumes per class + volume_dims, pixdims, affine, original_affine = process_metadata(slot_metadata) + if not mask_present and not class_names_to_export: + class_names_to_export = [ + "" + ] # If there are no annotations to export, we still need to create an empty volume + + return { + series_instance_uid: { class_name: Volume( pixel_array=np.zeros(volume_dims, dtype=np.uint8), affine=affine, @@ -223,19 +235,19 @@ def build_output_volumes( primary_plane=primary_plane, ) for class_name in class_names_to_export - } - return output_volumes + }, + } def check_for_error_and_return_imageid( - video_annotation: dt.AnnotationFile, output_dir: Path + annotation_file: dt.AnnotationFile, output_dir: Path ) -> Union[str, bool]: - """Given the video_annotation file and the output directory, checks for a range of errors and + """Given the annotation_file file and the output directory, checks for a range of errors and returns messages accordingly. Parameters ---------- - video_annotation : dt.AnnotationFile + annotation_file : dt.AnnotationFile The ``AnnotationFile``\\s to be exported. output_dir : Path The folder where the new instance mask files will be. @@ -246,7 +258,7 @@ def check_for_error_and_return_imageid( Returns the image_id if no errors are found, otherwise returns False """ # Check if all item slots have the correct file-extension - for slot in video_annotation.slots: + for slot in annotation_file.slots: for source_file in slot.source_files: filename = Path(source_file.file_name) if not ( @@ -260,7 +272,7 @@ def check_for_error_and_return_imageid( str(filename), ) - filename = Path(video_annotation.filename) + filename = Path(annotation_file.filename) if filename.name.lower().endswith(".nii.gz"): image_id = re.sub(r"(?i)\.nii\.gz$", "", str(filename)) elif filename.name.lower().endswith(".nii"): @@ -270,17 +282,7 @@ def check_for_error_and_return_imageid( else: image_id = str(filename) - if video_annotation is None: - return create_error_message_json( - "video_annotation not found", output_dir, image_id - ) - if video_annotation is None: - return create_error_message_json( - "video_annotation not found", output_dir, image_id - ) - - for slot in video_annotation.slots: - # Pick the first slot to take the metadata from. We assume that all slots have the same metadata. + for slot in annotation_file.slots: metadata = slot.metadata if metadata is None: return create_error_message_json( @@ -503,7 +505,9 @@ def write_output_volume_to_disk( output_volumes: Dict, image_id: str, output_dir: Union[str, Path], + item_name: str, legacy: bool = False, + slot_name: str = "0", # default slot name is "0" filename: str = None, ) -> None: """Writes the given output volumes to disk. @@ -519,8 +523,12 @@ def write_output_volume_to_disk( legacy : bool, default=False If ``True``, the exporter will use the legacy calculation. If ``False``, the exporter will use the new calculation by dividing with pixdims. - filename: str - The filename of the dataset item + item_name : str + Name of the dataset item. + slot_name : str + Name of the dataset item slot the volume belongs to. + filename : str + Name of the file occupying the dataset item slot. Returns ------- @@ -544,10 +552,23 @@ def unnest_dict_to_list(d: Dict) -> List: affine=volume.affine, ) img = _get_reoriented_nifti_image(img, volume, legacy, filename) + filename_stem = Path( + Path(filename).stem + ).stem # We take stem twice to handle ".nii.gz" suffixes if volume.from_raster_layer: - output_path = Path(output_dir) / f"{image_id}_{volume.class_name}_m.nii.gz" + output_path = ( + Path(output_dir) + / item_name + / slot_name + / f"{filename_stem}_{volume.class_name}_m.nii.gz" + ) else: - output_path = Path(output_dir) / f"{image_id}_{volume.class_name}.nii.gz" + output_path = ( + Path(output_dir) + / item_name + / slot_name + / f"{filename_stem}_{volume.class_name}.nii.gz" + ) if not output_path.parent.exists(): output_path.parent.mkdir(parents=True) nib.save(img=img, filename=output_path) diff --git a/darwin/utils/utils.py b/darwin/utils/utils.py index c098bfda1..7d0549635 100644 --- a/darwin/utils/utils.py +++ b/darwin/utils/utils.py @@ -13,6 +13,7 @@ Iterator, List, Optional, + Sequence, Set, Tuple, Union, @@ -627,6 +628,18 @@ def _parse_darwin_v2(path: Path, data: Dict[str, Any]) -> dt.AnnotationFile: return annotation_file +def get_annotations_in_slot( + slot_name: str, annotations: Sequence[Union[dt.Annotation, dt.VideoAnnotation]] +) -> List[Union[dt.Annotation, dt.VideoAnnotation]]: + return [ + annotation + for annotation in annotations + if hasattr(annotation, "slot_names") + and annotation.slot_names + and annotation.slot_names[0] == slot_name + ] + + def _parse_darwin_slot(data: Dict[str, Any]) -> dt.Slot: source_files_data = data.get("source_files", []) source_files = [ diff --git a/e2e_tests/cli/test_convert.py b/e2e_tests/cli/test_convert.py index 634f28951..863b6c0cc 100644 --- a/e2e_tests/cli/test_convert.py +++ b/e2e_tests/cli/test_convert.py @@ -65,6 +65,11 @@ def compare_directories(self, path: Path, expected_path: Path) -> None: data_path / "nifti-no-legacy-scaling/from", data_path / "nifti-no-legacy-scaling/to", ), + ( + "nifti", + data_path / "nifti-multislot/from", + data_path / "nifti-multislot/to", + ), ( "instance_mask", data_path / "instance_mask/from", diff --git a/e2e_tests/cli/test_import.py b/e2e_tests/cli/test_import.py index bb6554bff..ab902f87f 100644 --- a/e2e_tests/cli/test_import.py +++ b/e2e_tests/cli/test_import.py @@ -512,6 +512,17 @@ def test_import_annotations_to_multi_slotted_item_with_slots_defined( ) +def test_import_annotations_to_multi_slotted_item_with_dicom_slots( + local_dataset: E2EDataset, config_values: ConfigValues +) -> None: + run_import_test( + local_dataset, + config_values, + item_type="multi_slotted_dicom", + annotations_subdir="multi_slotted_annotations_with_dicom_slots", + ) + + def test_import_annotations_to_multi_channel_item_without_slots_defined( local_dataset: E2EDataset, config_values: ConfigValues ) -> None: diff --git a/e2e_tests/data/convert/nifti-legacy-scaling/to/2044737.fat_Reference_sBAT.nii.gz b/e2e_tests/data/convert/nifti-legacy-scaling/to/2044737.fat.nii/0/2044737.fat_Reference_sBAT.nii.gz similarity index 100% rename from e2e_tests/data/convert/nifti-legacy-scaling/to/2044737.fat_Reference_sBAT.nii.gz rename to e2e_tests/data/convert/nifti-legacy-scaling/to/2044737.fat.nii/0/2044737.fat_Reference_sBAT.nii.gz diff --git a/e2e_tests/data/convert/nifti-legacy-scaling/to/2044737.fat_test_mask_basic_m.nii.gz b/e2e_tests/data/convert/nifti-legacy-scaling/to/2044737.fat.nii/0/2044737.fat_test_mask_basic_m.nii.gz similarity index 100% rename from e2e_tests/data/convert/nifti-legacy-scaling/to/2044737.fat_test_mask_basic_m.nii.gz rename to e2e_tests/data/convert/nifti-legacy-scaling/to/2044737.fat.nii/0/2044737.fat_test_mask_basic_m.nii.gz diff --git a/e2e_tests/data/convert/nifti-multislot/from/2044737.fat.nii.json b/e2e_tests/data/convert/nifti-multislot/from/2044737.fat.nii.json new file mode 100644 index 000000000..6fbe889cb --- /dev/null +++ b/e2e_tests/data/convert/nifti-multislot/from/2044737.fat.nii.json @@ -0,0 +1,2998 @@ +{ + "version": "2.0", + "schema_ref": "https://darwin-public.s3.eu-west-1.amazonaws.com/darwin_json/2.0/schema.json", + "item": { + "name": "2044737.fat.nii.gz", + "path": "/", + "source_info": { + "item_id": "0192eee1-7767-3bcc-1b02-7bd3a435b59d", + "dataset": { + "name": "MED_2D_VIEWER_OFF", + "slug": "med_2d_viewer_off", + "dataset_management_url": "https://darwin.v7labs.com/datasets/1354682/dataset-management" + }, + "team": { + "name": "V7 John", + "slug": "v7-john" + }, + "workview_url": "https://darwin.v7labs.com/workview?dataset=1354682&item=0192eee1-7767-3bcc-1b02-7bd3a435b59d" + }, + "slots": [ + { + "type": "dicom", + "slot_name": "0", + "width": 224, + "height": 174, + "fps": null, + "thumbnail_url": "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/thumbnail", + "source_files": [ + { + "file_name": "2044737.fat.nii.gz", + "url": "https://darwin.v7labs.com/api/v2/teams/v7-john/uploads/e760518f-563b-467a-be4d-e85eee725e45" + } + ], + "frame_count": 17, + "frame_urls": [ + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/0", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/2", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/3", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/4", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/5", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/6", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/7", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/8", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/9", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/10", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/11", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/12", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/13", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/14", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/15", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/16" + ], + "metadata": { + "shape": [ + 1, + 224, + 174, + 17 + ], + "SeriesInstanceUID": "1.2.826.0.1.3680043.8.498.89599582585125995121795967413768680340", + "affine": "[[2.232142925262451, 0.0, 0.0, -247.7678723335266], [0.0, 2.232142925262451, 0.0, -191.96429443359375], [0.0, 0.0, 3.0, -21.0], [0.0, 0.0, 0.0, 1.0]]", + "colorspace": "RG16", + "original_affine": [ + [ + "-2.232142925262451", + "-0.0", + "0.0", + "250.0" + ], + [ + "-0.0", + "2.232142925262451", + "-0.0", + "-191.96429443359375" + ], + [ + "0.0", + "0.0", + "3.0", + "-21.0" + ], + [ + "0.0", + "0.0", + "0.0", + "1.0" + ] + ], + "pixdim": "(2.232143, 2.232143, 3.0)", + "plane_map": { + "0": "AXIAL" + } + } + }, + { + "type": "dicom", + "slot_name": "1", + "width": 224, + "height": 174, + "fps": null, + "thumbnail_url": "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/thumbnail", + "source_files": [ + { + "file_name": "2044737.fat.nii.gz", + "url": "https://darwin.v7labs.com/api/v2/teams/v7-john/uploads/e760518f-563b-467a-be4d-e85eee725e45" + } + ], + "frame_count": 17, + "frame_urls": [ + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/0", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/1", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/2", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/3", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/4", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/5", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/6", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/7", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/8", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/9", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/10", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/11", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/12", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/13", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/14", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/15", + "https://darwin.v7labs.com/api/v2/teams/v7-john/files/8c754a67-b65a-4aad-aff1-2fdcb36a1669/sections/16" + ], + "metadata": { + "shape": [ + 1, + 224, + 174, + 17 + ], + "SeriesInstanceUID": "1.2.826.0.1.3680043.8.498.89599582585125995121795967413768680340", + "affine": "[[2.232142925262451, 0.0, 0.0, -247.7678723335266], [0.0, 2.232142925262451, 0.0, -191.96429443359375], [0.0, 0.0, 3.0, -21.0], [0.0, 0.0, 0.0, 1.0]]", + "colorspace": "RG16", + "original_affine": [ + [ + "-2.232142925262451", + "-0.0", + "0.0", + "250.0" + ], + [ + "-0.0", + "2.232142925262451", + "-0.0", + "-191.96429443359375" + ], + [ + "0.0", + "0.0", + "3.0", + "-21.0" + ], + [ + "0.0", + "0.0", + "0.0", + "1.0" + ] + ], + "pixdim": "(2.232143, 2.232143, 3.0)", + "plane_map": { + "0": "AXIAL" + } + } + } + ] + }, + "annotations": [ + { + "frames": { + "4": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": true, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "5": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "6": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "7": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "8": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "9": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "10": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "11": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "12": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "13": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "14": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "15": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "16": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": true, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + } + }, + "global_sub_types": {}, + "id": "c33371d2-e165-4808-bf16-2f1040dd3cb2", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "Reference_sBAT", + "properties": [], + "ranges": [ + [ + 4, + 17 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "4": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": true, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "5": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "6": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "7": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "8": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "9": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "10": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "11": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "12": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "13": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "14": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "15": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "16": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": true, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + } + }, + "global_sub_types": {}, + "id": "4664e9b3-f1c3-4bb4-a1a3-366a5441c1d7", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "Reference_sBAT", + "properties": [], + "ranges": [ + [ + 4, + 17 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "9": { + "keyframe": true, + "mask": {} + }, + "10": { + "keyframe": true, + "mask": {} + }, + "11": { + "keyframe": true, + "mask": {} + }, + "12": { + "keyframe": true, + "mask": {} + } + }, + "id": "e950fe0c-4811-4590-a28a-40cb7ea96864", + "interpolate_algorithm": "linear-1.1", + "name": "test_mask_basic", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 9, + 13 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "9": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 18868, + 1, + 6, + 0, + 216, + 1, + 9, + 0, + 215, + 1, + 9, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 213, + 1, + 11, + 0, + 212, + 1, + 12, + 0, + 212, + 1, + 12, + 0, + 211, + 1, + 13, + 0, + 211, + 1, + 12, + 0, + 212, + 1, + 11, + 0, + 213, + 1, + 11, + 0, + 213, + 1, + 10, + 0, + 215, + 1, + 9, + 0, + 215, + 1, + 8, + 0, + 218, + 1, + 4, + 0, + 16747 + ], + "mask_annotation_ids_mapping": { + "e950fe0c-4811-4590-a28a-40cb7ea96864": 1 + }, + "total_pixels": 38976 + } + }, + "10": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 17786, + 1, + 5, + 0, + 217, + 1, + 9, + 0, + 63, + 1, + 4, + 0, + 148, + 1, + 9, + 0, + 61, + 1, + 8, + 0, + 145, + 1, + 11, + 0, + 60, + 1, + 8, + 0, + 145, + 1, + 11, + 0, + 59, + 1, + 10, + 0, + 144, + 1, + 11, + 0, + 59, + 1, + 10, + 0, + 144, + 1, + 11, + 0, + 59, + 1, + 10, + 0, + 145, + 1, + 9, + 0, + 60, + 1, + 10, + 0, + 145, + 1, + 9, + 0, + 61, + 1, + 8, + 0, + 148, + 1, + 5, + 0, + 63, + 1, + 8, + 0, + 218, + 1, + 4, + 0, + 560, + 1, + 4, + 0, + 218, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 215, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 215, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 218, + 1, + 4, + 0, + 4390, + 1, + 4, + 0, + 218, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 215, + 1, + 10, + 0, + 213, + 1, + 11, + 0, + 213, + 1, + 11, + 0, + 213, + 1, + 11, + 0, + 213, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 215, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 218, + 1, + 4, + 0, + 9439 + ], + "mask_annotation_ids_mapping": { + "e950fe0c-4811-4590-a28a-40cb7ea96864": 1 + }, + "total_pixels": 38976 + } + }, + "11": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 17387, + 1, + 4, + 0, + 193, + 1, + 4, + 0, + 21, + 1, + 8, + 0, + 188, + 1, + 9, + 0, + 19, + 1, + 8, + 0, + 186, + 1, + 11, + 0, + 18, + 1, + 10, + 0, + 185, + 1, + 12, + 0, + 17, + 1, + 10, + 0, + 184, + 1, + 13, + 0, + 17, + 1, + 10, + 0, + 184, + 1, + 13, + 0, + 17, + 1, + 10, + 0, + 184, + 1, + 13, + 0, + 18, + 1, + 8, + 0, + 185, + 1, + 12, + 0, + 19, + 1, + 8, + 0, + 131, + 1, + 4, + 0, + 51, + 1, + 11, + 0, + 21, + 1, + 4, + 0, + 131, + 1, + 8, + 0, + 49, + 1, + 9, + 0, + 158, + 1, + 8, + 0, + 51, + 1, + 4, + 0, + 160, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 215, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 218, + 1, + 4, + 0, + 17640 + ], + "mask_annotation_ids_mapping": { + "e950fe0c-4811-4590-a28a-40cb7ea96864": 1 + }, + "total_pixels": 38976 + } + }, + "12": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 17547, + 1, + 4, + 0, + 218, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 60, + 1, + 5, + 0, + 150, + 1, + 10, + 0, + 57, + 1, + 9, + 0, + 148, + 1, + 10, + 0, + 57, + 1, + 9, + 0, + 148, + 1, + 10, + 0, + 56, + 1, + 11, + 0, + 147, + 1, + 10, + 0, + 56, + 1, + 11, + 0, + 148, + 1, + 8, + 0, + 57, + 1, + 11, + 0, + 148, + 1, + 8, + 0, + 57, + 1, + 11, + 0, + 150, + 1, + 4, + 0, + 60, + 1, + 9, + 0, + 215, + 1, + 9, + 0, + 217, + 1, + 5, + 0, + 2076, + 1, + 4, + 0, + 218, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 215, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 215, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 218, + 1, + 4, + 0, + 6463, + 1, + 4, + 0, + 218, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 215, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 215, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 218, + 1, + 4, + 0, + 6315 + ], + "mask_annotation_ids_mapping": { + "e950fe0c-4811-4590-a28a-40cb7ea96864": 1 + }, + "total_pixels": 38976 + } + } + }, + "id": "505f072e-94e5-46d8-89ef-f36663d82c0e", + "name": "__raster_layer__", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 0, + 17 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "4": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": true, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "5": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "6": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "7": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "8": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "9": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "10": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "11": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "12": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "13": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "14": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "15": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + }, + "16": { + "bounding_box": { + "h": 29.754599999999996, + "w": 44.632000000000005, + "x": 70.6022, + "y": 99.6134 + }, + "keyframe": true, + "polygon": { + "paths": [ + [ + { + "x": 94.5353, + "y": 99.6134 + }, + { + "x": 70.6022, + "y": 120.9591 + }, + { + "x": 115.2342, + "y": 129.368 + } + ] + ] + } + } + }, + "global_sub_types": {}, + "id": "c33371d2-e165-4808-bf16-2f1040dd3cb2", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "Reference_sBAT", + "properties": [], + "ranges": [ + [ + 4, + 17 + ] + ], + "slot_names": [ + "1" + ] + }, + { + "frames": { + "4": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": true, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "5": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "6": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "7": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "8": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "9": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "10": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "11": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "12": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "13": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "14": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "15": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + }, + "16": { + "bounding_box": { + "h": 16.170999999999992, + "w": 42.044700000000006, + "x": 128.8178, + "y": 97.3494 + }, + "keyframe": true, + "polygon": { + "paths": [ + [ + { + "x": 167.9517, + "y": 97.3494 + }, + { + "x": 128.8178, + "y": 99.9368 + }, + { + "x": 151.7807, + "y": 113.5204 + }, + { + "x": 170.8625, + "y": 97.6729 + } + ] + ] + } + } + }, + "global_sub_types": {}, + "id": "4664e9b3-f1c3-4bb4-a1a3-366a5441c1d7", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "Reference_sBAT", + "properties": [], + "ranges": [ + [ + 4, + 17 + ] + ], + "slot_names": [ + "1" + ] + }, + { + "frames": { + "9": { + "keyframe": true, + "mask": {} + }, + "10": { + "keyframe": true, + "mask": {} + }, + "11": { + "keyframe": true, + "mask": {} + }, + "12": { + "keyframe": true, + "mask": {} + } + }, + "id": "e950fe0c-4811-4590-a28a-40cb7ea96864", + "interpolate_algorithm": "linear-1.1", + "name": "test_mask_basic", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 9, + 13 + ] + ], + "slot_names": [ + "1" + ] + }, + { + "frames": { + "9": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 18868, + 1, + 6, + 0, + 216, + 1, + 9, + 0, + 215, + 1, + 9, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 213, + 1, + 11, + 0, + 212, + 1, + 12, + 0, + 212, + 1, + 12, + 0, + 211, + 1, + 13, + 0, + 211, + 1, + 12, + 0, + 212, + 1, + 11, + 0, + 213, + 1, + 11, + 0, + 213, + 1, + 10, + 0, + 215, + 1, + 9, + 0, + 215, + 1, + 8, + 0, + 218, + 1, + 4, + 0, + 16747 + ], + "mask_annotation_ids_mapping": { + "e950fe0c-4811-4590-a28a-40cb7ea96864": 1 + }, + "total_pixels": 38976 + } + }, + "10": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 17786, + 1, + 5, + 0, + 217, + 1, + 9, + 0, + 63, + 1, + 4, + 0, + 148, + 1, + 9, + 0, + 61, + 1, + 8, + 0, + 145, + 1, + 11, + 0, + 60, + 1, + 8, + 0, + 145, + 1, + 11, + 0, + 59, + 1, + 10, + 0, + 144, + 1, + 11, + 0, + 59, + 1, + 10, + 0, + 144, + 1, + 11, + 0, + 59, + 1, + 10, + 0, + 145, + 1, + 9, + 0, + 60, + 1, + 10, + 0, + 145, + 1, + 9, + 0, + 61, + 1, + 8, + 0, + 148, + 1, + 5, + 0, + 63, + 1, + 8, + 0, + 218, + 1, + 4, + 0, + 560, + 1, + 4, + 0, + 218, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 215, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 215, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 218, + 1, + 4, + 0, + 4390, + 1, + 4, + 0, + 218, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 215, + 1, + 10, + 0, + 213, + 1, + 11, + 0, + 213, + 1, + 11, + 0, + 213, + 1, + 11, + 0, + 213, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 215, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 218, + 1, + 4, + 0, + 9439 + ], + "mask_annotation_ids_mapping": { + "e950fe0c-4811-4590-a28a-40cb7ea96864": 1 + }, + "total_pixels": 38976 + } + }, + "11": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 17387, + 1, + 4, + 0, + 193, + 1, + 4, + 0, + 21, + 1, + 8, + 0, + 188, + 1, + 9, + 0, + 19, + 1, + 8, + 0, + 186, + 1, + 11, + 0, + 18, + 1, + 10, + 0, + 185, + 1, + 12, + 0, + 17, + 1, + 10, + 0, + 184, + 1, + 13, + 0, + 17, + 1, + 10, + 0, + 184, + 1, + 13, + 0, + 17, + 1, + 10, + 0, + 184, + 1, + 13, + 0, + 18, + 1, + 8, + 0, + 185, + 1, + 12, + 0, + 19, + 1, + 8, + 0, + 131, + 1, + 4, + 0, + 51, + 1, + 11, + 0, + 21, + 1, + 4, + 0, + 131, + 1, + 8, + 0, + 49, + 1, + 9, + 0, + 158, + 1, + 8, + 0, + 51, + 1, + 4, + 0, + 160, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 215, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 218, + 1, + 4, + 0, + 17640 + ], + "mask_annotation_ids_mapping": { + "e950fe0c-4811-4590-a28a-40cb7ea96864": 1 + }, + "total_pixels": 38976 + } + }, + "12": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 17547, + 1, + 4, + 0, + 218, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 60, + 1, + 5, + 0, + 150, + 1, + 10, + 0, + 57, + 1, + 9, + 0, + 148, + 1, + 10, + 0, + 57, + 1, + 9, + 0, + 148, + 1, + 10, + 0, + 56, + 1, + 11, + 0, + 147, + 1, + 10, + 0, + 56, + 1, + 11, + 0, + 148, + 1, + 8, + 0, + 57, + 1, + 11, + 0, + 148, + 1, + 8, + 0, + 57, + 1, + 11, + 0, + 150, + 1, + 4, + 0, + 60, + 1, + 9, + 0, + 215, + 1, + 9, + 0, + 217, + 1, + 5, + 0, + 2076, + 1, + 4, + 0, + 218, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 215, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 215, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 218, + 1, + 4, + 0, + 6463, + 1, + 4, + 0, + 218, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 215, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 214, + 1, + 10, + 0, + 215, + 1, + 8, + 0, + 216, + 1, + 8, + 0, + 218, + 1, + 4, + 0, + 6315 + ], + "mask_annotation_ids_mapping": { + "e950fe0c-4811-4590-a28a-40cb7ea96864": 1 + }, + "total_pixels": 38976 + } + } + }, + "id": "505f072e-94e5-46d8-89ef-f36663d82c0e", + "name": "__raster_layer__", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 0, + 17 + ] + ], + "slot_names": [ + "1" + ] + } + ], + "properties": [] +} diff --git a/e2e_tests/data/convert/nifti-no-legacy-scaling/to/2044737.fat_Reference_sBAT.nii.gz b/e2e_tests/data/convert/nifti-multislot/to/2044737.fat.nii/0/2044737.fat_Reference_sBAT.nii.gz similarity index 100% rename from e2e_tests/data/convert/nifti-no-legacy-scaling/to/2044737.fat_Reference_sBAT.nii.gz rename to e2e_tests/data/convert/nifti-multislot/to/2044737.fat.nii/0/2044737.fat_Reference_sBAT.nii.gz diff --git a/e2e_tests/data/convert/nifti-no-legacy-scaling/to/2044737.fat_test_mask_basic_m.nii.gz b/e2e_tests/data/convert/nifti-multislot/to/2044737.fat.nii/0/2044737.fat_test_mask_basic_m.nii.gz similarity index 100% rename from e2e_tests/data/convert/nifti-no-legacy-scaling/to/2044737.fat_test_mask_basic_m.nii.gz rename to e2e_tests/data/convert/nifti-multislot/to/2044737.fat.nii/0/2044737.fat_test_mask_basic_m.nii.gz diff --git a/e2e_tests/data/convert/nifti-multislot/to/2044737.fat.nii/1/2044737.fat_Reference_sBAT.nii.gz b/e2e_tests/data/convert/nifti-multislot/to/2044737.fat.nii/1/2044737.fat_Reference_sBAT.nii.gz new file mode 100644 index 000000000..af3c51339 Binary files /dev/null and b/e2e_tests/data/convert/nifti-multislot/to/2044737.fat.nii/1/2044737.fat_Reference_sBAT.nii.gz differ diff --git a/e2e_tests/data/convert/nifti-multislot/to/2044737.fat.nii/1/2044737.fat_test_mask_basic_m.nii.gz b/e2e_tests/data/convert/nifti-multislot/to/2044737.fat.nii/1/2044737.fat_test_mask_basic_m.nii.gz new file mode 100644 index 000000000..6a0f29941 Binary files /dev/null and b/e2e_tests/data/convert/nifti-multislot/to/2044737.fat.nii/1/2044737.fat_test_mask_basic_m.nii.gz differ diff --git a/e2e_tests/data/convert/nifti-no-legacy-scaling/to/2044737.fat.nii/0/2044737.fat_Reference_sBAT.nii.gz b/e2e_tests/data/convert/nifti-no-legacy-scaling/to/2044737.fat.nii/0/2044737.fat_Reference_sBAT.nii.gz new file mode 100644 index 000000000..af3c51339 Binary files /dev/null and b/e2e_tests/data/convert/nifti-no-legacy-scaling/to/2044737.fat.nii/0/2044737.fat_Reference_sBAT.nii.gz differ diff --git a/e2e_tests/data/convert/nifti-no-legacy-scaling/to/2044737.fat.nii/0/2044737.fat_test_mask_basic_m.nii.gz b/e2e_tests/data/convert/nifti-no-legacy-scaling/to/2044737.fat.nii/0/2044737.fat_test_mask_basic_m.nii.gz new file mode 100644 index 000000000..6a0f29941 Binary files /dev/null and b/e2e_tests/data/convert/nifti-no-legacy-scaling/to/2044737.fat.nii/0/2044737.fat_test_mask_basic_m.nii.gz differ diff --git a/e2e_tests/data/import/multi_slotted_annotations_with_dicom_slots/multi_slotted_dicom_item.json b/e2e_tests/data/import/multi_slotted_annotations_with_dicom_slots/multi_slotted_dicom_item.json new file mode 100644 index 000000000..171c2b2e9 --- /dev/null +++ b/e2e_tests/data/import/multi_slotted_annotations_with_dicom_slots/multi_slotted_dicom_item.json @@ -0,0 +1,252 @@ +{ + "version": "2.0", + "schema_ref": "https://darwin-public.s3.eu-west-1.amazonaws.com/darwin_json/2.0/schema.json", + "item": { + "name": "multi_slotted_dicom_item", + "path": "/", + "source_info": { + "item_id": "01923065-fe73-590a-119b-59cf1cd9b0ea", + "dataset": { + "name": "test_dataset_c6d7f523-c837-41ce-9267-c9441258d831", + "slug": "test_dataset_c6d7f523-c837-41ce-9267-c9441258d831", + "dataset_management_url": "https://staging.v7labs.com/datasets/919888/dataset-management" + }, + "team": { + "name": "E2E Testing", + "slug": "e2e-testing" + }, + "workview_url": "https://staging.v7labs.com/workview?dataset=919888&item=01923065-fe73-590a-119b-59cf1cd9b0ea" + }, + "slots": [ + { + "slot_name": "0", + "type": "dicom", + "storage_key": "darwin-py/dicoms/file_1.dcm", + "storage_thumbnail_key": "darwin-py/images/image_3_thumbnail.jpg", + "file_name": "file_1.dcm", + "source_files": [ + { + "file_name": "file_1.dcm", + "storage_key": "darwin-py/dicoms/file_1.dcm", + "url": "https://staging.v7labs.com/api/v2/teams/e2e-testing/uploads/144dc80d-6bec-4885-b5cb-a174f18000e2" + } + ], + "sections": [], + "metadata": { + "handler": null, + "shape": [ + 1, + 512, + 512, + 1 + ], + "SeriesInstanceUID": "1.3.12.2.1107.5.2.41.169564.2020042813301141366601341", + "affine": "[[0.08913741368344952, -0.002451136967734148, 1.1977545891985513, 95.846341859537], [-1.4218570160804405, -0.3123601272972694, 0.07121401006667598, 205.87200175651], [0.31163018838647816, -1.4244863529748326, -0.017676742040419257, 120.40900817655], [0.0, 0.0, 0.0, 1.0]]", + "colorspace": "RG16", + "original_affine": [ + [ + "0.08913741368344952", + "-0.002451136967734148", + "1.1977545891985513", + "95.846341859537" + ], + [ + "-1.4218570160804405", + "-0.3123601272972694", + "0.07121401006667598", + "205.87200175651" + ], + [ + "0.31163018838647816", + "-1.4244863529748326", + "-0.017676742040419257", + "120.40900817655" + ], + [ + "0.0", + "0.0", + "0.0", + "1.0" + ] + ], + "pixdim": "(1.4583334, 1.4583334, 1.1999999)", + "plane_map": { + "0": "AXIAL" + } + } + }, + { + "slot_name": "1", + "type": "dicom", + "storage_key": "darwin-py/dicoms/file_2.dcm", + "storage_thumbnail_key": "darwin-py/images/image_3_thumbnail.jpg", + "file_name": "file_2.dcm", + "source_files": [ + { + "file_name": "file_2.dcm", + "storage_key": "darwin-py/dicoms/file_2.dcm", + "url": "https://staging.v7labs.com/api/v2/teams/e2e-testing/uploads/144dc80d-6bec-4885-b5cb-a174f18000e2" + } + ], + "sections": [], + "metadata": { + "handler": null, + "shape": [ + 1, + 512, + 512, + 1 + ], + "SeriesInstanceUID": "1.3.12.2.1107.5.2.41.169564.2020042813301141366601341", + "affine": "[[0.08913741368344952, -0.002451136967734148, 1.1977545891985513, 95.846341859537], [-1.4218570160804405, -0.3123601272972694, 0.07121401006667598, 205.87200175651], [0.31163018838647816, -1.4244863529748326, -0.017676742040419257, 120.40900817655], [0.0, 0.0, 0.0, 1.0]]", + "colorspace": "RG16", + "original_affine": [ + [ + "0.08913741368344952", + "-0.002451136967734148", + "1.1977545891985513", + "95.846341859537" + ], + [ + "-1.4218570160804405", + "-0.3123601272972694", + "0.07121401006667598", + "205.87200175651" + ], + [ + "0.31163018838647816", + "-1.4244863529748326", + "-0.017676742040419257", + "120.40900817655" + ], + [ + "0.0", + "0.0", + "0.0", + "1.0" + ] + ], + "pixdim": "(1.4583334, 1.4583334, 1.1999999)", + "plane_map": { + "0": "AXIAL" + } + } + } + ] + }, + "annotations": [ + { + "frames": { + "0": { + "keyframe": true, + "mask": {} + } + }, + "id": "e950fe0c-4811-4590-a28a-40cb7ea96864", + "interpolate_algorithm": "linear-1.1", + "name": "test_mask_basic", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 0, + 1 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "0": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 5, + 1, + 5, + 0, + 5 + ], + "mask_annotation_ids_mapping": { + "e950fe0c-4811-4590-a28a-40cb7ea96864": 1 + }, + "total_pixels": 15 + } + } + }, + "id": "505f072e-94e5-46d8-89ef-f36663d82c0e", + "name": "__raster_layer__", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 0, + 1 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "0": { + "keyframe": true, + "mask": {} + } + }, + "id": "e950fe0c-4811-4590-a28a-40cb7ea96865", + "interpolate_algorithm": "linear-1.1", + "name": "test_mask_basic", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 0, + 1 + ] + ], + "slot_names": [ + "1" + ] + }, + { + "frames": { + "0": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 5, + 1, + 5, + 0, + 5 + ], + "mask_annotation_ids_mapping": { + "e950fe0c-4811-4590-a28a-40cb7ea96865": 1 + }, + "total_pixels": 15 + } + } + }, + "id": "505f072e-94e5-46d8-89ef-f36663d82c0f", + "name": "__raster_layer__", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 0, + 1 + ] + ], + "slot_names": [ + "1" + ] + } + ], + "properties": [] +} diff --git a/e2e_tests/objects.py b/e2e_tests/objects.py index d0639be89..ab405af60 100644 --- a/e2e_tests/objects.py +++ b/e2e_tests/objects.py @@ -1,11 +1,12 @@ +import json from collections import namedtuple from dataclasses import dataclass -from typing import List, Literal, Optional, Tuple, Dict +from typing import Dict, List, Literal, Optional, Tuple from uuid import UUID -from darwin.datatypes import JSONType import requests -import json + +from darwin.datatypes import JSONType ConfigValues = namedtuple("ConfigValues", ["server", "api_key", "team_slug"]) @@ -421,6 +422,51 @@ def get_read_only_registration_payload( ], } ], + "multi_slotted_dicom": [ + { + "path": path or "/", + "layout": { + "slots": ["0", "1"], + "type": "horizontal", + "version": 1, + }, + "slots": [ + { + "type": "dicom", + "file_name": "file_1.dcm", + "storage_key": "darwin-py/dicoms/file_1.dcm", + "storage_thumbnail_key": "darwin-py/images/image_3_thumbnail.jpg", + "sections": [ + { + "section_index": 1, + "height": 1080, + "width": 1920, + "storage_hq_key": "darwin-py/videos/hq_frames/image_1_hq.jpg", + "storage_lq_key": "darwin-py/videos/hq_frames/image_1_lq.jpg", + }, + ], + "slot_name": "0", + }, + { + "type": "dicom", + "file_name": "file_2.dcm", + "storage_key": "darwin-py/dicoms/file_2.dcm", + "storage_thumbnail_key": "darwin-py/images/image_3_thumbnail.jpg", + "sections": [ + { + "section_index": 1, + "height": 1080, + "width": 1920, + "storage_hq_key": "darwin-py/videos/hq_frames/image_1_hq.jpg", + "storage_lq_key": "darwin-py/videos/hq_frames/image_1_lq.jpg", + }, + ], + "slot_name": "1", + }, + ], + "name": "multi_slotted_dicom_item", + }, + ], } return { "items": items[item_type], # type: ignore diff --git a/tests/darwin/exporter/formats/export_nifti_test.py b/tests/darwin/exporter/formats/export_nifti_test.py index cec352648..7aff411a2 100644 --- a/tests/darwin/exporter/formats/export_nifti_test.py +++ b/tests/darwin/exporter/formats/export_nifti_test.py @@ -156,15 +156,25 @@ def test_export_creates_file_for_polygons_and_masks( / "nifti/releases/latest/annotations" ) video_annotation_files = { - "mask_only.json": ["hippocampus_multislot_3_test_hippo_LOIN_m.nii.gz"], + "mask_only.json": [ + Path("mask_only/0/hippocampus_multislot_3_test_hippo_LOIN_m.nii.gz") + ], "polygon_only.json": [ - "hippocampus_multislot_3_test_hippo_create_class_1.nii.gz" + Path( + "polygon_only/0/hippocampus_multislot_3_test_hippo_create_class_1.nii.gz" + ), ], "polygon_and_mask.json": [ - "hippocampus_multislot_3_test_hippo_create_class_1.nii.gz", - "hippocampus_multislot_3_test_hippo_LOIN_m.nii.gz", + Path( + "polygon_and_mask/0/hippocampus_multislot_3_test_hippo_create_class_1.nii.gz" + ), + Path( + "polygon_and_mask/0/hippocampus_multislot_3_test_hippo_LOIN_m.nii.gz" + ), + ], + "empty.json": [ + Path("empty/0/hippocampus_multislot_3_test_hippo_.nii.gz") ], - "empty.json": ["hippocampus_multislot_3_test_hippo_.nii.gz"], } for video_annotation_file in video_annotation_files: video_annotation_filepaths = [annotations_dir / video_annotation_file]