Writer for the COR.fif FIFF representation of an MRI volume (Neuromag/MNE convention used by all mne-c source-space tooling). More...
#include "mri_global.h"#include "mri_vol_data.h"#include <fiff/fiff_coord_trans.h>#include <QString>#include <QVector>

Go to the source code of this file.
Classes | |
| class | MRILIB::MriCorFifIO |
| Stateless serialiser that turns an MriVolData into a FIFF MRI set (COR.fif). More... | |
Namespaces | |
| namespace | MRILIB |
| Volume I/O, voxel geometry and slice resampling for structural MRI data inside mne-cpp. | |
Writer for the COR.fif FIFF representation of an MRI volume (Neuromag/MNE convention used by all mne-c source-space tooling).
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors
COR.fif is the canonical FIFF wrapper for MRI volume data used by every downstream mne-c step that needs MRI geometry — coregistration, BEM surface generation, forward-model assembly, and the mne_analyze inverse pipeline all consume the same tag structure. Producing it here lets mne-cpp loaders (MriMghIO, MriNiftiIO, MriCorIO) feed any legacy FIFF-driven workflow without requiring callers to detour through the MNE-Python mri.fif writer.
The writer takes an in-memory MriVolData, materialises one FIFFB_MRI_SLICE block per slice (carrying the slice's geometry and pixel buffer in the source's native encoding — byte / word / float, no quantisation), bundles them inside a single FIFFB_MRI_SET, and prefixes the head\u2192MRI identity plus any extra transforms the volume carries (e.g. Talairach).
Block structure:
FIFFB_MRI FIFF_BLOCK_ID FIFFB_MRI_SET FIFF_COORD_TRANS (HEAD -> MRI identity) [additional coord transforms: Talairach etc.] FIFFB_MRI_SLICE (repeated for each slice) FIFF_MRI_WIDTH FIFF_MRI_WIDTH_M FIFF_MRI_HEIGHT FIFF_MRI_HEIGHT_M FIFF_COORD_TRANS (slice -> MRI) FIFF_MRI_PIXEL_ENCODING FIFF_MRI_PIXEL_DATA /FIFFB_MRI_SLICE /FIFFB_MRI_SET /FIFFB_MRI
Ported from save_slices() / write_slice() in MNE C write_mri_set.c by Matti Hamalainen.
Definition in file mri_cor_fif_io.h.