v2.0.0
Loading...
Searching...
No Matches
mri_vol_data.h File Reference

Format-agnostic in-memory representation of a 3D MRI volume plus its slice decomposition. More...

#include "mri_global.h"
#include "mri_types.h"
#include <fiff/fiff_coord_trans.h>
#include <QString>
#include <QVector>
#include <Eigen/Core>
Include dependency graph for mri_vol_data.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MRILIB::MriSlice
 Single 2D MRI slice (pixels + slice→RAS transform) used as the volume's storage unit. More...
class  MRILIB::MriVolData
 Format-agnostic 3D MRI volume: header geometry, voxel buffer (as a vector of MriSlice), scan parameters and provenance. More...

Namespaces

namespace  MRILIB
 Volume I/O, voxel geometry and slice resampling for structural MRI data inside mne-cpp.

Detailed Description

Format-agnostic in-memory representation of a 3D MRI volume plus its slice decomposition.

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

Two cooperating types live in this header:

  • MriSlice — a single 2D slice with its own pixel buffer (byte / word / float, picked at load time to mirror the on-disk FIFFV_MRI_PIXEL_* encoding) and an explicit slice-to-MRI (surface RAS) FIFFLIB::FiffCoordTrans. This is the unit the rendering pipeline and the COR.fif writer consume, so every loader (MGH, NIfTI, raw COR) ultimately decomposes its 3D buffer into a vector of these.
  • MriVolData — the full volume bundle: header geometry (width/height/depth, voxel spacing, direction cosines, RAS centre), optional scan parameters (TR / TE / flip-angle / FoV), and the slice vector above. It owns the voxToSurfRAS(), voxToTalairach() and inverse transforms derived from the MGH Mdc / c_ras header fields and any additional transforms attached by the source-file reader (e.g. talairach.xfm).

The read() convenience method dispatches by file suffix to the matching loader (MriMghIO, MriNiftiIO, COR directory) so application code can stay one-liner clean irrespective of the on-disk format — the equivalent of nibabel.load() on the Python side.

Header reference: https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/MghFormat Ported from mneMRIdataRec / mneMRIvolumeRec in MNE C (mne_types_mne-c.h) by Matti Hamalainen.

Definition in file mri_vol_data.h.