Skip to content

[main] Feature: SpatialData I/O support#37

Open
enric-bazz wants to merge 20 commits intodpeerlab:mainfrom
enric-bazz:feature/spatialdata_io
Open

[main] Feature: SpatialData I/O support#37
enric-bazz wants to merge 20 commits intodpeerlab:mainfrom
enric-bazz:feature/spatialdata_io

Conversation

@enric-bazz
Copy link
Copy Markdown

This PR ports the changes from the v2-incremental branch into main, primarily to introduce SpatialData I/O support.

Key features

  • SpatialData support

    • Accepts SpatialData objects as input, including data read from Zarr stores

    • Produces output as a Zarr-backed SpatialData object

    • Output is controlled via the save_spatialdata flag (default: true), consistent with existing AnnData behavior

    • Supports configurable boundary construction methods:

      • convex_hull
      • delaunay
  • 3D segmentation

    • Enabled when a valid z coordinate is present and the feature is activated (default: false)
  • Quality value (QV) filtering

    • Default threshold: QV > 20

Provenance of changes

Most of the implementation is derived and adapted from prior changes to the v2-incremental branch, namely:

@Tobiaspk
Copy link
Copy Markdown
Collaborator

Tobiaspk commented May 8, 2026

Hi @enric-bazz thanks for the PR. These are good features, but the scope is too large to review in a single PR (really helpful to get them below 400 lines per PR). I'd suggest to split it into smaller PRs grouped by functionality, such as:

  • 3d support
  • SpatialData support (ideally part of preprocessor.py; XeniumPreprocessor could be a good reference)
  • Custom qv parameter
  • Lazy loading and variable exports

For lazy loading, I'd suggest to only use where truly needed. Otherwise it adds lots of complexity overhead. For example StandardBoundaryFields loads quickly and doesn’t need lazy loading. there's also some duplicated logic between get_preprocess and preprocess for example. This can be simplified too.

Thanks!

@Tobiaspk Tobiaspk changed the title Feature: SpatialData I/O support [main] Feature: SpatialData I/O support May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants