Skip to content

Commit

Permalink
Added tests for
Browse files Browse the repository at this point in the history
  • Loading branch information
JBWilkie committed Jan 16, 2025
1 parent 0572f58 commit ab4c848
Show file tree
Hide file tree
Showing 2 changed files with 356 additions and 6 deletions.
19 changes: 14 additions & 5 deletions darwin/importer/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2487,19 +2487,28 @@ def _scale_coordinates_by_pixdims(
if not remote_files_that_require_pixel_to_mm_transform:
return maybe_parsed_files
for file in maybe_parsed_files:
if file.full_path in remote_files_that_require_pixel_to_mm_transform:
if Path(file.full_path) in remote_files_that_require_pixel_to_mm_transform:
for annotation in file.annotations:
slot_name = annotation.slot_names[0]
if (
slot_name
not in remote_files_that_require_pixel_to_mm_transform[
Path(file.full_path)
]
):
continue
pixdims = remote_files_that_require_pixel_to_mm_transform[
file.full_path
Path(file.full_path)
][slot_name]
if isinstance(annotation, dt.VideoAnnotation):
for frame_idx, frame_annotation in annotation.frames.items():
for _, frame_annotation in annotation.frames.items():
frame_annotation.scale_coordinates(
float(pixdims[0]), float(pixdims[1])
float(pixdims["x"]), float(pixdims["y"])
)
elif isinstance(annotation, dt.Annotation):
annotation.scale_coordinates(float(pixdims[0]), float(pixdims[1]))
annotation.scale_coordinates(
float(pixdims["x"]), float(pixdims["y"])
)
return maybe_parsed_files


Expand Down
Loading

0 comments on commit ab4c848

Please sign in to comment.