Skip to content

Commit 6cf8d8b

Browse files
committed
update pyslide package setup
1 parent a9cdaf3 commit 6cf8d8b

File tree

8 files changed

+38
-19
lines changed

8 files changed

+38
-19
lines changed

pyslide/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
import os, sys
44

5-
__all__ = ["PKG_DIR", "DATA_DIR", "__version__"]
5+
__all__ = ["PKG_DIR", "__version__"]
66

77
PKG_DIR = os.path.abspath(os.path.dirname(__file__))
8-
DATA_DIR = os.path.join(os.path.dirname(PKG_DIR), 'data')
98

10-
__version__ = '0.2.0'
9+
__version__ = '0.3.0'

pyslide/patch/_sample.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# -*- coding: utf-8 -*-
22

33
import os, sys
4-
import math, itertools
4+
import numpy as np
5+
import itertools
56

67
__all__ = ['wsi_patch_splitting',]
78

@@ -20,10 +21,10 @@ def split_patch_overlay(ttl_len, sub_len):
2021
p_sets.append(0)
2122
return p_sets
2223

23-
p_num = int(math.ceil(ttl_len * 1.0 / sub_len))
24+
p_num = int(np.ceil(ttl_len * 1.0 / sub_len))
2425
overlap_len = (p_num * sub_len - ttl_len) * 1.0 / (p_num - 1)
2526
extend_len = sub_len - overlap_len
26-
for ind in range(p_num):
27+
for ind in np.arange(p_num):
2728
p_sets.append(int(round(extend_len * ind)))
2829
return p_sets
2930

@@ -36,8 +37,8 @@ def split_patch_no_overlay(ttl_len, sub_len):
3637
p_sets.append(0)
3738
return p_sets
3839

39-
p_num = int(math.floor(ttl_len * 1.0 / sub_len))
40-
p_sets = [ele*sub_len for ele in range(p_num)]
40+
p_num = int(np.floor(ttl_len * 1.0 / sub_len))
41+
p_sets = [ele*sub_len for ele in np.arange(p_num)]
4142
return p_sets
4243

4344
if overlay == True:
@@ -53,4 +54,5 @@ def split_patch_no_overlay(ttl_len, sub_len):
5354
else:
5455
raise Exception("Cannot splitting")
5556

57+
5658
return coors_arr

pyslide/patch/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import os, sys
44

5-
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
65

76
def configuration(parent_package='', top_path=None):
87
from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
@@ -11,12 +10,13 @@ def configuration(parent_package='', top_path=None):
1110

1211
return config
1312

13+
1414
if __name__ == '__main__':
1515
from numpy.distutils.core import setup
1616
setup(maintainer='Pingjun Chen',
1717
maintainer_email='chenpingjun@gmx.com',
1818
description='Patch utility in whole slide image analysis',
1919
url='https://github.com/PingjunChen/pyslide',
20-
license='Apache',
20+
license='MIT',
2121
**(configuration(top_path='').todict())
2222
)

pyslide/pyramid/_pyramid.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
"load_wsi_head",
99
]
1010

11+
1112
def create_pyramidal_img(img_path, save_dir):
1213
""" Convert normal image to pyramidal image.
1314
1415
Parameters
15-
----------
16+
-------
1617
img_path: str
1718
Whole slide image path (absolute path is needed)
1819
save_dir: str
@@ -35,6 +36,7 @@ def create_pyramidal_img(img_path, save_dir):
3536
>>> save_dir = os.path.join(PRJ_PATH, "test/data/Slides")
3637
>>> status = pyramid.create_pyramidal_img(img_path, save_dir)
3738
>>> assert status == 0
39+
3840
"""
3941

4042
convert_cmd = "convert " + img_path
@@ -45,8 +47,20 @@ def create_pyramidal_img(img_path, save_dir):
4547

4648
return status
4749

50+
4851
def load_wsi_head(wsi_img_path):
4952
""" Load the header meta data of whole slide pyramidal image.
53+
54+
Parameters
55+
-------
56+
wsi_img_path: str
57+
The path to whole slide image
58+
59+
Returns
60+
-------
61+
wsi_header: slide class
62+
Meta information of whole slide image
63+
5064
"""
5165

5266
wsi_header = openslide.OpenSlide(wsi_img_path)

pyslide/pyramid/setup.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
import os, sys, pdb
4-
5-
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
3+
import os, sys
64

75

86
def configuration(parent_package='', top_path=None):
@@ -12,12 +10,13 @@ def configuration(parent_package='', top_path=None):
1210

1311
return config
1412

13+
1514
if __name__ == '__main__':
1615
from numpy.distutils.core import setup
1716
setup(maintainer='Pingjun Chen',
1817
maintainer_email='chenpingjun@gmx.com',
1918
description='File format utilities of whole slide image',
2019
url='https://github.com/PingjunChen/pyslide',
21-
license='Apache',
20+
license='MIT',
2221
**(configuration(top_path='').todict())
2322
)

pyslide/setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# -*- coding: utf-8 -*-
22

3-
import os, sys, pdb
3+
import os, sys
4+
45

56
def configuration(parent_package='', top_path=None):
67
from numpy.distutils.misc_util import Configuration
7-
8+
89
config = Configuration('pyslide', parent_package, top_path)
910
config.add_subpackage('patch')
1011
config.add_subpackage('pyramid')

requirements.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
numpy==1.12.1
1+
numpy==1.15.4
22
tissueloc==1.5.0
33
pycontour==1.1.0
4+
Pillow==5.3.0
5+
openslide-python==1.1.1
6+
scikit-image==0.14.1
7+
opencv-python==3.4.4.19

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
VERSION = pyslide.__version__
99
DESCRIPTION = "Whole slide image analysis toolbox."
1010
HOMEPAGE = "https://github.com/PingjunChen/pyslide"
11-
LICENSE = "Apache"
11+
LICENSE = "MIT"
1212
AUTHOR_NAME = "Pingjun Chen"
1313
AUTHOR_EMAIL = "chenpingjun@gmx.com"
1414

0 commit comments

Comments
 (0)