|
1 | 1 | # PPReCOGG |
2 | | -or **P**er-**P**ixel **Re**cognition of **C**ancers using **O**riented **G**abor filters on the **G**PU |
| 2 | + |
| 3 | +## What is this? |
| 4 | +PPReCOGG is a machine learning model for the **P**er-**P**ixel |
| 5 | +**Re**cognition of **C**ancers using **O**riented **G**abor |
| 6 | +filters on the **G**PU. |
| 7 | + |
| 8 | +More helpfully, PPReCOGG is software that uses texture-based |
| 9 | +features to help classify and differentiate early breast cancer |
| 10 | +lesions in microscopy images of fluorescently labelled breast |
| 11 | +tissue, such as that you'd extract from a breast biopsy. |
| 12 | + |
| 13 | +This library is almost, but not quite complete; much like the |
| 14 | +master's thesis for which it was written. |
| 15 | + |
| 16 | +## Documentation |
| 17 | +Documentation for PPReCOGG is still being completed, however the |
| 18 | +source code for PPReCOGG makes heavy use of docstrings, which |
| 19 | +should answer most of your questions regarding the PPReCOGG's API. |
| 20 | + |
| 21 | +## Installation |
| 22 | +**N.B.: Ease of installation and portability needs to be improved. |
| 23 | + Environments other than Anaconda Python 3 on Windows & Linux are |
| 24 | + not supported at this time.** |
| 25 | + |
| 26 | +PPReCOGG Dependencies: |
| 27 | +* [h5py](http://www.h5py.org/) (v.2.7.0) |
| 28 | +* [matplotlib](http://matplotlib.org/) (v.2.0.2) |
| 29 | +* [numpy](http://www.numpy.org/) (v1.13.1) |
| 30 | +* [pillow](https://pillow.readthedocs.io/en/4.3.x/) (v4.2.1) |
| 31 | +* [pytables](http://www.pytables.org/) (v.3.2.2) |
| 32 | +* [scikit-image](http://www.pytables.org/) (v.0.13.0) |
| 33 | +* [theano](http://www.deeplearning.net/software/theano/) (v0.9.0) |
| 34 | + |
| 35 | + |
| 36 | +## Usage |
| 37 | +PPReCOGG can be used as a python library or interactively through its CLI. |
| 38 | + |
| 39 | +### Library Usage Example |
| 40 | + |
| 41 | +```python |
| 42 | +from pprecogg import gaborExtract, classifyFeatures |
| 43 | + |
| 44 | +# path to the image you wish to classify |
| 45 | +unknown_img_path = "/path/to/unknown/image" |
| 46 | + |
| 47 | +# paths to the images whose class you know |
| 48 | +adh_img_path = "/path/to/adh/image" |
| 49 | +dcis_img_path = "/path/to/dcis/image" |
| 50 | + |
| 51 | +# features are extracted into HDF5 files, and extract_gabor_features |
| 52 | +# returns the path to said file |
| 53 | +unknown_features_path = gaborExtract.extract_gabor_features(unknown_img_path) |
| 54 | +adh_features_path = gaborExtract.extract_gabor_features(adh_img_path) |
| 55 | +dcis_features_path = gaborExtract.extract_gabor_features(dcis_img_path) |
| 56 | + |
| 57 | +# classify features from unknown image. |
| 58 | +# returns an array of class ID and an array of classified coordinates |
| 59 | +# indexed by class (see: that array of class IDs) |
| 60 | +class_names,classified_coords = classifyFeatures.classify_features(unknown_features_path, |
| 61 | +known_features_paths) |
| 62 | + |
| 63 | + |
| 64 | +# we can convert this into a dictionary where the key is the class name |
| 65 | +# and the value are the coordinates that belong to it |
| 66 | +classified_coords_dict = {class_names[class_num]: class_coords for class_num, class_coords in enumerate(classified_coords)} |
| 67 | + |
| 68 | +# small ergonomic function to plot classified pixels on to the |
| 69 | +# unknown image |
| 70 | +classifyFeatures.plot_coords(classified_coords_dict, |
| 71 | + unknown_img_path) |
| 72 | +``` |
| 73 | + |
| 74 | +### CLI Usage |
| 75 | + |
| 76 | +Simplest way to use PPReCOGG in CLI mode is to use the `full_auto` |
| 77 | +mode. |
| 78 | + |
| 79 | +**Step One: Create configuration file** |
| 80 | +config.json |
| 81 | +```json |
| 82 | +{ |
| 83 | + "unknown_image": "/path/to/unknown/image", |
| 84 | + |
| 85 | + /* optional, for rerunning */ |
| 86 | + "unknown_features": "/path/to/unknown/features.h5", |
| 87 | + |
| 88 | + "known_images":[ |
| 89 | + "/path/to/known/image", |
| 90 | + "/path/to/known/image"], |
| 91 | + |
| 92 | + /* optional, for rerunning */ |
| 93 | + "known_features":[ |
| 94 | + "/path/to/known/features.h5", |
| 95 | + "/path/to/known/features.h5" |
| 96 | + ], |
| 97 | + |
| 98 | + /* |
| 99 | + the smaller, the faster the computations. |
| 100 | + the bigger, the higher resolution output. |
| 101 | + */ |
| 102 | + "resize": 510 |
| 103 | +} |
| 104 | +``` |
| 105 | + |
| 106 | +**Step Two: Run PPReCOGG in `full_auto` mode** |
| 107 | +``` |
| 108 | +python -m pprecogg full_auto --config_file config.json |
| 109 | +``` |
0 commit comments