Learn R Programming

RNifti (version 1.7.0)

pixdim: Pixel dimensions and units

Description

By default, these generic functions return or replace the "pixdim" and "pixunits" attributes of their arguments. These represent the physical step size between pixel or voxel centre points, and the spatial and temporal units that they are given in. The former defaults to 1 in each dimension, if there is no attribute.

Usage

pixdim(object)

# S3 method for default pixdim(object)

pixdim(object) <- value

# S3 method for default pixdim(object) <- value

pixunits(object)

# S3 method for default pixunits(object)

pixunits(object) <- value

# S3 method for default pixunits(object) <- value

Value

pixdim returns a numeric vector of pixel dimensions.

pixunits returns a character vector of length up to two, giving the spatial and temporal unit names.

Arguments

object

An R object, generally an image.

value

Numeric vector of pixel dimensions along each axis, or character vector of abbreviated units. For dimensions, a scalar value will be recycled if necessary.

Author

Jon Clayden <code@clayden.org>

Examples

Run this code
im <- readNifti(system.file("extdata", "example.nii.gz", package="RNifti"))
pixdim(im)
pixunits(im)

Run the code above in your browser using DataLab