knitr::opts_chunk$set(echo = TRUE)
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) 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)
We can create a 4D image, by concatenating several 3D volumes:
vec <- concat(vol, vol, vol2) series1 <- vec[1,1,1,] length(series1)
See examples of use of neuroim2
in the vignettes.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.