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

Orthogonal-plane resampler that turns a 3D MriVolData into the 2D textures consumed by the slice viewer. More...

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

Go to the source code of this file.

Classes

struct  MRILIB::MriSliceImage
 Single 2D MRI cross-section produced by MriSlicer (pixel buffer + RAS metadata). More...
class  MRILIB::MriSlicer
 Orthogonal-plane resampler (axial / coronal / sagittal) from MriVolData to MriSliceImage. More...

Namespaces

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

Enumerations

enum class  MRILIB::SliceOrientation { MRILIB::Axial , MRILIB::Coronal , MRILIB::Sagittal }

Detailed Description

Orthogonal-plane resampler that turns a 3D MriVolData into the 2D textures consumed by the slice viewer.

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.2.0
Date
April 2026

The slicer is the bridge between the format-specific MRI readers (MriMghIO, MriNiftiIO, MriCorIO) and the MriSlicesPlugin / MriSlicesView widgets that render axial / coronal / sagittal cross-sections in mne_analyze_studio. Two cooperating types live here:

  • SliceOrientation — a strong enum picking the slicing axis (Axial / Coronal / Sagittal); used both as the user- facing radio-button value in the slice viewer and as the index-permutation key inside the slicer itself.
  • MriSliceImage — the result type: a normalised (0..1) Eigen::MatrixXf pixel buffer ready to upload as an OpenGL texture, paired with its own slice-to-RAS 4\u00d74 transform so the viewer can overlay surface meshes, source estimates or fiducials in the correct world space without re-deriving the geometry from the volume header.

The static MriSlicer::extract() method does the actual work: it picks the right axis stride from the volume header, dispatches by on-disk voxel type (UCHAR / SHORT / INT / FLOAT) so quantisation matches the source, normalises by the per-volume max so windowing stays stable across slices, and composes sliceToRas from the volume's voxToSurfRAS() pre-multiplied by the orientation-specific in-slice affine.

Definition in file mri_slicer.h.