histocartography.preprocessing.tissue_mask module¶
Summary¶
Classes:
Helper class to extract tissue mask from images |
|
Functions:
Get binary tissue mask |
- get_tissue_mask(image: numpy.ndarray, n_thresholding_steps: int = 1, sigma: float = 0.0, min_size: int = 500) → Tuple[numpy.ndarray, numpy.ndarray][source]¶
Get binary tissue mask
- Parameters
image (np.ndarray) – (m, n, 3) nd array of thumbnail RGB image or (m, n) nd array of thumbnail grayscale image
n_thresholding_steps (int, optional) – number of gaussian smoothign steps. Defaults to 1.
sigma (float, optional) – sigma of gaussian filter. Defaults to 0.0.
min_size (int, optional) – minimum size (in pixels) of contiguous tissue regions to keep. Defaults to 500.
- Returns
- np int32 array
each unique value represents a unique tissue region
- np bool array
largest contiguous tissue region.
- Return type
Tuple[np.ndarray, np.ndarray]
- class TissueMask(save_path: Union[None, str, pathlib.Path] = None, precompute: bool = True, link_path: Union[None, str, pathlib.Path] = None, precompute_path: Union[None, str, pathlib.Path] = None)[source]¶
Bases:
histocartography.pipeline.PipelineStep
- precompute(link_path: Union[None, str, pathlib.Path] = None, precompute_path: Union[None, str, pathlib.Path] = None) → None[source]¶
Precompute all necessary information
- Parameters
link_path (Union[None, str, Path], optional) – Path to link to. Defaults to None.
precompute_path (Union[None, str, Path], optional) – Path to save precomputation outputs. Defaults to None.
- class GaussianTissueMask(n_thresholding_steps: int = 1, sigma: int = 20, min_size: int = 10, kernel_size: int = 20, dilation_steps: int = 1, background_gray_value: int = 228, downsampling_factor: int = 4, **kwargs)[source]¶
Bases:
histocartography.preprocessing.tissue_mask.TissueMask
Helper class to extract tissue mask from images
- __init__(n_thresholding_steps: int = 1, sigma: int = 20, min_size: int = 10, kernel_size: int = 20, dilation_steps: int = 1, background_gray_value: int = 228, downsampling_factor: int = 4, **kwargs) → None[source]¶
- Parameters
n_thresholding_steps (int, optional) – Number of gaussian smoothing steps. Defaults to 1.
sigma (int, optional) – Sigma of gaussian filter. Defaults to 20.
min_size (int, optional) – Minimum size (in pixels) of contiguous tissue regions to keep. Defaults to 10.
kernel_size (int, optional) – Dilation kernel size. Defaults to 20.
dilation_steps (int, optional) – Number of dilation steps. Defaults to 1.
background_gray_value (int, optional) – Gray value of background pixels (usually high). Defaults to 228.
downsampling_factor (int, optional) – Downsampling factor from the input image resolution. Defaults to 4.
Reference¶
If you use histocartography in your projects, please cite the following:
@inproceedings{pati2021,
title = {Hierarchical Graph Representations for Digital Pathology},
author = {Pushpak Pati, Guillaume Jaume, Antonio Foncubierta, Florinda Feroce, Anna Maria Anniciello, Giosuè Scognamiglio, Nadia Brancati, Maryse Fiche, Estelle Dubruc, Daniel Riccio, Maurizio Di Bonito, Giuseppe De Pietro, Gerardo Botti, Jean-Philippe Thiran, Maria Frucci, Orcun Goksel, Maria Gabrani},
booktitle = {https://arxiv.org/pdf/2102.11057},
year = {2021}
}