Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/time_interval #20

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bioio_base/image_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import xarray as xr

from .dimensions import Dimensions
from .types import ImageLike, PhysicalPixelSizes
from .types import ImageLike, PhysicalPixelSizes, TimeInterval

###############################################################################

Expand Down Expand Up @@ -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
18 changes: 17 additions & 1 deletion bioio_base/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

###############################################################################

Expand Down Expand Up @@ -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]:
Expand Down
4 changes: 4 additions & 0 deletions bioio_base/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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,
)

Expand Down
4 changes: 4 additions & 0 deletions bioio_base/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ class PhysicalPixelSizes(NamedTuple):
Z: Optional[float]
Y: Optional[float]
X: Optional[float]


class TimeInterval(NamedTuple):
T: Optional[float]
Loading