Skip to content

Commit

Permalink
working first time round, does not check for raster_layer
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Varsavsky committed Dec 12, 2023
1 parent 0975f80 commit 317357a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion darwin/importer/formats/nifti.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ def get_mask_video_annotations(volume, processed_class_map, slot_names):
np.uint8
) # Product requirement: We only support 255 classes!
# We need to convert from nifti_idx to raster_idx
slice_mask = np.vectorize(map_from_nifti_idx_to_raster_idx.get)(slice_mask)
slice_mask = np.vectorize(
lambda key: map_from_nifti_idx_to_raster_idx.get(key, 0)
)(slice_mask)
dense_rle = convert_to_dense_rle(slice_mask)
raster_annotation = dt.make_raster_layer(
class_name="__raster_layer__",
Expand Down
2 changes: 2 additions & 0 deletions darwin/importer/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,8 @@ def _import_annotations(
if (
annotation_type not in remote_classes
or annotation_class.name not in remote_classes[annotation_type]
and annotation_type
!= "raster_layer" # We do not skip raster layers as they are always available.
):
if annotation_type not in remote_classes:
logger.warning(
Expand Down

0 comments on commit 317357a

Please sign in to comment.