get_neighbors_map#
- get_neighbors_map(array: ndarray) dict[source]#
Create map of region ids to lists of neighbors.
Each region id is also assigned a group number, where all regions in a given group are simply connected.
- Parameters:
array – Segmentation array.
- Returns:
Map of id to group and neighbor ids.
- get_bounding_box(array: ndarray) tuple[int, int, int, int, int, int][source]#
Find bounding box around array.
Bounds are calculated with a one-voxel border, if possible.
- Parameters:
array – Segmentation array.
- Returns:
The bounding box (xmin, xmax, ymin, ymax, zmin, zmax) indices
- get_cropped_array(array: np.ndarray, label: int, labels: np.ndarray | None = None, *, crop_original: bool) np.ndarray[source]#
Crop array around label region.
- Parameters:
array – Array to crop.
label – Region label.
labels – Array of all region labels.
crop_original – True to crop the original array keeping all labels, False otherwise.
- Returns:
Cropped array.