conn_comp
conn_comp(
x,
threshold=0,
cluster_table=True,
local_maxima=True,
local_maxima_dist=15,
connect='26-connect',
*,
mask=None,
two_tailed=False,
)Find connected components in an image.
Identifies and labels spatially connected regions in neuroimaging data, supporting both binary masks and thresholded volumes.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| x | NeuroVol | The image object. | required |
| threshold | float | Threshold defining lower intensity bound for the binary mask. Default is 0. See two_tailed for two-sided thresholding. |
0 |
| cluster_table | bool | Whether to return the cluster statistics table. Default True. | True |
| local_maxima | bool | Whether to compute local maxima within clusters. Default True. | True |
| local_maxima_dist | float | Minimum distance between local maxima in mm. Default 15. | 15 |
| connect | str | Connectivity pattern: “26-connect”, “18-connect”, or “6-connect”. Default “26-connect”. | '26-connect' |
| mask | LogicalNeuroVol, optional (keyword only) | Restrict clustering to voxels where mask is True. When supplied, verify.assert_same_space(x, mask) is invoked first so a foreign-affine mask raises before any clustering. |
None |
| two_tailed | bool, optional (keyword only) | When True, threshold the absolute value (\|x.data\| > threshold) so both positive- and negative-tail clusters survive. peak_value in the cluster table is read back from the original signed data so the sign of each cluster is retained. Default False (one-tailed x.data > threshold, the legacy behaviour). |
False |
Returns
| Name | Type | Description |
|---|---|---|
| ConnCompResult | index (ClusteredNeuroVol), size (NeuroVol), voxels, cluster_table, local_maxima, and provenance (populated with method_name="conn_comp" and the input space + mask hashes). |