write.amiramesh: Write a 3D data object to an amiramesh format file

View source: R/amiramesh-io.R

write.amirameshR Documentation

Write a 3D data object to an amiramesh format file

Description

Write a 3D data object to an amiramesh format file

Usage

write.amiramesh(
  x,
  file,
  enc = c("binary", "raw", "text", "hxzip"),
  dtype = c("float", "byte", "short", "ushort", "int", "double"),
  endian = .Platform$endian,
  WriteNrrdHeader = FALSE
)

Arguments

x

The image data to write (an im3d, or capable of being interpreted as such)

file

Character vector describing a single file

enc

Encoding of the data. NB "raw" and "binary" are synonyms.

dtype

Data type to write to disk

endian

Endianness of data block. Defaults to current value of .Platform$endian.

WriteNrrdHeader

Whether to write a separate detached nrrd header next to the amiramesh file allowing it to be opened by a NRRD reader. See details.

Details

Note that only 'raw' or 'text' format data can accommodate a detached NRRD format header since Amira's HxZip format is subtly different from NRRD's gzip encoding. There is a full description of the deteached NRRD format in the help for write.nrrd.

See Also

.Platform, read.amiramesh, write.nrrd

Examples

d=array(rnorm(1000), c(10, 10, 10))
tf=tempfile(fileext='.am')
write.amiramesh(im3d(d, voxdims=c(0.5,0.5,1)), file=tf, WriteNrrdHeader=TRUE)
d2=read.nrrd(paste(tf, sep='', '.nhdr'))
all.equal(d, d2, tol=1e-6)

nat documentation built on Aug. 25, 2023, 5:16 p.m.