Skip to content

Commit 98effb7

Browse files
committed
add draft transform() api
1 parent be9557e commit 98effb7

File tree

10 files changed

+43
-161
lines changed

10 files changed

+43
-161
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ classifiers = [
2424
]
2525
dependencies = [
2626
"graphviz>=0.21",
27+
"networkx>=3.5",
2728
# "ome-zarr-models ",
2829
"ome-zarr-models @ git+https://github.com/ome-zarr-models/ome-zarr-models-py@rfc5",
2930
"pillow>=12.0.0",
3031
# for debug logging (referenced from the issue template)
3132
"session-info2",
33+
"xarray>=2025.10.1",
3234
]
3335
optional-dependencies.dev = [
3436
"pre-commit",
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
from importlib.metadata import version
22

3-
from . import pl, pp, tl
4-
5-
__all__ = ["pl", "pp", "tl"]
63

74
__version__ = version("ngff-transformations")

src/ngff_transformations/pl/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/ngff_transformations/pl/basic.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/ngff_transformations/pp/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/ngff_transformations/pp/basic.py

Lines changed: 0 additions & 90 deletions
This file was deleted.

src/ngff_transformations/tl/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/ngff_transformations/tl/basic.py

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import numpy as np
2+
from xarray import DataArray
3+
import networkx as nx
4+
5+
def transform(data: np.ndarray, axes: list[str], transformation_graph: nx.DiGraph, input_coordinate_system_name: str, output_coordinate_system_name: str) -> DataArray:
6+
pass
7+
# locate (inside the graph) the coordinate_system classes from the coordinate_system names
8+
# first validate the input data wrt to axes and input_coordinate_system
9+
# 1. check that the data shape is (n x len(axes))
10+
# 2. check that the axes are the same (and in the same order) of the axes of the input_coordinate_system
11+
# traverse the graph to find the transformation -> Transform class
12+
# apply the transformations to the data (code to get inspired from https://github.com/scverse/spatialdata/blob/6652a03b1d66c8902a8f7a159176c51d8c9f823b/src/spatialdata/transformations/operations.py#L212)
13+
# tranform the data
14+
# return the transformed data as tuple (numpy array, output axes from the output coordinate systme)

uv.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)