external#
- medicalimageanalysis.utils.image.threshold.external(array, threshold=-250, min_volume=100, only_mask=True, less_than=False)[source]
Identifies the largest connected component in a 3D array (e.g., CT/MRI volume) above or below a threshold, optionally returning its mask, centroid positions per slice, number of external components per slice, and bounding box. Useful for isolating external anatomy or dominant structures.
Examples
>>> import numpy as np >>> from medicalimageanalysis.utils.image.threshold import external >>> mask = external(np.zeros((8, 32, 32), dtype=np.int16), threshold=-250, only_mask=True)