Learn R Programming

neuroim (version 0.0.6)

eachSeries: Generic functions to apply a function to each series of a 4D image That is, if the 4th dimension is 'time' each series is a 1D time series.

Description

Generic functions to apply a function to each series of a 4D image That is, if the 4th dimension is 'time' each series is a 1D time series.

Usage

eachSeries(x, FUN, withIndex, ...)
"eachSeries"(x, FUN, withIndex = FALSE, ...)
"eachSeries"(x, FUN, withIndex = FALSE, ...)

Arguments

x
a four dimensional image
FUN
a function taking one or two arguments (depending on the value of withIndex
withIndex
whether the index of the series is supplied as the second argument to the function
...
additional arguments

Details

when x is a SparseBrainVector eachSeries only iterates over nonzero series.

Examples

Run this code
bvec <- BrainVector(array(rnorm(24*24*24*24), c(24,24,24,24)), BrainSpace(c(24,24,24,24), c(1,1,1)))
res <- eachSeries(bvec, mean)
length(res) == 24*24*24

Run the code above in your browser using DataLab