64 const QVector<MriSlice>& slices,
65 const QVector<FiffCoordTrans>& additionalTrans)
93 qCritical() <<
"MriCorFifIO::write - Could not open file for writing:" << fileName;
106 Matrix3f identityRot = Matrix3f::Identity();
107 Vector3f zeroMove = Vector3f::Zero();
110 stream->write_coord_trans(headMriT);
114 stream->write_coord_trans(t);
118 for (
int k = 0; k < slices.size(); ++k) {
124 fiff_int_t w = slice.
width;
125 fiff_int_t h = slice.
height;
128 float wm =
static_cast<float>(slice.
width) * slice.
dimx;
133 float hm =
static_cast<float>(slice.
height) * slice.
dimy;
137 stream->write_coord_trans(slice.
trans);
144 auto pixelTag = std::make_unique<FiffTag>();
151 pixelTag->resize(nPixels);
152 memcpy(pixelTag->data(), slice.
pixels.constData(), nPixels);
157 pixelTag->resize(nPixels * 2);
158 memcpy(pixelTag->data(), slice.
pixelsWord.constData(), nPixels * 2);
163 pixelTag->resize(nPixels * 4);
164 memcpy(pixelTag->data(), slice.
pixelsFloat.constData(), nPixels * 4);
169 stream->write_tag(pixelTag);
Writer for the COR.fif FIFF representation of an MRI volume (Neuromag/MNE convention used by all mne-...
Symbolic FIFF tag, block, value, unit and channel-type constants shared across FIFFLIB.
FIFF tag-kind, block-kind and type-code numerical definitions, authoritative for FIFFLIB.
#define FIFF_MRI_HEIGHT_M
#define FIFF_MRI_PIXEL_DATA
#define FIFFV_MRI_PIXEL_BYTE
#define FIFF_MRI_PIXEL_ENCODING
#define FIFFV_MRI_PIXEL_FLOAT
#define FIFFV_MRI_PIXEL_WORD
FIFF tag: the 16-byte tag header (kind, type, size, next) plus its decoded payload.
4x4 affine FIFF coordinate transform (FIFF_COORD_TRANS) annotated with source/destination coordinate-...
FIFF binary tag-stream layer: wraps a QIODevice to read and write FIFF tags, directories,...
FIFF file I/O, in-memory data structures and high-level readers/writers.
Volume I/O, voxel geometry and slice resampling for structural MRI data inside mne-cpp.
Labelled 4x4 FIFF affine: source frame, destination frame, rotation, translation and cached inverse.
QSharedPointer< FiffStream > SPtr
static FiffStream::SPtr start_file(QIODevice &p_IODevice)
static bool write(const QString &fileName, const QVector< MriSlice > &slices, const QVector< FIFFLIB::FiffCoordTrans > &additionalTrans)
Single 2D MRI slice (pixels + slice→RAS transform) used as the volume's storage unit.
QVector< unsigned char > pixels
FIFFLIB::FiffCoordTrans trans
QVector< unsigned short > pixelsWord
QVector< float > pixelsFloat