clampmax: Return function that finds maximum of its inputs within a...

Description Usage Arguments Details Value Examples

View source: R/im3d.R

Description

Return function that finds maximum of its inputs within a clamping range

Usage

1
clampmax(xmin, xmax, replace.infinite = NA_real_)

Arguments

xmin, xmax

clamping range. If xmax is missing xmin should be a vector of length 2.

replace.infinite

The value with which to replace non-finite values in the input vector. When codereplace.infinite=FALSE no action is taken. The default value of NA will result in e.g. Inf being mapped to NA.

Details

Note that by default infinite values in the input vector are converted to NAs before the being compared with the clampmax range.

Value

A function with signature f(x, ..., na.rm)

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
LHMask=read.im3d(system.file('tests/testthat/testdata/nrrd/LHMask.nrrd',package='nat'))
d=unmask(rnorm(sum(LHMask),mean=5,sd=5),LHMask)
op=par(mfrow=c(1,2))
rval=image(projection(d,projfun=max))
image(projection(d,projfun=clampmax(0,10)),zlim=rval$zlim)
par(op)

## End(Not run)

nat documentation built on Sept. 6, 2021, 5:09 p.m.