as.antsImage: numeric matrix/array to antsImage

Description Usage Arguments Value Author(s) Examples

Description

Create an antsImage object from a numeric matrix or numeric array.

Usage

1
as.antsImage( object [, pixeltype] [, spacing] [, origin] )

Arguments

object

numeric matrix or numeric array to be used to construct the antsImage. Dimensions of this object are used to set the dimensions of the image constructed. Allowed dimensions: 2 , 3 , 4. Resulting image is filled up column-wise meaning that the first column of 'object' becomes the first column of the image and second column of 'object' becomes the second column of the image and so on.

pixeltype

C++ datatype to be used to represent the pixels of the image constructed. Make sure you use a type that can represent all the values in the input vector. There may be truncation involved otherwise. Allowed values: "double", "float", "unsigned int", "unsigned char". Default: "double"

spacing

numeric vector of length equal to the dimensions of the 'object' providing the 'spacing' information for the image to be constructed. Default: vector of 1s

origin

numeric vector of length equal to the dimensions of the 'object' providing the 'origin' information for the image to be constructed. Default: vector of 0s

Value

Object of class antsImage – Success ; NA – Failure

Author(s)

Shrinidhi KL

Examples

1
2
3
4
5
6
## Not run: 
# create an image from a numeric array with details as shown ; here the image pixeltype is assumed to be 'double'
arr = array( c(1:1000) , dim = c(10,10,10) )
img = as.antsImage( arr , spacing = c( 1.2 , 1.2 , 2 ) , origin = c( 0 , 0 , 0 ) )

## End(Not run)

klshrinidhi/ANTsR documentation built on May 20, 2019, 12:37 p.m.