Make an image with given size and voxel value or given a mask and vector.

makeImage(
  imagesize,
  voxval = 0,
  spacing = c(NA),
  origin = c(NA),
  direction = c(NA),
  components = FALSE,
  pixeltype = "float"
)

Arguments

imagesize

input image size or mask

voxval

input image value or vector, size of mask

spacing

image spatial resolution

origin

image spatial origin

direction

direction matrix to convert from index to physical space

components

whether there are components per pixel or not

pixeltype

data type of image values

Value

antsImage is output

Author

Avants BB

Examples


outimg <- makeImage(c(2, 10), 1)
outimg <- makeImage(outimg, c(2, 10))
#> Warning: Number of voxels not the same as the positive values
testthat::expect_error(makeImage(outimg, c(2, 10), components = 2))