-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
Hey everyone,
I wanted to read in an externally generated segmentation and parse it as a Label2DModel. In the harpy package they require identical chunks between the label and the values layer, therefore I wanted to pass in the same chunks into the label model. But it turns out that this parameter gets ignored entirely for a DataArray. I think the culprit is that it never gets passed to from_array:
spatialdata/src/spatialdata/models/models.py
Lines 186 to 189 in 53b9438
| elif isinstance(data, np.ndarray | DaskArray): | |
| if not isinstance(data, DaskArray): # numpy -> dask | |
| data = from_array(data) | |
| if dims is None: |
Repro:
import spatialdata as sd
import numpy as np
arr = np.random.rand(2048, 2048)
model = sd.models.Labels2DModel.parse(
arr,
dims=("y", "x"),
transformations={"global": sd.transformations.Identity()},
chunks={"x": 1024, "y": 1024 } # I also tried passing (1024, 1024) with same effect.
)
print(model.chunks)
# ((2048,), (2048,))Maybe related to #81
Metadata
Metadata
Assignees
Labels
No labels