bio-spatial-transcriptomics-image-analysis
Version Compatibility
Reference examples tested with: squidpy 1.7+, scanpy 1.10+, scikit-image 0.22+, numpy 1.26+, pandas 2.2+, cellpose 4.0+ (CLI tools: Baysor 0.6+, proseg 1.0+)
Before using code patterns, verify installed versions match. If versions differ:
- Python:
pip show <package>thenhelp(module.function)to check signatures
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Image Analysis for Spatial Transcriptomics
"Segment cells from my imaging data" -> Draw cell/nucleus boundaries on an image (or on the transcript point cloud) and assign each molecule to one cell, producing a cell-by-gene matrix.
- Python image-based:
cellpose.models.CellposeModel().eval(), StarDist for nuclei,squidpy.im.segment()(watershed baseline) - CLI transcript-based: Baysor, proseg run on the molecule table (x, y, gene)
"Extract image features for my spots" -> Summarize pixel intensity/texture under each Visium spot (a DIFFERENT operation from segmentation -- no cell boundaries are drawn).
- Python:
squidpy.im.calculate_image_features()(summary, histogram, texture/GLCM)