MriSliceImage
Namespace: MRILIB · Library: MRI Library
#include <mri/mri_slicer.h>
struct MRILIB::MriSliceImage
Single 2D MRI cross-section produced by MriSlicer (pixel buffer + RAS metadata).
Carries one orthogonal-plane sample of a 3D MriVolData ready for upload to the slice viewer: a normalised 8-bit grayscale pixel buffer, the in-volume slice index it was sampled at, and the bookkeeping the widget needs to map mouse picks back to RAS millimetres.
src/examples/ex_mri/main.cpp
const Vector3f ras(0.001f, -0.0005f, -0.002f); // metres; voxel (2,3,1)
const Vector3i voxel = MriSlicer::rasToVoxel(vox2ras, ras);
const QVector<MriSliceImage> planes = MriSlicer::extractOrthogonal(voxels, mgh.dims(), vox2ras, ras); // axial, coronal, sagittal
Example
- Full source:
src/examples/ex_mri/main.cpp - Build target:
ex_mri(runs under CTest)
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 119
const Vector3f ras(0.001f, -0.0005f, -0.002f); // metres; voxel (2,3,1)
const Vector3i voxel = MriSlicer::rasToVoxel(vox2ras, ras);
const QVector<MriSliceImage> planes = MriSlicer::extractOrthogonal(voxels, mgh.dims(), vox2ras, ras); // axial, coronal, sagittal
ok &= expect(voxel == Vector3i(2, 3, 1) && (MriSlicer::voxelToRas(vox2ras, voxel) - ras).norm() < 1e-7f && planes.size() == 3,
QString("RAS (1, -0.5, -2) mm -> voxel (%1, %2, %3); three orthogonal planes").arg(voxel(0)).arg(voxel(1)).arg(voxel(2)));
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>