### Install histocartography via pip Source: https://github.com/biomedsciai/histocartography/blob/main/README.md Recommended installation method using pip. ```bash pip install histocartography ``` -------------------------------- ### Cell Graph explainer Source: https://github.com/biomedsciai/histocartography/blob/main/examples/README.md Generates an explanation (node-level importance scores) using the GraphGradCAM algorithm. ```bash python cell_graph_explainer.py ``` -------------------------------- ### Stain Normalization with Vahadane et al. algorithm Source: https://github.com/biomedsciai/histocartography/blob/main/examples/README.md Applies stain normalization to a set of images using the Vahadane et al. algorithm. A reference image is used to evaluate transformation parameters. ```bash python stain_normalization.py ``` -------------------------------- ### Run unit tests Source: https://github.com/biomedsciai/histocartography/blob/main/README.md Command to run unit tests to ensure proper installation. ```sh python -m unittest discover -s test -p "test_*" -v ``` -------------------------------- ### Clone the repository Source: https://github.com/biomedsciai/histocartography/blob/main/README.md Cloning the histocartography repository for development setup. ```bash git clone https://github.com/histocartography/histocartography.git && cd histocartography ``` -------------------------------- ### Tissue Graph (TG) generation Source: https://github.com/biomedsciai/histocartography/blob/main/examples/README.md Builds a Tissue Graph (TG) from a stained normalized image by extracting tissue regions, extracting deep features for superpixels, and connecting adjacent regions. ```bash python tissue_graph_generation.py ``` -------------------------------- ### Feature cube extraction Source: https://github.com/biomedsciai/histocartography/blob/main/examples/README.md Extracts features on each patch of a set of H&E images, resulting in a feature cube. ```bash python feature_cube_extraction.py ``` -------------------------------- ### Cell Graph (CG) generation Source: https://github.com/biomedsciai/histocartography/blob/main/examples/README.md Generates a Cell Graph (CG) from an H&E stained histology image. This involves extracting nuclei, extracting node features, and building a kNN graph. ```bash python cell_graph_generation.py ``` -------------------------------- ### Directory Structure Source: https://github.com/biomedsciai/histocartography/blob/main/histocartography/preprocessing/README.md Command to display the directory structure of the preprocessing module. ```bash tree -v --charset utf-8 -I '*.egg-info|__pycache__' ``` -------------------------------- ### Running Single Datapoints Source: https://github.com/biomedsciai/histocartography/blob/main/histocartography/preprocessing/README.md Python code to run the preprocessing pipeline for a single datapoint using a configuration file. ```python import yaml from histocartography.preprocessing.pipeline import PipelineRunner with open('PATH_TO_CONFIG', 'r') as file: config = yaml.load(file) pipeline = PipelineRunner(output_path="PATH_TO_OUTPUT", **config) pipeline.precompute() output = pipeline.run(name="IDENTIFIER", input1=INPUT1, input2=INPUT2) ``` -------------------------------- ### Configuration File Structure Source: https://github.com/biomedsciai/histocartography/blob/main/histocartography/preprocessing/README.md Defines the structure for a YAML configuration file to set up the preprocessing pipeline stages, inputs, and outputs. ```yaml inputs: - input1 - input2 - ... outputs: - output1 - output2 - ... stages: - module1: class: class_name1 # (str) class to import from histocartography.preprocessing.module1 inputs: - input1 outputs: - output1 params: # Keyword arguments to histocartography.preprocessing.module1.class_name1.__init__ - module2: class: class_name2 # (str) class to import from histocartography.preprocessing.module2 inputs: - input2 - output1 outputs: - output1 params: # Keyword arguments to histocartography.preprocessing.module2.class_name2.__init__ - ... ``` -------------------------------- ### Create conda environment Source: https://github.com/biomedsciai/histocartography/blob/main/README.md Creating a conda environment using the provided environment.yml file. ```bash conda env create -f environment.yml ``` -------------------------------- ### Running a Whole Batch of Datapoints Source: https://github.com/biomedsciai/histocartography/blob/main/histocartography/preprocessing/README.md Python code to run the preprocessing pipeline for a batch of datapoints using multiprocessing. ```python import yaml from histocartography.preprocessing.pipeline import BatchPipelineRunner with open('PATH_TO_CONFIG', 'r') as file: config = yaml.load(file) pipeline = BatchPipelineRunner(output_path="PATH_TO_OUTPUT", **config) df = BUILD_DF() output = pipeline.run(metadata=df, cores=4) ``` -------------------------------- ### Activate conda environment Source: https://github.com/biomedsciai/histocartography/blob/main/README.md Activating the created conda environment. ```bash conda activate histocartography ``` -------------------------------- ### Citation for histocartography Source: https://github.com/biomedsciai/histocartography/blob/main/docs/api/histocartography.preprocessing.utils.rst This code block provides the citation details for using the histocartography library in projects. ```python @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} } ``` -------------------------------- ### Citation for histocartography Source: https://github.com/biomedsciai/histocartography/blob/main/docs/api/histocartography.ml.layers.dense_gin_layer.rst This code block provides the citation details for using the histocartography library in projects. ```python @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} } ``` -------------------------------- ### Visualizing a cell graph Source: https://github.com/biomedsciai/histocartography/blob/main/README.md This code snippet shows how to visualize a generated cell graph using OverlayGraphVisualization and InstanceImageVisualization from the histocartography.visualization module. ```python from histocartography.visualization import OverlayGraphVisualization, InstanceImageVisualization visualizer = OverlayGraphVisualization( instance_visualizer=InstanceImageVisualization( instance_style="filled+outline" ) ) viz_cg = visualizer.process( canvas=image, graph=cell_graph, instance_map=nuclei_map ) viz_cg.show() ``` -------------------------------- ### Citation for histocartography Source: https://github.com/biomedsciai/histocartography/blob/main/docs/api/histocartography.pipeline.rst This snippet provides the citation format for using the histocartography library in projects. ```python @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} } ``` -------------------------------- ### Citation for histocartography Source: https://github.com/biomedsciai/histocartography/blob/main/docs/api/histocartography.preprocessing.graph_builders.rst This code block provides the citation details for using the histocartography library in projects. ```python @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} } ``` -------------------------------- ### Citation Source: https://github.com/biomedsciai/histocartography/blob/main/docs/api/histocartography.ml.models.base_model.rst Citation for using the histocartography library in projects. ```python @inproceedings{pati2021, t 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} } ``` -------------------------------- ### Add histocartography to Python path Source: https://github.com/biomedsciai/histocartography/blob/main/README.md Adding the cloned histocartography directory to the PYTHONPATH for development. ```bash export PYTHONPATH="/histocartography:$PYTHONPATH" ``` -------------------------------- ### Citation for histocartography Source: https://github.com/biomedsciai/histocartography/blob/main/docs/api/histocartography.ml.layers.mlp.rst This code block provides the citation details for using the histocartography library in projects. ```python @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} } ``` -------------------------------- ### Building a cell-graph from an H&E image Source: https://github.com/biomedsciai/histocartography/blob/main/README.md This code snippet demonstrates how to use the NucleiExtractor, DeepFeatureExtractor, and KNNGraphBuilder from the histocartography.preprocessing module to generate a cell graph from an H&E image. ```python from histocartography.preprocessing import NucleiExtractor, DeepFeatureExtractor, KNNGraphBuilder nuclei_detector = NucleiExtractor() feature_extractor = DeepFeatureExtractor(architecture='resnet34', patch_size=72) knn_graph_builder = KNNGraphBuilder(k=5, thresh=50, add_loc_feats=True) image = np.array(Image.open('docs/_static/283_dcis_4.png')) nuclei_map, _ = nuclei_detector.process(image) features = feature_extractor.process(image, nuclei_map) cell_graph = knn_graph_builder.process(nuclei_map, features) ``` -------------------------------- ### HistoCartography Citation Source: https://github.com/biomedsciai/histocartography/blob/main/README.md BibTeX entry for citing the HistoCartography toolkit. ```bibtex @inproceedings{jaume2021, title = {HistoCartography: A Toolkit for Graph Analytics in Digital Pathology}, author = {Guillaume Jaume, Pushpak Pati, Valentin Anklin, Antonio Foncubierta, Maria Gabrani}, booktitle={MICCAI Workshop on Computational Pathology}, pages={117--128}, year = {2021} } @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 = {Medical Image Analysis (MedIA)}, volume={75}, pages={102264}, year = {2021} } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.