ANIMA
4.0
|
Class to compute various metrics to evaluate segmentation results. More...
#include <animaSegPerfCAnalyzer.h>
Public Member Functions | |
bool | checkImagesMatrixAndVolumes () |
Check if the 2 inputs images are compatible. More... | |
double | computeAverageSurfaceDistance () |
Compute average surface distance. More... | |
double | computeHausdorffDist () |
Compute Haussdorf distance. More... | |
void | computeITKMeasures () |
Compute different measures with ITK to evaluate segmentation. More... | |
double | computeMeanDist () |
Compute mean distance. More... | |
bool | getDetectionMarks (double &po_fPPVL, double &po_fSensL, double &po_fF1) |
Compute useful variables to get detection scores. More... | |
double | getDiceCoefficient () |
Getter of Dice coefficient. More... | |
double | getJaccardCoefficient () |
Getter of Jaccard coefficient. More... | |
double | getMeanOverlap () |
Getter of Mean overlap. More... | |
double | getNPV () |
Getter of Negative predictive value. More... | |
int | getNumberOfClusters () |
Return the number of clusters. More... | |
double | getPPV () |
Getter of Positive predictive value. More... | |
double | getRelativeVolumeError () |
Getter of Relative volume error. More... | |
double | getSensitivity () |
Getter of Sensibility. More... | |
double | getSpecificity () |
Getter of Specificity. More... | |
double | getUnionOverlap () |
Getter of Union overlap. More... | |
SegPerfCAnalyzer (std::string &pi_pchImageTestName, std::string &pi_pchImageRefName, bool advancedEvaluation) | |
Constructor. More... | |
void | selectCluster (unsigned int) |
Select the cluster we want to use to compute evaluation results. More... | |
void | setDetectionThresholdAlpha (double pi_fVal) |
void | setDetectionThresholdBeta (double pi_fVal) |
void | setDetectionThresholdGamma (double pi_fVal) |
void | setMinLesionVolumeDetection (double pi_fVal) |
void | setNbThreads (int pi_iNbThreads) |
Set the number of threads to use for the computation of ITK. More... | |
~SegPerfCAnalyzer () | |
Protected Member Functions | |
void | checkNumberOfLabels (int, int) |
Check if the number of labels is the same for both input images. More... | |
void | contourDectection () |
Extract the contour of the image to evaluate and the ground truth. More... | |
bool | falsePositiveRatioTester (int pi_iLessionReference, int pi_iNbLabelsTest, int pi_iNbLabelsRef, int **pi_ppiOverlapTab, int *pi_piTPRowSumTab, int *pi_piColumnSumTab, double pi_dfBeta, double pi_dfGamma) |
Compute if a lesion is detected or not with beta and gamma thresholds. More... | |
void | formatLabels () |
Format labels values for the image to evaluate and the ground truth to obtain : background pixels values = 0, cluster 1 pixels values = 1 ...etc. More... | |
void | getOverlapTab (int &po_iNbLabelsRef, int &po_iNbLabelsTest, int **&po_ppiOverlapTab) |
Compute a table of lesion overlap between 2 images. More... | |
int | getTruePositiveLesions (int pi_iNbLabelsRef, int pi_iNbLabelsTest, int **pi_ppiOverlapTab) |
Getter of True positive lesions. More... | |
Class to compute various metrics to evaluate segmentation results.
Definition at line 25 of file animaSegPerfCAnalyzer.h.
anima::SegPerfCAnalyzer::SegPerfCAnalyzer | ( | std::string & | pi_pchImageTestName, |
std::string & | pi_pchImageRefName, | ||
bool | bAdvancedEvaluation | ||
) |
Constructor.
Read input images
[in] | pi_pchImageTestName | Name of the image to evaluate |
[in] | pi_pchImageRefName | Name of the ground truth image |
[in] | bAdvancedEvaluation |
Definition at line 23 of file animaSegPerfCAnalyzer.cxx.
References checkImagesMatrixAndVolumes(), and formatLabels().
anima::SegPerfCAnalyzer::~SegPerfCAnalyzer | ( | ) |
Definition at line 160 of file animaSegPerfCAnalyzer.cxx.
bool anima::SegPerfCAnalyzer::checkImagesMatrixAndVolumes | ( | ) |
Check if the 2 inputs images are compatible.
Definition at line 97 of file animaSegPerfCAnalyzer.cxx.
Referenced by anima::SegPerfApp::play(), and SegPerfCAnalyzer().
|
protected |
Check if the number of labels is the same for both input images.
Definition at line 391 of file animaSegPerfCAnalyzer.cxx.
Referenced by formatLabels(), and setMinLesionVolumeDetection().
double anima::SegPerfCAnalyzer::computeAverageSurfaceDistance | ( | ) |
Compute average surface distance.
Definition at line 662 of file animaSegPerfCAnalyzer.cxx.
References contourDectection().
Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().
double anima::SegPerfCAnalyzer::computeHausdorffDist | ( | ) |
Compute Haussdorf distance.
Definition at line 590 of file animaSegPerfCAnalyzer.cxx.
References anima::SegmentationMeasuresImageFilter< TLabelImage >::New().
Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().
void anima::SegPerfCAnalyzer::computeITKMeasures | ( | ) |
Compute different measures with ITK to evaluate segmentation.
Definition at line 288 of file animaSegPerfCAnalyzer.cxx.
References anima::SegmentationMeasuresImageFilter< TLabelImage >::New().
Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().
double anima::SegPerfCAnalyzer::computeMeanDist | ( | ) |
Compute mean distance.
Definition at line 624 of file animaSegPerfCAnalyzer.cxx.
References contourDectection(), and anima::SegmentationMeasuresImageFilter< TLabelImage >::New().
Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().
|
protected |
Extract the contour of the image to evaluate and the ground truth.
Definition at line 232 of file animaSegPerfCAnalyzer.cxx.
References anima::SegmentationMeasuresImageFilter< TLabelImage >::New().
Referenced by computeAverageSurfaceDistance(), computeMeanDist(), and setMinLesionVolumeDetection().
|
protected |
Compute if a lesion is detected or not with beta and gamma thresholds.
[out] | pi_iLesionReference | the number of labels found by connected components into reference image (1 by connected component + 1 for the background). |
[out] | pi_iNbLabelsTest | the number of labels found by connected components into tested image (1 by connected component + 1 for the background). |
[out] | pi_iNbLabelsRef | the number of the label of the tested lesion. |
[out] | pi_ppiOverlapTab | the mapping table. |
[out] | pi_piTPRowSumTab | the table of sum of Rows. |
[out] | pi_piColumnSumTab | the table of sum of Columns. |
[out] | pi_dfBeta | the beta threshold. |
[out] | pi_dfGamma | the beta threshold. |
Definition at line 965 of file animaSegPerfCAnalyzer.cxx.
References pair_decreasing_comparator.
Referenced by getTruePositiveLesions(), and setMinLesionVolumeDetection().
|
protected |
Format labels values for the image to evaluate and the ground truth to obtain : background pixels values = 0, cluster 1 pixels values = 1 ...etc.
Definition at line 477 of file animaSegPerfCAnalyzer.cxx.
References checkNumberOfLabels().
Referenced by SegPerfCAnalyzer(), and setMinLesionVolumeDetection().
bool anima::SegPerfCAnalyzer::getDetectionMarks | ( | double & | po_fPPVL, |
double & | po_fSensL, | ||
double & | po_fF1 | ||
) |
Compute useful variables to get detection scores.
[out] | po_fFNL | the output FNL (False Negative Lesions) ratio. |
[out] | po_fFPL | the output FPL (False Positive Lesions) ratio. |
[out] | po_fPPVL | the output PPVL (Positive Predictive Value for Lesions) ratio. |
[out] | po_fSensL | the output SensL, Lesion detection sensitivity ratio. |
[out] | po_fF1 | the output F1_score. |
Definition at line 755 of file animaSegPerfCAnalyzer.cxx.
References getOverlapTab(), and getTruePositiveLesions().
Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().
double anima::SegPerfCAnalyzer::getDiceCoefficient | ( | ) |
Getter of Dice coefficient.
Definition at line 365 of file animaSegPerfCAnalyzer.cxx.
Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().
double anima::SegPerfCAnalyzer::getJaccardCoefficient | ( | ) |
Getter of Jaccard coefficient.
Definition at line 374 of file animaSegPerfCAnalyzer.cxx.
Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().
double anima::SegPerfCAnalyzer::getMeanOverlap | ( | ) |
Getter of Mean overlap.
Definition at line 320 of file animaSegPerfCAnalyzer.cxx.
Referenced by setMinLesionVolumeDetection().
double anima::SegPerfCAnalyzer::getNPV | ( | ) |
Getter of Negative predictive value.
Definition at line 356 of file animaSegPerfCAnalyzer.cxx.
Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().
int anima::SegPerfCAnalyzer::getNumberOfClusters | ( | ) |
Return the number of clusters.
Definition at line 168 of file animaSegPerfCAnalyzer.cxx.
Referenced by anima::SegPerfApp::play(), and setMinLesionVolumeDetection().
|
protected |
Compute a table of lesion overlap between 2 images.
[out] | po_iNbLabelsRef | the number of labels found by connected components into reference image (1 by connected component + 1 for the background). |
[out] | po_iNbLabelsTest | the number of labels found by connected components into tested image (1 by connected component + 1 for the background). |
[out] | po_ppiOverlapTab | the table allocated by this method. Dimensions are po_iNbLabelsTest*po_iNbLabelsRef. The first cell [0][0] is the number of True-Negative voxels (background in both images), first line (excepte first cell) are False-Posite voxels, first colomne are False-Negative voxels and the rest of cels are True positive voxels. In Other words: first line is the back ground into Ref-image, first column is the back ground into Tested-image and the element [i][j] (with i,j > 0) correspond to the number of voxel belonging to the label i, that overlap with a voxel of the label j. |
Definition at line 801 of file animaSegPerfCAnalyzer.cxx.
Referenced by getDetectionMarks(), and setMinLesionVolumeDetection().
double anima::SegPerfCAnalyzer::getPPV | ( | ) |
Getter of Positive predictive value.
Definition at line 347 of file animaSegPerfCAnalyzer.cxx.
Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().
double anima::SegPerfCAnalyzer::getRelativeVolumeError | ( | ) |
Getter of Relative volume error.
Definition at line 383 of file animaSegPerfCAnalyzer.cxx.
Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().
double anima::SegPerfCAnalyzer::getSensitivity | ( | ) |
Getter of Sensibility.
Definition at line 329 of file animaSegPerfCAnalyzer.cxx.
Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().
double anima::SegPerfCAnalyzer::getSpecificity | ( | ) |
Getter of Specificity.
Definition at line 338 of file animaSegPerfCAnalyzer.cxx.
Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().
|
protected |
Getter of True positive lesions.
Definition at line 896 of file animaSegPerfCAnalyzer.cxx.
References falsePositiveRatioTester().
Referenced by getDetectionMarks(), and setMinLesionVolumeDetection().
double anima::SegPerfCAnalyzer::getUnionOverlap | ( | ) |
Getter of Union overlap.
Definition at line 311 of file animaSegPerfCAnalyzer.cxx.
Referenced by setMinLesionVolumeDetection().
void anima::SegPerfCAnalyzer::selectCluster | ( | unsigned int | iCluster | ) |
Select the cluster we want to use to compute evaluation results.
[in] | iCluster |
Definition at line 177 of file animaSegPerfCAnalyzer.cxx.
Referenced by anima::SegPerfApp::processAnalyze().
|
inline |
Definition at line 36 of file animaSegPerfCAnalyzer.h.
Referenced by anima::SegPerfApp::processAnalyze().
|
inline |
Definition at line 41 of file animaSegPerfCAnalyzer.h.
Referenced by anima::SegPerfApp::processAnalyze().
|
inline |
Definition at line 46 of file animaSegPerfCAnalyzer.h.
Referenced by anima::SegPerfApp::processAnalyze().
|
inline |
Definition at line 51 of file animaSegPerfCAnalyzer.h.
References checkNumberOfLabels(), computeAverageSurfaceDistance(), computeHausdorffDist(), computeITKMeasures(), computeMeanDist(), contourDectection(), falsePositiveRatioTester(), formatLabels(), getDetectionMarks(), getDiceCoefficient(), getJaccardCoefficient(), getMeanOverlap(), getNPV(), getNumberOfClusters(), getOverlapTab(), getPPV(), getRelativeVolumeError(), getSensitivity(), getSpecificity(), getTruePositiveLesions(), and getUnionOverlap().
Referenced by anima::SegPerfApp::processAnalyze().
void anima::SegPerfCAnalyzer::setNbThreads | ( | int | pi_iNbThreads | ) |
Set the number of threads to use for the computation of ITK.
[in] | pi_iNbThreads | Number of threads. |
Definition at line 790 of file animaSegPerfCAnalyzer.cxx.
Referenced by anima::SegPerfApp::play().