antsImageops: Operations for antsImage Objects

antsImage-operatorsR Documentation

Operations for antsImage Objects

Description

Overloaded operators for antsImage objects

Usage

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

## S4 method for signature 'antsImage,antsImage'
e1 + e2

## S4 method for signature 'antsImage,antsImage'
e1 - e2

## S4 method for signature 'antsImage,antsImage'
e1 * e2

## S4 method for signature 'antsImage,antsImage'
e1 / e2

## S4 method for signature 'antsImage,antsImage'
e1 ^ e2

## S4 method for signature 'antsImage,antsImage'
e1 %% e2

## S4 method for signature 'antsImage,antsImage'
e1 %/% e2

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

## S4 method for signature 'antsImage,numeric'
e1 + e2

## S4 method for signature 'antsImage,numeric'
e1 - e2

## S4 method for signature 'antsImage,numeric'
e1 * e2

## S4 method for signature 'antsImage,numeric'
e1 / e2

## S4 method for signature 'antsImage,numeric'
e1 ^ e2

## S4 method for signature 'antsImage,numeric'
e1 %% e2

## S4 method for signature 'antsImage,numeric'
e1 %/% e2

## S4 method for signature 'numeric,antsImage'
e1 + e2

## S4 method for signature 'numeric,antsImage'
e1 - e2

## S4 method for signature 'numeric,antsImage'
e1 * e2

## S4 method for signature 'numeric,antsImage'
e1 / e2

## S4 method for signature 'numeric,antsImage'
e1 ^ e2

## S4 method for signature 'numeric,antsImage'
e1 %% e2

## S4 method for signature 'numeric,antsImage'
e1 %/% e2

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

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

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

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

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

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

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

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

## S4 method for signature 'antsImage,antsImage'
e1 == e2

## S4 method for signature 'antsImage,list'
e1 == e2

## S4 method for signature 'antsImage,array'
e1 == e2

## S4 method for signature 'array,antsImage'
e1 == e2

## S4 method for signature 'antsImage,ANY'
e1 == e2

## S4 method for signature 'ANY,antsImage'
e1 == e2

## S4 method for signature 'antsImage,antsImage'
e1 > e2

## S4 method for signature 'antsImage,list'
e1 > e2

## S4 method for signature 'antsImage,array'
e1 > e2

## S4 method for signature 'array,antsImage'
e1 > e2

## S4 method for signature 'antsImage,ANY'
e1 > e2

## S4 method for signature 'ANY,antsImage'
e1 > e2

## S4 method for signature 'antsImage,antsImage'
e1 < e2

## S4 method for signature 'antsImage,list'
e1 < e2

## S4 method for signature 'antsImage,array'
e1 < e2

## S4 method for signature 'array,antsImage'
e1 < e2

## S4 method for signature 'antsImage,ANY'
e1 < e2

## S4 method for signature 'ANY,antsImage'
e1 < e2

## S4 method for signature 'antsImage,antsImage'
e1 != e2

## S4 method for signature 'antsImage,list'
e1 != e2

## S4 method for signature 'antsImage,array'
e1 != e2

## S4 method for signature 'array,antsImage'
e1 != e2

## S4 method for signature 'antsImage,ANY'
e1 != e2

## S4 method for signature 'ANY,antsImage'
e1 != e2

## S4 method for signature 'antsImage,antsImage'
e1 <= e2

## S4 method for signature 'antsImage,list'
e1 <= e2

## S4 method for signature 'antsImage,array'
e1 <= e2

## S4 method for signature 'array,antsImage'
e1 <= e2

## S4 method for signature 'antsImage,ANY'
e1 <= e2

## S4 method for signature 'ANY,antsImage'
e1 <= e2

## S4 method for signature 'antsImage,antsImage'
e1 >= e2

## S4 method for signature 'antsImage,list'
e1 >= e2

## S4 method for signature 'antsImage,array'
e1 >= e2

## S4 method for signature 'array,antsImage'
e1 >= e2

## S4 method for signature 'antsImage,ANY'
e1 >= e2

## S4 method for signature 'ANY,antsImage'
e1 >= e2

## S4 method for signature 'antsImage'
is.na(x)

## S4 method for signature 'antsImage'
anyNA(x, recursive = FALSE)

## S4 method for signature 'antsImage'
is.nan(x)

## S4 method for signature 'antsImage'
is.infinite(x)

## S4 method for signature 'antsImage'
is.finite(x)

Arguments

e1

is an object of class antsImage.

e2

is an object of class antsImage.

x

is an object of class antsImage.

recursive

not used

Details

Overloading binary operators for antsImage Objects

Author(s)

John Muschellli muschellij2@gmail.com

Examples


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)
is.antsImage(sqrt(2) * img01)
is.antsImage(img02 / pi)
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)

###########################
# Multi image operations
########################
fname <- system.file("extdata",
  "multi_component_image.nii.gz",
  package = "ANTsRCore"
)
img <- antsImageRead(fname)

testthat::expect_is(img > 0, "antsImage")
testthat::expect_is(0 < img, "antsImage")
testthat::expect_is(img > c(0, 0), "antsImage")

testthat::expect_is(img >= 0, "antsImage")
testthat::expect_is(0 <= img, "antsImage")
testthat::expect_is(img >= c(0, 0), "antsImage")

testthat::expect_is(img < 0, "antsImage")
testthat::expect_is(0 > img, "antsImage")
testthat::expect_is(img < c(0, 0), "antsImage")

testthat::expect_is(img <= 0, "antsImage")
testthat::expect_is(0 >= img, "antsImage")
testthat::expect_is(img <= c(0, 0), "antsImage")

testthat::expect_is(img == 0, "antsImage")
testthat::expect_is(0 == img, "antsImage")
testthat::expect_is(img == c(0, 0), "antsImage")

testthat::expect_is(img != 0, "antsImage")
testthat::expect_is(0 != img, "antsImage")
testthat::expect_is(img != c(0, 0), "antsImage")

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())

stnava/ANTsR documentation built on April 16, 2024, 12:17 a.m.