Computes Sensitivity, Specificity, Positive Predictive Value (PPV), and Negative Predictive Value (NPV) by comparing detected points with ground truth ROI points. This function is used to assess the accuracy of SCC- or SPM-based detection in neuroimaging analysis.
Arguments
- detectedPoints
A data frame containing detected coordinates (
x
,y
). SCC-detected points should be obtained usinggetPoints
. SPM-detected points should be obtained usinggetSPMbinary
.- truePoints
A data frame with ground truth ROI coordinates (
x
,y
), extracted viaprocessROIs
.- totalCoords
A list with the full voxel grid dimensions, created by
getDimensions
. Must include named elementsxDim
andyDim
.- regionName
A character string used to label the output region.
Value
A data frame with the following evaluation metrics
region
: Name of the analyzed region.sensitivity
: True positive rate (TP / (TP + FN) * 100).specificity
: True negative rate (TN / (TN + FP) * 100).PPV
: Positive predictive value (TP / (TP + FP) * 100).NPV
: Negative predictive value (TN / (TN + FN) * 100).
Details
This function requires three precomputed objects
detectedPoints
: SCC-detected points fromgetPoints
or SPM-detected points fromgetSPMbinary
.truePoints
: Ground truth ROIs extracted usingprocessROIs
.totalCoords
: Full voxel coordinate grid fromgetDimensions
.
See also
getPoints
for SCC-detected regions. getSPMbinary
for binary SPM-detected points. processROIs
for defining ground truth ROIs. getDimensions
for generating the coordinate grid.
Examples
# Load precomputed inputs for the example
data("calculateMetricsExample", package = "neuroSCC")
# Evaluate SCC and SPM detection performance
with(calculateMetricsExample, {
metricsSCC <- calculateMetrics(detectedSCC, trueROI, totalCoords, "Region2_SCC")
metricsSPM <- calculateMetrics(detectedSPM, trueROI, totalCoords, "Region2_SPM")
print(metricsSCC)
print(metricsSPM)
})
#> region sensitivity specificity PPV NPV
#> 1 Region2_SCC 85.12872 95.62596 97.22839 78.10603
#> region sensitivity specificity PPV NPV
#> 1 Region2_SPM 75.14124 96.31291 96.33654 75.01638