Make im3d image array containing values at locations defined by a mask
unmask(x, mask, default = NA, attributes. = attributes(mask), copyAttributes = TRUE)
| x | the data to place on a regular grid |
|---|---|
| mask | An |
| default | Value for regions outside the mask (default: NA) |
| attributes. | Attributes to set on new object. Defaults to attributes of
|
| copyAttributes | Whether to copy over attributes (including |
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
# NOT RUN { # 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) # }