Segmenting data
The qim3d
library provides a set of methods for data segmentation.
qim3d.segmentation
qim3d.segmentation.watershed
Apply watershed segmentation to a binary volume.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bin_vol |
ndarray
|
Binary volume to segment. The input should be a 3D binary image where non-zero elements represent the objects to be segmented. |
required |
min_distance |
int
|
Minimum number of pixels separating peaks in the distance transform. Peaks that are too close will be merged, affecting the number of segmented objects. Default is 5. |
5
|
Returns:
Name | Type | Description |
---|---|---|
labeled_vol |
ndarray
|
A 3D array of the same shape as the input |
num_labels |
int
|
The total number of unique objects found in the labeled volume. |
Example
Source code in qim3d/segmentation/_common_segmentation_methods.py
qim3d.segmentation.get_3d_cc
Returns an object (CC) containing the connected components of the input volume. Use plot_cc to visualize the connected components.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image |
ndarray
|
An array-like object to be labeled. Any non-zero values in |
required |
Returns:
Name | Type | Description |
---|---|---|
CC |
CC
|
A ConnectedComponents object containing the connected components and the number of connected components. |