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

Implementation of MRILIB::MriVolData: header-driven geometry computations and the suffix-dispatch loader. More...

#include "mri_vol_data.h"
#include "mri_mgh_io.h"
#include "mri_nifti_io.h"
#include <fiff/fiff_file.h>
Include dependency graph for mri_vol_data.cpp:

Go to the source code of this file.

Detailed Description

Implementation of MRILIB::MriVolData: header-driven geometry computations and the suffix-dispatch loader.

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

Houses the non-trivial methods MriVolData declares:

  • voxToSurfRAS() / surfRASToVox() build the canonical 4\u00d74 affines from the MGH Mdc direction- cosine matrix, spacing vector and c_ras centre, matching FreeSurfer's MRIxfmCRS2XYZtkreg() exactly (the same convention MNE-Python's _read_mri_info returns) so source-space and BEM tooling stay coordinate-compatible.
  • voxelDataAsFloat() flattens the slice-of-slices representation back into the column-major x-fastest buffer that downstream resamplers and exporters expect, promoting UCHAR / SHORT / INT inputs to float on the fly.
  • read() inspects the path suffix and dispatches to MriMghIO (.mgh / .mgz), MriNiftiIO (.nii / .nii.gz), or the COR directory loader, giving callers a single "load whatever this is" entry point.

Definition in file mri_vol_data.cpp.