Overloaded operators for antsImage objects

# S4 method for antsImage
which(x, arr.ind = FALSE, useNames = TRUE)

# S4 method for antsImage,antsImage
Arith(e1, e2)

# S4 method for antsImage,antsImage
+(e1, e2)

# S4 method for antsImage,antsImage
-(e1, e2)

# S4 method for antsImage,antsImage
*(e1, e2)

# S4 method for antsImage,antsImage
/(e1, e2)

# S4 method for antsImage,antsImage
^(e1, e2)

# S4 method for antsImage,antsImage
%%(e1, e2)

# S4 method for antsImage,antsImage
%/%(e1, e2)

# S4 method for antsImage,numeric
Arith(e1, e2)

# S4 method for antsImage,numeric
+(e1, e2)

# S4 method for antsImage,numeric
-(e1, e2)

# S4 method for antsImage,numeric
*(e1, e2)

# S4 method for antsImage,numeric
/(e1, e2)

# S4 method for antsImage,numeric
^(e1, e2)

# S4 method for antsImage,numeric
%%(e1, e2)

# S4 method for antsImage,numeric
%/%(e1, e2)

# S4 method for numeric,antsImage
+(e1, e2)

# S4 method for numeric,antsImage
-(e1, e2)

# S4 method for numeric,antsImage
*(e1, e2)

# S4 method for numeric,antsImage
/(e1, e2)

# S4 method for numeric,antsImage
^(e1, e2)

# S4 method for numeric,antsImage
%%(e1, e2)

# S4 method for numeric,antsImage
%/%(e1, e2)

# S4 method for antsImage,missing
Arith(e1, e2)

# S4 method for numeric,antsImage
Arith(e1, e2)

# S4 method for antsImage,logical
Arith(e1, e2)

# S4 method for logical,antsImage
Arith(e1, e2)

# S4 method for antsImage,array
Arith(e1, e2)

# S4 method for array,antsImage
Arith(e1, e2)

# S4 method for list,antsImage
Arith(e1, e2)

# S4 method for antsImage,list
Arith(e1, e2)

# S4 method for antsImage,antsImage
==(e1, e2)

# S4 method for antsImage,list
==(e1, e2)

# S4 method for antsImage,array
==(e1, e2)

# S4 method for array,antsImage
==(e1, e2)

# S4 method for antsImage,ANY
==(e1, e2)

# S4 method for ANY,antsImage
==(e1, e2)

# S4 method for antsImage,antsImage
>(e1, e2)

# S4 method for antsImage,list
>(e1, e2)

# S4 method for antsImage,array
>(e1, e2)

# S4 method for array,antsImage
>(e1, e2)

# S4 method for antsImage,ANY
>(e1, e2)

# S4 method for ANY,antsImage
>(e1, e2)

# S4 method for antsImage,antsImage
<(e1, e2)

# S4 method for antsImage,list
<(e1, e2)

# S4 method for antsImage,array
<(e1, e2)

# S4 method for array,antsImage
<(e1, e2)

# S4 method for antsImage,ANY
<(e1, e2)

# S4 method for ANY,antsImage
<(e1, e2)

# S4 method for antsImage,antsImage
!=(e1, e2)

# S4 method for antsImage,list
!=(e1, e2)

# S4 method for antsImage,array
!=(e1, e2)

# S4 method for array,antsImage
!=(e1, e2)

# S4 method for antsImage,ANY
!=(e1, e2)

# S4 method for ANY,antsImage
!=(e1, e2)

# S4 method for antsImage,antsImage
<=(e1, e2)

# S4 method for antsImage,list
<=(e1, e2)

# S4 method for antsImage,array
<=(e1, e2)

# S4 method for array,antsImage
<=(e1, e2)

# S4 method for antsImage,ANY
<=(e1, e2)

# S4 method for ANY,antsImage
<=(e1, e2)

# S4 method for antsImage,antsImage
>=(e1, e2)

# S4 method for antsImage,list
>=(e1, e2)

# S4 method for antsImage,array
>=(e1, e2)

# S4 method for array,antsImage
>=(e1, e2)

# S4 method for antsImage,ANY
>=(e1, e2)

# S4 method for ANY,antsImage
>=(e1, e2)

# S4 method for antsImage,antsImage
&(e1, e2)

# S4 method for antsImage,antsImage
|(e1, e2)

# S4 method for antsImage,array
Logic(e1, e2)

# S4 method for array,antsImage
Logic(e1, e2)

# S4 method for antsImage,logical
&(e1, e2)

# S4 method for antsImage,logical
|(e1, e2)

# S4 method for logical,antsImage
Logic(e1, e2)

# S4 method for antsImage,numeric
Logic(e1, e2)

# S4 method for numeric,antsImage
Logic(e1, e2)

# S4 method for antsImage,ANY
Logic(e1, e2)

# S4 method for ANY,antsImage
Logic(e1, e2)

# S4 method for list,antsImage
Logic(e1, e2)

# S4 method for antsImage,list
Logic(e1, e2)

Arguments

x

a logical vector or array.

arr.ind

logical; should array indices be returned when x is an array?

useNames

logical indicating if the value of arrayInd() should have (non-null) dimnames at all.

e1

is an object of class antsImage.

e2

is an object of class antsImage.

Examples

img = makeImage(c(10,10),rnorm(100)) mask = img > 0 which(mask)
#> [1] 1 2 3 4 5 7 9 10 12 15 16 18 19 25 26 28 30 31 33 #> [20] 34 37 38 40 42 44 47 50 52 53 54 57 58 59 60 62 65 66 67 #> [39] 69 71 74 76 77 80 81 83 84 85 87 89 90 94 95 97 98 100
which(mask, arr.ind = TRUE)
#> row col #> [1,] 1 1 #> [2,] 2 1 #> [3,] 3 1 #> [4,] 4 1 #> [5,] 5 1 #> [6,] 7 1 #> [7,] 9 1 #> [8,] 10 1 #> [9,] 2 2 #> [10,] 5 2 #> [11,] 6 2 #> [12,] 8 2 #> [13,] 9 2 #> [14,] 5 3 #> [15,] 6 3 #> [16,] 8 3 #> [17,] 10 3 #> [18,] 1 4 #> [19,] 3 4 #> [20,] 4 4 #> [21,] 7 4 #> [22,] 8 4 #> [23,] 10 4 #> [24,] 2 5 #> [25,] 4 5 #> [26,] 7 5 #> [27,] 10 5 #> [28,] 2 6 #> [29,] 3 6 #> [30,] 4 6 #> [31,] 7 6 #> [32,] 8 6 #> [33,] 9 6 #> [34,] 10 6 #> [35,] 2 7 #> [36,] 5 7 #> [37,] 6 7 #> [38,] 7 7 #> [39,] 9 7 #> [40,] 1 8 #> [41,] 4 8 #> [42,] 6 8 #> [43,] 7 8 #> [44,] 10 8 #> [45,] 1 9 #> [46,] 3 9 #> [47,] 4 9 #> [48,] 5 9 #> [49,] 7 9 #> [50,] 9 9 #> [51,] 10 9 #> [52,] 4 10 #> [53,] 5 10 #> [54,] 7 10 #> [55,] 8 10 #> [56,] 10 10
img01 <- as.antsImage(array(1:64, c(4,4,4,1))) img02 <- as.antsImage(array(64:1, c(4,4,4,1))) is.antsImage(img01 + img02)
#> [1] TRUE
is.antsImage(sqrt(2) * img01)
#> [1] TRUE
is.antsImage(img02 / pi)
#> [1] TRUE
img01 <- as.antsImage(array(1:64, c(4,4,4,1))) et = function(x) { testthat::expect_true(x) } x <- is.antsImage(img01 == img01) et(x) x <- is.antsImage(img01 == as.array(img01)) et(x) x <- is.antsImage(img01 == 1) et(x) x <- is.antsImage(1 == img01) et(x) x <- is.antsImage(as.array(img01) == img01) et(x) x <- is.antsImage(img01 >= img01) et(x) x <- is.antsImage(img01 >= as.array(img01)) et(x) x <- is.antsImage(img01 >= 1) et(x) x <- is.antsImage(1 >= img01) et(x) x <- is.antsImage(as.array(img01) >= img01) et(x) x <- is.antsImage(img01 > img01) et(x) x <- is.antsImage(img01 > as.array(img01)) et(x) x <- is.antsImage(img01 > 1) et(x) x <- is.antsImage(1 > img01) et(x) x <- is.antsImage(as.array(img01) > img01) et(x) x <- is.antsImage(img01 < img01) et(x) x <- is.antsImage(img01 < as.array(img01)) et(x) x <- is.antsImage(img01 < 1) et(x) x <- is.antsImage(1 < img01) et(x) x <- is.antsImage(as.array(img01) < img01) et(x) x <- is.antsImage(img01 <= img01) et(x) x <- is.antsImage(img01 <= as.array(img01)) et(x) x <- is.antsImage(1 <= img01) et(x) x <- is.antsImage(img01 <= 1) et(x) x <- is.antsImage(as.array(img01) <= img01) et(x) x <- is.antsImage(img01 != img01) et(x) x <- is.antsImage(img01 != as.array(img01)) et(x) x <- is.antsImage(1 != img01) et(x) x <- is.antsImage(img01 != 1) et(x) x <- is.antsImage(as.array(img01) != img01) et(x) img01 <- as.antsImage(array(1:64, c(4,4,4,1))) testthat::expect_error(img01 == list()) img01 <- as.antsImage(array(1:64, c(4,4,4,1))) testthat::expect_error(img01 > list()) img01 <- as.antsImage(array(1:64, c(4,4,4,1))) testthat::expect_error(img01 < list()) img01 <- as.antsImage(array(1:64, c(4,4,4,1))) testthat::expect_error(img01 != list()) img01 <- as.antsImage(array(1:64, c(4,4,4,1))) testthat::expect_error(img01 <= list()) img01 <- as.antsImage(array(1:64, c(4,4,4,1))) testthat::expect_error(img01 >= list()) img01 <- as.antsImage(array(1:64, c(4,4,4,1))) mask1 = img01 == 1 mask2 = img01 == 2 testthat::expect_true(is.antsImage(mask1)) testthat::expect_true(is.antsImage(mask2)) testthat::expect_true(is.antsImage(mask1 & mask2)) testthat::expect_true(is.antsImage(mask1 | mask2)) testthat::expect_true(is.antsImage(as.array(mask2) | mask1)) testthat::expect_true(is.antsImage(as.array(mask2) & mask1)) testthat::expect_true(is.antsImage(mask2 | as.array(mask1))) testthat::expect_true(is.antsImage(mask2 & as.array(mask1))) testthat::expect_true(is.antsImage(mask2 | 1)) testthat::expect_true(is.antsImage(mask2 | TRUE)) testthat::expect_true(is.antsImage(mask2 & 1)) testthat::expect_true(is.antsImage(mask2 & TRUE))