Learn R Programming

mritc (version 0.3-2)

writeMRI: Write an MR Image

Description

Write an MR image into a file of different formats.

Usage

writeMRI(data, file, header, format)

Arguments

data
MRI data in a three dimensional array or four dimensional array with the forth dimension equal to 1.
file
the name of the image file to be written out.
header
the header file. For file of the "rawb.gz" format, header is NULL.
format
the format of the image file. Right now only the "Analyze", "NIfTI", and raw byte (unsigned with 1 byte per element in the byte stream) gzip formats are supported.

Value

  • Nothing is returned.

Details

Header file is needed for the file of "Analyze" or "NIfTI" format. For details of the header files for "Analyze" format, see http://eeg.sourceforge.net/ANALYZE75.pdf. For details of the header files for "NIfTI" format and the comparison between the "Analyze" and "NIfTI" formates, see http://nifti.nimh.nih.gov/.

Files of "Analyze" format are written out through the function write.ANALYZE. An adapted version of write.NIFTI is used to write files of "NIfTI" format. Instead of ".nii", the adapted version writes data out into ".nii.gz" files to save space.

See Also

write.ANALYZE, write.NIFTI

Examples

Run this code
writeMRI(vol, file="vol.rawb.gz", header=NULL, format="rawb.gz")
  
  writeMRI(vol, file="vol", header=niftiheader, format="nifti")

  writeMRI(vol, file="vol", header=analyzeheader, format="analyze")

Run the code above in your browser using DataLab