Skip to content

Conversation

@stephenwilliams22
Copy link
Collaborator

@stephenwilliams22 stephenwilliams22 commented Oct 6, 2025

This pr adds support for cell segmentation in Visium HD which was added in Space Ranger 4.0.

Features include

  • Updating and refactoring the visium_hd function
  • Default loading of Visium HD cell segmentations
  • New parameters
    • load_segmentations_only which disables bin loading
    • load_nucleus_segmentations which loads nucleus segmentations and calculates a nucleus only expression matrix

spatial data structure will look something like

SpatialData object
├── Images
│     ├── 'hd_hires_image': DataArray[cyx] (3, 5394, 6000)
│     └── 'hd_lowres_image': DataArray[cyx] (3, 540, 600)
├── Shapes
│     ├── 'hd_cell_segmentations': GeoDataFrame shape: (612, 2) (2D shapes)
│     └── 'hd_nucleus_segmentations': GeoDataFrame shape: (950, 2) (2D shapes)
└── Tables
      ├── 'cell_segmentations': AnnData (612, 32285)
      └── 'nucleus_segmentations': AnnData (950, 32285)
with coordinate systems:
    ▸ 'hd_downscaled_hires', with elements:
        hd_hires_image (Images), hd_cell_segmentations (Shapes), hd_nucleus_segmentations (Shapes)
    ▸ 'hd_downscaled_lowres', with elements:
        hd_lowres_image (Images), hd_cell_segmentations (Shapes), hd_nucleus_segmentations (Shapes)

To do based on submission guidelines

@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 93.37748% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.20%. Comparing base (7cccdd1) to head (301650e).
⚠️ Report is 30 commits behind head on main.

Files with missing lines Patch % Lines
src/spatialdata_io/readers/visium_hd.py 92.95% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #328      +/-   ##
==========================================
+ Coverage   49.06%   55.20%   +6.13%     
==========================================
  Files          26       26              
  Lines        2686     2806     +120     
==========================================
+ Hits         1318     1549     +231     
+ Misses       1368     1257     -111     
Files with missing lines Coverage Δ
src/spatialdata_io/__main__.py 86.18% <100.00%> (+0.15%) ⬆️
src/spatialdata_io/_constants/_constants.py 100.00% <100.00%> (ø)
src/spatialdata_io/readers/visium_hd.py 76.53% <92.95%> (+61.39%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@stephenwilliams22
Copy link
Collaborator Author

@LucaMarconato please let me know if my vignette should go someplace else but I thought it would be good to have one.

@LucaMarconato
Copy link
Member

Thanks @stephenwilliams22! We can review the vignette here, but before merging please move it to the spatialdata-notebooks repo, in this folder.

If you would like we could add the vignette in gallery in the docs.

@stephenwilliams22
Copy link
Collaborator Author

stephenwilliams22 commented Oct 13, 2025

Thanks @stephenwilliams22! We can review the vignette here, but before merging please move it to the spatialdata-notebooks repo, in this folder.

If you would like we could add the vignette in gallery in the docs.

Perfect. moved here scverse/spatialdata-notebooks#152

@stephenwilliams22 stephenwilliams22 marked this pull request as ready for review October 29, 2025 18:58
@stephenwilliams22
Copy link
Collaborator Author

@LucaMarconato tests updated. Let me know what you think!

@LucaMarconato LucaMarconato merged commit 55efc2c into scverse:main Nov 8, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants