# Load example 4D image file included with package
file_path <- system.file("extdata", "global_mask_v4.nii", package = "neuroim2")
fbvec <- FileBackedNeuroVec(file_path)
# Get dimensions of the image
dim(fbvec)
# Extract first volume
vol1 <- sub_vector(fbvec, 1)
# Extract multiple volumes
vols <- sub_vector(fbvec, 1:2)
Run the code above in your browser using DataLab