Learn R Programming

nifti.io (version 1.0.0)

read.nii.volume: Read NII Volume

Description

Read indicated volume from NIfTI files.

Usage

read.nii.volume(nii.file, vol.num)

Arguments

nii.file

Full directory listing to a NIFTI file. File must not be gzipped.

vol.num

An integer indicating which volume to read.

Value

An array containing values from NIFTI volume.

Details

NIfTI files need to be unzipped before using this function or any other portions of the nifti.io package. This is necessary given the inconsistent way in which gzipped files are indexed (Some information on this is given in the documentation for the readBin function).

Examples

Run this code
# NOT RUN {
# get filename for example NII file included in nifti.io package
nii.eg <- system.file("extdata", "egBrain.nii", package="nifti.io")

# read entire volume into array
volume.values <- read.nii.volume(nii.file = nii.eg, vol.num = 1)
# }

Run the code above in your browser using DataLab