-
Notifications
You must be signed in to change notification settings - Fork 79
Open
Description
Using the method match_sdata_to_table() removes a lot of layers, which is undesirable.
Minimal example:
import spatialdata as sd
from spatialdata.datasets import blobs
sdata = blobs()
sdata
This returns:
SpatialData object
├── Images
│ ├── 'blobs_image': DataArray[cyx] (3, 512, 512)
│ └── 'blobs_multiscale_image': DataTree[cyx] (3, 512, 512), (3, 256, 256), (3, 128, 128)
├── Labels
│ ├── 'blobs_labels': DataArray[yx] (512, 512)
│ └── 'blobs_multiscale_labels': DataTree[yx] (512, 512), (256, 256), (128, 128)
├── Points
│ └── 'blobs_points': DataFrame with shape: (<Delayed>, 4) (2D points)
├── Shapes
│ ├── 'blobs_circles': GeoDataFrame shape: (5, 2) (2D shapes)
│ ├── 'blobs_multipolygons': GeoDataFrame shape: (2, 1) (2D shapes)
│ └── 'blobs_polygons': GeoDataFrame shape: (5, 1) (2D shapes)
└── Tables
└── 'table': AnnData (26, 3)
with coordinate systems:
▸ 'global', with elements:
blobs_image (Images), blobs_multiscale_image (Images), blobs_labels (Labels), blobs_multiscale_labels (Labels), blobs_points (Points), blobs_circles (Shapes), blobs_multipolygons (Shapes), blobs_polygons (Shapes)
Then, if one runs:
sdata = sd.match_sdata_to_table(sdata, "table")
sdata
The resulting object looks like this:
SpatialData object
├── Labels
│ └── 'blobs_labels': DataArray[yx] (512, 512)
└── Tables
└── 'table': AnnData (26, 3)
with coordinate systems:
▸ 'global', with elements:
blobs_labels (Labels)
Desired behavior: keep all layers, and subset them according to the cells present in the table. For layers that cannot be filtered (such as the image), I would like to keep them in the object as is.
Metadata
Metadata
Assignees
Labels
No labels