https://github.com/biomedsciai/histocartography
A standardized Python API with necessary preprocessing, machine learning and explainability tools to facilitate graph-analytics in computational pathology.
Science Score: 33.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
✓Committers with academic emails
1 of 12 committers (8.3%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (19.0%) to scientific vocabulary
Keywords
Repository
A standardized Python API with necessary preprocessing, machine learning and explainability tools to facilitate graph-analytics in computational pathology.
Basic Info
Statistics
- Stars: 258
- Watchers: 5
- Forks: 59
- Open Issues: 22
- Releases: 10
Topics
Metadata Files
README.md
Welcome to the histocartography repository! histocartography is a python-based library designed to facilitate the development of graph-based computational pathology pipelines. The library includes plug-and-play modules to perform,
- standard histology image pre-processing (e.g., stain normalization, nuclei detection, tissue detection)
- entity-graph representation building (e.g. cell graph, tissue graph, hierarchical graph)
- modeling Graph Neural Networks (e.g. GIN, PNA)
- feature attribution based graph interpretability techniques (e.g. GraphGradCAM, GraphGradCAM++, GNNExplainer)
- visualization tools
All the functionalities are grouped under a user-friendly API.
If you encounter any issue or have questions regarding the library, feel free to open a GitHub issue. We'll do our best to address it.
Installation
PyPI installer (recommended)
pip install histocartography
Development setup
- Clone the repo:
git clone https://github.com/histocartography/histocartography.git && cd histocartography
- Create a conda environment:
conda env create -f environment.yml
NOTE: To use GPUs, install GPU compatible Pytorch, Torchvision and DGL packages according to your OS, package manager, and CUDA.
- Activate it:
conda activate histocartography
- Add
histocartographyto your python path:
export PYTHONPATH="<PATH>/histocartography:$PYTHONPATH"
Tests
To ensure proper installation, run unit tests as:
sh
python -m unittest discover -s test -p "test_*" -v
Running tests on cpu can take up to 20mn.
Using histocartography
The histocartography library provides a set of helpers grouped in different modules, namely preprocessing, ml, visualization and interpretability.
For instance, in histocartography.preprocessing, building a cell-graph from an H&E image is as simple as:
```
from histocartography.preprocessing import NucleiExtractor, DeepFeatureExtractor, KNNGraphBuilder
nucleidetector = NucleiExtractor() featureextractor = DeepFeatureExtractor(architecture='resnet34', patchsize=72) knngraphbuilder = KNNGraphBuilder(k=5, thresh=50, addloc_feats=True)
image = np.array(Image.open('docs/static/283dcis4.png')) nucleimap, _ = nucleidetector.process(image) features = featureextractor.process(image, nucleimap) cellgraph = knngraphbuilder.process(nuclei_map, features) ```
The output can be then visualized with:
```
from histocartography.visualization import OverlayGraphVisualization, InstanceImageVisualization
visualizer = OverlayGraphVisualization( ... instancevisualizer=InstanceImageVisualization( ... instancestyle="filled+outline" ... ) ... ) vizcg = visualizer.process( ... canvas=image, ... graph=cellgraph, ... instancemap=nucleimap ... ) viz_cg.show() ```
A list of examples to discover the capabilities of the histocartography library is provided in examples. The examples will show you how to perform:
- stain normalization with Vahadane or Macenko algorithm
- cell graph generation to transform an H&E image into a graph-based representation where nodes encode nuclei and edges nuclei-nuclei interactions. It includes: nuclei detection based on HoverNet pretrained on PanNuke dataset, deep feature extraction and kNN graph building.
- tissue graph generation to transform an H&E image into a graph-based representation where nodes encode tissue regions and edges tissue-to-tissue interactions. It includes: tissue detection based on superpixels, deep feature extraction and RAG graph building.
- feature cube extraction to extract deep representations of individual patches depicting the image
- cell graph explainer to generate an explanation to highlight salient nodes. It includes inference on a pretrained CG-GNN model followed by GraphGradCAM explainer.
A tutorial with detailed descriptions and visualizations of some of the main functionalities is provided here as a notebook.
External Ressources
Learn more about GNNs
- We have prepared a gentle introduction to Graph Neural Networks. In this tutorial, you can find slides, notebooks and a set of reference papers.
- For those of you interested in exploring Graph Neural Networks in depth, please refer to this content or this one.
Papers already using this library
- Hierarchical Graph Representations for Digital Pathology, Pati et al., Medical Image Analysis, 2021. [pdf] [code]
- Quantifying Explainers of Graph Neural Networks in Computational Pathology, Jaume et al., CVPR, 2021. [pdf] [code]
- Learning Whole-Slide Segmentation from Inexact and Incomplete Labels using Tissue Graphs, Anklin et al., MICCAI, 2021. [pdf] [code]
If you use this library, please consider citing:
``` @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} } ```
Owner
- Name: BiomedSciAI
- Login: BiomedSciAI
- Kind: organization
- Repositories: 6
- Profile: https://github.com/BiomedSciAI
GitHub Events
Total
- Watch event: 21
- Issue comment event: 5
- Fork event: 2
Last Year
- Watch event: 21
- Issue comment event: 5
- Fork event: 2
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Guillaume Jaume | g****a@z****m | 617 |
| Valentin Anklin | A****V@z****m | 568 |
| Antonio Foncubierta Rodriguez | f****a@z****m | 236 |
| guillaumjaume | g****e@e****h | 154 |
| Lauren | f****d@z****m | 57 |
| pus | p****s@z****m | 53 |
| Sonali | s****n@g****m | 25 |
| Pushpak Pati | p****l@g****m | 14 |
| Kevin Thandiackal | k****l@g****m | 13 |
| Lauren Alisha Fernandes | f****d@m****m | 5 |
| sam-zurich | s****m@z****m | 2 |
| Patricio Astudillo | p****o@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 37
- Total pull requests: 22
- Average time to close issues: 4 months
- Average time to close pull requests: 1 day
- Total issue authors: 32
- Total pull request authors: 9
- Average comments per issue: 1.7
- Average comments per pull request: 0.14
- Merged pull requests: 16
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- Ramxnan (3)
- hossam-zaki (2)
- CarlinLiao (2)
- akhila1729 (2)
- Extord1108 (1)
- yangyang117 (1)
- sina1303 (1)
- Abbas009 (1)
- VolodymyrChapman (1)
- PeterrHH (1)
- spencerkrichevsky (1)
- JiangWenJie-stack (1)
- jiaqiwu1999 (1)
- Parisa-Boodaghi (1)
- WxpHB (1)
Pull Request Authors
- afoncubierta (7)
- guillaumejaume (4)
- kevthan (4)
- ChrisBtt (1)
- amirkasaei (1)
- patricio-astudillo (1)
- crobbins327 (1)
- kaczmarj (1)
- PushpakPati (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- PyYAML >=5.1.2
- dgl ==0.4.3.post2
- h5py >=2.9.0
- matplotlib >=3.1.1
- opencv-python >=3.4.8.29
- pandas >=0.24.2
- pillow >=7.2.0
- scikit-image >=0.17.2
- scikit-learn >=0.22
- seaborn >=0.9.0
- torch ==1.3.1
- torchvision ==0.4.0
- tqdm >=4.35.0
- pip
- python 3.9