Remove coordinate system from Spatialdata

How can I remove a coordinate system from a SpatialData object?
I have a Visium SpatialData object that looks like this:

SpatialData object with:
├── Images
│     └── 'SAMP427_16_hires': SpatialImage[cyx] (3, 2000, 2000)
├── Shapes
│     └── 'SAMP427_16': GeoDataFrame shape: (4919, 2) (2D shapes)
└── Tables
      └── 'table': AnnData (274, 18922)
with coordinate systems:
▸ 'SAMP427_16', with elements:
        SAMP427_16_hires (Images), SAMP427_16 (Shapes)
▸ 'downscaled_lowres', with elements:
        SAMP427_16 (Shapes)
▸ 'global', with elements:
        SAMP427_16 (Shapes)

how can I only retain the SAMP427_16 coordinate system? I tried .filter_by_coordinate_system, but it only filters the respective elements, but not the coordinate system itself.

Hello,

Currently we have the API documented here for this:
spatialdata.transformations.remove_transformations_to_coordinate_system — spatialdata (scverse.org)

spatialdata.transformations.remove_transformation — spatialdata (scverse.org)

The top one is the one you need, but the bottom one can come in handy if you only want to do this for a particular element.

2 Likes