Skip to content

Commit

Permalink
first tables layout
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzocerrone committed Sep 23, 2024
1 parent 108b718 commit 2a9b48d
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 10 deletions.
21 changes: 12 additions & 9 deletions src/ngio/core/roi.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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,
)

Expand Down
2 changes: 1 addition & 1 deletion src/ngio/pipes/data_transform_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Empty file added src/ngio/tables/__init__.py
Empty file.
Empty file.
Empty file.
Empty file added src/ngio/tables/utils.py
Empty file.
Empty file added src/ngio/tables/v1/specs.py
Empty file.
Empty file.

0 comments on commit 2a9b48d

Please sign in to comment.