This function removes specified timepoints (volumes) from a 4D NIfTI image and saves the resulting image to a new file. Timepoints are specified using 1-based indexing, consistent with R conventions.
Details
This function uses the volumes
argument in RNifti to efficiently read
only the retained timepoints from disk. If all volumes are removed, an error is thrown.
The input image must be 4-dimensional (i.e., include a time dimension).
Examples
if (FALSE) { # \dontrun{
remove_nifti_volumes("input_bold.nii.gz", remove_tpts = c(1, 2, 100),
outfile = "trimmed_bold.nii.gz")
} # }