Skip to content

Commit 51bb983

Browse files
LucaMarconatoclaude
andcommitted
fix: improve steinbock docstring accuracy and RST formatting
- Move notes into a proper NumPy `Notes` section (fixes RST render) - Fix typos: andata→anndata, adviced→advised - Correct adata.obs.images→adata.obs.image (verified from source) - Replace plain URL with RST hyperlink syntax - Clarify that only one masks dir is used at a time (controlled by labels_kind) - Specify *.ome.tiff image format (from SteinbockKeys.IMAGE_SUFFIX) - Explain the images.csv/--info mechanism with required columns and correct link to file types docs instead of preprocessing docs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7811298 commit 51bb983

2 files changed

Lines changed: 25 additions & 18 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ __pycache__/
3434
_version.py
3535
node_modules/
3636
.code-workspace
37+
.asv/
38+
uv.lock
3739

3840
# test datasets (e.g. Xenium ones)
3941
data/

src/spatialdata_io/readers/steinbock.py

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,6 @@ def steinbock(
3333
3434
- `Steinbock pipeline <https://bodenmillergroup.github.io/steinbock/latest/>`_.
3535
36-
Current mandatory outputs of the Steinbock toolkit
37-
----------
38-
- one comprehensive anndata object labeled as 'cells.h5ad' in the main working directory
39-
- an 'ome' folder containing the steinbock ome.tiff exported tiff images
40-
- masks directory labeled as either 'masks_deepcell' or 'masks_ilastik'
41-
42-
Users have to carefully construct the andata object with steinbock using the images.csv table.
43-
Constructing the anndata object without the images.csv table will leave the anndata without
44-
'adata.obs.images' which will subsequently result in an error (see line 99)
45-
Therefore, currently users are adviced to start their steinbock analyses from .mcd files.
46-
A possible workaround for this would be to handcraft the images.csv table according to steinbock format
47-
if users want to start from tiff images in steinbock
48-
(https://bodenmillergroup.github.io/steinbock/latest/cli/preprocessing/)
49-
50-
The andata tables, masks and ome.tiffs have to be named accordingly so the
51-
spatialdata.io steinbock reader correctly assigns all instances.
52-
53-
5436
Parameters
5537
----------
5638
path
@@ -65,6 +47,29 @@ def steinbock(
6547
Returns
6648
-------
6749
:class:`spatialdata.SpatialData`
50+
51+
Notes
52+
-----
53+
Mandatory outputs of the Steinbock pipeline required by this reader:
54+
55+
- ``cells.h5ad``: the AnnData object in the main working directory
56+
- ``ome/``: directory containing the steinbock OME-TIFF images (``*.ome.tiff``)
57+
- ``masks_deepcell/`` or ``masks_ilastik/``: the masks directory, selected via the
58+
``labels_kind`` parameter (only one is used at a time)
59+
60+
When exporting to AnnData with ``steinbock export anndata``, the ``--info`` option
61+
(default: ``images.csv``) controls whether image metadata is embedded. When present,
62+
steinbock copies the ``image`` column from ``images.csv`` into ``adata.obs.image`` for
63+
every cell; this reader requires that column to map cells to their source image. Without
64+
it, ``adata.obs.image`` will not exist and the reader will fail. ``images.csv`` is
65+
generated automatically by ``steinbock preprocess imc images`` when starting from
66+
``.mcd`` files. Users who start from TIFF images must hand-craft ``images.csv`` with at
67+
least the columns ``image``, ``width_px``, ``height_px``, and ``num_channels`` as
68+
described in the
69+
`Steinbock file types documentation <https://bodenmillergroup.github.io/steinbock/latest/file-types/>`_.
70+
71+
All AnnData tables, masks, and OME-TIFFs must follow the steinbock naming conventions so
72+
that the reader can correctly match all instances.
6873
"""
6974
path = Path(path)
7075

0 commit comments

Comments
 (0)