57using namespace UTILSLIB;
58using namespace FIFFLIB;
76: QByteArray( p_pFiffTag->data(), p_pFiffTag->size())
77, kind(p_pFiffTag->kind)
78, type(p_pFiffTag->type)
79, next(p_pFiffTag->next)
124 if(!this->
isMatrix() || this->data() == NULL)
133 qint32* t_pInt32 = (qint32*)this->data();
135 p_ndim = t_pInt32[(this->size()-4)/4];
138 for(
int i = p_ndim+1; i > 1; --i)
139 p_Dims.append(t_pInt32[(this->size()-(i*4))/4]);
141 for(
int i = p_ndim+2; i > 1; --i)
142 p_Dims.append(t_pInt32[(this->size()-(i*4))/4]);
145 printf(
"Error: Cannot handle other than dense or sparse matrices yet.\n");
170 QString t_qStringInfo;
177 t_qStringInfo =
"Matrix of type FIFFT_INT";
180 t_qStringInfo =
"Matrix of type FIFFT_JULIAN";
183 t_qStringInfo =
"Matrix of type FIFFT_FLOAT";
186 t_qStringInfo =
"Matrix of type FIFFT_DOUBLE";
188 case FIFFT_COMPLEX_FLOAT:
189 t_qStringInfo =
"Matrix of type FIFFT_COMPLEX_FLOAT";
191 case FIFFT_COMPLEX_DOUBLE:
192 t_qStringInfo =
"Matrix of type FIFFT_COMPLEX_DOUBLE";
195 t_qStringInfo =
"Matrix of unknown type";
206 t_qStringInfo =
"Simple type FIFFT_BYTE";
209 t_qStringInfo =
"Simple type FIFFT_SHORT";
212 t_qStringInfo =
"Simple type FIFFT_INT";
215 t_qStringInfo =
"Simple type FIFFT_USHORT";
218 t_qStringInfo =
"Simple type FIFFT_UINT";
221 t_qStringInfo =
"Simple type FIFFT_FLOAT";
224 t_qStringInfo =
"Simple type FIFFT_DOUBLE";
227 t_qStringInfo =
"Simple type FIFFT_STRING";
229 case FIFFT_DAU_PACK16:
230 t_qStringInfo =
"Simple type FIFFT_DAU_PACK16";
232 case FIFFT_COMPLEX_FLOAT:
233 t_qStringInfo =
"Simple type FIFFT_COMPLEX_FLOAT";
235 case FIFFT_COMPLEX_DOUBLE:
236 t_qStringInfo =
"Simple type FIFFT_COMPLEX_DOUBLE";
241 case FIFFT_ID_STRUCT:
242 t_qStringInfo =
"Structure FIFFT_ID_STRUCT";
244 case FIFFT_DIG_POINT_STRUCT:
245 t_qStringInfo =
"Structure FIFFT_DIG_POINT_STRUCT";
247 case FIFFT_COORD_TRANS_STRUCT:
248 t_qStringInfo =
"Structure FIFFT_COORD_TRANS_STRUCT";
250 case FIFFT_CH_INFO_STRUCT:
251 t_qStringInfo =
"Structure FIFFT_CH_INFO_STRUCT";
254 t_qStringInfo =
"Structure FIFFT_OLD_PACK";
256 case FIFFT_DIR_ENTRY_STRUCT:
257 t_qStringInfo =
"Structure FIFFT_DIR_ENTRY_STRUCT";
260 t_qStringInfo =
"Structure unknown";
263 return t_qStringInfo;
307 for (
k = 0;
k < 3;
k++) {
325 int *dimp,*data,
kind,np,nz;
328 unsigned int tsize = tag->size();
332 if (tag->data() == NULL)
334 if (tsize <
sizeof(fiff_int_t))
337 dimp = ((fiff_int_t *)((tag->data())+tag->size()-
sizeof(fiff_int_t)));
341 if (tsize < (ndim+1)*
sizeof(fiff_int_t))
344 for (
k = 0, np = 1;
k < ndim;
k++) {
350 if (tsize < (ndim+2)*
sizeof(fiff_int_t))
354 dimp = dimp - ndim - 1;
355 for (
k = 0;
k < ndim+1;
k++)
359 np = nz + dimp[2] + 1;
361 np = nz + dimp[1] + 1;
367 for (data = (
int *)(tag->data())+nz,
k = 0;
k < np;
k++)
375 if (
kind == FIFFT_INT) {
376 for (data = (
int *)(tag->data()),
k = 0;
k < np;
k++)
379 else if (
kind == FIFFT_FLOAT) {
380 for (fdata = (
float *)(tag->data()),
k = 0;
k < np;
k++)
383 else if (
kind == FIFFT_DOUBLE) {
384 for (ddata = (
double *)(tag->data()),
k = 0;
k < np;
k++)
399 int *dimp,*data,
kind,np;
402 unsigned int tsize = tag->size();
406 if (tag->data() == NULL)
408 if (tsize <
sizeof(fiff_int_t))
411 dimp = ((fiff_int_t *)(((
char *)tag->data())+tag->size()-
sizeof(fiff_int_t)));
416 if (tsize < (ndim+1)*
sizeof(fiff_int_t))
419 for (
k = 0, np = 1;
k < ndim;
k++) {
425 if (tsize < (ndim+2)*
sizeof(fiff_int_t))
429 dimp = dimp - ndim - 1;
431 np = dimp[0] + dimp[2] + 1;
433 np = dimp[0] + dimp[1] + 1;
436 for (
k = 0;
k < ndim+1;
k++)
443 if (
kind == FIFFT_INT) {
444 for (data = (
int *)(tag->data()),
k = 0;
k < np;
k++)
447 else if (
kind == FIFFT_FLOAT) {
448 for (fdata = (
float *)(tag->data()),
k = 0;
k < np;
k++)
451 else if (
kind == FIFFT_DOUBLE) {
452 for (ddata = (
double *)(tag->data()),
k = 0;
k < np;
k++)
455 else if (
kind == FIFFT_COMPLEX_FLOAT) {
456 for (fdata = (
float *)(tag->data()),
k = 0;
k < 2*np;
k++)
459 else if (
kind == FIFFT_COMPLEX_DOUBLE) {
460 for (ddata = (
double *)(tag->data()),
k = 0;
k < 2*np;
k++)
486 if (tag->data() == NULL || tag->size() == 0)
490 from_endian = NATIVE_ENDIAN;
492 to_endian = NATIVE_ENDIAN;
494 if (from_endian == to_endian)
498 if (from_endian == NATIVE_ENDIAN)
510 np = tag->size()/
sizeof(fiff_int_t);
511 for (ithis = (fiff_int_t *)tag->data(),
k = 0;
k < np;
k++, ithis++)
517 np = tag->size()/
sizeof(fiff_long_t);
518 for (lthis = (fiff_long_t *)tag->data(),
k = 0;
k < np;
k++, lthis++)
523 case FIFFT_DAU_PACK16 :
525 np = tag->size()/
sizeof(fiff_short_t);
526 for (sthis = (fiff_short_t *)tag->data(),
k = 0;
k < np;
k++, sthis++)
531 case FIFFT_COMPLEX_FLOAT :
532 np = tag->size()/
sizeof(fiff_float_t);
533 for (fthis = (fiff_float_t *)tag->data(),
k = 0;
k < np;
k++, fthis++)
538 case FIFFT_COMPLEX_DOUBLE :
539 np = tag->size()/
sizeof(fiff_double_t);
540 for (dthis = (fiff_double_t *)tag->data(),
k = 0;
k < np;
k++, dthis++)
544 case FIFFT_OLD_PACK :
545 fthis = (
float *)tag->data();
551 sthis = (
short *)(fthis+2);
552 np = (tag->size() - 2*
sizeof(float))/
sizeof(short);
553 for (
k = 0;
k < np;
k++,sthis++)
557 case FIFFT_DIR_ENTRY_STRUCT :
566 for (
k = 0;
k < np;
k++) {
568 ithis = (fiff_int_t*) offset;
576 case FIFFT_ID_STRUCT :
586 for (
k = 0;
k < np;
k++) {
588 ithis = (fiff_int_t*) offset;
597 case FIFFT_CH_INFO_STRUCT :
611 for (
k = 0;
k < np;
k++) {
613 ithis = (fiff_int_t*) offset;
614 fthis = (
float*) offset;
622 for (r = 0; r < 12; ++r)
630 case FIFFT_CH_POS_STRUCT :
636 for (
k = 0;
k < np; ++
k)
639 ithis = (fiff_int_t*) offset;
640 fthis = (
float*) offset;
643 for (r = 0; r < 12; r++)
649 case FIFFT_DIG_POINT_STRUCT :
660 for (
k = 0;
k < np;
k++) {
662 ithis = (fiff_int_t*) offset;
663 fthis = (
float*) offset;
668 for (r = 0; r < 3; ++r)
673 case FIFFT_COORD_TRANS_STRUCT :
690 for(
k = 0;
k < np; ++
k)
693 ithis = (fiff_int_t*)offset;
694 fthis = (
float*)offset;
699 for (r = 0; r < 24; ++r)
704 case FIFFT_DATA_REF_STRUCT :
706 for (drthis = (
fiffDataRef)tag->data(),
k = 0;
k < np;
k++, drthis++) {
725 return type & FIFFTS_FS_MASK;
732 return type & FIFFTS_BASE_MASK;
739 return type & FIFFTS_MC_MASK;
FiffTag class declaration, which provides fiff tag I/O and processing methods.
#define FIFFV_NATIVE_ENDIAN
IOUtils class declaration.
static qint32 storageSize()
Measurement channel position and coil type.
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)
static void convert_matrix_to_file_data(FiffTag::SPtr tag)
fiff_int_t getMatrixCoding() const
static fiff_int_t fiff_type_fundamental(fiff_int_t type)
QSharedPointer< FiffTag > SPtr
static void convert_matrix_from_file_data(FiffTag::SPtr tag)
fiff_int_t getType() const
static fiff_int_t fiff_type_base(fiff_int_t type)
static void convert_ch_pos(FiffChPos *pos)
bool getMatrixDimensions(qint32 &p_ndim, QVector< qint32 > &p_Dims) const
static void convert_tag_data(FiffTag::SPtr tag, int from_endian, int to_endian)
static void swap_doublep(double *source)
static qint32 swap_int(qint32 source)
static void swap_floatp(float *source)
static void swap_longp(qint64 *source)
static void swap_intp(qint32 *source)
static qint64 swap_long(qint64 source)
static qint16 swap_short(qint16 source)