Adds distributed connected components utility for N5 datasets.
The algorithm is inspired by synapse counting method and @davidackerman's connected components implementation for cosem: in the first pass the components are labeled in each block separately, then touching components are merged across the blocks.
The startup scripts are available for cluster and local use and are named n5-connected-components.py.
Input dataset is treated as a binary mask by default (all input values input > 0 are included in the mask).
There is also an optional parameter -t / --threshold that specifies the min input value to be included in the mask. If it's set, the condition for the binary mask will be input >= threshold.
There are two types of neighborhood shape that change how pixels are grouped into components:
Diamond (default): only direct neighbors are considered (4-neighborhood in 2D, 6-neighborhood in 3D).
Box: diagonal pixels are considered as well (8-neighborhood in 2D, 26-neighborhood in 3D). It can be used to decrease the number of trivial components. (-s box / --shape box)
There is an option of filtering resulting connected components by their size (in pixels). The minimum size can be specified with -m / --minSize, and all components that contain fewer pixels will be discarded from the result. It could also be useful for minimizing the number of trivial components. By default there is no filtering, so all components are kept.
Block size and compression of the output dataset will be the same as the input dataset by default, but they can be overridden with the optional parameters.
It can be also used together with paintera-conversion-helper to convert a raw dataset into a paintera-compatible multiscale label source.
Adds distributed connected components utility for N5 datasets.
The algorithm is inspired by synapse counting method and @davidackerman's connected components implementation for cosem: in the first pass the components are labeled in each block separately, then touching components are merged across the blocks.
The startup scripts are available for cluster and local use and are named
n5-connected-components.py
.input > 0
are included in the mask).-t
/--threshold
that specifies the min input value to be included in the mask. If it's set, the condition for the binary mask will beinput >= threshold
.-s box
/--shape box
)-m
/--minSize
, and all components that contain fewer pixels will be discarded from the result. It could also be useful for minimizing the number of trivial components. By default there is no filtering, so all components are kept.It can be also used together with paintera-conversion-helper to convert a raw dataset into a paintera-compatible multiscale label source.