View source: R/calculateMetrics.R
calculateMetrics | R Documentation |
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.
calculateMetrics(detectedPoints, truePoints, totalCoords, regionName)
detectedPoints |
A data frame containing detected coordinates ( |
truePoints |
A data frame with ground truth ROI coordinates ( |
totalCoords |
A list with the full voxel grid dimensions, created by |
regionName |
A character string used to label the output region. |
This function requires three precomputed objects
detectedPoints
: SCC-detected points from getPoints
or SPM-detected points from getSPMbinary
.
truePoints
: Ground truth ROIs extracted using processROIs
.
totalCoords
: Full voxel coordinate grid from getDimensions
.
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).
getPoints
for SCC-detected regions.
getSPMbinary
for binary SPM-detected points.
processROIs
for defining ground truth ROIs.
getDimensions
for generating the coordinate grid.
# 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)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.