sct-pipeline / ukbiobank-spinalcord-csa

Measure of the averaged cross-sectional area (cord CSA) between C2 and C3 of the spinal cord with UK Biobank Brain MRI dataset.
MIT License
3 stars 0 forks source link

Compute mean dice coeff of segmentations from candidates #42

Closed sandrinebedard closed 3 years ago

sandrinebedard commented 3 years ago

Description

This PR adds the script compute_dice.py that computes dice coefficient across segmentations from candidates and ground truth segmentations as discussed in #36. The script outputs dice coefficient per image for each candidate and mean dice score (saves in log file).

Example of output: image

sandrinebedard commented 3 years ago

the function compute_dice() could have been written by simply opening the data using nibabel.load() and then computing the Dice directly in Python in a two-liner. That way you would have bypassed this issue, your code would probably be 4x shorter and you would remove a system call to SCT (making your open-source code more reusable).

i'm approving this anyway because this code has a fairly "isolated" purpose. But useful tips for you to consider in the future.

Oki thanks for the tip!