Description Usage Arguments Details Value Examples
Write an image file from an array.
1 2 | writeMRI(data, filename, format,
gzipped = TRUE, verbose = optionsMRIaggr("verbose"), size = "NA_integer_")
|
data |
the data to export. three dimensional array. REQUIRED. |
filename |
the name of the image file. character. REQUIRED. |
format |
the format of the image file. Can be |
size |
the number of bytes per element in the byte stream. integer. See the documentation of the |
gzipped |
is a character string that enables exportation of compressed (.gz) files. |
verbose |
is a logical variable that allows text-based feedback during execution of the function. |
This function requires to have installed the oro.nifti package to work if argument format is set to "analyze" or "nifti".
ARGUMENTS :
file argument corresponds to:
the con argument of the base::readBin function.
the filename argument of the oro.nifti::readANALYZE function. It should be a pathname to .img or .hdr files without the suffix.
the filename argument of the oro.nifti::readNIfTI function.
FUNCTION :
This function is a copy of the writeMRI function of the mritc package. It calls
writeANALYZE of the oro.nifti package to write analyze files,
writeNIfTI of the oro.nifti package to write NIFTI files,
and writeBin of the base package to write rawb.gz.
None.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
set.seed(10)
X <- rnorm(1000)
## Not run:
writeMRI(array(X, c(10,10,10)), filename = "test", format = "nifti", verbose = TRUE)
# range(array(X, c(10,10,10)) - readMRI("test", format = "nifti")[])
writeMRI(array(X, c(10,10,10)), filename = "test", format = "analyze", verbose = TRUE)
# range(array(X, c(10,10,10)) - readMRI("test", format = "analyze")[])
writeMRI(array(X, c(10,10,10)) , filename = "test", format = "rawb.gz", verbose = TRUE,
size = "NA_integer_")
# range(array(X, c(10,10,10)) - readMRI("test",
# format = "rawb.gz", size = "NA_integer_", dim = c(10,10,10)))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.