Learn R Programming

ANTsR (version 1.0)

Comparison: Relational operators for antsImage

Description

Relational operators to compare pixel values of an antsImage with a scalar value within a given antsRegion.

Usage

img == value
img != value
img <= value="" img="">= value
img < value
img > value

or use lists

img == lst img != lst img <= lst="" img="">= lst img < lst img > lst

Arguments

img

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

value

Scalar numeric to be compared to the pixel values.

lst

list of named arguments containing names 'value' and 'region'. lst$value is used as 'value' and lst$region is used as the antsRegion within the image for comparison.

Value

logical vector of dimensions equal to that of 'region' considered -- Success ; NA -- Failure

Details

img == value

Image-region considered is the largest-possible-region( entire image ) of the image.

Examples

Run this code
# NOT RUN {
# compare all the values in the region starting at index 'c(1,1,1)' with size 'c(10,10,10)' with value '20' ;
# here the logical vector 'vect' will have dimensions '10*10*10'
reg = new( "antsRegion" , index = c(1,1,1) , size = c(10,10,10) )
vect = ( img = list( value = 20 , region = reg ) )
# compare all the pixels in the image with value '30' ;
# here the logical vector 'vect' will have dimensions of the image
vect = ( img == 30 )
# }

Run the code above in your browser using DataLab