|
libfs
Header-only C++11 library for accessing FreeSurfer neuroimaging data
|
Models the header of an MGH file. More...
#include <libfs.h>

Public Member Functions | |
| MghHeader () | |
| Empty default constuctor. | |
| MghHeader (Curv curv) | |
| MghHeader (std::vector< float > curv_data) | |
| size_t | num_values () const |
| Compute the number of values based on the dim*length header fields. | |
| std::vector< float > | compute_vox2ras () const |
| Compute the 4x4 voxel-to-RAS (vox2ras) matrix from the RAS header fields, if available. | |
Models the header of an MGH file.
|
inline |
< Constuctor to fill header from a 1D float array (curv data).
|
inline |
Compute the 4x4 voxel-to-RAS (vox2ras) matrix from the RAS header fields, if available.
The vox2ras matrix maps voxel indices to world (RAS) coordinates: the world coordinate of a voxel (i, j, k) is vox2ras * [i, j, k, 1]. The linear part (upper left 3x3 block) maps a unit step along voxel axis j to a world displacement of size_j * Mdc_row_j, i.e. column j is scaled by the voxel size of axis j. This is the FreeSurfer convention (vox2ras = Mdc^T * diag(size), with the rows of the MGH Mdc matrix being the unit direction cosines of the 3 volume axes). The translation is the RAS coordinate of voxel (0,0,0), derived from the center voxel Pxyz_c stored in the header (center index uses integer division dim/2).