diff --git a/bioio_base/image_container.py b/bioio_base/image_container.py index 69d7736..1306c9e 100644 --- a/bioio_base/image_container.py +++ b/bioio_base/image_container.py @@ -9,7 +9,7 @@ import xarray as xr from .dimensions import Dimensions -from .types import ImageLike, PhysicalPixelSizes +from .types import ImageLike, PhysicalPixelSizes, TimeInterval ############################################################################### @@ -119,3 +119,8 @@ def channel_names(self) -> Optional[List[str]]: @abstractmethod def physical_pixel_sizes(self) -> PhysicalPixelSizes: pass + + @property + @abstractmethod + def time_interval(self) -> TimeInterval: + pass diff --git a/bioio_base/reader.py b/bioio_base/reader.py index f32a5b1..65eed85 100644 --- a/bioio_base/reader.py +++ b/bioio_base/reader.py @@ -15,7 +15,7 @@ from .dimensions import DEFAULT_DIMENSION_ORDER, DimensionNames, Dimensions from .image_container import ImageContainer from .io import pathlike_to_fs -from .types import PhysicalPixelSizes +from .types import PhysicalPixelSizes, TimeInterval ############################################################################### @@ -863,6 +863,22 @@ def physical_pixel_sizes(self) -> PhysicalPixelSizes: """ return PhysicalPixelSizes(None, None, None) + @property + def time_interval(self) -> TimeInterval: + """ + Returns + ------- + sizes: Time Interval + Using available metadata, the floats representing time interval sizes for + dimension T. + + Notes + ----- + We currently do not handle unit attachment to these values. Please see the file + metadata for unit information. + """ + return TimeInterval(None) + def get_mosaic_tile_position( self, mosaic_tile_index: int, **kwargs: int ) -> Tuple[int, int]: diff --git a/bioio_base/test_utilities.py b/bioio_base/test_utilities.py index 600db4c..19acb83 100644 --- a/bioio_base/test_utilities.py +++ b/bioio_base/test_utilities.py @@ -66,6 +66,7 @@ def run_image_container_checks( expected_physical_pixel_sizes: Tuple[ Optional[float], Optional[float], Optional[float] ], + expected_time_interval: Tuple[Optional[float]], expected_metadata_type: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]], set_resolution_level: int = 0, expected_current_resolution_level: int = 0, @@ -99,6 +100,7 @@ def run_image_container_checks( assert image_container.dims.shape == expected_shape assert image_container.channel_names == expected_channel_names assert image_container.physical_pixel_sizes == expected_physical_pixel_sizes + assert image_container.time_interval == expected_time_interval assert isinstance(image_container.metadata, expected_metadata_type) # Read different chunks @@ -167,6 +169,7 @@ def run_image_file_checks( expected_physical_pixel_sizes: Tuple[ Optional[float], Optional[float], Optional[float] ], + expected_time_interval: Tuple[Optional[float]], expected_metadata_type: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]], set_resolution_level: int = 0, expected_current_resolution_level: int = 0, @@ -192,6 +195,7 @@ def run_image_file_checks( expected_dims_order=expected_dims_order, expected_channel_names=expected_channel_names, expected_physical_pixel_sizes=expected_physical_pixel_sizes, + expected_time_interval=expected_time_interval, expected_metadata_type=expected_metadata_type, ) diff --git a/bioio_base/types.py b/bioio_base/types.py index 78d76b1..c5c50aa 100644 --- a/bioio_base/types.py +++ b/bioio_base/types.py @@ -24,3 +24,7 @@ class PhysicalPixelSizes(NamedTuple): Z: Optional[float] Y: Optional[float] X: Optional[float] + + +class TimeInterval(NamedTuple): + T: Optional[float]