remove_small_connected_components
Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.
- remove_small_connected_components(label_map: ndarray, roi_mask: ndarray, *, min_component_size: int = 30, connectivity: int = 1, settings: Mapping[str, Any] | None = None) ndarray[source]
Remove tiny connected components by label-wise reassignment in ROI.
- Parameters:
label_map – 3D integer label map where 0 means background.
roi_mask – 3D boolean mask indicating valid ROI.
min_component_size – Minimum voxels required to keep a component.
connectivity – Neighborhood connectivity in
{1, 2, 3}.settings – Optional legacy mapping. When provided,
min_component_sizeandconnectivitymay be overridden from it. Theenabledkey is ignored here; callers that honourenabledmust gate the call themselves (or use the utils facade).
- Returns:
Cleaned label map with reduced tiny fragments.