Skip to content

Commit

Permalink
Merge pull request #16 from bioio-devs/bugfix/reset-pixel-size
Browse files Browse the repository at this point in the history
Rename pixel size property to match bioio-base
  • Loading branch information
aswallace authored Jan 17, 2025
2 parents e9b3d1a + 81e6b49 commit 8100780
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bioio_lif/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class Reader(reader.Reader):
_mosaic_xarray_data: Optional["xr.DataArray"] = None
_dims: Optional[dimensions.Dimensions] = None
_metadata: Optional[Any] = None
_physical_pixel_sizes: Optional[types.PhysicalPixelSizes] = None
_scenes: Optional[Tuple[str, ...]] = None
_current_scene_index: int = 0
# Do not provide default value because
Expand Down Expand Up @@ -115,7 +116,6 @@ def __init__(

# Delayed storage
self._scene_short_info: Dict[str, Any] = {}
self._px_sizes: Optional[types.PhysicalPixelSizes] = None

# Enforce valid image
if not self._is_supported_image(self._fs, self._path):
Expand Down Expand Up @@ -507,7 +507,7 @@ def _read_delayed(self) -> xr.DataArray:
)

# Store pixel sizes
self._px_sizes = px_sizes
self._physical_pixel_sizes = px_sizes

return xr.DataArray(
image_data,
Expand Down Expand Up @@ -567,7 +567,7 @@ def _read_immediate(self) -> xr.DataArray:
)

# Store pixel sizes
self._px_sizes = px_sizes
self._physical_pixel_sizes = px_sizes

return xr.DataArray(
image_data,
Expand Down Expand Up @@ -755,15 +755,15 @@ def physical_pixel_sizes(self) -> types.PhysicalPixelSizes:
We currently do not handle unit attachment to these values. Please see the file
metadata for unit information.
"""
if self._px_sizes is None:
if self._physical_pixel_sizes is None:
# We get pixel sizes as a part of array construct
# so simply run array construct
self.dask_data

if self._px_sizes is None:
if self._physical_pixel_sizes is None:
raise ValueError("Pixel sizes weren't created as a part of image reading")

return self._px_sizes
return self._physical_pixel_sizes

def get_mosaic_tile_position(
self, mosaic_tile_index: int, **kwargs: int
Expand Down

0 comments on commit 8100780

Please sign in to comment.