64,
x_ras(-1.0f, 0.0f, 0.0f)
65,
y_ras( 0.0f, 0.0f, -1.0f)
66,
z_ras( 0.0f, 1.0f, 0.0f)
67,
c_ras( 0.0f, 0.0f, 0.0f)
89 const QString lower = path.toLower();
90 if (lower.endsWith(QStringLiteral(
".nii")) || lower.endsWith(QStringLiteral(
".nii.gz"))) {
93 QVector<FIFFLIB::FiffCoordTrans> additionalTrans;
105 QVector<float> result(
static_cast<qsizetype
>(
width) *
height *
depth, 0.0f);
107 for (
int k = 0; k <
depth && k <
slices.size(); ++k) {
109 int offset = k * nPixels;
113 for (
int p = 0; p < qMin(nPixels, slice.
pixels.size()); ++p)
114 result[offset + p] =
static_cast<float>(slice.
pixels[p]);
117 for (
int p = 0; p < qMin(nPixels, slice.
pixelsWord.size()); ++p)
118 result[offset + p] =
static_cast<float>(slice.
pixelsWord[p]);
121 for (
int p = 0; p < qMin(nPixels, slice.
pixelsFloat.size()); ++p)
162 Vector3f center(
static_cast<float>(
width) / 2.0f,
163 static_cast<float>(
height) / 2.0f,
164 static_cast<float>(
depth) / 2.0f);
167 Vector3f P0 =
c_ras - M * center;
170 Matrix4f vox2ras = Matrix4f::Identity();
171 vox2ras.block<3, 3>(0, 0) = M / 1000.0f;
172 vox2ras.block<3, 1>(0, 3) = P0 / 1000.0f;
189 Vector3f center(
static_cast<float>(
width) / 2.0f,
190 static_cast<float>(
height) / 2.0f,
191 static_cast<float>(
depth) / 2.0f);
193 Vector3f P0 = -M * center;
195 Matrix4f vox2ras_tkr = Matrix4f::Identity();
196 vox2ras_tkr.block<3, 3>(0, 0) = M / 1000.0f;
197 vox2ras_tkr.block<3, 1>(0, 3) = P0 / 1000.0f;
NIfTI-1 single-file (.nii / .nii.gz) volume reader producing the same per-slice layout as the MGH rea...
FreeSurfer MGH / MGZ volume reader: byte-level decoder for the 284-byte fixed header,...
Format-agnostic in-memory representation of a 3D MRI volume plus its slice decomposition.
FIFF tag-kind, block-kind and type-code numerical definitions, authoritative for FIFFLIB.
#define FIFFV_MRI_PIXEL_BYTE
#define FIFFV_MRI_PIXEL_FLOAT
#define FIFFV_MRI_PIXEL_WORD
Volume I/O, voxel geometry and slice resampling for structural MRI data inside mne-cpp.
constexpr int MRI_MGH_VERSION
static bool read(const QString &mgzFile, MriVolData &volData, QVector< FIFFLIB::FiffCoordTrans > &additionalTrans, const QString &subjectMriDir=QString(), bool verbose=false)
static bool read(const QString &niiFile, MriVolData &volData, bool verbose=false)
Single 2D MRI slice (pixels + slice→RAS transform) used as the volume's storage unit.
QVector< unsigned char > pixels
QVector< unsigned short > pixelsWord
QVector< float > pixelsFloat
Eigen::Matrix4f computeVox2RasTkr() const
bool read(const QString &path)
QVector< MriSlice > slices
Eigen::Matrix4f computeVox2Ras() const
QVector< float > voxelDataAsFloat() const