eachSeries {neuroim}R Documentation

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, ...)

## S4 method for signature 'SparseBrainVector,'function',logical'
eachSeries(x, FUN,
  withIndex = FALSE, ...)

## S4 method for signature 'BrainVector,'function',missing'
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

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

[Package neuroim version 0.0.6 Index]