spectral_unmixing.make_alpha_maskο
- spectral_unmixing.make_alpha_mask(source, target=None, *, signal_percentile=99.0, target_low_percentile=None, min_voxels=16)[source]ο
Create a robust mask for alpha estimation.
- Parameters:
source (array-like) β Prepared source intensities used to define the bright-source mask.
target (array-like or None, optional) β Optional prepared target intensities used to additionally constrain the mask to low-target voxels.
signal_percentile (float, optional) β Source percentile above which voxels are considered signal-rich.
target_low_percentile (float or None, optional) β If provided, only voxels at or below this target percentile are kept, unless that mask would become too small and the source-only fallback is used instead.
min_voxels (int, optional) β Minimum number of voxels required for a valid estimation mask.
- Return type:
tuple[ndarray,dict]- Returns:
tuple β
(mask, details)wheremaskis a boolean array anddetailsis a metadata dictionary describing thresholds, fallback behavior, and voxel counts.