|
a |
|
b/README.md |
|
|
1 |
# MediAug |
|
|
2 |
|
|
|
3 |
## Overview |
|
|
4 |
|
|
|
5 |
MediAug is a set of tools for data augmentation of histology |
|
|
6 |
slides. It is primaraly developed for cervical cancer by |
|
|
7 |
augmenting Pap smear slides. However, it can be extended to |
|
|
8 |
any cell data that has an image and mask of different types of |
|
|
9 |
cells. Currently supports general image augmentation techniques |
|
|
10 |
as well as specialized ones like cell insertion and blending. |
|
|
11 |
|
|
|
12 |
 |
|
|
13 |
|
|
|
14 |
## Installation |
|
|
15 |
|
|
|
16 |
To install: |
|
|
17 |
|
|
|
18 |
```bash |
|
|
19 |
$ git clone https://github.com/smwade/MediAug |
|
|
20 |
$ python setup.py install |
|
|
21 |
``` |
|
|
22 |
|
|
|
23 |
## Datasets |
|
|
24 |
|
|
|
25 |
There are two main open datasets for Pap smear images and MediAug is able to support both. |
|
|
26 |
|
|
|
27 |
### SMEAR |
|
|
28 |
|
|
|
29 |
The SMEAR dataset is 917 indavidual cells. They are segmented by nucleus and cytoplasm. |
|
|
30 |
|
|
|
31 |
<https://mde-lab.aegean.gr/downloads> |
|
|
32 |
|
|
|
33 |
### SPIaKMeD |
|
|
34 |
|
|
|
35 |
The SIPaKMeD Database consists of 4049 images of isolated cells that have been manually cropped from 966 cluster cell images of Pap smear slides. These images were acquired through a CCD camera adapted to an optical microscope. The cell images are divided into five categories containing normal, abnormal and benign cells. |
|
|
36 |
|
|
|
37 |
<http://cs.uoi.gr/~marina/sipakmed.html> |
|
|
38 |
|
|
|
39 |
|
|
|
40 |
## Custom Dataset |
|
|
41 |
|
|
|
42 |
The data pipeline can work with other datasets besides SIPaKMed and SMEAR. In order to |
|
|
43 |
use another, you must convert the data to the correct format. |
|
|
44 |
|
|
|
45 |
``` |
|
|
46 |
slides/ |
|
|
47 |
metaplastic/ |
|
|
48 |
image/ |
|
|
49 |
mask/ |
|
|
50 |
parabasal/ |
|
|
51 |
image/ |
|
|
52 |
mask/ |
|
|
53 |
... |
|
|
54 |
``` |
|
|
55 |
|
|
|
56 |
And for cells: |
|
|
57 |
|
|
|
58 |
``` |
|
|
59 |
cells/ |
|
|
60 |
metaplastic/ |
|
|
61 |
image/ |
|
|
62 |
mask/ |
|
|
63 |
parabasal/ |
|
|
64 |
image/ |
|
|
65 |
mask/ |
|
|
66 |
... |
|
|
67 |
``` |
|
|
68 |
|
|
|
69 |
## Notebooks |
|
|
70 |
|
|
|
71 |
To show the library in action there are several notebooks that address key aspects of the library, such as what is a dataset, using Operations, and creating a Pipeline. These are found in `notebooks/` |
|
|
72 |
|
|
|
73 |
## CLI |
|
|
74 |
|
|
|
75 |
MediAug comes with a CLI with useful scripts. These include: |
|
|
76 |
|
|
|
77 |
* generate-augment-dataset |
|
|
78 |
* prepare-pix2pix-images |
|
|
79 |
* resize-images |
|
|
80 |
|
|
|
81 |
The list of all can be seen with the command |
|
|
82 |
|
|
|
83 |
```bash |
|
|
84 |
$ mediaug --help |
|
|
85 |
``` |
|
|
86 |
|
|
|
87 |
### Generate cell augmented dataset |
|
|
88 |
|
|
|
89 |
```bash |
|
|
90 |
$ mediaug generate-augment-dataset --slide_dir <slide_dir> --cell_dir <cell_dir> --out_dir <out_dir> --num 1000 --max_cells <10> |
|
|
91 |
``` |
|
|
92 |
|
|
|
93 |
### Prepare images for Pix2Pix |
|
|
94 |
|
|
|
95 |
```bash |
|
|
96 |
$ mediaug prepare-pix2pix-images --image_dir <image_dir> --mask_dir <mask_dir> --out_dir <out_dir> --split_ratio <split_ratio> |
|
|
97 |
``` |
|
|
98 |
|
|
|
99 |
### Recursivly resize all images in directory |
|
|
100 |
|
|
|
101 |
```bash |
|
|
102 |
$ mediaug resize-images --input_dir <input_dir> --out_dir <out_dir> --w 256 --height 256 |
|
|
103 |
``` |