ANIMA  4.0
Public Member Functions | Protected Member Functions | List of all members
anima::SegPerfCAnalyzer Class Reference

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...
 

Detailed Description

Class to compute various metrics to evaluate segmentation results.

Definition at line 25 of file animaSegPerfCAnalyzer.h.

Constructor & Destructor Documentation

◆ SegPerfCAnalyzer()

anima::SegPerfCAnalyzer::SegPerfCAnalyzer ( std::string &  pi_pchImageTestName,
std::string &  pi_pchImageRefName,
bool  bAdvancedEvaluation 
)

Constructor.

Read input images

Parameters
[in]pi_pchImageTestNameName of the image to evaluate
[in]pi_pchImageRefNameName of the ground truth image
[in]bAdvancedEvaluation

Definition at line 23 of file animaSegPerfCAnalyzer.cxx.

References checkImagesMatrixAndVolumes(), and formatLabels().

◆ ~SegPerfCAnalyzer()

anima::SegPerfCAnalyzer::~SegPerfCAnalyzer ( )

Definition at line 160 of file animaSegPerfCAnalyzer.cxx.

Member Function Documentation

◆ checkImagesMatrixAndVolumes()

bool anima::SegPerfCAnalyzer::checkImagesMatrixAndVolumes ( )

Check if the 2 inputs images are compatible.

Returns
true if image are compatible else false.

Definition at line 97 of file animaSegPerfCAnalyzer.cxx.

Referenced by anima::SegPerfApp::play(), and SegPerfCAnalyzer().

◆ checkNumberOfLabels()

void anima::SegPerfCAnalyzer::checkNumberOfLabels ( int  iNbLabelsImageTest,
int  iNbLabelsImageRef 
)
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().

◆ computeAverageSurfaceDistance()

double anima::SegPerfCAnalyzer::computeAverageSurfaceDistance ( )

Compute average surface distance.

Returns
average surface distance

Definition at line 662 of file animaSegPerfCAnalyzer.cxx.

References contourDectection().

Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().

◆ computeHausdorffDist()

double anima::SegPerfCAnalyzer::computeHausdorffDist ( )

Compute Haussdorf distance.

Returns
hausdorffDistance in double

Definition at line 590 of file animaSegPerfCAnalyzer.cxx.

References anima::SegmentationMeasuresImageFilter< TLabelImage >::New().

Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().

◆ computeITKMeasures()

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().

◆ computeMeanDist()

double anima::SegPerfCAnalyzer::computeMeanDist ( )

Compute mean distance.

Returns
meanDistance

Definition at line 624 of file animaSegPerfCAnalyzer.cxx.

References contourDectection(), and anima::SegmentationMeasuresImageFilter< TLabelImage >::New().

Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().

◆ contourDectection()

void anima::SegPerfCAnalyzer::contourDectection ( )
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().

◆ falsePositiveRatioTester()

bool anima::SegPerfCAnalyzer::falsePositiveRatioTester ( int  pi_iLesionReference,
int  pi_iNbLabelsTest,
int  pi_iNbLabelsRef,
int **  pi_ppiOverlapTab,
int *  pi_piTPRowSumTab,
int *  pi_piColumnSumTab,
double  pi_dfBeta,
double  pi_dfGamma 
)
protected

Compute if a lesion is detected or not with beta and gamma thresholds.

Parameters
[out]pi_iLesionReferencethe number of labels found by connected components into reference image (1 by connected component + 1 for the background).
[out]pi_iNbLabelsTestthe number of labels found by connected components into tested image (1 by connected component + 1 for the background).
[out]pi_iNbLabelsRefthe number of the label of the tested lesion.
[out]pi_ppiOverlapTabthe mapping table.
[out]pi_piTPRowSumTabthe table of sum of Rows.
[out]pi_piColumnSumTabthe table of sum of Columns.
[out]pi_dfBetathe beta threshold.
[out]pi_dfGammathe beta threshold.
Returns
true if the lesion is detected, false in other cases.

Definition at line 965 of file animaSegPerfCAnalyzer.cxx.

References pair_decreasing_comparator.

Referenced by getTruePositiveLesions(), and setMinLesionVolumeDetection().

◆ formatLabels()

void anima::SegPerfCAnalyzer::formatLabels ( )
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().

◆ getDetectionMarks()

bool anima::SegPerfCAnalyzer::getDetectionMarks ( double &  po_fPPVL,
double &  po_fSensL,
double &  po_fF1 
)

Compute useful variables to get detection scores.

Parameters
[out]po_fFNLthe output FNL (False Negative Lesions) ratio.
[out]po_fFPLthe output FPL (False Positive Lesions) ratio.
[out]po_fPPVLthe output PPVL (Positive Predictive Value for Lesions) ratio.
[out]po_fSensLthe output SensL, Lesion detection sensitivity ratio.
[out]po_fF1the output F1_score.
Returns
true

Definition at line 755 of file animaSegPerfCAnalyzer.cxx.

References getOverlapTab(), and getTruePositiveLesions().

Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().

◆ getDiceCoefficient()

double anima::SegPerfCAnalyzer::getDiceCoefficient ( )

Getter of Dice coefficient.

Returns
Dice coefficient in double

Definition at line 365 of file animaSegPerfCAnalyzer.cxx.

Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().

◆ getJaccardCoefficient()

double anima::SegPerfCAnalyzer::getJaccardCoefficient ( )

Getter of Jaccard coefficient.

Returns
Jaccard coefficient in double

Definition at line 374 of file animaSegPerfCAnalyzer.cxx.

Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().

◆ getMeanOverlap()

double anima::SegPerfCAnalyzer::getMeanOverlap ( )

Getter of Mean overlap.

Returns
Mean overlap in double

Definition at line 320 of file animaSegPerfCAnalyzer.cxx.

Referenced by setMinLesionVolumeDetection().

◆ getNPV()

double anima::SegPerfCAnalyzer::getNPV ( )

Getter of Negative predictive value.

Returns
Negative predictive value in double

Definition at line 356 of file animaSegPerfCAnalyzer.cxx.

Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().

◆ getNumberOfClusters()

int anima::SegPerfCAnalyzer::getNumberOfClusters ( )

Return the number of clusters.

Returns
Number of clusters

Definition at line 168 of file animaSegPerfCAnalyzer.cxx.

Referenced by anima::SegPerfApp::play(), and setMinLesionVolumeDetection().

◆ getOverlapTab()

void anima::SegPerfCAnalyzer::getOverlapTab ( int &  po_iNbLabelsRef,
int &  po_iNbLabelsTest,
int **&  po_ppiOverlapTab 
)
protected

Compute a table of lesion overlap between 2 images.

Parameters
[out]po_iNbLabelsRefthe number of labels found by connected components into reference image (1 by connected component + 1 for the background).
[out]po_iNbLabelsTestthe number of labels found by connected components into tested image (1 by connected component + 1 for the background).
[out]po_ppiOverlapTabthe 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().

◆ getPPV()

double anima::SegPerfCAnalyzer::getPPV ( )

Getter of Positive predictive value.

Returns
Positive predictive value in double

Definition at line 347 of file animaSegPerfCAnalyzer.cxx.

Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().

◆ getRelativeVolumeError()

double anima::SegPerfCAnalyzer::getRelativeVolumeError ( )

Getter of Relative volume error.

Returns
Relative volume error in double

Definition at line 383 of file animaSegPerfCAnalyzer.cxx.

Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().

◆ getSensitivity()

double anima::SegPerfCAnalyzer::getSensitivity ( )

Getter of Sensibility.

Returns
Sensibility in double

Definition at line 329 of file animaSegPerfCAnalyzer.cxx.

Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().

◆ getSpecificity()

double anima::SegPerfCAnalyzer::getSpecificity ( )

Getter of Specificity.

Returns
Specificity in double

Definition at line 338 of file animaSegPerfCAnalyzer.cxx.

Referenced by anima::SegPerfApp::processAnalyze(), and setMinLesionVolumeDetection().

◆ getTruePositiveLesions()

int anima::SegPerfCAnalyzer::getTruePositiveLesions ( int  pi_iNbLabelsRef,
int  pi_iNbLabelsTest,
int **  pi_ppiOverlapTab 
)
protected

Getter of True positive lesions.

Returns
True positive lesions

Definition at line 896 of file animaSegPerfCAnalyzer.cxx.

References falsePositiveRatioTester().

Referenced by getDetectionMarks(), and setMinLesionVolumeDetection().

◆ getUnionOverlap()

double anima::SegPerfCAnalyzer::getUnionOverlap ( )

Getter of Union overlap.

Returns
Union overlap in double

Definition at line 311 of file animaSegPerfCAnalyzer.cxx.

Referenced by setMinLesionVolumeDetection().

◆ selectCluster()

void anima::SegPerfCAnalyzer::selectCluster ( unsigned int  iCluster)

Select the cluster we want to use to compute evaluation results.

Parameters
[in]iCluster

Definition at line 177 of file animaSegPerfCAnalyzer.cxx.

Referenced by anima::SegPerfApp::processAnalyze().

◆ setDetectionThresholdAlpha()

void anima::SegPerfCAnalyzer::setDetectionThresholdAlpha ( double  pi_fVal)
inline

Definition at line 36 of file animaSegPerfCAnalyzer.h.

Referenced by anima::SegPerfApp::processAnalyze().

◆ setDetectionThresholdBeta()

void anima::SegPerfCAnalyzer::setDetectionThresholdBeta ( double  pi_fVal)
inline

Definition at line 41 of file animaSegPerfCAnalyzer.h.

Referenced by anima::SegPerfApp::processAnalyze().

◆ setDetectionThresholdGamma()

void anima::SegPerfCAnalyzer::setDetectionThresholdGamma ( double  pi_fVal)
inline

Definition at line 46 of file animaSegPerfCAnalyzer.h.

Referenced by anima::SegPerfApp::processAnalyze().

◆ setMinLesionVolumeDetection()

void anima::SegPerfCAnalyzer::setMinLesionVolumeDetection ( double  pi_fVal)
inline

◆ setNbThreads()

void anima::SegPerfCAnalyzer::setNbThreads ( int  pi_iNbThreads)

Set the number of threads to use for the computation of ITK.

Parameters
[in]pi_iNbThreadsNumber of threads.

Definition at line 790 of file animaSegPerfCAnalyzer.cxx.

Referenced by anima::SegPerfApp::play().


The documentation for this class was generated from the following files: