read.nii.voxel: Read NII Voxel

Description Usage Arguments Details Value Author(s) Examples

View source: R/read.nii.voxel.R

Description

Read values from NIfTI files at given coordinates (x,y,z,t).

Usage

1
read.nii.voxel(nii.file, coords)

Arguments

nii.file

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

coords

A numeric vector conatining x,y,z,t coordinates indicating the location to read values

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).

Values for t coordinates (coords[4]) may be Inf to retrieve all timepoints for the given x,y,z coordinates. If data is 4D and only x, y, z coordinates are given, the value at those coordinates for the first volume only is returned.

Value

A number or a numeric vector containing values for all timepoints.

Author(s)

Timothy R. Koscik <timothy-koscik@uiowa.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
example.image <- "~/example_image.nii"
coordinates <- c(50,50,50,1)
image.voxel <- read.nii.volume(nii.file = example.image, coords = coordinates)

example.image <- "~/example_image_multivolume.nii"
coordinates <- c(50,50,50,Inf)
image.voxel.allVolumes <- read.nii.volume(nii.file = example.image, coords = coordinates)

## End(Not run)

TKoscik/tk.nifti documentation built on June 6, 2021, 2:30 a.m.