antsImageWrite: Image Write

View source: R/antsImageWrite.R

antsImageWriteR Documentation

Image Write

Description

Write an image object of S4 class antsImage to a file.

Usage

antsImageWrite(image, filename, as.tensor = FALSE)

Arguments

image

Image object of S4 class antsImage to be written.

filename

Name of the file to write the image to.

as.tensor

flag indicating to write as symmetric tensor if image has 6 components

Value

0 – Success
1 – Failure

Author(s)

Shrinidhi KL

See Also

antsImageRead

Examples


fn <- getANTsRData("r16")
fi <- antsImageRead(fn)
antsImageWrite(fi, tempfile(fileext = ".nii.gz"))
antsImageWrite(fi, tempfile(fileext = ".mha"))
antsImageWrite(fi, tempfile(fileext = ".nrrd"))
antsImageWrite(
  antsImageClone(fi, "unsigned char"),
  tempfile(fileext = ".jpg")
)
antsImageWrite(
  antsImageClone(fi, "float"),
  tempfile(fileext = ".tif")
)
antsImageWrite(fi, tempfile(fileext = ".mrc"))
antsImageWrite(fi, tempfile(fileext = ".hd5"))
components(fi) <- 0L
antsImageWrite(fi, tempfile(fileext = ".nii.gz"))


stnava/ANTsR documentation built on April 16, 2024, 12:17 a.m.