v2.0.0
Loading...
Searching...
No Matches
mri_mgh_io.cpp File Reference

Implementation of MRILIB::MriMghIO: byte-exact MGH/MGZ parser and zlib-streamed MGZ decoder. More...

#include "mri_mgh_io.h"
#include <fiff/fiff_coord_trans.h>
#include <fiff/fiff_constants.h>
#include <fiff/fiff_file.h>
#include <QFile>
#include <QFileInfo>
#include <QDataStream>
#include <QDebug>
#include <QRegularExpression>
#include <zlib.h>
#include <Eigen/Core>
Include dependency graph for mri_mgh_io.cpp:

Go to the source code of this file.

Detailed Description

Implementation of MRILIB::MriMghIO: byte-exact MGH/MGZ parser and zlib-streamed MGZ decoder.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.0.0
Date
February 2026

Implements the big-endian header parse, the column-major voxel buffer reader (templated over the four MGH voxel types — UCHAR / SHORT / INT / FLOAT — so quantisation is preserved instead of being eagerly promoted to float), and the optional footer-tag walker that recovers TR / TE / flipAngle / FoV plus the talairach.xfm path. MGZ inputs are routed through a single zlib inflate() call with MAX_WBITS+16 (gzip wrapping enabled) so the on-disk and in-memory paths share the same parser. Output is materialised as the slice-of-slices MriVolData representation consumed by every downstream rendering and export path. Ported from make_mgh_cor_set() in MNE C mne_make_cor_set by Matti Hamalainen.

Definition in file mri_mgh_io.cpp.