Write a 3D data object to an amiramesh format file

Share:

Description

Write a 3D data object to an amiramesh format file

Usage

1
2
3
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

1
2
3
4
5
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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.