The neuroim2
package is currently in development. The goal of the
project is to to provide basic functionality for working with
neuroimaging data in R. neuroim2
It is an effort to modify and upgrade
the neuroim
package (https://github.com/bbuchsbaum/neuroim).
You can install the development version of neuroim2
(v. 0.1.0
) from
Github with:
# install.packages("devtools")
devtools::install_github("bbuchsbaum/neuroim2")
To read in a volumetric NIFTI formatted image, use the read_vol
function:
library(neuroim2)
## Loading required package: Matrix
fname <- system.file("extdata", "global_mask.nii", package="neuroim2")
vol <- read_vol(fname)
Now, vol
can be treated as a three-dimensional array:
v1 <- vol[1,1,1]
vol2 <- vol + vol
vol3 <- vol2 - vol
all(vol == vol3)
## [1] TRUE
We can create a 4D image, by concatenating several 3D volumes:
vec <- concat(vol, vol, vol2)
series1 <- vec[1,1,1,]
length(series1)
## [1] 3
See examples of use of neuroim2
in the
vignettes.