read_nifti: readNIfTI

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

These functions read in the header information and multidimensional array from a binary file in NIfTI-1 format into a nifti-class object.

Usage

1
2
3
4
readNIfTI(fname, verbose = FALSE, warn = -1, reorient = TRUE,
  call = NULL, read_data = TRUE)

nifti_header(fname, verbose = FALSE, warn = -1)

Arguments

fname

is the file name of the NIfTI file(s).

verbose

is a logical variable (default = FALSE) that allows text-based feedback during execution of the function.

warn

is a number to regulate the display of warnings (default = -1). See options for more details.

reorient

is a logical variable (default = TRUE) that enforces Qform/Sform transformations.

call

keeps track of the current function call for use in the NIfTI extension.

read_data

Should the data be read in? If this is FALSE, then an array of NAs are given instead of the true data. Useful if you are simply interested in the header.

Details

The readNIfTI function utilizes internal methods readBin and readChar to efficiently extract information from the binary file(s).

Current acceptable data types include

list("UINT8")

BINARY (1 bit per voxel)

list("INT16")

SIGNED SHORT (16 bits per voxel)

list("INT32")

SINGED INT (32 bits per voxel)

list("FLOAT32")

FLOAT (32 bits per voxel)

list("DOUBLE64")

DOUBLE (64 bits per voxel)

list("UINT16")

UNSIGNED SHORT (16 bits per voxel)

list("UINT32")

UNSIGNED INT (32 bits per voxel)

Value

An object of class nifti.

Author(s)

Brandon Whitcher [email protected],
Volker Schmid [email protected],
Andrew Thornton [email protected]

References

NIfTI-1
http://nifti.nimh.nih.gov/

See Also

readAFNI, readANALYZE

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 
url <- "http://nifti.nimh.nih.gov/nifti-1/data/filtered_func_data.nii.gz"
urlfile <- file.path(system.file("nifti", package="oro.nifti"),
                     "filtered_func_data")
download.file(url, urlfile, quiet=TRUE)

## End(Not run)
## The NIfTI file provided here contains the first 18 volumes (10%)
## of the original data set
urlfile <- file.path(system.file("nifti", package="oro.nifti"),
                     "filtered_func_data")
(ffd <- readNIfTI(urlfile))
image(ffd, oma=rep(2,4))
orthographic(ffd, oma=rep(2,4))
## Not run: 
## 27 scans of Colin Holmes (MNI) brain co-registered and averaged
## NIfTI two-file format
URL <- "http://imaging.mrc-cbu.cam.ac.uk/downloads/Colin/colin_1mm.tgz"
urlfile <- file.path(tempdir(), "colin_1mm.tgz")
download.file(URL, dest=urlfile, quiet=TRUE)
untar(urlfile, exdir=tempdir())
colin <- readNIfTI(file.path(tempdir(), "colin_1mm"))
image(colin, oma=rep(2,4))
orthographic(colin, oma=rep(2,4))

## End(Not run)

oro.nifti documentation built on Nov. 17, 2017, 4:04 a.m.