78 if (!this->
isMatrix() || this->data() ==
nullptr) {
86 qint32* t_pInt32 = (qint32*)this->data();
88 p_ndim = t_pInt32[(this->size() - 4) / 4];
91 for (
int i = p_ndim + 1; i > 1; --i)
92 p_Dims.append(t_pInt32[(this->size() - (i * 4)) / 4]);
94 for (
int i = p_ndim + 2; i > 1; --i)
95 p_Dims.append(t_pInt32[(this->size() - (i * 4)) / 4]);
97 qWarning(
"Cannot handle other than dense or sparse matrices yet.");
119 QString t_qStringInfo;
124 t_qStringInfo =
"Matrix of type FIFFT_INT";
127 t_qStringInfo =
"Matrix of type FIFFT_JULIAN";
130 t_qStringInfo =
"Matrix of type FIFFT_FLOAT";
133 t_qStringInfo =
"Matrix of type FIFFT_DOUBLE";
136 t_qStringInfo =
"Matrix of type FIFFT_COMPLEX_FLOAT";
139 t_qStringInfo =
"Matrix of type FIFFT_COMPLEX_DOUBLE";
142 t_qStringInfo =
"Matrix of unknown type";
150 t_qStringInfo =
"Simple type FIFFT_BYTE";
153 t_qStringInfo =
"Simple type FIFFT_SHORT";
156 t_qStringInfo =
"Simple type FIFFT_INT";
159 t_qStringInfo =
"Simple type FIFFT_USHORT";
162 t_qStringInfo =
"Simple type FIFFT_UINT";
165 t_qStringInfo =
"Simple type FIFFT_JULIAN";
168 t_qStringInfo =
"Simple type FIFFT_FLOAT";
171 t_qStringInfo =
"Simple type FIFFT_DOUBLE";
174 t_qStringInfo =
"Simple type FIFFT_STRING";
177 t_qStringInfo =
"Simple type FIFFT_DAU_PACK16";
180 t_qStringInfo =
"Simple type FIFFT_COMPLEX_FLOAT";
183 t_qStringInfo =
"Simple type FIFFT_COMPLEX_DOUBLE";
189 t_qStringInfo =
"Structure FIFFT_ID_STRUCT";
192 t_qStringInfo =
"Structure FIFFT_DIG_POINT_STRUCT";
195 t_qStringInfo =
"Structure FIFFT_COORD_TRANS_STRUCT";
198 t_qStringInfo =
"Structure FIFFT_CH_INFO_STRUCT";
201 t_qStringInfo =
"Structure FIFFT_OLD_PACK";
204 t_qStringInfo =
"Structure FIFFT_DIR_ENTRY_STRUCT";
207 t_qStringInfo =
"Structure unknown";
210 return t_qStringInfo;
254 for (k = 0; k < 3; k++) {
272 int *dimp, *data,
kind, np, nz;
275 unsigned int tsize = tag->size();
279 if (tag->data() ==
nullptr)
291 for (k = 0, np = 1; k < ndim; k++) {
300 dimp = dimp - ndim - 1;
301 for (k = 0; k < ndim + 1; k++)
305 np = nz + dimp[2] + 1;
307 np = nz + dimp[1] + 1;
313 for (data = (
int*)(tag->data()) + nz, k = 0; k < np; k++)
322 for (data = (
int*)(tag->data()), k = 0; k < np; k++)
325 for (fdata = (
float*)(tag->data()), k = 0; k < np; k++)
328 for (ddata = (
double*)(tag->data()), k = 0; k < np; k++)
331 for (fdata = (
float*)(tag->data()), k = 0; k < 2 * np; k++)
334 for (ddata = (
double*)(tag->data()), k = 0; k < 2 * np; k++)
349 int *dimp, *data,
kind, np;
352 unsigned int tsize = tag->size();
356 if (tag->data() ==
nullptr)
369 for (k = 0, np = 1; k < ndim; k++) {
378 dimp = dimp - ndim - 1;
379 const int nz = dimp[0];
381 np = nz + dimp[2] + 1;
383 np = nz + dimp[1] + 1;
386 for (k = 0; k < ndim + 1; k++)
388 for (data = (
int*)(tag->data()) + nz, k = 0; k < np; k++)
397 for (data = (
int*)(tag->data()), k = 0; k < np; k++)
400 for (fdata = (
float*)(tag->data()), k = 0; k < np; k++)
403 for (ddata = (
double*)(tag->data()), k = 0; k < np; k++)
406 for (fdata = (
float*)(tag->data()), k = 0; k < 2 * np; k++)
409 for (ddata = (
double*)(tag->data()), k = 0; k < 2 * np; k++)
438 if (tag->data() ==
nullptr || tag->size() == 0)
446 if (from_endian == to_endian)
461 np =
static_cast<int>(tag->size() /
sizeof(
fiff_int_t));
462 for (ithis = (
fiff_int_t*)tag->data(), k = 0; k < np; k++, ithis++)
468 np =
static_cast<int>(tag->size() /
sizeof(
fiff_long_t));
469 for (lthis = (
fiff_long_t*)tag->data(), k = 0; k < np; k++, lthis++)
476 np =
static_cast<int>(tag->size() /
sizeof(
fiff_short_t));
477 for (sthis = (
fiff_short_t*)tag->data(), k = 0; k < np; k++, sthis++)
483 np =
static_cast<int>(tag->size() /
sizeof(
fiff_float_t));
484 for (fthis = (
fiff_float_t*)tag->data(), k = 0; k < np; k++, fthis++)
491 for (dthis = (
fiff_double_t*)tag->data(), k = 0; k < np; k++, dthis++)
496 fthis = (
float*)tag->data();
502 sthis = (
short*)(fthis + 2);
503 np = (tag->size() - 2 *
sizeof(
float)) /
sizeof(short);
504 for (k = 0; k < np; k++, sthis++)
517 for (k = 0; k < np; k++) {
537 for (k = 0; k < np; k++) {
562 for (k = 0; k < np; k++) {
565 fthis = (
float*)offset;
573 for (r = 0; r < 12; ++r)
587 for (k = 0; k < np; ++k) {
590 fthis = (
float*)offset;
593 for (r = 0; r < 12; r++)
610 for (k = 0; k < np; k++) {
613 fthis = (
float*)offset;
618 for (r = 0; r < 3; ++r)
640 for (k = 0; k < np; ++k) {
643 fthis = (
float*)offset;
648 for (r = 0; r < 24; ++r)
655 for (drthis = (
fiffDataRef)tag->data(), k = 0; k < np; k++, drthis++) {
Endianness swap helpers for the FIFF binary tag I/O layer (FIFF is always written big-endian on disk)...
FIFF tag: the 16-byte tag header (kind, type, size, next) plus its decoded payload.
#define FIFFT_COMPLEX_DOUBLE
#define FIFFT_CH_INFO_STRUCT
#define FIFFT_CH_POS_STRUCT
#define FIFFT_COMPLEX_FLOAT
#define FIFFV_NATIVE_ENDIAN
#define FIFFT_DIR_ENTRY_STRUCT
#define FIFFT_COORD_TRANS_STRUCT
#define FIFFT_DIG_POINT_STRUCT
#define FIFFT_DATA_REF_STRUCT
FIFF file I/O, in-memory data structures and high-level readers/writers.
FiffDataRef * fiffDataRef
Backward-compatible pointer typedef for the old fiffDataRef pointer.
void swap_doublep(double *source)
qint32 swap_int(qint32 source)
void swap_longp(qint64 *source)
qint64 swap_long(qint64 source)
void swap_floatp(float *source)
void swap_intp(qint32 *source)
qint16 swap_short(qint16 source)
static qint32 storageSize()
Channel coil-frame placement: origin r0 (m) and orthonormal axes ex / ey / ez in FIFFV_COORD_DEVICE.
static qint32 storageSize()
static qint32 storageSize()
static qint32 storageSize()
static qint32 storageSize()
static qint32 storageSize()
static qint32 storageSize()
static fiff_int_t fiff_type_matrix_coding(fiff_int_t type)
std::unique_ptr< FiffTag > UPtr
fiff_int_t getMatrixCoding() const
static fiff_int_t fiff_type_fundamental(fiff_int_t type)
static void convert_tag_data(const FiffTag::UPtr &tag, int from_endian, int to_endian)
static void convert_matrix_to_file_data(const FiffTag::UPtr &tag)
fiff_int_t getType() const
static fiff_int_t fiff_type_base(fiff_int_t type)
static void convert_matrix_from_file_data(const FiffTag::UPtr &tag)
static void convert_ch_pos(FiffChPos *pos)
bool getMatrixDimensions(qint32 &p_ndim, QVector< qint32 > &p_Dims) const