Make im3d image array containing values at locations defined by a mask
unmask(
x,
mask,
default = NA,
attributes. = attributes(mask),
copyAttributes = TRUE
)
the data to place on a regular grid
An im3d
regular image array where non-zero voxels are the
selected element.
Value for regions outside the mask (default: NA)
Attributes to set on new object. Defaults to attributes of
mask
Whether to copy over attributes (including dim
)
from the mask to the returned object. default: TRUE
A new im3d
object with attributes/dimensions defined by
mask
and values from x
. If copyAttributes
is
FALSE
, then it will have mode of x
and length of mask
but no other attributes.
The values in x will be placed into a grid defined by the dimensions
of the mask
in the order defined by the standard R linear
subscripting of arrays (see e.g. arrayInd
).
Other im3d:
as.im3d()
,
boundingbox()
,
im3d-coords
,
im3d-io
,
im3d()
,
imexpand.grid()
,
imslice()
,
is.im3d()
,
mask()
,
origin()
,
projection()
,
threshold()
,
voxdims()
if (FALSE) {
# read in a mask
LHMask=read.im3d(system.file('tests/testthat/testdata/nrrd/LHMask.nrrd', package='nat'))
# pick out all the non zero values
inmask=LHMask[LHMask!=0]
# fill the non-zero elements of the mask with a vector that iterates over the
# values 0:9
stripes=unmask(seq(inmask)%%10, LHMask)
# make an image from one slice of that result array
image(imslice(stripes,11), asp=TRUE)
}