get_normalizer¶
- get_normalizer(method_name, stain_matrix=None)[source]¶
Return a
StainNormalizer
with corresponding name.- Parameters:
method_name (str) – Name of stain norm method, must be one of “reinhard”, “custom”, “ruifrok”, “macenko” or “vahadane”.
stain_matrix (
numpy.ndarray
or str or pathlib.Path) – User-defined stain matrix. This must either be a numpy array or a path to either a .csv or .npy file. This is only utilised if using “custom” method name.
- Returns:
An object with base :class:’.StainNormalizer’ as base class.
- Return type:
Examples
>>> from tiatoolbox.tools.stainnorm import get_normalizer >>> norm = get_normalizer('Reinhard') >>> norm.fit(target_img) >>> norm_img = norm.transform(source_img)