Skip to content

Commit

Permalink
Use full metric names when saving CSV
Browse files Browse the repository at this point in the history
  • Loading branch information
valosekj committed Feb 29, 2024
1 parent 07098ca commit f1faffa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions compute_metrics/compute_metrics_reloaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@
from MetricsReloaded.metrics.pairwise_measures import BinaryPairwiseMeasures as BPM


METRICS_TO_NAME = {
'dsc': 'Dice similarity coefficient (DSC)',
'hd': 'Hausdorff distance',
'fbeta': 'FBeta score',
'nsd': 'Normalized surface distance (NSD)',
'vol_diff': 'Volume difference',
'rel_vol_diff': 'Relative volume error (RVE)',
}


def get_parser():
# parse command line arguments
parser = argparse.ArgumentParser(description='Compute MetricsReloaded metrics for segmentation tasks.')
Expand Down Expand Up @@ -223,6 +233,9 @@ def main():
# Convert JSON data to pandas DataFrame
df = build_output_dataframe(output_list)

# Rename columns
df.rename(columns={metric: METRICS_TO_NAME[metric] for metric in METRICS_TO_NAME}, inplace=True)

# save as CSV
fname_output_csv = os.path.abspath(args.output)
df.to_csv(fname_output_csv, index=False)
Expand Down

0 comments on commit f1faffa

Please sign in to comment.