v2.0.0
Loading...
Searching...
No Matches
fiff_tag.h
Go to the documentation of this file.
1//=============================================================================================================
36
37#ifndef FIFF_TAG_H
38#define FIFF_TAG_H
39
40//=============================================================================================================
41// DEFINES
42//=============================================================================================================
43
44/* NOTE:
45 The architecture is now deduced from the operating system, which is
46 a bit stupid way, since the same operating system can me run on various
47 architectures. This may need revision later on. */
48
49#if defined(DARWIN)
50
51#if defined(__LITTLE_ENDIAN__)
52#define INTEL_X86_ARCH
53#else
54#define BIG_ENDIAN_ARCH
55#endif
56
57#else
58
59#if defined(__hpux) || defined(__Lynx__) || defined(__sun)
60#define BIG_ENDIAN_ARCH
61#else
62#if defined(__linux) || defined(WIN32) || defined(__APPLE__)
63#define INTEL_X86_ARCH
64#endif
65
66#endif
67#endif
68
69#define NATIVE_ENDIAN FIFFV_LITTLE_ENDIAN
70
71#ifdef INTEL_X86_ARCH
72#define NATIVE_ENDIAN FIFFV_LITTLE_ENDIAN
73#endif
74
75#ifdef BIG_ENDIAN_ARCH
76#define NATIVE_ENDIAN FIFFV_BIG_ENDIAN
77#endif
78
79//=============================================================================================================
80// INCLUDES
81//=============================================================================================================
82
83#include "fiff_global.h"
84#include "fiff_constants.h"
85#include "fiff_file.h"
86#include "fiff_types.h"
87#include "fiff_id.h"
88#include "fiff_coord_trans.h"
89#include "fiff_ch_info.h"
90#include "fiff_ch_pos.h"
91#include "fiff_dir_entry.h"
92#include "fiff_dig_point.h"
93
94//=============================================================================================================
95// EIGEN INCLUDES
96//=============================================================================================================
97
98#include <Eigen/Core>
99#include <Eigen/SparseCore>
100
101//=============================================================================================================
102// QT INCLUDES
103//=============================================================================================================
104
105#include <QDebug>
106#include <QByteArray>
107#include <QList>
108#include <QSharedPointer>
109#include <QVector>
110
111//=============================================================================================================
112// STL INCLUDES
113//=============================================================================================================
114
115#include <iostream>
116#include <memory>
117
118//=============================================================================================================
119// DEFINE NAMESPACE FIFFLIB
120//=============================================================================================================
121
122namespace FIFFLIB
123{
124
125class FiffStream;
126class FiffDirNode;
127
128//=============================================================================================================
129// FORWARD DECLARATIONS
130//=============================================================================================================
131//
132// The magic hexadecimal values
133//
134#define IS_MATRIX 0xFFFF0000
135#define MATRIX_CODING_DENSE 0x00004000
136#define MATRIX_CODING_CCS 0x00004010
137#define MATRIX_CODING_RCS 0x00004020
138#define DATA_TYPE 0x0000FFFF
139
140//const fiff_int_t IS_MATRIX = 4294901760; /**< Is Matrix encoding. ffff0000. */
141//const fiff_int_t MATRIX_CODING_DENSE = 16384; /**< MATRIX_CODING_DENSE encoding. 4000. */
142//const fiff_int_t MATRIX_CODING_CCS = 16400; /**< MATRIX_CODING_CCS encoding. 4010. */
143//const fiff_int_t MATRIX_CODING_RCS = 16416; /**< MATRIX_CODING_RCS encoding. 4020. */
144//const fiff_int_t DATA_TYPE = 65535; /**< DATA_TYPE encoding. ffff. */
145
146//=============================================================================================================
152class FIFFSHARED_EXPORT FiffTag : public QByteArray
153{
154
155public:
156 using SPtr = QSharedPointer<FiffTag>;
157 using ConstSPtr = QSharedPointer<const FiffTag>;
158 using UPtr = std::unique_ptr<FiffTag>;
159 using ConstUPtr = std::unique_ptr<const FiffTag>;
160
161 //=========================================================================================================
165 FiffTag();
166
167 //=========================================================================================================
173 FiffTag(const FiffTag& p_FiffTag) = default;
174
175 //=========================================================================================================
179 FiffTag(FiffTag&& other) = default;
180
181 //=========================================================================================================
185 FiffTag& operator=(const FiffTag& other) = default;
186
187 //=========================================================================================================
191 FiffTag& operator=(FiffTag&& other) = default;
192
193 //=========================================================================================================
197 ~FiffTag() = default;
198
199 //=========================================================================================================
206
207 //=========================================================================================================
213 bool isMatrix() const;
214
215 //=========================================================================================================
225 bool getMatrixDimensions(qint32& p_ndim, QVector<qint32>& p_Dims) const;
226
227 //=========================================================================================================
233 fiff_int_t getType() const;
234
235 //=========================================================================================================
241 QString getInfo() const;
242
243 //
244 // Simple types
245 //
246 //=========================================================================================================
253 inline quint8* toByte() const;
254
255 //=========================================================================================================
262 inline quint16* toUnsignedShort() const;
263
264 //=========================================================================================================
271 inline qint16* toShort() const;
272
273 //=========================================================================================================
280 inline quint32* toUnsignedInt() const;
281
282 //=========================================================================================================
289 inline qint32* toInt() const;
290
291 //=========================================================================================================
298 inline qint32* toJulian() const;
299
300 //=========================================================================================================
307 inline const float* toFloat() const;
308
309 //=========================================================================================================
316 inline const double* toDouble() const;
317
318 //=========================================================================================================
324 inline QString toString() const;
325
326 //=========================================================================================================
333 inline qint16* toDauPack16() const;
334
335 //
336 // Structures
337 //
338 //=========================================================================================================
344 inline FiffId toFiffID() const;
345
346 //=========================================================================================================
352 inline FiffDigPoint toDigPoint() const;
353
354 //=========================================================================================================
360 inline FiffCoordTrans toCoordTrans() const;
361
362 //=========================================================================================================
368 inline FiffChInfo toChInfo() const;
369
370// //=========================================================================================================
371// /**
372// * to fiff OLD PACK
373// */
374// inline fiff_coord_trans_t toCoordTrans() const;
375
376 //=========================================================================================================
382 inline QList< QSharedPointer<FiffDirEntry> > toDirEntry() const;
383
384 //
385 // MATRIX
386 //
387 //=========================================================================================================
393 inline Eigen::MatrixXi toIntMatrix() const;
394
395 //=========================================================================================================
403 inline Eigen::MatrixXf toFloatMatrix() const;
404
405 //=========================================================================================================
413 inline Eigen::SparseMatrix<double> toSparseFloatMatrix() const;
414
415 //
416 //from fiff_combat.c
417 //
418
419 //=========================================================================================================
425 static void convert_ch_pos(FiffChPos* pos);
426
427 /*
428 * Data type conversions for the little endian systems.
429 */
438 static void convert_matrix_from_file_data(const FiffTag::UPtr& tag);
439
440 //=========================================================================================================
446 static void convert_matrix_to_file_data(const FiffTag::UPtr& tag);
447
448 //
449 // Data type conversions for the little endian systems.
450 //
451 //=========================================================================================================
465 static void convert_tag_data(const FiffTag::UPtr& tag, int from_endian, int to_endian);
466
467 //
468 // from fiff_type_spec.c
469 //
470 //=========================================================================================================
479
480 //=========================================================================================================
489
490 //=========================================================================================================
499
500 //=========================================================================================================
507 inline static qint32 storageSize();
508
509public:
518};
519
520//=============================================================================================================
521// INLINE DEFINITIONS
522//=============================================================================================================
523
524inline qint32 FiffTag::storageSize()
525{
526 // On-disk layout: kind, type, size, next (4 x fiff_int_t)
527 // Note: 'size' is not a class member (QByteArray::size() is used at runtime),
528 // but it is part of the on-disk wire format.
529 return sizeof(FiffTag::kind) + sizeof(FiffTag::type)
530 + sizeof(fiff_int_t) /* size field on disk */
531 + sizeof(FiffTag::next);
532}
533
534//=============================================================================================================
535// Simple types
536//=============================================================================================================
537
538inline quint8* FiffTag::toByte() const
539{
540 if(this->isMatrix() || this->getType() != FIFFT_BYTE)
541 return nullptr;
542 else
543 return (quint8*)this->data();
544}
545
546//=============================================================================================================
547
548inline quint16* FiffTag::toUnsignedShort() const
549{
550 if(this->isMatrix() || this->getType() != FIFFT_USHORT)
551 return nullptr;
552 else
553 return (quint16*)this->data();
554}
555
556//=============================================================================================================
557
558inline qint16* FiffTag::toShort() const
559{
560 if(this->isMatrix() || this->getType() != FIFFT_SHORT)
561 return nullptr;
562 else
563 return (qint16*)this->data();
564}
565
566//=============================================================================================================
567
568inline quint32* FiffTag::toUnsignedInt() const
569{
570 if(this->isMatrix() || this->getType() != FIFFT_UINT)
571 return nullptr;
572 else
573 return (quint32*)this->data();
574}
575
576//=============================================================================================================
577
578inline qint32* FiffTag::toInt() const
579{
580 if(this->isMatrix() || this->getType() != FIFFT_INT) {
581 qWarning("Expected an integer tag : %d (found data type %d instead)\n",this->kind,this->getType());
582 return nullptr;
583 }
584 else
585 return (qint32*)this->data();
586}
587
588//=============================================================================================================
589
590inline qint32* FiffTag::toJulian() const
591{
592 if(this->isMatrix() || this->getType() != FIFFT_JULIAN) {
593 qWarning("Expected a julian tag : %d (found data type %d instead)\n",this->kind,this->getType());
594 return nullptr;
595 }
596 else
597 return (qint32*)this->data();
598}
599
600//=============================================================================================================
601
602inline const float* FiffTag::toFloat() const
603{
604 if(this->isMatrix() || this->getType() != FIFFT_FLOAT)
605 return nullptr;
606 else
607 return reinterpret_cast<const float*>(this->data());
608}
609
610//=============================================================================================================
611
612inline const double* FiffTag::toDouble() const
613{
614 if(this->isMatrix() || this->getType() != FIFFT_DOUBLE)
615 return nullptr;
616 else
617 return reinterpret_cast<const double*>(this->data());
618}
619
620//=============================================================================================================
621
622inline QString FiffTag::toString() const
623{
624 if(this->isMatrix() || this->getType() != FIFFT_STRING)
625 return nullptr;
626 else
627 return *this;
628}
629
630//=============================================================================================================
631
632inline qint16* FiffTag::toDauPack16() const
633{
634 if(this->isMatrix() || this->getType() != FIFFT_DAU_PACK16)
635 return nullptr;
636 else
637 return (qint16*)this->data();
638}
639
640//=============================================================================================================
641// Structures
642//=============================================================================================================
643
645{
646 FiffId p_fiffID;
647 if(this->isMatrix() || this->getType() != FIFFT_ID_STRUCT || this->data() == nullptr)
648 return p_fiffID;
649 else
650 {
651 const qint32* t_pInt32 = (qint32*)this->data();
652
653 p_fiffID.version = t_pInt32[0];
654 p_fiffID.machid[0] = t_pInt32[1];
655 p_fiffID.machid[1] = t_pInt32[2];
656 p_fiffID.time.secs = t_pInt32[3];
657 p_fiffID.time.usecs = t_pInt32[4];
658
659 return p_fiffID;
660 }
661}
662
663//=============================================================================================================
664
666{
667
668 FiffDigPoint t_fiffDigPoint;
669 if(this->isMatrix() || this->getType() != FIFFT_DIG_POINT_STRUCT || this->data() == nullptr)
670 return t_fiffDigPoint;
671 else
672 {
673 auto *t_pInt32 = reinterpret_cast<const qint32*>(this->data());
674
675 t_fiffDigPoint.kind = t_pInt32[0];
676 t_fiffDigPoint.ident = t_pInt32[1];
677
678 auto *t_pFloat = reinterpret_cast<const float*>(this->data());
679 t_fiffDigPoint.r[0] = t_pFloat[2];
680 t_fiffDigPoint.r[1] = t_pFloat[3];
681 t_fiffDigPoint.r[2] = t_pFloat[4];
682 t_fiffDigPoint.coord_frame = 0;
683
684 return t_fiffDigPoint;
685 }
686}
687
688//=============================================================================================================
689
691{
692
693 FiffCoordTrans p_FiffCoordTrans;
694 if(this->isMatrix() || this->getType() != FIFFT_COORD_TRANS_STRUCT || this->data() == nullptr)
695 return p_FiffCoordTrans;
696 else
697 {
698 auto *t_pInt32 = reinterpret_cast<const qint32*>(this->data());
699 p_FiffCoordTrans.from = t_pInt32[0];
700 p_FiffCoordTrans.to = t_pInt32[1];
701
702 p_FiffCoordTrans.trans.setIdentity(4,4);
703 auto *t_pFloat = reinterpret_cast<const float*>(this->data());
704 int count = 0;
705 int r, c;
706 for (r = 0; r < 3; ++r) {
707 p_FiffCoordTrans.trans(r,3) = t_pFloat[11+r];
708 for (c = 0; c < 3; ++c) {
709 p_FiffCoordTrans.trans(r,c) = t_pFloat[2+count];
710 ++count;
711 }
712 }
713
714 p_FiffCoordTrans.invtrans.setIdentity(4,4);
715 count = 0;
716 for (r = 0; r < 3; ++r) {
717 p_FiffCoordTrans.invtrans(r,3) = t_pFloat[23+r];
718 for (c = 0; c < 3; ++c) {
719 p_FiffCoordTrans.invtrans(r,c) = t_pFloat[14+count];
720 ++count;
721 }
722 }
723
724 return p_FiffCoordTrans;
725 }
726}
727
728//=========================================================================================================
733{
734 FiffChInfo p_FiffChInfo;
735
736 if(this->isMatrix() || this->getType() != FIFFT_CH_INFO_STRUCT || this->data() == nullptr)
737 return p_FiffChInfo;
738 else
739 {
740 auto *t_pInt32 = reinterpret_cast<const qint32*>(this->data());
741 p_FiffChInfo.scanNo = t_pInt32[0];
742 p_FiffChInfo.logNo = t_pInt32[1];
743 p_FiffChInfo.kind = t_pInt32[2];
744 auto *t_pFloat = reinterpret_cast<const float*>(this->data());
745 p_FiffChInfo.range = t_pFloat[3];
746 p_FiffChInfo.cal = t_pFloat[4];
747
748 p_FiffChInfo.chpos.coil_type = t_pInt32[5];
749
750 //
751 // Read the coil coordinate system definition
752 //
753 qint32 r;
754 // r0
755 for (r = 0; r < 3; ++r)
756 p_FiffChInfo.chpos.r0[r] = t_pFloat[6+r];
757 // ex
758 for (r = 0; r < 3; ++r)
759 p_FiffChInfo.chpos.ex[r] = t_pFloat[6+3+r];
760 // ey
761 for (r = 0; r < 3; ++r)
762 p_FiffChInfo.chpos.ey[r] = t_pFloat[6+6+r];
763 // ez
764 for (r = 0; r < 3; ++r)
765 p_FiffChInfo.chpos.ez[r] = t_pFloat[6+9+r];
766
767 p_FiffChInfo.coord_frame = FIFFV_COORD_UNKNOWN;
768
769 //
770 // Convert loc into a more useful format
771 //
772 if (p_FiffChInfo.kind == FIFFV_MEG_CH || p_FiffChInfo.kind == FIFFV_REF_MEG_CH)
773 {
774 p_FiffChInfo.coil_trans.setIdentity(4,4);
775 // r0
776 for (r = 0; r < 3; ++r)
777 p_FiffChInfo.coil_trans(r,3) = p_FiffChInfo.chpos.r0[r];
778 // ex
779 for (r = 0; r < 3; ++r)
780 p_FiffChInfo.coil_trans(r,0) = p_FiffChInfo.chpos.ex[r];
781 // ey
782 for (r = 0; r < 3; ++r)
783 p_FiffChInfo.coil_trans(r,1) = p_FiffChInfo.chpos.ey[r];
784 // ez
785 for (r = 0; r < 3; ++r)
786 p_FiffChInfo.coil_trans(r,2) = p_FiffChInfo.chpos.ez[r];
787
788 p_FiffChInfo.coord_frame = FIFFV_COORD_DEVICE;
789 }
790 else if (p_FiffChInfo.kind == FIFFV_EEG_CH)
791 {
792 if (p_FiffChInfo.chpos.ex.norm() > 0) {
793 p_FiffChInfo.eeg_loc.block(0,0,3,1) = p_FiffChInfo.chpos.r0.block(0,0,3,1);
794 p_FiffChInfo.eeg_loc.block(0,1,3,1) = p_FiffChInfo.chpos.ex.block(0,0,3,1);
795 }
796 else {
797 p_FiffChInfo.eeg_loc.block(0,0,3,1) = p_FiffChInfo.chpos.r0.block(0,0,3,1);
798 }
799 p_FiffChInfo.coord_frame = FIFFV_COORD_HEAD;
800 }
801 //
802 // Unit and exponent
803 //
804 p_FiffChInfo.unit = t_pInt32[18];
805 p_FiffChInfo.unit_mul = t_pInt32[19];
806
807 //
808 // Handle the channel name
809 //
810 const char* orig = static_cast<const char*>(this->data());
811 p_FiffChInfo.ch_name = QString::fromUtf8(orig + 80).replace(" ","");
812
813 return p_FiffChInfo;
814 }
815}
816
817// //=========================================================================================================
818// /**
819// * to fiff OLD PACK
820// */
821// inline fiff_coord_trans_t toCoordTrans() const
822// {
823
824// }
825
826//=============================================================================================================
827
828inline QList< QSharedPointer<FiffDirEntry> > FiffTag::toDirEntry() const
829{
830// tag.data = struct('kind',{},'type',{},'size',{},'pos',{});
831 QList< QSharedPointer<FiffDirEntry> > p_ListFiffDir;
832 if(this->isMatrix() || this->getType() != FIFFT_DIR_ENTRY_STRUCT || this->data() == nullptr)
833 return p_ListFiffDir;
834 else
835 {
836 QSharedPointer<FiffDirEntry> t_pFiffDirEntry;
837 qint32* t_pInt32 = (qint32*)this->data();
838 for (int k = 0; k < this->size()/16; ++k)
839 {
840 t_pFiffDirEntry = QSharedPointer<FiffDirEntry>(new FiffDirEntry);
841 t_pFiffDirEntry->kind = t_pInt32[k*4];//fread(fid,1,'int32');
842 t_pFiffDirEntry->type = t_pInt32[k*4+1];//fread(fid,1,'uint32');
843 t_pFiffDirEntry->size = t_pInt32[k*4+2];//fread(fid,1,'int32');
844 t_pFiffDirEntry->pos = t_pInt32[k*4+3];//fread(fid,1,'int32');
845 p_ListFiffDir.append(t_pFiffDirEntry);
846 }
847 }
848 return p_ListFiffDir;
849}
850
851//=============================================================================================================
852// MATRIX
853//=============================================================================================================
854
855//=============================================================================================================
856
857inline Eigen::MatrixXi FiffTag::toIntMatrix() const
858{
859 if(!this->isMatrix() || this->getType() != FIFFT_INT || this->data() == nullptr)
860 return Eigen::MatrixXi();
861
862 qint32 ndim;
863 QVector<qint32> dims;
864 this->getMatrixDimensions(ndim, dims);
865
866 if (ndim != 2)
867 {
868 qWarning("Only two-dimensional matrices are supported at this time");
869 return Eigen::MatrixXi();
870 }
871
872 // Use copy constructor instead --> slower performance but higher memory management reliability
873 Eigen::MatrixXi p_Matrix(Eigen::Map<const Eigen::MatrixXi>(reinterpret_cast<const int*>(this->data()), dims[0], dims[1]));
874
875 return p_Matrix;
876}
877
878//=============================================================================================================
879
880inline Eigen::MatrixXf FiffTag::toFloatMatrix() const
881{
882 if(!this->isMatrix() || this->getType() != FIFFT_FLOAT || this->data() == nullptr)
883 return Eigen::MatrixXf();//NULL;
884
886 {
887 qWarning("Error in FiffTag::toFloatMatrix(): Matrix is not dense!");
888 return Eigen::MatrixXf();
889 }
890
891 qint32 ndim;
892 QVector<qint32> dims;
893 this->getMatrixDimensions(ndim, dims);
894
895 if (ndim != 2)
896 {
897 qWarning("Only two-dimensional matrices are supported at this time");
898 return Eigen::MatrixXf();
899 }
900
901 // Use copy constructor instead --> slower performance but higher memory management reliability
902 Eigen::MatrixXf p_Matrix(Eigen::Map<const Eigen::MatrixXf>(reinterpret_cast<const float*>(this->data()), dims[0], dims[1]));
903
904 return p_Matrix;
905}
906
907//=============================================================================================================
908
909inline Eigen::SparseMatrix<double> FiffTag::toSparseFloatMatrix() const
910{
911 if(!this->isMatrix() || this->getType() != FIFFT_FLOAT || this->data() == nullptr)
912 return Eigen::SparseMatrix<double>();//NULL;
913
915 {
916 qCritical("Error in FiffTag::toSparseFloatMatrix(): Matrix is not sparse!\n");
917 return Eigen::SparseMatrix<double>();//NULL;
918 }
919
920 qint32 ndim;
921 QVector<qint32> dims;
922 this->getMatrixDimensions(ndim, dims);
923
924 if (ndim != 2)
925 {
926 qWarning("Only two-dimensional matrices are supported at this time");
927 return Eigen::SparseMatrix<double>();
928 }
929
930 qint32 nnz = dims[0];
931 qint32 nrow = dims[1];
932 qint32 ncol = dims[2];
933
934 using T = Eigen::Triplet<double>;
935 std::vector<T> tripletList;
936 tripletList.reserve(nnz);
937
938 auto *t_pFloat = reinterpret_cast<const float*>(this->data());
939 auto *t_pInt = reinterpret_cast<const int*>(this->data());
940 qint32 offset1 = nnz;
941 qint32 offset2 = 2*nnz;
943 {
944 //
945 // CCS
946 //
947 qWarning("Warning in FiffTag::toSparseFloatMatrix(): CCS has to be debugged - never done before.");
948 qint32 p = 0;
949 for(qint32 j = 0; j < ncol; ++j)
950 {
951 while( p < t_pInt[offset2+j+1])
952 {
953// tripletList[p] = T(tripletList[p].row(), j, tripletList[p].value());
954 tripletList.push_back(T(t_pInt[offset1+p], j, static_cast<double>(t_pFloat[p])));
955 ++p;
956 }
957 }
958 }
959 else
960 {
961 //
962 // RCS
963 //
964 qint32 p = 0;
965 for(qint32 j = 0; j < nrow; ++j)
966 {
967 while( p < t_pInt[offset2+j+1])
968 {
969// tripletList[p] = T(j, tripletList[p].col(), tripletList[p].value());
970 tripletList.push_back(T(j, t_pInt[offset1+p], static_cast<double>(t_pFloat[p])));
971 ++p;
972 }
973 }
974 }
975
976// std::cout << "Size: " << tripletList.size() << std::endl;
977// qint32 offsetTest = tripletList.size() - 10;
978// for(qint32 i = 0; i < 10; ++i)
979// std::cout << std::endl << tripletList[offsetTest + i].row() << " " << tripletList[offsetTest + i].col() << " " << tripletList[offsetTest + i].value();
980
981 Eigen::SparseMatrix<double> p_Matrix(nrow, ncol);
982 p_Matrix.setFromTriplets(tripletList.begin(), tripletList.end());
983
984 return p_Matrix;
985}
986} // NAMESPACE
987
988#endif // FIFF_TAG_H
Fiff library export/import macros.
#define FIFFSHARED_EXPORT
Definition fiff_global.h:52
FiffChPos class declaration.
Old fiff_type declarations - replace them.
FiffCoordTrans class declaration.
fiff_int_t fiff_type_base(fiff_int_t type)
fiff_int_t fiff_type_matrix_coding(fiff_int_t type)
fiff_int_t fiff_type_fundamental(fiff_int_t type)
Header file describing the numerical values used in fif files.
#define FIFFT_ID_STRUCT
Definition fiff_file.h:248
#define FIFFTS_MC_RCS
Definition fiff_file.h:270
#define FIFFT_CH_INFO_STRUCT
Definition fiff_file.h:247
#define FIFFT_UINT
Definition fiff_file.h:236
#define FIFFT_INT
Definition fiff_file.h:231
#define FIFFT_SHORT
Definition fiff_file.h:230
#define FIFFT_BYTE
Definition fiff_file.h:229
#define FIFFT_DAU_PACK16
Definition fiff_file.h:243
#define FIFFTS_MC_CCS
Definition fiff_file.h:269
#define FIFFT_DOUBLE
Definition fiff_file.h:233
#define FIFFT_USHORT
Definition fiff_file.h:235
#define FIFFT_JULIAN
Definition fiff_file.h:234
#define FIFFT_FLOAT
Definition fiff_file.h:232
#define FIFFT_STRING
Definition fiff_file.h:238
#define FIFFTS_MC_DENSE
Definition fiff_file.h:268
#define FIFFT_DIR_ENTRY_STRUCT
Definition fiff_file.h:249
#define FIFFT_COORD_TRANS_STRUCT
Definition fiff_file.h:252
#define FIFFT_DIG_POINT_STRUCT
Definition fiff_file.h:250
FiffDirEntry class declaration.
Fiff constants.
#define FIFFV_EEG_CH
#define FIFFV_COORD_DEVICE
#define FIFFV_REF_MEG_CH
#define FIFFV_MEG_CH
#define FIFFV_COORD_HEAD
#define FIFFV_COORD_UNKNOWN
FiffChInfo class declaration.
FiffDigPoint class declaration.
FiffId class declaration.
FIFF file I/O and data structures (raw, epochs, evoked, covariance, forward).
qint32 fiff_int_t
Definition fiff_types.h:89
Channel info descriptor.
Eigen::Matrix< float, 3, 2, Eigen::DontAlign > eeg_loc
Eigen::Matrix< float, 4, 4, Eigen::DontAlign > coil_trans
Measurement channel position and coil type.
Definition fiff_ch_pos.h:68
Eigen::Vector3f r0
fiff_int_t coil_type
Eigen::Vector3f ey
Eigen::Vector3f ex
Eigen::Vector3f ez
Coordinate transformation description.
Eigen::Matrix< float, 4, 4, Eigen::DontAlign > trans
Eigen::Matrix< float, 4, 4, Eigen::DontAlign > invtrans
Digitization point description.
Directory entry description.
Universally unique identifier.
Definition fiff_id.h:68
fiff_int_t machid[2]
Definition fiff_id.h:180
FiffTime time
Definition fiff_id.h:181
fiff_int_t version
Definition fiff_id.h:179
static fiff_int_t fiff_type_matrix_coding(fiff_int_t type)
Definition fiff_tag.cpp:707
~FiffTag()=default
QString toString() const
Definition fiff_tag.h:622
qint16 * toShort() const
Definition fiff_tag.h:558
QSharedPointer< FiffTag > SPtr
Definition fiff_tag.h:156
Eigen::MatrixXf toFloatMatrix() const
Definition fiff_tag.h:880
quint32 * toUnsignedInt() const
Definition fiff_tag.h:568
fiff_int_t kind
Definition fiff_tag.h:510
FiffTag(FiffTag &&other)=default
std::unique_ptr< FiffTag > UPtr
Definition fiff_tag.h:158
FiffCoordTrans toCoordTrans() const
Definition fiff_tag.h:690
std::unique_ptr< const FiffTag > ConstUPtr
Definition fiff_tag.h:159
qint32 * toJulian() const
Definition fiff_tag.h:590
fiff_int_t getMatrixCoding() const
Definition fiff_tag.cpp:74
Eigen::MatrixXi toIntMatrix() const
Definition fiff_tag.h:857
quint16 * toUnsignedShort() const
Definition fiff_tag.h:548
FiffChInfo toChInfo() const
Definition fiff_tag.h:732
qint16 * toDauPack16() const
Definition fiff_tag.h:632
FiffDigPoint toDigPoint() const
Definition fiff_tag.h:665
qint32 * toInt() const
Definition fiff_tag.h:578
const double * toDouble() const
Definition fiff_tag.h:612
const float * toFloat() const
Definition fiff_tag.h:602
static void convert_tag_data(const FiffTag::UPtr &tag, int from_endian, int to_endian)
Definition fiff_tag.cpp:438
static void convert_matrix_to_file_data(const FiffTag::UPtr &tag)
Definition fiff_tag.cpp:362
FiffTag & operator=(FiffTag &&other)=default
QString getInfo() const
Definition fiff_tag.cpp:138
quint8 * toByte() const
Definition fiff_tag.h:538
bool isMatrix() const
Definition fiff_tag.cpp:81
fiff_int_t getType() const
Definition fiff_tag.cpp:124
Eigen::SparseMatrix< double > toSparseFloatMatrix() const
Definition fiff_tag.h:909
FiffId toFiffID() const
Definition fiff_tag.h:644
fiff_int_t type
Definition fiff_tag.h:512
static qint32 storageSize()
Definition fiff_tag.h:524
FiffTag & operator=(const FiffTag &other)=default
static void convert_matrix_from_file_data(const FiffTag::UPtr &tag)
Definition fiff_tag.cpp:288
fiff_int_t next
Definition fiff_tag.h:514
static void convert_ch_pos(FiffChPos *pos)
Definition fiff_tag.cpp:273
FiffTag(const FiffTag &p_FiffTag)=default
QSharedPointer< const FiffTag > ConstSPtr
Definition fiff_tag.h:157
bool getMatrixDimensions(qint32 &p_ndim, QVector< qint32 > &p_Dims) const
Definition fiff_tag.cpp:91
QList< QSharedPointer< FiffDirEntry > > toDirEntry() const
Definition fiff_tag.h:828