Skip to content

Commit ded9f7e

Browse files
committed
distributed.rst
1 parent d093f42 commit ded9f7e

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

docs/distributed.rst

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ of the whole dataset.
1111

1212
Built to run on workstations or clusters. Blocks can be run in parallel, in series, or both.
1313
Compute resources (GPUs, CPUs, and RAM) can be arbitrarily partitioned for parallel computing.
14-
Currently workstations (your own machine) and LSF clusters are supported. SLURM clusters are
14+
Currently workstations and LSF clusters are supported. SLURM clusters are
1515
an easy addition - if you need this to run on a SLURM cluster `please post a feature request issue
1616
to the github repository <https://github.com/MouseLand/cellpose/issues>`_ and tag @GFleishman.
1717

@@ -20,6 +20,14 @@ convert your data to a zarr array, but not all formats or situations are covered
2020
good opportunities to submit pull requests. Currently, the module must be run via the Python API,
2121
but making it available in the GUI is another good PR or feature request.
2222

23+
All user facing functions in the module have verbose docstrings that explain inputs and outputs.
24+
You can access these docstrings like this:
25+
26+
.. code-block:: python
27+
28+
from cellpose.contrib.distributed_segmentation import distributed_eval
29+
distributed_eval?
30+
2331
Examples
2432
~~~~~~~~
2533

@@ -94,6 +102,31 @@ Test run a single block before distributing the whole dataset (always a good ide
94102
)
95103
96104
105+
Convert a single large (but still smaller than system memory) tiff image to a zarr array:
106+
107+
.. code-block:: python
108+
109+
# Note full image will be loaded in system memory
110+
import tifffile
111+
from cellpose.contrib.distributed_segmentation import numpy_array_to_zarr
112+
113+
data_numpy = tifffile.imread('/path/to/image.tiff')
114+
data_zarr = numpy_array_to_zarr('/path/to/output.zarr', data_numpy, chunks=(256, 256, 256))
115+
del data_numpy # assumption is data is large, don't keep in memory copy around
116+
117+
118+
Wrap a folder of tiff images/tiles into a single zarr array without duplicating any data:
119+
120+
.. code-block:: python
121+
122+
# Note tiff filenames must indicate the position of each file in the overall tile grid
123+
from cellpose.contrib.distributed_segmentation import wrap_folder_of_tiffs
124+
reconstructed_virtual_zarr_array = wrap_folder_of_tiffs(
125+
filname_pattern='/path/to/folder/of/*.tiff',
126+
block_index_pattern=r'_(Z)(\d+)(Y)(\d+)(X)(\d+)',
127+
)
128+
129+
97130
Run distributed Cellpose on an LSF cluster with 128 GPUs (e.g. Janelia cluster):
98131

99132
.. code-block:: python
@@ -129,3 +162,4 @@ Run distributed Cellpose on an LSF cluster with 128 GPUs (e.g. Janelia cluster):
129162
eval_kwargs=eval_kwargs,
130163
cluster_kwargs=cluster_kwargs,
131164
)
165+

0 commit comments

Comments
 (0)