Skip to content

Commit 87560f3

Browse files
committed
bugfix: send stats after increase of pred counter
1 parent f36fb64 commit 87560f3

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

totalsegmentator/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def increase_prediction_counter():
5959
config = json.load(open(totalseg_config_file, "r"))
6060
config["prediction_counter"] += 1
6161
json.dump(config, open(totalseg_config_file, "w"), indent=4)
62+
return config
6263

6364

6465
def get_version():
@@ -69,7 +70,7 @@ def get_version():
6970

7071

7172
def send_usage_stats(config, params):
72-
if config["send_usage_stats"]:
73+
if config is not None and config["send_usage_stats"]:
7374

7475
params["roi_subset"] = "" if params["roi_subset"] is None else "-".join(params["roi_subset"])
7576

totalsegmentator/python_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ def totalsegmentator(input, output, ml=False, nr_thr_resamp=1, nr_thr_saving=6,
212212
quiet=quiet, verbose=verbose, test=test, skip_saving=skip_saving)
213213
seg = seg_img.get_fdata().astype(np.uint8)
214214

215-
config = setup_totalseg()
216-
increase_prediction_counter()
215+
setup_totalseg()
216+
config = increase_prediction_counter()
217217
send_usage_stats(config, {"task": task, "fast": fast, "preview": preview,
218218
"multilabel": ml, "roi_subset": roi_subset,
219219
"statistics": statistics, "radiomics": radiomics})

0 commit comments

Comments
 (0)