Skip to content

jcreinhold/lesion-metrics

Repository files navigation

lesion-metrics

Documentation Status

Various metrics for evaluating lesion segmentations [1]

Install

The easiest way to install the package is with:

pip install lesion-metrics

To install the dependencies of the CLI, install with:

pip install "lesion-metrics[cli]"

You can also download the source and run:

python setup.py install

Basic Usage

You can generate a report of lesion metrics for a directory of predicted labels and truth labels with the CLI:

lesion-metrics -p predictions/ -t truth/ -o output.csv

Or you can import the metrics and run them on label images:

import nibabel as nib
from lesion_metrics.metrics import dice
pred = nib.load('pred_label.nii.gz').get_fdata()
truth = nib.load('truth_label.nii.gz').get_fdata()
dice_score = dice(pred, truth)

References

[1] Carass, Aaron, et al. "Longitudinal multiple sclerosis lesion segmentation: resource and challenge." NeuroImage 148 (2017): 77-102.