Skip to content

Commit

Permalink
Update dice_correlation.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Bridgeford authored Feb 4, 2023
1 parent f68a956 commit 5a5e746
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/dice_correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from math import floor


def dice_roi(input_dir, output_dir, atlas1, atlas2):
def dice_roi(input_dir, output_dir, atlas1, atlas2, verbose=True):
"""Calculates the dice coefficient for every ROI combination from atlas1 and atlas2
Parameters
Expand Down Expand Up @@ -48,7 +48,8 @@ def dice_roi(input_dir, output_dir, atlas1, atlas2):

Dice[int(i)][int(j)]=float(dice)

print(f'Dice coefficient for {yname} {i} of {max_y}, {xname} {j} of {max_x} = {dice}')
if verbose:
print(f'Dice coefficient for {yname} {i} of {max_y}, {xname} {j} of {max_x} = {dice}')

if dice > 1 or dice < 0:
raise ValueError(f"Dice coefficient is greater than 1 or less than 0 ({dice}) at atlas1: {val1}, atlas2: {val2}")
Expand Down Expand Up @@ -151,4 +152,4 @@ def main():
Dice_matrix, ylabels, xlabels = dice_roi(input_dir,output_dir,atlases[i],atlases[j])

if __name__ == "__main__":
main()
main()

0 comments on commit 5a5e746

Please sign in to comment.