From 69d5a6164b6eb9bc600594b69914e3c58751e86d Mon Sep 17 00:00:00 2001 From: Brian Whitney Date: Wed, 24 Jun 2026 09:44:51 -0700 Subject: [PATCH 1/2] feature/finegrain-region-read --- bioio/bio_image.py | 16 +++++++++++++--- pyproject.toml | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bioio/bio_image.py b/bioio/bio_image.py index 28f236a..81a3230 100644 --- a/bioio/bio_image.py +++ b/bioio/bio_image.py @@ -904,11 +904,21 @@ def get_image_data( See `bioio_base.transforms.reshape_data` for more details. """ - # If no out orientation, simply return current data as dask array + + # direct reader sub-region read + if ( + dimension_order_out is not None + and kwargs + and not ( + self._reconstruct_mosaic + and biob.dimensions.DimensionNames.MosaicTile in self.reader.dims.order + ) + ): + return self.reader.get_image_data(dimension_order_out, **kwargs) + + # Otherwise read the full image: return it as-is, or reshape/slice it. if dimension_order_out is None and not kwargs: return self.data - - # Transform and return return biob.transforms.reshape_data( data=self.data, given_dims=self.dims.order, diff --git a/pyproject.toml b/pyproject.toml index 874dbcd..445d6ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ dynamic = ["version"] dependencies = [ # We always pin a specific version of bioio-base with # each release so that we avoid bioio + bioio-base misalignment. - "bioio-base~=3.3.0", + "bioio-base~=3.4.0", "dask[array]>=2021.4.1", "numpy>=1.21.0", "ome-types[lxml]>=0.4.0", From 95f5bb4b889a7be10963fca9954ea6478b13cfad Mon Sep 17 00:00:00 2001 From: Brian Whitney Date: Wed, 24 Jun 2026 11:16:57 -0700 Subject: [PATCH 2/2] update boolean logic and comments --- bioio/bio_image.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bioio/bio_image.py b/bioio/bio_image.py index 81a3230..4ea0724 100644 --- a/bioio/bio_image.py +++ b/bioio/bio_image.py @@ -905,15 +905,14 @@ def get_image_data( See `bioio_base.transforms.reshape_data` for more details. """ - # direct reader sub-region read - if ( - dimension_order_out is not None - and kwargs - and not ( - self._reconstruct_mosaic - and biob.dimensions.DimensionNames.MosaicTile in self.reader.dims.order - ) - ): + # Determine if image needs to be stitched + stitching_mosaic = ( + self._reconstruct_mosaic + and biob.dimensions.DimensionNames.MosaicTile in self.reader.dims.order + ) + # direct reader sub-region read for kwarg slice. The only accepted kwargs + # is slice definitions so we can assert directly on their presence. + if dimension_order_out is not None and kwargs and not stitching_mosaic: return self.reader.get_image_data(dimension_order_out, **kwargs) # Otherwise read the full image: return it as-is, or reshape/slice it.