apply: Extension of apply to allow input of antsImage

View source: R/apply.antsImage.R

applyR Documentation

Extension of apply to allow input of antsImage

Description

Returns an antsImage after applying function.

Usage

apply(X, MARGIN, FUN, ...)

## Default S3 method:
apply(X, MARGIN, FUN, ...)

## S3 method for class 'antsImage'
apply(X, MARGIN, FUN, ...)

Arguments

X

an antsImage

MARGIN

a vector giving the subscripts which the function will be applied over.

FUN

the function to be applied.

...

optional arguments to FUN

Value

output is antsImage of lower dimnesion than input

Author(s)

Duda JT

Examples


img <- makeImage(c(4, 4, 4), rnorm(4 * 4 * 4))
img2 <- apply(img, c(1, 2), mean)
is.antsImage(img2)


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