Skip to content

Commit

Permalink
bugfix: send stats after increase of pred counter
Browse files Browse the repository at this point in the history
  • Loading branch information
wasserth committed Jul 24, 2023
1 parent f36fb64 commit 87560f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion totalsegmentator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def increase_prediction_counter():
config = json.load(open(totalseg_config_file, "r"))
config["prediction_counter"] += 1
json.dump(config, open(totalseg_config_file, "w"), indent=4)
return config


def get_version():
Expand All @@ -69,7 +70,7 @@ def get_version():


def send_usage_stats(config, params):
if config["send_usage_stats"]:
if config is not None and config["send_usage_stats"]:

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

Expand Down
4 changes: 2 additions & 2 deletions totalsegmentator/python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ def totalsegmentator(input, output, ml=False, nr_thr_resamp=1, nr_thr_saving=6,
quiet=quiet, verbose=verbose, test=test, skip_saving=skip_saving)
seg = seg_img.get_fdata().astype(np.uint8)

config = setup_totalseg()
increase_prediction_counter()
setup_totalseg()
config = increase_prediction_counter()
send_usage_stats(config, {"task": task, "fast": fast, "preview": preview,
"multilabel": ml, "roi_subset": roi_subset,
"statistics": statistics, "radiomics": radiomics})
Expand Down

0 comments on commit 87560f3

Please sign in to comment.