File tree Expand file tree Collapse file tree 8 files changed +38
-19
lines changed
Expand file tree Collapse file tree 8 files changed +38
-19
lines changed Original file line number Diff line number Diff line change 22
33import os , sys
44
5- __all__ = ["PKG_DIR" , "DATA_DIR" , " __version__" ]
5+ __all__ = ["PKG_DIR" , "__version__" ]
66
77PKG_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'
Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
22
33import 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
Original file line number Diff line number Diff line change 22
33import os , sys
44
5- BASE_PATH = os .path .abspath (os .path .dirname (__file__ ))
65
76def 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+
1414if __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 )
Original file line number Diff line number Diff line change 88 "load_wsi_head" ,
99 ]
1010
11+
1112def 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+
4851def 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 )
Original file line number Diff line number Diff line change 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
86def configuration (parent_package = '' , top_path = None ):
@@ -12,12 +10,13 @@ def configuration(parent_package='', top_path=None):
1210
1311 return config
1412
13+
1514if __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 )
Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
22
3- import os , sys , pdb
3+ import os , sys
4+
45
56def 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' )
Original file line number Diff line number Diff line change 1- numpy == 1.12.1
1+ numpy == 1.15.4
22tissueloc == 1.5.0
33pycontour == 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
Original file line number Diff line number Diff line change 88VERSION = pyslide .__version__
99DESCRIPTION = "Whole slide image analysis toolbox."
1010HOMEPAGE = "https://github.com/PingjunChen/pyslide"
11- LICENSE = "Apache "
11+ LICENSE = "MIT "
1212AUTHOR_NAME = "Pingjun Chen"
1313AUTHOR_EMAIL = "chenpingjun@gmx.com"
1414
You can’t perform that action at this time.
0 commit comments