Skip to content

Commit 15dd676

Browse files
author
Tony Tung
authored
Fix docs build (#1696)
- Added top-level .rst files for a bunch of packages/modules that should be autodoc'ed. - Fixed places where things didn't generate correctly. - Added top-level constructs to starfish.morphology - Fixed inadvertent copy-pasta in `starfish/core/types/_constants.py` Test plan: make docs-html lint mypy
1 parent 5bccfd8 commit 15dd676

File tree

10 files changed

+89
-22
lines changed

10 files changed

+89
-22
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.. _binary_mask:
2+
3+
BinaryMaskCollection
4+
====================
5+
6+
.. autoclass:: starfish.morphology.BinaryMaskCollection
7+
:members:

docs/source/api/data_structures/index.rst

+6
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,9 @@ serialization for use in single-cell analysis environments such as Seurat_ and S
5959

6060
.. toctree::
6161
decoded_intensity_table.rst
62+
63+
.. toctree::
64+
binary_mask.rst
65+
66+
.. toctree::
67+
label_image.rst
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.. _label_image:
2+
3+
LabelImage
4+
==========
5+
6+
.. autoclass:: starfish.morphology.LabelImage
7+
:members:

docs/source/api/index.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ API
1818
.. toctree::
1919
spots/index.rst
2020

21+
.. toctree::
22+
morphology/index.rst
23+
2124
.. toctree::
2225
types/index.rst
2326

@@ -28,4 +31,4 @@ API
2831
utils/index.rst
2932

3033
.. toctree::
31-
datasets/index.rst
34+
datasets/index.rst

docs/source/api/morphology/index.rst

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.. _morphology:
2+
3+
Morphology Transformations
4+
==========================
5+
6+
starfish provides a variety of methods to perform transformations on morphological data. These include :py:class:`~starfish.morphology.Binarize`, which transform image data into morphological data and
7+
:py:class:`~starfish.morphology.Filter`, which performs filtering operations on morphological data.
8+
9+
10+
.. _binarize:
11+
12+
Binarize
13+
--------
14+
15+
Binarizing operations can be imported using ``starfish.morphology.Binarize``, which registers all classes that subclass :py:class:`~starfish.morphology.Binarize.BinarizeAlgorithm`:
16+
17+
.. code-block:: python
18+
19+
from starfish.morphology import Binarize
20+
21+
.. automodule:: starfish.morphology.Binarize
22+
:members:
23+
24+
.. _morphological_filter:
25+
26+
Filter
27+
------
28+
29+
Filtering operations can be imported using ``starfish.morphology.Filter``, which registers all classes that subclass :py:class:`~starfish.morphology.Filter.FilterAlgorithm`:
30+
31+
.. code-block:: python
32+
33+
from starfish.morphology import Filter
34+
35+
.. automodule:: starfish.morphology.Filter
36+
:members:

docs/source/api/types/index.rst

+10-2
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,17 @@ detected spots.
6262
:members:
6363

6464
Clip
65-
_____
65+
----
66+
67+
Clip is deprecated in favor of :py:class:`~starfish.types.Levels`.
6668

67-
.. autoclass:: starfish.core.types.Clip
69+
.. autoclass:: starfish.types.Clip
6870
:members:
6971
:undoc-members:
7072

73+
Levels
74+
------
75+
76+
.. autoclass:: starfish.types.Levels
77+
:members:
78+
:undoc-members:

starfish/core/morphology/binary_mask/binary_mask.py

+9-13
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ class BinaryMaskCollection:
4848
----------
4949
pixel_ticks : Union[Mapping[Axes, ArrayLike[int]], Mapping[str, ArrayLike[int]]]
5050
A map from the axis to the values for that axis.
51-
physical_ticks : Union[Mapping[Coordinates, ArrayLike[Number]],
52-
Mapping[str, ArrayLike[Number]]
51+
physical_ticks : Union[Mapping[Coordinates, ArrayLike[Number]], Mapping[str, ArrayLike[Number]]
5352
A map from the physical coordinate type to the values for axis. For 2D label images,
5453
X and Y physical coordinates must be provided. For 3D label images, Z physical
5554
coordinates must also be provided.
@@ -280,22 +279,20 @@ def from_binary_arrays_and_ticks(
280279
the smallest size that contains the non-zero values, but pixel and physical coordinates
281280
ticks are retained. Masks extracted from BinaryMaskCollections will be cropped. To extract
282281
masks sized to the original label image, use
283-
:py:meth:`starfish.BinaryMaskCollection.uncropped_mask`.
284-
282+
:py:meth:`starfish.morphology.BinaryMaskCollection.uncropped_mask`.
285283
286284
Parameters
287285
----------
288286
arrays : Sequence[np.ndarray]
289287
A set of 2D or 3D binary arrays. The ordering of the axes must be Y, X for 2D images
290288
and ZPLANE, Y, X for 3D images. The arrays must have identical sizes and match the
291289
sizes of pixel_ticks and physical_ticks.
292-
pixel_ticks : Optional[Union[Mapping[Axes, ArrayLike[int]],
293-
Mapping[str, ArrayLike[int]]]]
290+
pixel_ticks : Optional[Union[Mapping[Axes, ArrayLike[int]], Mapping[str, ArrayLike[int]]]]
294291
A map from the axis to the values for that axis. For any axis that exist in the array
295292
but not in pixel_ticks, the pixel coordinates are assigned from 0..N-1, where N is
296293
the size along that axis.
297-
physical_ticks : Union[Mapping[Coordinates, ArrayLike[Number]],
298-
Mapping[str, ArrayLike[Number]]]
294+
physical_ticks : Union[Mapping[Coordinates, ArrayLike[Number]], Mapping[str,
295+
ArrayLike[Number]]]
299296
A map from the physical coordinate type to the values for axis. For 2D label images,
300297
X and Y physical coordinates must be provided. For 3D label images, Z physical
301298
coordinates must also be provided.
@@ -408,20 +405,19 @@ def from_label_array_and_ticks(
408405
the smallest size that contains the non-zero values, but pixel and physical coordinates
409406
ticks are retained. Masks extracted from BinaryMaskCollections will be cropped. To extract
410407
masks sized to the original label image, use
411-
:py:meth:`starfish.BinaryMaskCollection.uncropped_mask`.
408+
:py:meth:`starfish.morphology.BinaryMaskCollection.uncropped_mask`.
412409
413410
Parameters
414411
----------
415412
array : np.ndarray
416413
A 2D or 3D array containing the labels. The ordering of the axes must be Y, X for 2D
417414
images and ZPLANE, Y, X for 3D images.
418-
pixel_ticks : Optional[Union[Mapping[Axes, ArrayLike[int]],
419-
Mapping[str, ArrayLike[int]]]]
415+
pixel_ticks : Optional[Union[Mapping[Axes, ArrayLike[int]], Mapping[str, ArrayLike[int]]]]
420416
A map from the axis to the values for that axis. For any axis that exist in the array
421417
but not in pixel_ticks, the pixel coordinates are assigned from 0..N-1, where N is
422418
the size along that axis.
423-
physical_ticks : Union[Mapping[Coordinates, ArrayLike[Number]],
424-
Mapping[str, ArrayLike[Number]]]
419+
physical_ticks : Union[Mapping[Coordinates, ArrayLike[Number]], Mapping[str,
420+
ArrayLike[Number]]]
425421
A map from the physical coordinate type to the values for axis. For 2D label images,
426422
X and Y physical coordinates must be provided. For 3D label images, Z physical
427423
coordinates must also be provided.

starfish/core/morphology/label_image/label_image.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,12 @@ def from_label_array_and_ticks(
7272
array : np.ndarray
7373
A 2D or 3D array containing the labels. The ordering of the axes must be Y, X for 2D
7474
images and ZPLANE, Y, X for 3D images.
75-
pixel_ticks : Optional[Union[Mapping[Axes, ArrayLike[int]],
76-
Mapping[str, ArrayLike[int]]]]
75+
pixel_ticks : Optional[Union[Mapping[Axes, ArrayLike[int]], Mapping[str, ArrayLike[int]]]]
7776
A map from the axis to the values for that axis. For any axis that exist in the array
7877
but not in pixel_coordinates, the pixel coordinates are assigned from 0..N-1, where N is
7978
the size along that axis.
80-
physical_ticks : Union[Mapping[Coordinates, ArrayLike[Number]],
81-
Mapping[str, ArrayLike[Number]]]
79+
physical_ticks : Union[Mapping[Coordinates, ArrayLike[Number]], Mapping[str,
80+
ArrayLike[Number]]]
8281
A map from the physical coordinate type to the values for axis. For 2D label images,
8382
X and Y physical coordinates must be provided. For 3D label images, Z physical
8483
coordinates must also be provided.

starfish/core/types/_constants.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class Levels(AugmentedEnum):
120120
SCALE_BY_CHUNK = 'scale_by_chunk'
121121
"""Rescale the intensity of an image chunk by the peak intensity. Note that if the peak
122122
intensity of an image chunk is not saturated, this behaves differently than
123-
Clip.SCALE_BY_IMAGE."""
123+
Clip.SCALE_BY_CHUNK."""
124124

125125

126126
class TransformType(AugmentedEnum):

starfish/morphology.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
from starfish.core.morphology import Filter # noqa: F401
1+
from starfish.core.morphology import ( # noqa: F401
2+
Binarize,
3+
Filter,
4+
)
5+
from starfish.core.morphology.binary_mask import BinaryMaskCollection # noqa: F401
6+
from starfish.core.morphology.label_image import LabelImage # noqa: F401

0 commit comments

Comments
 (0)