Stateless decoder for FreeSurfer MGH and MGZ volume containers. More...
#include <mri_mgh_io.h>
Static Public Member Functions | |
| static bool | read (const QString &mgzFile, MriVolData &volData, QVector< FIFFLIB::FiffCoordTrans > &additionalTrans, const QString &subjectMriDir=QString(), bool verbose=false) |
Stateless decoder for FreeSurfer MGH and MGZ volume containers.
Parses the 284-byte big-endian header, decodes the column-major voxel buffer for every supported MRI type (uchar, int, float, short) and reads the optional tag footer (scan parameters, talairach.xfm path) into an MriVolData. .mgz inputs are inflated in-memory through zlib's MAX_WBITS+16 gunzip mode before parsing, so callers never need to know whether they are looking at the compressed or uncompressed variant.
Format reference: https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/MghFormat
Ported from make_mgh_cor_set() in MNE C mne_make_cor_set by Matti Hamalainen.
Definition at line 100 of file mri_mgh_io.h.
|
static |
Reads a FreeSurfer MGH or MGZ file.
Parses the header geometry (dimensions, voxel sizes, direction cosines, center RAS), reads voxel data into per-slice MriSlice structures, and extracts footer tags including the Talairach .xfm path.
For .mgz files, automatic gzip decompression is performed via zlib.
| [in] | mgzFile | Path to the .mgz or .mgh file. |
| [out] | volData | MriVolData structure to populate. |
| [out] | additionalTrans | Additional coordinate transforms found in footer (e.g., Talairach). |
| [in] | subjectMriDir | Path to subject's mri/ directory (for resolving relative .xfm paths). |
| [in] | verbose | If true, print progress information. |
Definition at line 67 of file mri_mgh_io.cpp.