spectral_unmixing.prepare_source_target_for_alphaο
- spectral_unmixing.prepare_source_target_for_alpha(source_volume, target_volume, *, background_percentile=1.0, preprocess_alpha_inputs=True)[source]ο
Convert, optionally background-correct, and clip source and target volumes.
- Parameters:
source_volume, target_volume (array-like) β Matching source and target image volumes. Any matching shape is accepted, for example
ZYXor flattened arrays.background_percentile (float, optional) β Low percentile used to estimate a rough background in each input.
preprocess_alpha_inputs (bool, optional) β If
True, subtract the percentile-based background from each input and clip negative values to zero. IfFalse, the inputs are only converted tofloat32.
- Return type:
tuple[ndarray,ndarray,float,float]- Returns:
tuple β
(source_prepared, target_prepared, source_background, target_background).- Raises:
ValueError β If the input volumes do not share the same shape or are empty.