Skip to main content

MriCorIO

Namespace: MRILIB  ·  Library: MRI Library

#include <mri/mri_cor_io.h>

class MRILIB::MriCorIO

Stateless reader for the FreeSurfer COR-NNN directory layout.

Walks a mri/T1 (or mri/orig, mri/brain, …) directory, loads the 256 COR-001 … COR-256 flat 256×256 unsigned-char coronal slice files, and assembles them into an MriVolData with the per-slice coordinate transform (slice→surface RAS) the rest of MRILIB expects. The class exposes only static methods there is no per-instance state, the caller supplies the directory path and an output volume.

Ported from make_cor_set() in MNE C mne_make_cor_set by Matti Hamalainen.

src/examples/ex_mri/main.cpp
QVector<MriSlice> corSlices;
MriCorIO::read(corDir, corSlices);

Static Methods​

read(dir, slices, verbose)​

Reads COR slice files from a directory.

Expects files named COR-001 through COR-256, each containing 256×256 unsigned char pixel data.

Parameters:

  • dir : const QString & Path to the directory containing COR-NNN files.

  • slices : QVector< MriSlice > & Vector of MriSlice structures to populate.

  • verbose : bool If true, print progress information.

Returns:

  • bool — True on success, false on error.

Example​

Used in examples​

ex_mri​

MRI library: MGH/MGZ and NIfTI volumes, voxel/RAS transforms, slicing and COR sets.

src/examples/ex_mri/main.cpp, line 139
QVector<MriSlice> corSlices;
MriCorIO::read(corDir, corSlices);
ok &= expect(corSlices.size() == 256 && corSlices[7].pixels.size() == 256 * 256 && corSlices[7].pixels[0] == 7,
QString("COR set: %1 slices of 256x256, slice 7 holds 7").arg(corSlices.size()));

Authors of this file​