### Install torchstain Source: https://github.com/eidoslab/torchstain/blob/main/README.md Install the torchstain library using pip. To install with specific backends, use 'torchstain[torch]' or 'torchstain[tf]'. The numpy backend is included by default. ```bash pip install torchstain ``` -------------------------------- ### Macenko Normalization with PyTorch Backend Source: https://github.com/eidoslab/torchstain/blob/main/README.md Example of using the Macenko normalizer with a PyTorch backend. This involves loading target and source images, defining a transformation, fitting the normalizer to the target image, and then normalizing the source image. ```python import torch from torchvision import transforms import torchstain import cv2 target = cv2.cvtColor(cv2.imread("./data/target.png"), cv2.COLOR_BGR2RGB) to_transform = cv2.cvtColor(cv2.imread("./data/source.png"), cv2.COLOR_BGR2RGB) T = transforms.Compose([ transforms.ToTensor(), transforms.Lambda(lambda x: x*255) ]) normalizer = torchstain.normalizers.MacenkoNormalizer(backend='torch') normalizer.fit(T(target)) t_to_transform = T(to_transform) norm, H, E = normalizer.normalize(I=t_to_transform, stains=True) ``` -------------------------------- ### TorchStain BibTeX Citation Source: https://github.com/eidoslab/torchstain/blob/main/README.md BibTeX entry for citing the torchstain software. Includes author, title, month, year, publisher, version, DOI, and URL. ```bibtex @software{barbano2022torchstain, author = {Carlo Alberto Barbano and André Pedersen}, title = {EIDOSLAB/torchstain: v1.2.0-stable}, month = aug, year = 2022, publisher = {Zenodo}, version = {v1.2.0-stable}, doi = {10.5281/zenodo.6979540}, url = {https://doi.org/10.5281/zenodo.6979540} } ``` -------------------------------- ### UniToPatho Dataset BibTeX Citation Source: https://github.com/eidoslab/torchstain/blob/main/README.md BibTeX entry for citing the UniToPatho dataset. Includes title, authors, booktitle, pages, year, and organization. ```bibtex @inproceedings{barbano2021unitopatho, title={UniToPatho, a labeled histopathological dataset for colorectal polyps classification and adenoma dysplasia grading}, author={Barbano, Carlo Alberto and Perlo, Daniele and Tartaglione, Enzo and Fiandrotti, Attilio and Bertero, Luca and Cassoni, Paola and Grangetto, Marco}, booktitle={2021 IEEE International Conference on Image Processing (ICIP)}, pages={76--80}, year={2021}, organization={IEEE} } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.