InputOutput-writeMRI: Write an image file

Description Usage Arguments Details Value Examples

Description

Write an image file from an array.

Usage

1
2
writeMRI(data, filename, format, 
         gzipped = TRUE, verbose = optionsMRIaggr("verbose"), size = "NA_integer_")

Arguments

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 "raw.gz", "analyze", "nifti" or "dicom". REQUIRED.

size

the number of bytes per element in the byte stream. integer. See the documentation of the writeBin function for more details.

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.

Details

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:

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.

Value

None.

Examples

 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)

bozenne/MRIaggr documentation built on May 13, 2019, 1:39 a.m.