is_affine3D {rpyANTs} | R Documentation |
Check if an object is a 3D 'affine' transform matrix
Description
Check if an object is a 3D 'affine' transform matrix
Usage
is_affine3D(x, ...)
## Default S3 method:
is_affine3D(x, strict = TRUE, ...)
## S3 method for class 'ants.core.ants_transform.ANTsTransform'
is_affine3D(x, ...)
Arguments
x |
R or Python object, accepted forms are numeric |
... |
passed to other methods |
strict |
whether the last element should be always 1 |
Value
A logical value whether the object can be loaded as a 4-by-4 matrix.
Examples
# not affine
is_affine3D(1)
# 3x3 matrix is not as it is treated as 2D transform
is_affine3D(matrix(rnorm(9), nrow = 3))
# 3x4 matrix
x <- matrix(rnorm(12), nrow = 3)
is_affine3D(x)
# 4x4 matrix
x <- rbind(x, c(0,0,0,1))
is_affine3D(x)
if(interactive() && ants_available()) {
ants <- load_ants()
x <- ants$new_ants_transform(dimension = 3L)
is_affine3D(x)
# save the parameters
f <- tempfile(fileext = ".mat")
ants$write_transform(x, f)
is_affine3D(f)
}
[Package rpyANTs version 0.0.3 Index]