Skip to content

Metrics for evaluating lesion segmentations

License

Notifications You must be signed in to change notification settings

Pubec/lesion-metrics

 
 

Repository files navigation

Lesion metrics

Original Repository: https://github.com/jcreinhold/lesion-metrics

Improved:

  • pymedio imports
  • helper.Metrics LTPR bug
  • helper.Metrics prettifed print

Various metrics for evaluating lesion segmentations [1]

Install

The easiest way to install the package is in editable mode:

git clone https://github.com/pubec/lesion-metrics
cd lesion-metrics
pip install -e .
pip install pymedio pydicom

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)
from lesion_metrics.helper import Metrics

metrics_5 = Metrics.from_filenames(pred_filename=path_pred, truth_filename=path_true, iou_threshold=0.05)
metrics_25 = Metrics.from_filenames(pred_filename=path_pred, truth_filename=path_true, iou_threshold=0.25)

print(metrics_5)
print(metrics_25)

About

Metrics for evaluating lesion segmentations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 92.5%
  • Makefile 7.5%