pub fn label<S, O>(
data: &ArrayBase<S, Ix3>,
structure: &ArrayBase<S, Ix3>,
) -> (Array3<O>, usize)Expand description
Labels features of 3D binary images.
Returns the labels and the number of features.
mask- Binary image to be labeled.falsevalues are considered the background.structure- Structuring element used for the labeling. Must be 3x3x3 (e.g. the result ofKernel3d::generate) and centrosymmetric. The center must betrue.
The return type of label can be specified using turbofish syntax:
// Will use `u16` as the label type
ndarray_ndimage::label::<_, u16>(
&ndarray::Array3::from_elem((100, 100, 100), true),
&ndarray_ndimage::Kernel3d::Star.generate()
);As a rough rule of thumb, the maximum value of the label type should be larger than data.len().
This is the worst case, the exact bound will depend on the kernel used. If the label type overflows
while assigning labels, a panic will occur.