v2.0.0
Loading...
Searching...
No Matches
mri_vol_data.h
Go to the documentation of this file.
1//=============================================================================================================
41
42#ifndef MRI_VOL_DATA_H
43#define MRI_VOL_DATA_H
44
45//=============================================================================================================
46// INCLUDES
47//=============================================================================================================
48
49#include "mri_global.h"
50#include "mri_types.h"
51
53
54//=============================================================================================================
55// QT INCLUDES
56//=============================================================================================================
57
58#include <QString>
59#include <QVector>
60
61//=============================================================================================================
62// EIGEN INCLUDES
63//=============================================================================================================
64
65#include <Eigen/Core>
66
67//=============================================================================================================
68// DEFINE NAMESPACE MRILIB
69//=============================================================================================================
70
71namespace MRILIB {
72
73//=============================================================================================================
89{
90 QString fileName;
91 QVector<unsigned char> pixels;
92 QVector<unsigned short> pixelsWord;
93 QVector<float> pixelsFloat;
95 int width;
96 int height;
97 float dimx;
98 float dimy;
99 float scale;
101
102 //=========================================================================================================
107 : pixelFormat(1) // FIFFV_MRI_PIXEL_BYTE
108 , width(0)
109 , height(0)
112 , scale(1.0f)
113 {}
114};
115
116//=============================================================================================================
142{
143public:
144 //=========================================================================================================
148 MriVolData();
149
150 //=========================================================================================================
162 bool read(const QString& path);
163
164 //=========================================================================================================
170 bool isValid() const;
171
172 //=========================================================================================================
176 int dimX() const { return width; }
177
178 //=========================================================================================================
182 int dimY() const { return height; }
183
184 //=========================================================================================================
188 int dimZ() const { return depth; }
189
190 //=========================================================================================================
194 QVector<int> dims() const { return {width, height, depth}; }
195
196 //=========================================================================================================
206 QVector<float> voxelDataAsFloat() const;
207
208 //=========================================================================================================
220 Eigen::Matrix4f computeVox2Ras() const;
221
222 //=========================================================================================================
231 Eigen::Matrix4f computeVox2RasTkr() const;
232
233 //=========================================================================================================
234 // MGH Header Fields
235 //=========================================================================================================
236
237 QString fileName;
239 int width;
240 int height;
241 int depth;
243 int type;
244 int dof;
245 bool rasGood;
246 float xsize;
247 float ysize;
248 float zsize;
249 Eigen::Vector3f x_ras;
250 Eigen::Vector3f y_ras;
251 Eigen::Vector3f z_ras;
252 Eigen::Vector3f c_ras;
253
254 //=========================================================================================================
255 // Coordinate Transforms
256 //=========================================================================================================
257
259
260 //=========================================================================================================
261 // Optional Footer Data (scan parameters)
262 //=========================================================================================================
263
264 float TR;
265 float flipAngle;
266 float TE;
267 float TI;
268 float FoV;
269
270 //=========================================================================================================
271 // Talairach Transform
272 //=========================================================================================================
273
275
276 //=========================================================================================================
277 // Slice Data
278 //=========================================================================================================
279
280 QVector<MriSlice> slices;
281};
282
283} // namespace MRILIB
284
285#endif // MRI_VOL_DATA_H
Export/import macros and build-info accessors for MRILIB.
#define MRISHARED_EXPORT
Definition mri_global.h:39
Numeric type codes, layout constants, and sentinel values shared by every MRI reader.
4x4 affine FIFF coordinate transform (FIFF_COORD_TRANS) annotated with source/destination coordinate-...
Volume I/O, voxel geometry and slice resampling for structural MRI data inside mne-cpp.
constexpr float COR_PIXEL_SIZE
Definition mri_types.h:136
Labelled 4x4 FIFF affine: source frame, destination frame, rotation, translation and cached inverse.
QVector< unsigned char > pixels
FIFFLIB::FiffCoordTrans trans
QVector< unsigned short > pixelsWord
QVector< float > pixelsFloat
FIFFLIB::FiffCoordTrans voxelSurfRasT
Eigen::Vector3f y_ras
bool read(const QString &path)
QVector< int > dims() const
bool isValid() const
Eigen::Vector3f x_ras
QVector< MriSlice > slices
Eigen::Vector3f z_ras
Eigen::Vector3f c_ras