@@ -254,18 +254,21 @@ def connected_components(
254254 binary_image:bool = False ,
255255) -> np.ndarray:
256256 """
257- Connected components applied to 3D images with
258- handling for multiple labels .
259-
257+ Connected components applied to 2D or 3D images.
258+ Images may be binary , multivalued , or continuously valued .
259+
260260 Required:
261- data: Input weights in a 2D or 3D numpy array.
261+ data: Input weights in a 2D or 3D numpy or pytorch array.
262262 Optional:
263- max_labels (int ): save memory by predicting the maximum
264- number of possible labels that might be output.
265- Defaults to number of voxels.
263+ max_labels (deprecated ): This parameter formerly saved memory
264+ by predicting the maximum number of possible labels that
265+ might be output, but created a risk of a segfault if you picked
266+ too low. More reliable methods have been available for
267+ some time so this parameter is now disconnected from
268+ doing anything.
266269 connectivity (int ):
267270 For 3 D images, 6 (voxel faces), 18 (+ edges), or 26 (+ corners)
268- If the input image is 2 D, you may specify 4 (pixel faces ) or
271+ If the input image is 2 D, you may specify 4 (pixel edges ) or
269272 8 (+ corners).
270273 return_N (bool ): if True , also return the number of connected components
271274 as the second argument of a return tuple .
@@ -280,10 +283,13 @@ def connected_components(
280283 out_file: If specified, the output array will be an mmapped
281284 file . Can be a file - name or a file - like object .
282285 periodic_boundary: the boundary edges wrap around
286+ Only supported for 4 ,8 , and 6 connected images.
283287 binary_image: if True , regardless of the input type ,
284288 treat as a binary image (foreground > 0 , background == 0 ).
285289 Certain inputs will always be treated as a binary
286290 image (e.g. bool dtype, delta == max int or max float etc.).
291+ Certain optimizations are available for binary images that
292+ are not possible for multivalued images.
287293
288294 let OUT = 1 D, 2 D or 3 D numpy array remapped to reflect
289295 the connected components sequentially numbered from 1 to N.
0 commit comments