projection: Make 2D (orthogonal) projection of 3D image data

View source: R/im3d.R

projectionR Documentation

Make 2D (orthogonal) projection of 3D image data

Description

Make 2D (orthogonal) projection of 3D image data

Usage

projection(
  a,
  projdim = "z",
  projfun = c("integrate", "mean", "sum"),
  na.rm = T,
  mask = NULL,
  ...
)

Arguments

a

Array of image data (im3d format)

projdim

The image dimension down which to project

projfun

The function that collapses each vector of image data down to a single pixel. Can be a character vector naming a function or a function. See details.

na.rm

Logical indicating whether to ignore NA values in the image data when calculating function results. default: TRUE

mask

A mask with the same extent as the image.

...

Additional arguments for projfun

Details

Note that projfun must have an argument na.rm like the S3 Summary groupGeneric functions such as sum, min etc.

Note also that the BoundingBox of a 2d projection is not well-defined for the axis along which the projection was made. Presently both the evaluation location and the BoundingBox extremes are set to 0 after a projection is made but FIXME this is not completely satisfactory. Perhaps defining this to be NA or the midpoint of the orginal axis would be better justified.

See Also

groupGeneric, clampmax

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

Examples

## 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)
## Not run: 
LHMask=read.im3d(system.file('tests/testthat/testdata/nrrd/LHMask.nrrd',package='nat'))
image(projection(LHMask),asp=TRUE)

## End(Not run)

nat documentation built on Aug. 25, 2023, 5:16 p.m.