afni_subset_4d: Subset 4D images

Description Usage Arguments Value Examples

View source: R/afni_subset_4d.R

Description

Subset 4D images

Usage

1
2
afni_subset_4d(file, time_start = 0, time_end = "$", by = 1,
  retimg = FALSE)

Arguments

file

4-dimensional Filename or nifti object to subset

time_start

the time point to subset from. Remember timepoint numbering starts from 0

time_end

the last time point to subset

by

How should the subsetting be done. If you want to subset every second time point, use by = 2 for example

retimg

Should an image be returned (TRUE) or a filename?

Value

A nifti object or an output file depending on retimg

Examples

1
2
3
4
5
6
7
8
library(kirby21.fmri)
if (have_afni()) {
tdir = tempfile()
res = download_fmri_data(outdir = tdir)
file = kirby21.fmri::get_fmri_filenames(outdir = tdir)[1]
sub_file = afni_subset_4d(file, time_start = 0, time_end = 1)
dim(neurobase::readnii(sub_file))[4] == 2
}

neuroconductor/afnir documentation built on May 22, 2021, 9:54 a.m.