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

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



Array of image data (im3d format)


The image dimension down which to project


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.


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


A mask with the same extent as the image.


Additional arguments for projfun


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 original axis would be better justified.

See also


if (FALSE) { 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) } if (FALSE) { LHMask=read.im3d(system.file('tests/testthat/testdata/nrrd/LHMask.nrrd',package='nat')) image(projection(LHMask),asp=TRUE) }