This function creates an fMRI dataset object from a set of scans, design information, and other data. The new implementation uses a pluggable backend architecture.
Usage
fmri_dataset(
scans,
mask = NULL,
TR,
run_length,
event_table = data.frame(),
base_path = ".",
censor = NULL,
preload = FALSE,
mode = c("normal", "bigvec", "mmap", "filebacked"),
backend = NULL
)
Arguments
- scans
A vector of one or more file names of the images comprising the dataset, or a pre-created storage backend object.
- mask
Name of the binary mask file indicating the voxels to include in the analysis. Ignored if scans is a backend object.
- TR
The repetition time in seconds of the scan-to-scan interval.
- run_length
A vector of one or more integers indicating the number of scans in each run.
- event_table
A data.frame containing the event onsets and experimental variables. Default is an empty data.frame.
- base_path
The file path to be prepended to relative file names. Default is "." (current directory).
- censor
A binary vector indicating which scans to remove. Default is NULL.
- preload
Read image scans eagerly rather than on first access. Default is FALSE.
- mode
The type of storage mode ('normal', 'bigvec', 'mmap', filebacked'). Default is 'normal'. Ignored if scans is a backend object.
- backend
Deprecated. Use scans parameter to pass a backend object.
Value
An fMRI dataset object of class c("fmri_file_dataset", "volumetric_dataset", "fmri_dataset", "list").
Examples
if (FALSE) { # \dontrun{
# Create an fMRI dataset with 3 scans and a mask
dset <- fmri_dataset(c("scan1.nii", "scan2.nii", "scan3.nii"),
mask = "mask.nii", TR = 2, run_length = rep(300, 3),
event_table = data.frame(
onsets = c(3, 20, 99, 3, 20, 99, 3, 20, 99),
run = c(1, 1, 1, 2, 2, 2, 3, 3, 3)
)
)
# Create an fMRI dataset with 1 scan and a mask
dset <- fmri_dataset("scan1.nii",
mask = "mask.nii", TR = 2,
run_length = 300,
event_table = data.frame(onsets = c(3, 20, 99), run = rep(1, 3))
)
# Create an fMRI dataset with a backend
backend <- nifti_backend(c("scan1.nii", "scan2.nii"), mask_source = "mask.nii")
dset <- fmri_dataset(backend, TR = 2, run_length = c(150, 150))
} # }