v2.0.0
Loading...
Searching...
No Matches
MRILIB::MriSlicer Class Reference

Orthogonal-plane resampler (axial / coronal / sagittal) from MriVolData to MriSliceImage. More...

#include <mri_slicer.h>

Static Public Member Functions

static MriSliceImage extractSlice (const QVector< float > &volData, const QVector< int > &dims, const Eigen::Matrix4f &vox2ras, SliceOrientation orientation, int sliceIndex)
static int voxelAxisForOrientation (const Eigen::Matrix4f &vox2ras, SliceOrientation orientation)
static int dimensionForOrientation (const QVector< int > &dims, const Eigen::Matrix4f &vox2ras, SliceOrientation orientation)
static int sliceIndexForOrientation (const Eigen::Matrix4f &vox2ras, SliceOrientation orientation, const Eigen::Vector3i &voxel)
static QVector< MriSliceImageextractOrthogonal (const QVector< float > &volData, const QVector< int > &dims, const Eigen::Matrix4f &vox2ras, const Eigen::Vector3f &rasPoint)
static Eigen::Vector3i rasToVoxel (const Eigen::Matrix4f &vox2ras, const Eigen::Vector3f &rasPoint)
static Eigen::Vector3f voxelToRas (const Eigen::Matrix4f &vox2ras, const Eigen::Vector3i &voxel)
static MriSliceImage extractSlice (const MriVolData &vol, SliceOrientation orientation, int sliceIndex)
static int voxelAxisForOrientation (const MriVolData &vol, SliceOrientation orientation)
static int dimensionForOrientation (const MriVolData &vol, SliceOrientation orientation)
static int sliceIndexForOrientation (const MriVolData &vol, SliceOrientation orientation, const Eigen::Vector3i &voxel)
static QVector< MriSliceImageextractOrthogonal (const MriVolData &vol, const Eigen::Vector3f &rasPoint)
static Eigen::Vector3i rasToVoxel (const MriVolData &vol, const Eigen::Vector3f &rasPoint)
static Eigen::Vector3f voxelToRas (const MriVolData &vol, const Eigen::Vector3i &voxel)

Detailed Description

Orthogonal-plane resampler (axial / coronal / sagittal) from MriVolData to MriSliceImage.

Pure static methods — no instance state is owned. For a given orientation and slice index, samples the source volume at the matching row/column/depth plane, normalises voxel intensities into 8-bit grayscale via the volume's percentile-clipped window, and emits the result with the slice→RAS transform the viewer needs to draw rulers and crosshairs in millimetres.

Definition at line 107 of file mri_slicer.h.

Member Function Documentation

◆ dimensionForOrientation() [1/2]

int MriSlicer::dimensionForOrientation ( const MriVolData & vol,
SliceOrientation orientation )
static

Return the volume dimension used by an anatomical slice orientation.

Definition at line 303 of file mri_slicer.cpp.

◆ dimensionForOrientation() [2/2]

int MRILIB::MriSlicer::dimensionForOrientation ( const QVector< int > & dims,
const Eigen::Matrix4f & vox2ras,
SliceOrientation orientation )
static

Return the volume dimension used by an anatomical slice orientation.

Parameters
[in]dimsVolume dimensions {dimX, dimY, dimZ}.
[in]vox2ras4x4 voxel-to-RAS transform.
[in]orientationAnatomical slice orientation.
Returns
Number of slices along the orientation's fixed voxel axis.

◆ extractOrthogonal() [1/2]

QVector< MriSliceImage > MRILIB::MriSlicer::extractOrthogonal ( const MriVolData & vol,
const Eigen::Vector3f & rasPoint )
static

Extract all three orthogonal slices at a given RAS point.

Parameters
[in]volLoaded MRI volume.
[in]rasPointRAS coordinate to slice through.
Returns
Vector of three MriSliceImage (axial, coronal, sagittal).

◆ extractOrthogonal() [2/2]

QVector< MriSliceImage > MRILIB::MriSlicer::extractOrthogonal ( const QVector< float > & volData,
const QVector< int > & dims,
const Eigen::Matrix4f & vox2ras,
const Eigen::Vector3f & rasPoint )
static

Extract all three orthogonal slices at a given RAS point.

Parameters
[in]volDataFlat array of voxel intensities.
[in]dimsVolume dimensions {dimX, dimY, dimZ}.
[in]vox2ras4x4 voxel-to-RAS transform.
[in]rasPointRAS coordinate to slice through.
Returns
Vector of three MriSliceImage (axial, coronal, sagittal).

◆ extractSlice() [1/2]

MriSliceImage MriSlicer::extractSlice ( const MriVolData & vol,
SliceOrientation orientation,
int sliceIndex )
static

Extract a 2D slice from an MriVolData volume.

Parameters
[in]volLoaded MRI volume.
[in]orientationSlice orientation.
[in]sliceIndexIndex along the slicing axis.
Returns
The extracted slice image.

Definition at line 285 of file mri_slicer.cpp.

◆ extractSlice() [2/2]

MriSliceImage MRILIB::MriSlicer::extractSlice ( const QVector< float > & volData,
const QVector< int > & dims,
const Eigen::Matrix4f & vox2ras,
SliceOrientation orientation,
int sliceIndex )
static

Extract a 2D slice from a 3D volume stored as a flat array.

Parameters
[in]volDataFlat array of voxel intensities (dimX x dimY x dimZ, x-fastest).
[in]dimsVolume dimensions {dimX, dimY, dimZ}.
[in]vox2ras4x4 voxel-to-RAS transform.
[in]orientationSlice orientation (Axial, Coronal, or Sagittal).
[in]sliceIndexIndex along the slicing axis.
Returns
The extracted slice image.

◆ rasToVoxel() [1/2]

Eigen::Vector3i MRILIB::MriSlicer::rasToVoxel ( const Eigen::Matrix4f & vox2ras,
const Eigen::Vector3f & rasPoint )
static

Convert RAS coordinate to voxel index.

Parameters
[in]vox2ras4x4 voxel-to-RAS transform.
[in]rasPointRAS coordinate.
Returns
Voxel index (rounded to nearest integer).

◆ rasToVoxel() [2/2]

Eigen::Vector3i MRILIB::MriSlicer::rasToVoxel ( const MriVolData & vol,
const Eigen::Vector3f & rasPoint )
static

Convert RAS coordinate to voxel index using a volume's transform.

Parameters
[in]volLoaded MRI volume.
[in]rasPointRAS coordinate.
Returns
Voxel index (rounded to nearest integer).

◆ sliceIndexForOrientation() [1/2]

int MRILIB::MriSlicer::sliceIndexForOrientation ( const Eigen::Matrix4f & vox2ras,
SliceOrientation orientation,
const Eigen::Vector3i & voxel )
static

Return the slice index for an anatomical orientation from a voxel coordinate.

Parameters
[in]vox2ras4x4 voxel-to-RAS transform.
[in]orientationAnatomical slice orientation.
[in]voxelVoxel coordinate.
Returns
The voxel component that indexes the requested anatomical slice stack.

◆ sliceIndexForOrientation() [2/2]

int MRILIB::MriSlicer::sliceIndexForOrientation ( const MriVolData & vol,
SliceOrientation orientation,
const Eigen::Vector3i & voxel )
static

Return the slice index for an anatomical orientation from a voxel coordinate.

◆ voxelAxisForOrientation() [1/2]

int MRILIB::MriSlicer::voxelAxisForOrientation ( const Eigen::Matrix4f & vox2ras,
SliceOrientation orientation )
static

Return the voxel axis used as the fixed slicing axis for an anatomical orientation.

Uses the voxel-to-RAS transform to map anatomical planes onto the source volume's storage axes. For FreeSurfer tkRAS volumes, axial maps to voxel Y and coronal maps to voxel Z, while an identity transform keeps the conventional Z/Y/X mapping.

Parameters
[in]vox2ras4x4 voxel-to-RAS transform.
[in]orientationAnatomical slice orientation.
Returns
Voxel axis index: 0 = X, 1 = Y, 2 = Z.

◆ voxelAxisForOrientation() [2/2]

int MriSlicer::voxelAxisForOrientation ( const MriVolData & vol,
SliceOrientation orientation )
static

Return the voxel axis used as the fixed slicing axis for an anatomical orientation.

Definition at line 295 of file mri_slicer.cpp.

◆ voxelToRas() [1/2]

Eigen::Vector3f MRILIB::MriSlicer::voxelToRas ( const Eigen::Matrix4f & vox2ras,
const Eigen::Vector3i & voxel )
static

Convert voxel index to RAS coordinate.

Parameters
[in]vox2ras4x4 voxel-to-RAS transform.
[in]voxelVoxel index.
Returns
RAS coordinate.

◆ voxelToRas() [2/2]

Eigen::Vector3f MRILIB::MriSlicer::voxelToRas ( const MriVolData & vol,
const Eigen::Vector3i & voxel )
static

Convert voxel index to RAS coordinate using a volume's transform.

Parameters
[in]volLoaded MRI volume.
[in]voxelVoxel index.
Returns
RAS coordinate.

The documentation for this class was generated from the following files: