diff --git a/src/ngio/core/roi.py b/src/ngio/core/roi.py index f91e452..cea08b1 100644 --- a/src/ngio/core/roi.py +++ b/src/ngio/core/roi.py @@ -1,7 +1,8 @@ +import numpy as np from pydantic import BaseModel -from ngio.ngff_meta.fractal_image_meta import SpaceUnits, PixelSize -import numpy as np +from ngio.core.dimensions import Dimensions +from ngio.ngff_meta.fractal_image_meta import PixelSize, SpaceUnits class Point(BaseModel): @@ -29,16 +30,18 @@ def _to_raster(self, value: float, pixel_size: PixelSize, max_shape: int) -> int round_value = int(np.round(value / pixel_size)) return min(round_value, max_shape) - def to_raster_coo(self, pixel_size: PixelSize, max_shape) -> "RasterCooROI": + def to_raster_coo( + self, pixel_size: PixelSize, dimensions: Dimensions + ) -> "RasterCooROI": """Convert to raster coordinates.""" RasterCooROI( field_index=self.field_index, - x=self._to_raster(value=self.x, pixel_size=pixel_size.x, max_shape=2**32), - y=int(self.y / pixel_size.y), - z=int(self.z / pixel_size.z), - x_length=int(self.x_length / pixel_size.x), - y_length=int(self.y_length / pixel_size.y), - z_length=int(self.z_length / pixel_size.z), + x=self._to_raster(self.x, pixel_size.x, dimensions.x), + y=self._to_raster(self.y, pixel_size.y, dimensions.y), + z=self._to_raster(self.z, pixel_size.z, dimensions.z), + x_length=self._to_raster(self.x_length, pixel_size.x, dimensions.x), + y_length=self._to_raster(self.y_length, pixel_size.y, dimensions.y), + z_length=self._to_raster(self.z_length, pixel_size.z, dimensions.z), original_roi=self, ) diff --git a/src/ngio/pipes/data_transform_pipe.py b/src/ngio/pipes/data_transform_pipe.py index 73b920e..9436358 100644 --- a/src/ngio/pipes/data_transform_pipe.py +++ b/src/ngio/pipes/data_transform_pipe.py @@ -4,9 +4,9 @@ import zarr from dask import array as da +from ngio.pipes import ArrayLike from ngio.pipes._slicer_transforms import SlicerTransform from ngio.pipes._transforms import Transform -from ngio.pipes import ArrayLike class DataTransformPipe: diff --git a/src/ngio/tables/__init__.py b/src/ngio/tables/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/ngio/tables/fractal_tables.py b/src/ngio/tables/fractal_tables.py new file mode 100644 index 0000000..e69de29 diff --git a/src/ngio/tables/tables_handler.py b/src/ngio/tables/tables_handler.py new file mode 100644 index 0000000..e69de29 diff --git a/src/ngio/tables/utils.py b/src/ngio/tables/utils.py new file mode 100644 index 0000000..e69de29 diff --git a/src/ngio/tables/v1/specs.py b/src/ngio/tables/v1/specs.py new file mode 100644 index 0000000..e69de29 diff --git a/src/ngio/tables/v1/zarr_utils.py b/src/ngio/tables/v1/zarr_utils.py new file mode 100644 index 0000000..e69de29