v2.0.0
Loading...
Searching...
No Matches
MRILIB::MriMghIO Class Reference

FreeSurfer MGH/MGZ file reader. 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)

Detailed Description

FreeSurfer MGH/MGZ file reader.

Reader for FreeSurfer MGH/MGZ volume files.

Reads the header, voxel data, and footer tags from MGH/MGZ files into an MriVolData structure. Automatically decompresses .mgz files using gunzip.

Based on the FreeSurfer MGH format specification: 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 108 of file mri_mgh_io.h.

Member Function Documentation

◆ read()

bool MriMghIO::read ( const QString & mgzFile,
MriVolData & volData,
QVector< FIFFLIB::FiffCoordTrans > & additionalTrans,
const QString & subjectMriDir = QString(),
bool verbose = false )
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.

Parameters
[in]mgzFilePath to the .mgz or .mgh file.
[out]volDataMriVolData structure to populate.
[out]additionalTransAdditional coordinate transforms found in footer (e.g., Talairach).
[in]subjectMriDirPath to subject's mri/ directory (for resolving relative .xfm paths).
[in]verboseIf true, print progress information.
Returns
True on success, false on error.

Definition at line 78 of file mri_mgh_io.cpp.


The documentation for this class was generated from the following files: