Learn R Programming

freesurferformats (version 1.1.0)

nii1header.for.mgh: Create a NIFTI v1 header from the header information contained in an fs.volume instance.

Description

Create a NIFTI v1 header from the header information contained in an fs.volume instance.

Usage

nii1header.for.mgh(mgh, endian = "little", pair = FALSE)

Value

a NIFTI v1 header structure (see ni1header.template). Note that the header may or may not contain full RAS information, depending on whether the source fs.volume contained such information or not. If the MGH header does not have valid RAS information, the qform and sform codes will be set to 0 (unknown).

Arguments

mgh

an fs.volume instance, or a string. If a string, it is interpreted as a filepath to a volume file (NIFTI, MGH or MGZ) that will be loaded with read.fs.volume.

endian

character string, the endianness to use. Either 'little' or 'big'. Defaults to 'little'.

pair

logical, whether the header should describe a NIFTI v1 pair (a .hdr header file with the voxel data in a separate .img file, the variant of the format that FSL and 3D Slicer work with) instead of a single file (.nii). See ni1header.template.

See Also

Other nifti1 writers: write.fs.morph.ni1(), write.nifti1()