Skip to content

Commit

Permalink
Docs for datasets (blobs, raccoon) (#674)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaMarconato authored Aug 13, 2024
1 parent 4ccdd55 commit a2c2a4b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
17 changes: 17 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,22 @@ The transformations that can be defined between elements and coordinate systems
assert_elements_dict_are_identical
```

## Datasets

Convenience small datasets

```{eval-rst}
.. currentmodule:: spatialdata.datasets
.. autosummary::
:toctree: generated
blobs
blobs_annotating_element
raccoon
```

## Data format (advanced topic)

The SpatialData format is defined as a set of versioned subclasses of :class:`spatialdata._io.format.SpatialDataFormat`, one per type of element.
Expand Down Expand Up @@ -211,3 +227,4 @@ These classes are useful to ensure backward compatibility whenever a major versi
CurrentTablesFormat
TablesFormatV01
```

16 changes: 14 additions & 2 deletions src/spatialdata/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ def blobs(
Returns
-------
SpatialData
SpatialData object with blobs dataset.
SpatialData object with blobs dataset.
"""
return BlobsDataset(
length=length,
Expand Down Expand Up @@ -355,6 +354,19 @@ def _generate_random_points(self, n: int, bbox: tuple[int, int]) -> list[Point]:


def blobs_annotating_element(name: BlobsTypes) -> SpatialData:
"""
Return the blobs dataset with the desired element annotated by the table.
Parameters
----------
name
Name of the element to annotate. One of "blobs_labels", "blobs_multiscale_labels", "blobs_circles",
"blobs_polygons", "blobs_multipolygons".
Returns
-------
SpatialData object with the desired element annotated by the table.
"""
sdata = blobs(length=50)
if name in ["blobs_labels", "blobs_multiscale_labels"]:
instance_id = get_element_instances(sdata[name]).tolist()
Expand Down

0 comments on commit a2c2a4b

Please sign in to comment.