AI-Driven Spatial Pathologist via spatho#

Overview#

AI-Driven Spatial Pathologist is an external workflow layer for AI-assisted pathology review around Xenium-scale spatial transcriptomics. The public Python package and CLI are named spatho.

pyXenium treats this as an optional external workflow bridge, not as a new pyXenium.spatho namespace. The goal is to show where pyXenium hands a structured Xenium case to spatho, while keeping the AI workflow implementation in the AI-Driven Spatial Pathologist project.

Relationship to XeniumSlide#

The spatho tutorial workflow is enabled by the same data model pyXenium uses for Xenium I/O and downstream analysis. XeniumSlide keeps the core case components together:

  • a cell table in XeniumSlide.table

  • transcript points in XeniumSlide.points or streaming point_sources

  • cell and nucleus boundaries in XeniumSlide.shapes

  • H&E image metadata in XeniumSlide.images

  • optional bridge conversion through XeniumSlide.to_spatialdata()

This gives AI-Driven Spatial Pathologist a consistent Xenium foundation without duplicating pyXenium readers or storing a large spatho wrapper inside pyXenium.

Minimal setup#

Install spatho separately from pyXenium:

pip install -U spatho

Create a starter workflow JSON for a Xenium case:

spatho init-workflow \
  --organ breast \
  --case-name breast_case_01 \
  --dataset-root /path/to/Xenium_outs \
  --base-pipeline-config /path/to/project/configs/breast_case_01.json \
  --output /path/to/workflows/breast_case_01.json

Check the workflow before running it:

spatho doctor --config /path/to/workflows/breast_case_01.json

Run the workflow:

spatho run --config /path/to/workflows/breast_case_01.json

Backend choices#

spatho can run pathology review through several paths:

  • openai: uses OPENAI_API_KEY for managed OpenAI API calls.

  • pathology_ai_api: calls a local or PDC-hosted pathology-ai HTTP service.

  • heuristic-only mode: runs deterministic smoke checks without AI review calls.

For the full operational tutorial, including local deployment and the Atera WTA breast PDC run, use the upstream documentation:

pyXenium boundary#

pyXenium provides the Xenium data foundation and the reusable XeniumSlide structure. spatho owns the AI-driven spatial pathology workflow, organ packs, pathology review prompts, and optional local pathology-ai backend.

This boundary keeps pyXenium lightweight: no new runtime dependency, no vendored AI workflow code, and no extra pyXenium CLI wrapper are required.