Skip to contents

Loads a NIfTI-format neuroimaging file and transforms it into a structured data frame, organizing voxel-level information for downstream analysis. This function is the first step in the neuroimaging processing pipeline in neuroSCC, converting raw PET data into a format suitable for functional data analysis. SCCs are later computed using functions from the ImageSCC package, such as ImageSCC::scc.image().

Usage

neuroCleaner(name, demo = NULL, demoRow = 1)

Arguments

name

character. The full path to the NIfTI file to process.

demo

Optional data.frame containing demographic information. If provided, it should include columns (case-insensitive): PPT, Group, Sex, and Age. If automatic matching via the PPT column fails, the row specified by demoRow is used. Default is NULL.

demoRow

integer. Row to use from the demographic table if automatic matching fails. Default is 1.

Value

A data frame where each row represents a voxel (3D pixel).

  • If demographics are provided: the columns include PPT, Group, Sex, Age, z, x, y, and pet.

  • If demographics are not provided: the columns include z, x, y, and pet.

The pet column contains the PET intensity value at each voxel location.

Details

The function performs the following steps

  1. Loads the NIfTI file using oro.nifti::readNIfTI().

  2. Converts the 3D image into a tidy data frame.

  3. Adds z, x, and y voxel coordinates.

  4. If demographic data is provided, attempts to match based on PPT (case-insensitive). If no match is found, demoRow is used.

The resulting data frame serves as input for databaseCreator, matrixCreator, and other core functions in the neuroSCC pipeline.

See also

databaseCreator for batch image processing.
readNIfTI for reading NIfTI-format files.

Examples

# Load a sample Control NIfTI file
niftiFile <- system.file("extdata", "syntheticControl1.nii.gz", package = "neuroSCC")

# Example Without demographic data
petData <- neuroCleaner(niftiFile)
petData[sample(nrow(petData), 10), ]  # Show 10 random voxels
#>         z  x   y pet
#> 727430 74 31  73   0
#> 782978 79 86  31   0
#> 682067 69 70  54   6
#> 860620 87 70  65   0
#> 667570 68 28  54  10
#> 118523 12 87  40   0
#> 391197 40 40 105   0
#> 29528   3 89  98   0
#> 297705 31  2  26   0
#> 142307 15 32  62   5