StainFit#
- class squidpy.experimental.im.StainFit(method, stain_matrix=None, mu=None, sigma=None, white_point=None, max_concentrations=None)[source]#
A fitted stain reference.
Returned by
fit_stain_reference(). Usetransform()to normalize an image to it, ordecompose()to project one onto its stain matrix.- Parameters:
- method
Literal['macenko','vahadane','reinhard'] Fitting method:
"macenko","vahadane", or"reinhard".- stain_matrix
ndarray|None(default:None) Shape
(3, 3)unit-norm matrix in canonical order(H, E, complement). Required for decomposition methods.- mu
ndarray|None(default:None) Shape
(3,)Ruderman Lab channel means. Reinhard only.- sigma
ndarray|None(default:None) Shape
(3,)Ruderman Lab channel standard deviations. Reinhard only.- white_point
ndarray|None(default:None) Shape
(3,)per-channel white-point estimate. Required for decomposition methods (apply consumes it). Forbidden for Reinhard because Reinhard’s color transfer operates in Ruderman Lab and does not model absorbance. There is no universal default; pass an estimate from your data (seeestimate_white_point).- max_concentrations
ndarray|None(default:None) Shape
(2,)reference per-stain (H, E) 99th-percentile concentrations - a fitted characterization of the reference’s staining strength. Decomposition only, and diagnostic: the colour-basisapplytransfers stain colour, not amount, so it does not consume this. Optional; forbidden for Reinhard.
- method
Methods