diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644
index 0000000..7278880
--- /dev/null
+++ b/.circleci/config.yml
@@ -0,0 +1,20 @@
+version: 2
+jobs:
+ build:
+ docker:
+ - image: circleci/python:3.6
+ steps:
+ - checkout
+ - run: sudo apt-get install openslide-tools
+ - run:
+ command: |
+ python3 -m venv venv
+ . venv/bin/activate
+ pip install --upgrade pip
+ pip install -r requirements.txt
+ pip install -U pytest
+ - run:
+ command: |
+ . venv/bin/activate
+ cd test
+ pytest .
diff --git a/AUTHORS.md b/AUTHORS.md
index f540780..e97a687 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -1,7 +1,7 @@
-#### Main author:
+#### Main author
-- [Pingjun Chen](https://github.com/PingjunChen)
+ - [Pingjun Chen](https://github.com/PingjunChen)
-#### Contributors (alphabetical last name):
+#### Contributors (alphabetical last name)
-- Lin Yang
+ - Lin Yang
diff --git a/README.md b/README.md
index a72cc67..249e884 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,16 @@
tissueloc: Whole slide digital pathology image tissue localization
-========
+=============
+[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2f1d165f709e43c4bc6d1d3a6563418e)](https://app.codacy.com/app/PingjunChen/tissueloc?utm_source=github.com&utm_medium=referral&utm_content=PingjunChen/tissueloc&utm_campaign=Badge_Grade_Dashboard)
[![Build Status](https://travis-ci.org/PingjunChen/tissueloc.svg?branch=master)](https://travis-ci.org/PingjunChen/tissueloc)
[![Documentation Status](https://readthedocs.org/projects/tissueloc/badge/?version=latest)](https://tissueloc.readthedocs.io/en/latest/?badge=latest)
[![PyPI version](https://badge.fury.io/py/tissueloc.svg)](https://badge.fury.io/py/tissueloc)
[![DOI](http://joss.theoj.org/papers/10.21105/joss.01148/status.svg)](https://doi.org/10.21105/joss.01148)
-[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2529982.svg)](https://doi.org/10.5281/zenodo.2529982)
+[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/PingjunChen)
![](https://img.shields.io/github/stars/PingjunChen/tissueloc.svg)
+
-
-
-
-## Installation
+Installation
+-------------
1. Install [OpenSlide](https://openslide.org/download/).
```
$ sudo apt-get install openslide-tools
@@ -26,7 +26,8 @@ $ pip install openslide-python
$ pip install tissueloc==2.0.0
```
-## Usage example
+Usage example
+-------------
#### Interface
```
def locate_tissue_cnts(slide_path,
@@ -69,25 +70,27 @@ cnts, d_factor = locate_tissue_cnts(slide_path,
min_tissue_size=10000)
```
-
-
-## Documentation
+Documentation
+-------------
Hosted in [https://tissueloc.readthedocs.io](https://tissueloc.readthedocs.io), powered by [readthedocs](https://readthedocs.org) and [Sphinx](http://www.sphinx-doc.org).
-
-## Contributing
+Contributing
+-------------
``tissueloc`` is an open source project and anyone is welcome to contribute. An easy way to get started is by suggesting a new enhancement on the [Issues](https://github.com/PingjunChen/tissueloc/issues). If you have found a bug, then either report this through [Issues](https://github.com/PingjunChen/tissueloc/issues), or even better, make a fork of the repository, fix the bug and then create a [Pull Requests](https://github.com/PingjunChen/tissueloc/pulls) to get the fix into the master branch.
We would like to test this package on more diversified digital slides. Slides (low level images would be better) and their corresponding results are also very welcome as [Pull Requests](https://github.com/PingjunChen/tissueloc/pulls).
-## License
+License
+-------------
[tissueloc](https://github.com/PingjunChen/tissueloc) is free software made available under the MIT License. For details see the [LICENSE](LICENSE) file.
-## Contributors
+Contributors
+-------------
See the [AUTHORS.md](AUTHORS.md) file for a complete list of contributors to the project.
-## Citing
-``tissueloc`` is published in the Journal of Open Source Software - if it's ever useful for your research please consider citing it:
+Citing
+-------------
+``tissueloc`` is published in the Journal of Open Source Software - please cite if it's useful for your research:
```
@article{chen2019tissueloc,
author = {Pingjun Chen and Lin Yang},
diff --git a/tissuelocDemo.png b/docs/media/tissuelocDemo.png
similarity index 100%
rename from tissuelocDemo.png
rename to docs/media/tissuelocDemo.png
diff --git a/setup.py b/setup.py
index f9529c1..bbf94e7 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
-import os, sys
from setuptools import setup, find_packages
import tissueloc
diff --git a/test/test_load_slide.py b/test/test_load_slide.py
index a30d653..6690a49 100644
--- a/test/test_load_slide.py
+++ b/test/test_load_slide.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
import os, sys
-import numpy as np
-import pytest
+# import numpy as np
+# import pytest
TEST_PATH = os.path.abspath(os.path.dirname(__file__))
PRJ_PATH = os.path.dirname(TEST_PATH)
sys.path.insert(0, PRJ_PATH)
-from tissueloc.load_slide import select_slide_level, load_slide_img
+# from tissueloc.load_slide import select_slide_level
+# from tissueloc.load_slide import load_slide_img
# def test_select_slide_level():
diff --git a/test/test_locate_tissue.py b/test/test_locate_tissue.py
index 787714a..7c5fa07 100644
--- a/test/test_locate_tissue.py
+++ b/test/test_locate_tissue.py
@@ -5,17 +5,16 @@
import numpy as np
import scipy.misc as misc
import cv2
-import pytest
TEST_PATH = os.path.abspath(os.path.dirname(__file__))
PRJ_PATH = os.path.dirname(TEST_PATH)
sys.path.insert(0, PRJ_PATH)
-
-from tissueloc.load_slide import select_slide_level, load_slide_img
+# from tissueloc.load_slide import select_slide_level
+from tissueloc.load_slide import load_slide_img
from tissueloc.locate_tissue import rgb2gray, thresh_slide, fill_tissue_holes
from tissueloc.locate_tissue import remove_small_tissue, find_tissue_cnts
-from tissueloc.locate_tissue import locate_tissue_cnts
+# from tissueloc.locate_tissue import locate_tissue_cnts
@@ -34,7 +33,7 @@ def test_gen_intermediate_files():
misc.imsave(os.path.join(output_dir, "gray.png"), gray_img)
# Step 4: Smooth and Binarize
thresh_val = 0.8
- bw_img = thresh_slide(gray_img, thresh_val=0.8, sigma=5)
+ bw_img = thresh_slide(gray_img, thresh_val=thresh_val, sigma=5)
misc.imsave(os.path.join(output_dir, "bw.png"), (bw_img*255.0).astype(np.uint8))
# Step 5: Fill tissue holes
bw_fill = fill_tissue_holes(bw_img)
diff --git a/tissueloc/load_slide.py b/tissueloc/load_slide.py
index 06c6dd1..30a44ac 100644
--- a/tissueloc/load_slide.py
+++ b/tissueloc/load_slide.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
-import os, sys
import openslide
from PIL import Image
import numpy as np
@@ -35,7 +34,7 @@ def select_slide_level(slide_path, max_size=2048):
level_dims = slide_head.level_dimensions
d_factors = slide_head.level_downsamples
- assert len(level_dims) > 1, "This slide doesnot have mutliple levels"
+ # assert len(level_dims) > 1, "This slide doesnot have mutliple levels"
select_level = len(level_dims) - 1
for ind in np.arange(len(level_dims)):
cur_w, cur_h = level_dims[ind]
@@ -77,7 +76,7 @@ def load_slide_img(slide_path, level=0):
img_size = slide_head.level_dimensions[level]
slide_img = slide_head.read_region((0, 0), level, img_size)
if isinstance(slide_img, Image.Image):
- slide_img = im = np.asarray(slide_img)
+ slide_img = np.asarray(slide_img)
if slide_img.shape[2] == 4:
slide_img = slide_img[:, :, :-1]
return slide_img
diff --git a/tissueloc/locate_tissue.py b/tissueloc/locate_tissue.py
index 1ff0b59..09a2243 100644
--- a/tissueloc/locate_tissue.py
+++ b/tissueloc/locate_tissue.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
-import os, sys
import numpy as np
from scipy.ndimage import binary_fill_holes
from skimage import filters, img_as_ubyte
diff --git a/tissueloc/setup.py b/tissueloc/setup.py
index 0ff39f2..aae072d 100644
--- a/tissueloc/setup.py
+++ b/tissueloc/setup.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import os, sys
+import os
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
PKG_NAME = os.path.basename(BASE_PATH)