knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(neuroSCC)
This vignette guides you through the initial data preparation steps necessary to use the neuroSCC package for analyzing neuroimaging data with Simultaneous Confidence Corridors (SCC).
We'll begin by loading a sample PET neuroimaging file included with the package and inspecting its structure.
niftiFile <- system.file("extdata", "syntheticControl1.nii.gz", package = "neuroSCC") # Load and clean data using neuroCleaner petData <- neuroCleaner(niftiFile) # Inspect the data head(petData) str(petData)
Now, let's demonstrate how to create a structured database using multiple PET files available in the package.
# Create database for control subjects controlPattern <- "^syntheticControl.*\\.nii.gz$" databaseControls <- databaseCreator(pattern = controlPattern, control = TRUE, quiet = FALSE) # Inspect the created database head(databaseControls) table(databaseControls$CN_number)
We'll transform the PET database into a matrix format suitable for SCC analysis.
# Create matrix for Z-slice 35 matrixControls <- matrixCreator(databaseControls, paramZ = 35, quiet = FALSE) # Inspect matrix structure dim(matrixControls) str(matrixControls)
Normalization adjusts for global intensity differences between subjects.
# Perform mean normalization normalizedMatrix <- meanNormalization(matrixControls, returnDetails = FALSE)
Contours from the neuroimage are used to set boundaries for SCC computations.
# Extract contours from sample data contours <- neuroContour(niftiFile, paramZ = 35, levels = 0, plotResult = TRUE) # Check contours structure length(contours) str(contours[[1]])
The triangulation step requires the external Triangulation
package, currently not on CRAN. Ensure you have this package installed. If not, install it using:
remotes::install_github("FIRST-Data-Lab/Triangulation")
Conditional example for triangulation:
if (!requireNamespace("Triangulation", quietly = TRUE)) { cat("Triangulation package is not installed.\nInstall it using: remotes::install_github('FIRST-Data-Lab/Triangulation')\n") } else { # Perform triangulation with the first contour mesh <- Triangulation::TriMesh(n = 15, contours[[1]]) # Inspect mesh print(mesh[["V"]][1:10, ]) print(mesh[["Tr"]][1:10, ]) }
You're now ready to perform Simultaneous Confidence Corridor analyses:
one_group_scc
vignette)two_group_comparison
vignette)one_vs_group
vignette)Feel free to explore these vignettes to continue your analysis journey with neuroSCC.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.