a b/README.md
1
<div align="center">
2
3
# PathAIA
4
5
6
**Simple digital pathology analysis tools.**
7
8
---
9
10
<p align="center">
11
  <a href="#basic-usage">Basic Usage</a> •
12
  <a href="#advanced-features">Advanced features</a> •
13
  <a href="https://linktothedoc.com">Docs</a> •
14
  <a href="#community">Community</a> •
15
  <a href="#license">License</a>
16
</p>
17
18
<!-- DO NOT ADD CONDA DOWNLOADS... README CHANGES MUST BE APPROVED BY EDEN OR WILL -->
19
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pathaia)](https://pypi.org/project/pathaia/)
20
[![PyPI Status](https://badge.fury.io/py/pathaia.svg)](https://badge.fury.io/py/pathaia)
21
[![PyPI Status](https://pepy.tech/badge/pathaia)](https://pepy.tech/project/pathaia)
22
[![codecov](https://codecov.io/gh/ArnaudAbreu/PathAIA/branch/master/graph/badge.svg?token=SE4ZX0LXN6)](https://codecov.io/gh/ArnaudAbreu/PathAIA)
23
[![Documentation Status](https://readthedocs.org/projects/pathaia/badge/?version=latest)](https://pathaia.readthedocs.io/en/latest/?badge=latest)
24
[![license](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/ArnaudABreu/PathAIA/blob/master/LICENSE)
25
26
</div>
27
28
29
---
30
31
## PathAIA aims to standardize and automate most of WSI analysis in digital pathology
32
If you feel like you keep rewriting the same code over and over again when working on Whole Slide Images and you wish there were a nicely integrated library to automate all this, you came to the right place. With PathAIA we aim to create a fast, high level and modular library to work on WSI at scale in order to perform image analysis or to create a well rounded dataset for your machine learning project.
33
34
---
35
36
## Basic Usage
37
38
### Step 0: Install
39
40
Simple installation from PyPI
41
```bash
42
pip install pathaia
43
```
44
45
### Step 1: Import pathaia's patch extraction tool
46
47
```python
48
from pathaia.patches import patchify_folder_hierarchically
49
```
50
51
### Step 2: Define your extraction parameters
52
You can extract at multiple pyramid levels with a hierarchical structure between patches of different levels. You can control pretty much every extraction parameter you like, from patch size to interval between patches or filters to chose which patch to extract. You can also decide whether you want to save patches as png or just extract coordinates in csv.
53
54
```python
55
infolder = "/path/to/input/slide/folder"
56
outfolder = "/path/to/output/patches/folder"
57
top_level = 5
58
low_level = 0
59
psize = 224
60
interval = {"x": 224, "y": 224}
61
silent = list(range(low_level, top_level+1))
62
extensions = [".svs"]
63
recurse = False
64
slide_filters = ["full"]
65
verbose = 2
66
```
67
With these parameters you will find all svs slides that are directly in `infolder` and extract patch coordinates from levels 0 to 5 with a hierarchical structure. No png image will be stored as `silent` lists all levels. Patches will be contiguous with size 224 and will only be extracted from tissue zone that are determined by filtering on slide thumbnails. With `verbose=2` thumbnails of extracted areas are also stored on disk.
68
69
### Step 3: Extract !
70
71
```python
72
patchify_folder_hierarchically(
73
    infolder,
74
    outfolder,
75
    top_level,
76
    low_level,
77
    psize,
78
    interval,
79
    silent=silent,
80
    extensions=extensions,
81
    recurse=recurse,
82
    slide_filters=slide_filters,
83
    verbose=verbose,
84
)
85
```
86
Output csv will look like :
87
|         id         |       parent      |        level       |   x  |   y  |  dx |  dy |
88
|:-----------:|:-------------:|:------------:|:----:|:----:|:---:|:---:|
89
|  Patch identifier  | Parent identifier | int (0, max level) |  int |  int | int | int |
90
|         #1         |        None       |          2         |   0  |   0  | 996 | 996 |
91
|        #1#1        |         #1        |          1         |   0  |   0  | 448 | 448 |
92
|       #1#1#1       |        #1#1       |          0         |   0  |   0  | 224 | 224 |
93
|       #1#1#2       |        #1#1       |          0         |   0  |  224 | 224 | 224 |
94
|         ...        |         ...       |         ...        |  ... |  ... | ... | ... |
95
96
## Advanced features
97
You can use more advanced features to work on slides, most notably using your custom filters. Check [documentation](https://linktothedoc.com) for more info.
98
99
---
100
101
## Community
102
103
The lightning community is maintained by 4 core contributors from [Institut Universitaire du Cancer de Toulouse - Oncopole](https://www.iuct-oncopole.fr/):
104
* [Arnaud Abreu](https://github.com/ArnaudAbreu)
105
* [Pilar Ortega](https://github.com/pilarOrtega)
106
* [Robin Schwob](https://github.com/schwobr)
107
* [Kevin Cortacero](https://github.com/KevinCortacero)
108
109
### Asking for help
110
If you have any questions please:
111
1. [Read the docs](https://pathaia.readthedocs.io/en/latest/index.html).
112
2. [Check existing issues](https://github.com/ArnaudAbreu/PathAIA/issues), or [add a new issue](https://github.com/ArnaudAbreu/PathAIA/issues/new)
113
114
## License
115
116
Please observe the GNU GPL 3.0 license that is listed in this repository.
117
118
## BibTeX
119
If you want to cite the framework feel free to use this.
120
121
```bibtex
122
@article{pathaia2021,
123
  title={PathAIA},
124
  author={Abreu, A and .al},
125
  journal={GitHub. Note: https://github.com/ArnaudAbreu/PathAIA},
126
  volume={3},
127
  year={2021}
128
}
129
```