Import a neuroim2::NeuroVec (4D brain volume) as a GDS object.
The 4th dimension can represent subjects OR contrasts.
Usage
# S3 method for class 'NeuroVec'
as_gds(
x,
assay_name = "beta",
along = c("subject", "contrast"),
subjects = NULL,
contrasts = NULL,
mask = NULL,
...
)
# S3 method for class 'DenseNeuroVec'
as_gds(
x,
assay_name = "beta",
along = c("subject", "contrast"),
subjects = NULL,
contrasts = NULL,
mask = NULL,
...
)Arguments
- x
A
neuroim2::NeuroVecobject.- assay_name
Name for the assay (default:
"beta").- along
What does the 4th dimension represent? One of:
"subject": Each volume is a different subject (single contrast)"contrast": Each volume is a different contrast (single subject)
- subjects
Character vector of subject IDs. Length must match the 4th dimension when
along = "subject", or length 1 whenalong = "contrast".- contrasts
Character vector of contrast names. Length must match the 4th dimension when
along = "contrast", or length 1 whenalong = "subject".- mask
Optional mask. See
as_gds.NeuroVolfor options.- ...
Additional arguments passed to
new_gds().
Examples
if (requireNamespace("neuroim2", quietly = TRUE)) {
sp4 <- neuroim2::NeuroSpace(c(4, 4, 2, 3), spacing = c(2, 2, 2))
vec4d <- neuroim2::NeuroVec(array(rnorm(96), c(4, 4, 2, 3)), sp4)
# 4D volume where each volume is a subject
gds_obj <- as_gds(vec4d, along = "subject",
subjects = c("sub-01", "sub-02", "sub-03"))
print(subjects(gds_obj))
# 4D volume where each volume is a contrast
gds_obj <- as_gds(vec4d, along = "contrast",
contrasts = c("faces", "places", "objects"))
print(contrasts(gds_obj))
}
#> [1] "sub-01" "sub-02" "sub-03"
#> [1] "faces" "places" "objects"