Learn R Programming

tractor.base (version 2.5.0)

newMriImageWithData: Functions for creating MriImage objects from data

Description

Functions for creating MriImage objects from data, including other images.

Usage

newMriImageWithData(data, templateImage = nilObject(), imageDims = NA,
    voxelDims = NA, voxelDimUnits = NA, origin = NA, tags = NA)

newMriImageByExtraction(image, dim, loc) extractDataFromMriImage(image, dim, loc) newMriImageByMasking(image, mask) newMriImageByThresholding(image, level, defaultValue = 0) newMriImageByTrimming(image, clearance = 4) newMriImageByReordering(image)

newMriImageAsShapeOverlay(type = c("cross", "block"), baseImage, ...) generateImageDataForShape(type = c("cross", "block"), dim, background = 0, centre = NA, width = NA)

newMriImageWithSimpleFunction(image, fun, ...) newMriImageWithBinaryFunction(image1, image2, fun, ...)

Arguments

data
An array of voxel data.
templateImage
An optional MriImage object, to be used as a metadata template.
imageDims, voxelDims, voxelDimUnits, origin, tags
Metadata for the new image object. These values override any from the metadata object or data array.
image, image1, image2
MriImage objects.
dim, loc
For newMriImageByExtraction, the dimension and location along that dimension for which data should be extracted. For generateImageDataForShape, dim is the dimensions of the image. newMriImageAsShapeOverlay
mask
An array of mode logical indicating which voxels are in the mask. Must have the same dimensions as the image.
level
A numeric value specifying the threshold level.
defaultValue
The value of the final image in voxels which are below threshold.
clearance
The number of voxels' clearance left around a trimmed image.
type
The shape type to generate. A "block" is a cubic region of the image; a "cross" is the central line of the cube in each dimension.
baseImage
The MriImage to use as a base for the overlay.
background
The voxel value outside the shape.
centre, width
The centre and width of the shape.
fun
A function object, taking one or two numeric array parameters, as appropriate.
...
For newMriImageAsShapeOverlay, further parameters to generateImageDataForShape. And for newMriImageWithSimpleFunction and newMriImageWithBinaryFunction, further parameters to fun.

Value

  • An MriImage object.

Details

All of these functions use data from arrays or MriImage objects to create a new MriImage object. newMriImageWithData is the basic function for creating an object from its constituents: an array of voxel values and some metadata (and/or a template image). newMriImageByExtraction reduces the dimensionality of the source image by one, by extracting a single ``line'' of data along one dimension. (An array, rather than an MriImage object, is returned by extractDataFromMriImage.) newMriImageByMasking modifies the data by masking out unwanted voxels, and newMriImageByThresholding by thresholding. newMriImageByTrimming trims empty space from the edges of an image, reducing the dimensions of the image and thus avoiding the storage of lots of zeroes. newMriImageByReordering reorders the image data (and corresponding metadata) to the LAS convention, an operation which is usually performed when an image is read from file. newMriImageAsShapeOverlay creates an image which contains a simple shape. newMriImageWithSimpleFunction and newMriImageWithBinaryFunction modify the image data by applying an arbitrary function to it. Any function that can be applied to numeric arrays, and expects one or two arguments, respectively, is suitable for fun.

References

Please cite the following reference when using TractoR in your work:

J.D. Clayden, S. Muñoz Maniega, A.J. Storkey, M.D. King, M.E. Bastin & C.A. Clark (2011). TractoR: Magnetic resonance imaging and tractography with R. Journal of Statistical Software 44(8):1-18. http://www.jstatsoft.org/v44/i08/.

See Also

MriImage