78 if(!this->
isMatrix() || this->data() ==
nullptr)
87 qint32* t_pInt32 = (qint32*)this->data();
89 p_ndim = t_pInt32[(this->size()-4)/4];
92 for(
int i = p_ndim+1; i > 1; --i)
93 p_Dims.append(t_pInt32[(this->size()-(i*4))/4]);
95 for(
int i = p_ndim+2; i > 1; --i)
96 p_Dims.append(t_pInt32[(this->size()-(i*4))/4]);
99 qWarning(
"Cannot handle other than dense or sparse matrices yet.");
124 QString t_qStringInfo;
131 t_qStringInfo =
"Matrix of type FIFFT_INT";
134 t_qStringInfo =
"Matrix of type FIFFT_JULIAN";
137 t_qStringInfo =
"Matrix of type FIFFT_FLOAT";
140 t_qStringInfo =
"Matrix of type FIFFT_DOUBLE";
143 t_qStringInfo =
"Matrix of type FIFFT_COMPLEX_FLOAT";
146 t_qStringInfo =
"Matrix of type FIFFT_COMPLEX_DOUBLE";
149 t_qStringInfo =
"Matrix of unknown type";
160 t_qStringInfo =
"Simple type FIFFT_BYTE";
163 t_qStringInfo =
"Simple type FIFFT_SHORT";
166 t_qStringInfo =
"Simple type FIFFT_INT";
169 t_qStringInfo =
"Simple type FIFFT_USHORT";
172 t_qStringInfo =
"Simple type FIFFT_UINT";
175 t_qStringInfo =
"Simple type FIFFT_FLOAT";
178 t_qStringInfo =
"Simple type FIFFT_DOUBLE";
181 t_qStringInfo =
"Simple type FIFFT_STRING";
184 t_qStringInfo =
"Simple type FIFFT_DAU_PACK16";
187 t_qStringInfo =
"Simple type FIFFT_COMPLEX_FLOAT";
190 t_qStringInfo =
"Simple type FIFFT_COMPLEX_DOUBLE";
196 t_qStringInfo =
"Structure FIFFT_ID_STRUCT";
199 t_qStringInfo =
"Structure FIFFT_DIG_POINT_STRUCT";
202 t_qStringInfo =
"Structure FIFFT_COORD_TRANS_STRUCT";
205 t_qStringInfo =
"Structure FIFFT_CH_INFO_STRUCT";
208 t_qStringInfo =
"Structure FIFFT_OLD_PACK";
211 t_qStringInfo =
"Structure FIFFT_DIR_ENTRY_STRUCT";
214 t_qStringInfo =
"Structure unknown";
217 return t_qStringInfo;
261 for (k = 0; k < 3; k++) {
279 int *dimp,*data,
kind,np,nz;
282 unsigned int tsize = tag->size();
286 if (tag->data() ==
nullptr)
288 if (tsize <
sizeof(fiff_int_t))
291 dimp = ((fiff_int_t *)((tag->data())+tag->size()-
sizeof(fiff_int_t)));
295 if (tsize < (ndim+1)*
sizeof(fiff_int_t))
298 for (k = 0, np = 1; k < ndim; k++) {
304 if (tsize < (ndim+2)*
sizeof(fiff_int_t))
308 dimp = dimp - ndim - 1;
309 for (k = 0; k < ndim+1; k++)
313 np = nz + dimp[2] + 1;
315 np = nz + dimp[1] + 1;
321 for (data = (
int *)(tag->data())+nz, k = 0; k < np; k++)
330 for (data = (
int *)(tag->data()), k = 0; k < np; k++)
334 for (fdata = (
float *)(tag->data()), k = 0; k < np; k++)
338 for (ddata = (
double *)(tag->data()), k = 0; k < np; k++)
353 int *dimp,*data,
kind,np;
356 unsigned int tsize = tag->size();
360 if (tag->data() ==
nullptr)
362 if (tsize <
sizeof(fiff_int_t))
365 dimp = ((fiff_int_t *)(((
char *)tag->data())+tag->size()-
sizeof(fiff_int_t)));
370 if (tsize < (ndim+1)*
sizeof(fiff_int_t))
373 for (k = 0, np = 1; k < ndim; k++) {
379 if (tsize < (ndim+2)*
sizeof(fiff_int_t))
383 dimp = dimp - ndim - 1;
385 np = dimp[0] + dimp[2] + 1;
387 np = dimp[0] + dimp[1] + 1;
390 for (k = 0; k < ndim+1; k++)
398 for (data = (
int *)(tag->data()), k = 0; k < np; k++)
402 for (fdata = (
float *)(tag->data()), k = 0; k < np; k++)
406 for (ddata = (
double *)(tag->data()), k = 0; k < np; k++)
410 for (fdata = (
float *)(tag->data()), k = 0; k < 2*np; k++)
414 for (ddata = (
double *)(tag->data()), k = 0; k < 2*np; k++)
440 if (tag->data() ==
nullptr || tag->size() == 0)
448 if (from_endian == to_endian)
464 np = tag->size()/
sizeof(fiff_int_t);
465 for (ithis = (fiff_int_t *)tag->data(), k = 0; k < np; k++, ithis++)
471 np = tag->size()/
sizeof(fiff_long_t);
472 for (lthis = (fiff_long_t *)tag->data(), k = 0; k < np; k++, lthis++)
479 np = tag->size()/
sizeof(fiff_short_t);
480 for (sthis = (fiff_short_t *)tag->data(), k = 0; k < np; k++, sthis++)
486 np = tag->size()/
sizeof(fiff_float_t);
487 for (fthis = (fiff_float_t *)tag->data(), k = 0; k < np; k++, fthis++)
493 np = tag->size()/
sizeof(fiff_double_t);
494 for (dthis = (fiff_double_t *)tag->data(), k = 0; k < np; k++, dthis++)
499 fthis = (
float *)tag->data();
505 sthis = (
short *)(fthis+2);
506 np = (tag->size() - 2*
sizeof(
float))/
sizeof(short);
507 for (k = 0; k < np; k++,sthis++)
520 for (k = 0; k < np; k++) {
522 ithis = (fiff_int_t*) offset;
540 for (k = 0; k < np; k++) {
542 ithis = (fiff_int_t*) offset;
565 for (k = 0; k < np; k++) {
567 ithis = (fiff_int_t*) offset;
568 fthis = (
float*) offset;
576 for (r = 0; r < 12; ++r)
590 for (k = 0; k < np; ++k)
593 ithis = (fiff_int_t*) offset;
594 fthis = (
float*) offset;
597 for (r = 0; r < 12; r++)
614 for (k = 0; k < np; k++) {
616 ithis = (fiff_int_t*) offset;
617 fthis = (
float*) offset;
622 for (r = 0; r < 3; ++r)
644 for( k = 0; k < np; ++k)
647 ithis = (fiff_int_t*)offset;
648 fthis = (
float*)offset;
653 for (r = 0; r < 24; ++r)
660 for (drthis = (
fiffDataRef)tag->data(), k = 0; k < np; k++, drthis++) {
#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 tag: the 16-byte tag header (kind, type, size, next) plus its decoded payload.
Endianness swap helpers for the FIFF binary tag I/O layer (FIFF is always written big-endian on disk)...
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