threshold: Threshold an object, typically to produce a mask

Description Usage Arguments Details Value See Also Examples

View source: R/im3d.R

Description

Threshold an object, typically to produce a mask

Usage

1
2
3
4
5
6
7
8
9
threshold(x, ...)

## S3 method for class 'im3d'
threshold(
  x,
  threshold = 0,
  mode = c("logical", "integer", "raw", "numeric"),
  ...
)

Arguments

x

Object to be thresholded

...

Additional arguments passed to methods

threshold

Either a numeric value that pixels must exceed in order to be included in the mask or a logical vector defining foreground pixels.

mode

The storage mode of the resultant object (see vector

Details

Note that threshold.im3d passes ... arguments on to im3d

Value

an oject with attributes matching x and elements with value as.vector(TRUE, mode=mode) i.e. TRUE, 1, 0x01 and as.vector(FALSE, mode=mode) i.e. FALSE, 0, 0x00 as appropriate.

See Also

Other im3d: as.im3d(), boundingbox(), im3d-coords, im3d-io, im3d(), imexpand.grid(), imslice(), is.im3d(), mask(), origin(), projection(), unmask(), voxdims()

Examples

1
2
x=im3d(rnorm(1000),dims=c(10,10,10), BoundingBox=c(20,200,100,200,200,300))
stopifnot(all.equal(threshold(x, 0), threshold(x, x>0)))

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