Description Usage Arguments Details Value Author(s) Examples
Set of methods extract a numeric vector
from an antsImage
. Set of methods to replace the pixels in an antsImage
using a numeric vector
1 2 3 4 5 6 7 8 9 |
img |
Image object of S4 class 'antsImage' to be indexed. |
mask |
|
region |
|
lst |
|
vect |
|
row |
|
col |
|
slice |
|
time |
|
img[mask]
Image-region considered is the largest-possible-region( entire image ) of the image.
img[row,col,slice,time]
Number of indices must match the number of dimensions of the image. A 2D image requires and allows indices 'row' and 'col' only. A 3D image requires and allows indices 'row', 'col' and 'slice' only. A 4D image requires and allows indices 'row', 'col', 'slice' and 'time'.
Extractors :
numeric vector
of dimensions equal to that of 'region' considered or number of 'pixels' considered – Success ; NA – Failure
Mutators :
Modified S4 object of class antsImage
– Success ; Original S4 object of class antsImage
– Failure
Shrinidhi KL
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## 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) ;
# here the first 10 elements of vect correspond to first column ( row = 1:10 , col = 1 , slice = 1 ) of image-region, next 10 elements come from
# second column ( row = 1:10 , col = 2 , slice = 1 ) of the image-region and so on
reg = new( "antsRegion" , index = c(1,1,1) , size = c(10,10,10) )
vect = img[ NULL , region = reg ] # OR
vect = img[ list( mask = NULL , region = reg ) ]
# set the values of pixels in the square ( row = 1:10 , col = 1:10 , slice = 3 ) using the vector c(1:100) ;
# here the first column ( row = 1:10 , col = 1 , slice = 3 ) of image gets values c(1:10), second column ( row = 1:10 , col = 2 , slice = 3 ) gets
# values c(11:20) and so on
img[ 1:10 , 1:10 , 3 ] <- c(1:100)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.