as.numeric: antsImage to numeric vector

Description Usage Arguments Value Author(s) Examples

Description

Convert/coerce an antsImage object to a numeric vector. More precisely, extract a numeric vector from an antsImage.

Usage

1
as.numeric( x [, mask] [, region] )

Arguments

x

Image object of S4 class 'antsImage' to be coerced.

mask

logical vector/matrix/array to be used as mask while extracting pixel values from the image. 1/TRUEs return corresponding pixel values ; 0/FALSEs return NA. The vector provided will be 'matched' against the image-region column-wise meaning that first column of image-region is extracted using first column-length values from the vector, second column is extracted using the next column-length values from the vector and so on. Default: entire region is extracted.

region

antsRegion with in the antsImage to be considered for extraction. An antsRegion object can be created using new. Default: largest-possible-region( entire image ) in the image.

Value

numeric vector of dimensions equal to that of 'region' considered – Success ; NA – Failure

Author(s)

Shrinidhi KL

Examples

1
2
3
4
5
6
## Not run: 
# extract a vector from an image 'img' of class 'antsImage' by considering only the region starting at index (1,1,1) with size (10,10,10)
reg = new( "antsRegion" , index = c(1,1,1) , size = c(10,10,10) )
vect = as.numeric( img , region = reg )

## End(Not run)

stnava/itkImageR documentation built on May 30, 2019, 7:21 p.m.