View source: R/matrixCreator.R
matrixCreator | R Documentation |
Converts a PET image database (created via databaseCreator
) into
a matrix format suitable for functional data analysis.
Each row of the resulting matrix corresponds to a subject, and each column to a voxel's PET intensity
values at a specified brain slice.
matrixCreator(
database,
paramZ = 35,
useSequentialNumbering = FALSE,
quiet = FALSE
)
database |
A data frame created by |
paramZ |
An integer specifying the z-coordinate (slice) to extract. Default is |
useSequentialNumbering |
|
quiet |
|
This function performs the following steps
Verifies that the specified z-slice exists in the database.
Identifies the correct subject grouping column (CN_number
or AD_number
).
Determines the matrix dimensions using x
and y
coordinates.
Extracts PET intensities per subject at the given slice.
Replaces any NaN
values with 0
to ensure numerical stability.
This function typically follows databaseCreator
and precedes
meanNormalization
in the neuroSCC workflow.
A numeric matrix where
Each row represents one subject's PET values at the selected z-slice.
Each column corresponds to a voxel (flattened as a 1D row).
databaseCreator
for generating the input database.
meanNormalization
for scaling matrix data prior to SCC computation.
# NOTE: To keep example runtime short, only one synthetic PET file is used.
# For full analysis, expand the filename pattern accordingly.
# Step 1: Generate a database for a single subject
controlPattern <- "^syntheticControl1\\.nii\\.gz$"
databaseControls <- databaseCreator(pattern = controlPattern, control = TRUE, quiet = TRUE)
# Step 2: Convert the database into a matrix format
matrixControls <- matrixCreator(databaseControls, paramZ = 35, quiet = TRUE)
# Display dimensions of the matrix
dim(matrixControls)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.