Skip to content

Commit 4f718de

Browse files
authored
BUG: Fix CLI for slide-info and travis for deployment to pypi (#17)
- Fix CLI for slide-info and travis for deployment to pypi
1 parent 50e1b95 commit 4f718de

File tree

6 files changed

+28
-9
lines changed

6 files changed

+28
-9
lines changed

.deepsource.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version = 1
22

3-
test_patterns = ["*/tests/test_*.py"]
3+
test_patterns = ["tests/test_*.py"]
44

55
[[analyzers]]
66
name = "python"

docs/conf.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,12 @@
119119
# The paper size ('letterpaper' or 'a4paper').
120120
#
121121
# 'papersize': 'letterpaper',
122-
123122
# The font size ('10pt', '11pt' or '12pt').
124123
#
125124
# 'pointsize': '10pt',
126-
127125
# Additional stuff for the LaTeX preamble.
128126
#
129127
# 'preamble': '',
130-
131128
# Latex figure (float) alignment
132129
#
133130
# 'figure_align': 'htbp',

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.2.1
2+
current_version = 0.2.2
33
commit = True
44
tag = False
55

@@ -22,3 +22,4 @@ test = pytest
2222

2323
[tool:pytest]
2424
collect_ignore = ['setup.py']
25+

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@
5656
test_suite="tests",
5757
tests_require=test_requirements,
5858
url="https://github.com/tialab/tiatoolbox",
59-
version="0.2.1",
59+
version="0.2.2",
6060
zip_safe=False,
6161
)

tiatoolbox/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
__author__ = """TIA Lab"""
88
__email__ = "tialab@dcs.warwick.ac.uk"
9-
__version__ = "0.2.1"
9+
__version__ = "0.2.2"
1010

1111
if __name__ == "__main__":
1212
pass

tiatoolbox/cli.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def main():
4040
)
4141
@click.option(
4242
"--mode",
43+
default="show",
4344
help="'show' to display meta information only or 'save' to save "
4445
"the meta information, default=show",
4546
)
@@ -52,23 +53,43 @@ def main():
5253
def slide_info(wsi_input, output_dir, file_types, mode, workers=None):
5354
"""Displays or saves WSI metadata"""
5455
file_types = tuple(file_types.split(", "))
56+
5557
if os.path.isdir(wsi_input):
5658
files_all = utils.misc.grab_files_from_dir(
5759
input_path=wsi_input, file_types=file_types
5860
)
61+
if output_dir is None and mode == "save":
62+
input_dir, _, _ = utils.misc.split_path_name_ext(wsi_input)
63+
output_dir = pathlib.Path(input_dir).joinpath("meta")
64+
5965
elif os.path.isfile(wsi_input):
6066
files_all = [
6167
wsi_input,
6268
]
69+
if output_dir is None and mode == "save":
70+
input_dir, _, _ = utils.misc.split_path_name_ext(wsi_input)
71+
output_dir = pathlib.Path(input_dir).joinpath("..").joinpath("meta")
6372
else:
6473
raise ValueError("wsi_input path is not valid")
6574

6675
print(files_all)
6776

68-
dataloader.slide_info.slide_info(
69-
input_path=files_all, output_dir=output_dir, mode=mode, workers=workers,
77+
slide_params = dataloader.slide_info.slide_info(
78+
input_path=files_all, workers=workers,
7079
)
7180

81+
if mode == "show":
82+
for slide_param in slide_params:
83+
print(slide_param)
84+
85+
if mode == "save":
86+
output_dir.mkdir(parents=True, exist_ok=True)
87+
for slide_param in slide_params:
88+
utils.misc.save_yaml(slide_param,
89+
pathlib.Path(output_dir)
90+
.joinpath(slide_param["file_name"] + ".yaml"))
91+
print("Meta files saved at " + str(output_dir))
92+
7293

7394
@main.command()
7495
@click.option("--wsi_input", help="Path to WSI file")

0 commit comments

Comments
 (0)