takeVolume {neuroim}R Documentation

Generic function to extract a one or more individual volumes from a four-dimensional image

Description

Generic function to extract a one or more individual volumes from a four-dimensional image

Usage

takeVolume(x, i, ...)

## S4 method for signature 'SparseBrainVector,numeric'
takeVolume(x, i, merge = FALSE)

## S4 method for signature 'BrainVector,numeric'
takeVolume(x, i, merge = FALSE)

Arguments

x

four-dimensional image

i

the indices of the volume(s) to extract

...

additional arguments

merge

concatenate extracted volumes

Value

a list of BrainVolume elements

Examples

bvec <- BrainVector(array(rnorm(24*24*24*24), c(24,24,24,24)), BrainSpace(c(24,24,24,24), c(1,1,1)))
vol <- takeVolume(bvec,1)
all.equal(dim(vol), c(24,24,24))

vol <- takeVolume(bvec,1:3)
length(vol) == 3
class(vol) == "list"

[Package neuroim version 0.0.6 Index]