JonasLamy / LiverVesselness

Repository for Vesselness algorithms
Other
44 stars 9 forks source link

LiverVesselness

EDIT : Repository updated the 7th of October 2022. Some implementation mistakes have been corrected. The corrected version of the journal article is available here

This is the Repository for the journal article :

"A Benchmark Framework for Multi-Region Analysis of Vesselness Filters" Jonas Lamy, Odyssee Merveille, Bertrand Kerautret, Nicolas Passat

For results on the work submitted to ICPR 2020, please see the ICPR_2020 branch.

The implementations of the seven vessel filtering methods are available and the results presented on the paper can be reproduced. An installation-free online demonstration is also available: http://ipol-geometry.loria.fr/~kerautre/ipol_demo/LiverVesselnessIPOLDemo

3D Slicer integration (13/06/2023)

The filters implementation is now directly available in 3DSlicer extension manager. Github page

A plug-in for manual liver vessels segmentation is also available here: Github page

How to cite

Please cite the reference of this work if you use any of it :

@ARTICLE{9833530,
  author={Lamy, Jonas and Merveille, Odyssée and Kerautret, Bertrand and Passat, Nicolas},
  journal={IEEE Transactions on Medical Imaging}, 
  title={A Benchmark Framework for Multiregion Analysis of Vesselness Filters}, 
  year={2022},
  volume={41},
  number={12},
  pages={3649-3662},
  doi={10.1109/TMI.2022.3192679}}

DATA

Data for the benchmark comes from the modification of public datasets. The tweaked versions are available here : http://dionysos.univ-lyon2.fr/R-vessel-X/ (Edit: if the link is down, post an issue)

Original data are available on the authors websites :

Scripts to transform data are available in the scripts/BDDgenerator folder

Dependancies

CMake > 3.10.2 (https://cmake.org/)

ITK >= 5.2 : Github page recommanded options : Module_Thickness3D, ITK_USE_FFTWF, ITK_USE_FFTWD

Jsoncpp : Github page. Initialise with :

git submodule update --init

Boost Math : Github page. This is only required for bessel functions in OOF.

Build

Livervesselness should be built with cmake and generate:

Vesselness filters

All vesselness filters are available as standalone programs. Look for each filter's help for usage.

Antiga (Frangi)

./Antiga --input OneInputFromVolumeList --ouput antiga.nii --sigmaMin 2.4 --sigmaMax 2.6 --nbSigmaSteps 4 --alpha 0.7 --beta 0.1 --gamma 5

Benchmark

Purpose

This benchmarking tool was created to compare Vesselness filters in a common application. It is decomposed in 3 steps :

1) Parameters files creation This step uses python scripts to generate the parameters of the vesselness filters used by the benchmark. 2) Filters computation For each parameter sets the vesselness filter is computed 3) Computing metrics Several metrics are computed for each filter result and summed up in a csv file. This step is also implemented in C/C++ as 3D data are expensive to process. 4) Analysing results The metrics are analysed using python scripts (ROC curves, mean metrics, etc.).

Features

Usage

A Json settings file should be created and give to the benchmark executable as follows:

./Benchmark --settingsFile settingFile.json

or

./Benchmark -s settingFile.json

Benchmark Settings file

The settings file options are the following :

Example of settings file:

{
    "Settings":{
    "name":"newBenchark",
    "path":"/home/path/WhereIWant/My/BenchmarkToBe",
    "inputVolumesList":"fileLists/ircad_10_and_11.txt",
    "algorithmSets":"paramSets/minimal.json",
    "maskList":["Organ","Vessels","Bifurcations],
    "enhancementMask":"Organ",
    "nbThresholds":200,
    "removeResultsVolumes":false,
    "rescaleFilters":true /* Note: this option is only available with the journal version of the benchmark */
    }
}

For existing methods parameters, please refers to vesselness executables documentation and reference papers.

*Masks can greatly beneficiate some methods that rely on gobal information such as the biggest eigen value in the whole image, or a Kmean in a specific area.

Benchmark Hierarchy

Running a benchmark will create the following hierarchy :

path/newBenchmark
    |_ csv
    |   |_ newBenchmark.csv
    |   |_ newBenchmark_dilatedVessels.csv
    |   |_ newBenchmark_bifurcations.csv
    |_ data1
    |   |_ ouputVesselness1.nii
    |   |_ ouputVesselness2.nii
    |   |_outputVesselness3.nii
    |_ data2
    |   |_ ouputVesselness1.nii
    |   |_ ouputVesselness2.nii
    |   |_outputVesselness3.nii

where:

Input Volumes list

For a given data, for instance liver CTs, the input volume list requires an input volume, several masks and a groundtruth. The supported Image types are listed in the table below:

Volume Other (.mhd,.nii,etc.) Dicom
input volume double int_16
masks uint_8 uint_8
ground truth uint_8 uint_8

Other types will require to tweak the C++ templates in the code...

The input volume list is a .txt file listing all necessary volumes for the benchmark in the following order :

Note that the unique ID is used to create a folder containing all its vesselness results. This corresponds to data1 and data2 in the previous section.

Example :

3Dircadb1.10 // ID of the first sequence 
/DATA/ircad_iso_111/3Dircadb1.10/patientIso.nii // input data
/DATA/ircad_iso_111/3Dircadb1.10/vesselsIso.nii // groundtruth
/DATA/ircad_iso_111/3Dircadb1.10/liverMaskIso.nii // 1rst mask 
/DATA/ircad_iso_111/3Dircadb1.10/bifurcationsMaskIso.nii // 2nd mask 
/DATA/ircad_iso_111/3Dircadb1.10/dilatedVesselsMaskIso.nii // 3rd mask

3Dircadb1.11 // ID of the second sequence
/DATA/ircad_iso_111/3Dircadb1.11/patientIso.nii // input data
/DATA/ircad_iso_111/3Dircadb1.11/vesselsIso.nii // groundtruth
/DATA/ircad_iso_111/3Dircadb1.11/liverMaskIso.nii // 1rst mask 
/DATA/ircad_iso_111/3Dircadb1.11/bifurcationsMaskIso.nii // 2nd mask 
/DATA/ircad_iso_111/3Dircadb1.11/dilatedVesselsMaskIso.nii // 3rd mask 
...

Notes: The number and order of masks in this file must match the number of masks declared in the settings file. Be careful not to add an extra end of line caracter at the end of the input volume list file.

methods Parameters

The parameter file lists the parameters used for each vesselness filter.

Each parameter set is defined by :

Here is an example :

{
 "Antiga" :
    [
     {
        "Output":"antiga.nii",
        "Arguments":[
        {"sigmaMin":"2.4"},
        {"sigmaMax":"2.6"},
        {"nbSigmaSteps":"4"},
        {"alpha":"0.7"},
        {"beta":"0.1"},
        {"gamma":"5"}
        ]
     }
    ],
    "Jerman" :
    [
     {
        "Output":"jerman.nii",
        "Arguments":[
        {"sigmaMin":"2.0"},
        {"sigmaMax":"2.2"},
        {"nbSigmaSteps":"5"},
        {"tau":"0.75"}
        ]
     },
     {
        "Output":"jerman.nii",
        "Arguments":[
        {"sigmaMin":"1.0"},
        {"sigmaMax":"3.0"},
        {"nbSigmaSteps":"3"},
        {"tau":"0.2"}
        ]
     }
    ]
}

Note that a parameter file can be composed of one or several vesselness with one or several instances of parameters.

for instance, when testing one instance of each vesselness "frangi.nii", "Jerman.nii", "Sato.nii", naming scheme is suitable. When benchmarking parameters, a naming scheme with the value of the parameters is more practical. For example, "0.1-0.5.nii","0.5-0.5.nii" for testing the influence of the pair of parameters alpha and beta for frangi's vesselness.

Adding a custom vesselness

As stated before, the benchmark is designed to use stand alone vesselness functions. Any extra vesselness filter can be included by following these two steps: 1) Put the new vesselness filter executable in the same directory as the Benchmark executable so that it can be called using bash command ./YourVesselnessName. 2) The new vesselness filter executable should be called using --option. Also --input and --ouput are compulsory parameters. The minimal call of a new filter should be : ./YourVesselness --input inputVolume.nii --output outputVolume.nii 3) An optionnal --mask option is also prefered, when used it should return a masked version of the vesselness. Vesselness pixels masked by the foreground pixels values should be preserved.

Analyse scripts

These scripts compute, per parameter set, the mean of the binary filter output that maximize the MCC over the "Organ" ROI.

The csv metric files can be processed using two files AnalyseBenchmark.py and aggregateResults.py

AnalyseBenchmark.py

This script expects output benchmark folders with names in the form {database name}{optimization step}{filter name} for example 'ircad_PS_Frangi'.

usage:

python3 analyseBenchmark.py ircad_PS_Frangi

This scripts create one folder per ROI mask, a folder named Summary and a Pickle Folder.

The summary folder contains the MCC, Dice, SNR, PSNR for all ROI of the best parameter set. Each ROI folder contains a number of results files:

ROI
|_ Best_mean_metric
|   |_ XXX_Best_CF_M.csv : mean metrics values for the maximized metric M per parameter set
|   |_ XXX_Best_mean_M.csv : mean metrics values for the maximized metric M per parameter set
|_ Best_metric_per_volume
|   |_ XXX_Best_M_per_volume.csv : Metrics values for the threshold maximizing the metric M for all pairs {volume, parameter set}
|   |_ XXX_Best_M_per_volume_summary.csv : Metrics values for the threshold maximizing the metric M the best pair {volume, parameter set}
|_ mean_metric
    |_ XXX_mean_M.csv : mean metrics values in ROI for the parameter set chosen by the optimization of metric M in the Organ ROI
    |_ XXX_mean_CF_M.csv : mean metrics values in ROI for the parameter set chosen by the optimization of metric M in the Organ ROI

agregrateResults.py

This scripts agregate the results of each filters into pdf and csv files.

With the following hierarchy :

Benchmark
|_ ircad_PS_Frangi
|_ ircad_PS_Sato
|_ ircad_PS_Jerman

usage:

python3 agregateResults.py Benchmark

The command will create several files with a summary of the best parameters and associated metrics of each filters present in the folder.