Skip to content

Commit

Permalink
Only use AICS pixels if they are all defined
Browse files Browse the repository at this point in the history
  • Loading branch information
multimeric committed Aug 2, 2024
1 parent b28e5ef commit f064ea0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/lls_core/models/deskew.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,11 @@ def convert_skew(cls, v: Any):
def convert_pixels(cls, v: Any, values: dict[Any, Any]):
from aicsimageio.types import PhysicalPixelSizes
if isinstance(v, PhysicalPixelSizes):
return DefinedPixelSizes.from_physical(v)
v = DefinedPixelSizes.from_physical(v)
elif isinstance(v, tuple) and len(v) == 3:
# Allow the pixel sizes to be specified as a tuple
return DefinedPixelSizes(Z=v[0], Y=v[1], X=v[2])
v = DefinedPixelSizes(Z=v[0], Y=v[1], X=v[2])

return v

@root_validator(pre=True)
Expand All @@ -187,7 +188,8 @@ def read_image(cls, values: dict):
# If the image was convertible to AICSImage, we should use the metadata from there
if aics:
values["input_image"] = aics.xarray_dask_data
values["physical_pixel_sizes"] = aics.physical_pixel_sizes
if all(size is not None for size in aics.physical_pixel_sizes):
values["physical_pixel_sizes"] = aics.physical_pixel_sizes

# In all cases, input_image will be a DataArray (XArray) at this point

Expand Down

0 comments on commit f064ea0

Please sign in to comment.