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 float* toFloat() const;
308
309 //=========================================================================================================
316 inline 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 printf("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 printf("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 float* FiffTag::toFloat() const
603{
604 if(this->isMatrix() || this->getType() != FIFFT_FLOAT)
605 return nullptr;
606 else
607 return (float*)this->data();
608}
609
610//=============================================================================================================
611
612inline double* FiffTag::toDouble() const
613{
614 if(this->isMatrix() || this->getType() != FIFFT_DOUBLE)
615 return nullptr;
616 else
617 return (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
642//inline std::complex<float>* FiffTag::toComplexFloat()
643//{
644// if(this->isMatrix() || this->getType() != FIFFT_COMPLEX_FLOAT)
645// return nullptr;
646// else if(this->m_pComplexFloatData == nullptr)
647// {
648// float* t_pFloat = (float*)this->data();
649// qDebug() << "ToDo toComplexFloat";
650// //ToDo check this for arrays which contains more than one value
651// this->m_pComplexFloatData = new std::complex<float>(t_pFloat[0],t_pFloat[1]);
652// }
653// return m_pComplexFloatData;
654//}
655
656//=============================================================================================================
657
658//inline std::complex<double>* FiffTag::toComplexDouble()
659//{
660// if(this->isMatrix() || this->getType() != FIFFT_COMPLEX_DOUBLE)
661// return nullptr;
662// else if(this->m_pComplexDoubleData == nullptr)
663// {
664// double* t_pDouble = (double*)this->data();
665// qDebug() << "ToDo toComplexDouble";
666// //ToDo check this for arrays which contains more than one value
667// this->m_pComplexDoubleData = new std::complex<double>(t_pDouble[0],t_pDouble[1]);
668// }
669// return m_pComplexDoubleData;
670//}
671
672//=============================================================================================================
673// Structures
674//=============================================================================================================
675
677{
678 FiffId p_fiffID;
679 if(this->isMatrix() || this->getType() != FIFFT_ID_STRUCT || this->data() == nullptr)
680 return p_fiffID;
681 else
682 {
683 const qint32* t_pInt32 = (qint32*)this->data();
684
685 p_fiffID.version = t_pInt32[0];
686 p_fiffID.machid[0] = t_pInt32[1];
687 p_fiffID.machid[1] = t_pInt32[2];
688 p_fiffID.time.secs = t_pInt32[3];
689 p_fiffID.time.usecs = t_pInt32[4];
690
691 return p_fiffID;
692 }
693}
694
695//=============================================================================================================
696
698{
699
700 FiffDigPoint t_fiffDigPoint;
701 if(this->isMatrix() || this->getType() != FIFFT_DIG_POINT_STRUCT || this->data() == nullptr)
702 return t_fiffDigPoint;
703 else
704 {
705 qint32* t_pInt32 = (qint32*)this->data();
706// memcpy (&t_fiffDigPoint,this->data,this->size);
707
708 t_fiffDigPoint.kind = t_pInt32[0];
709 t_fiffDigPoint.ident = t_pInt32[1];
710
711 float* t_pFloat = (float*)this->data();
712 t_fiffDigPoint.r[0] = t_pFloat[2];
713 t_fiffDigPoint.r[1] = t_pFloat[3];
714 t_fiffDigPoint.r[2] = t_pFloat[4];
715 t_fiffDigPoint.coord_frame = 0;
716
717 return t_fiffDigPoint;
718 }
719}
720
721//=============================================================================================================
722
724{
725
726 FiffCoordTrans p_FiffCoordTrans;
727 if(this->isMatrix() || this->getType() != FIFFT_COORD_TRANS_STRUCT || this->data() == nullptr)
728 return p_FiffCoordTrans;
729 else
730 {
731 qint32* t_pInt32 = (qint32*)this->data();
732 p_FiffCoordTrans.from = t_pInt32[0];
733 p_FiffCoordTrans.to = t_pInt32[1];
734
735 p_FiffCoordTrans.trans.setIdentity(4,4);
736 float* t_pFloat = (float*)this->data();
737 int count = 0;
738 int r, c;
739 for (r = 0; r < 3; ++r) {
740 p_FiffCoordTrans.trans(r,3) = t_pFloat[11+r];
741 for (c = 0; c < 3; ++c) {
742 p_FiffCoordTrans.trans(r,c) = t_pFloat[2+count];
743 ++count;
744 }
745 }
746
747 p_FiffCoordTrans.invtrans.setIdentity(4,4);
748 count = 0;
749 for (r = 0; r < 3; ++r) {
750 p_FiffCoordTrans.invtrans(r,3) = t_pFloat[23+r];
751 for (c = 0; c < 3; ++c) {
752 p_FiffCoordTrans.invtrans(r,c) = t_pFloat[14+count];
753 ++count;
754 }
755 }
756
757 return p_FiffCoordTrans;
758 }
759}
760
761//=========================================================================================================
766{
767 FiffChInfo p_FiffChInfo;
768
769 if(this->isMatrix() || this->getType() != FIFFT_CH_INFO_STRUCT || this->data() == nullptr)
770 return p_FiffChInfo;
771 else
772 {
773 qint32* t_pInt32 = (qint32*)this->data();
774 p_FiffChInfo.scanNo = t_pInt32[0];
775 p_FiffChInfo.logNo = t_pInt32[1];
776 p_FiffChInfo.kind = t_pInt32[2];
777 float* t_pFloat = (float*)this->data();
778 p_FiffChInfo.range = t_pFloat[3];
779 p_FiffChInfo.cal = t_pFloat[4];
780
781 p_FiffChInfo.chpos.coil_type = t_pInt32[5];
782
783 //
784 // Read the coil coordinate system definition
785 //
786 qint32 r;
787 // r0
788 for (r = 0; r < 3; ++r)
789 p_FiffChInfo.chpos.r0[r] = t_pFloat[6+r];
790 // ex
791 for (r = 0; r < 3; ++r)
792 p_FiffChInfo.chpos.ex[r] = t_pFloat[6+3+r];
793 // ey
794 for (r = 0; r < 3; ++r)
795 p_FiffChInfo.chpos.ey[r] = t_pFloat[6+6+r];
796 // ez
797 for (r = 0; r < 3; ++r)
798 p_FiffChInfo.chpos.ez[r] = t_pFloat[6+9+r];
799
800 p_FiffChInfo.coord_frame = FIFFV_COORD_UNKNOWN;
801
802 //
803 // Convert loc into a more useful format
804 //
805 if (p_FiffChInfo.kind == FIFFV_MEG_CH || p_FiffChInfo.kind == FIFFV_REF_MEG_CH)
806 {
807 p_FiffChInfo.coil_trans.setIdentity(4,4);
808 // r0
809 for (r = 0; r < 3; ++r)
810 p_FiffChInfo.coil_trans(r,3) = p_FiffChInfo.chpos.r0[r];
811 // ex
812 for (r = 0; r < 3; ++r)
813 p_FiffChInfo.coil_trans(r,0) = p_FiffChInfo.chpos.ex[r];
814 // ey
815 for (r = 0; r < 3; ++r)
816 p_FiffChInfo.coil_trans(r,1) = p_FiffChInfo.chpos.ey[r];
817 // ez
818 for (r = 0; r < 3; ++r)
819 p_FiffChInfo.coil_trans(r,2) = p_FiffChInfo.chpos.ez[r];
820
821 p_FiffChInfo.coord_frame = FIFFV_COORD_DEVICE;
822 }
823 else if (p_FiffChInfo.kind == FIFFV_EEG_CH)
824 {
825 if (p_FiffChInfo.chpos.ex.norm() > 0) {
826 p_FiffChInfo.eeg_loc.block(0,0,3,1) = p_FiffChInfo.chpos.r0.block(0,0,3,1);
827 p_FiffChInfo.eeg_loc.block(0,1,3,1) = p_FiffChInfo.chpos.ex.block(0,0,3,1);
828 }
829 else {
830 p_FiffChInfo.eeg_loc.block(0,0,3,1) = p_FiffChInfo.chpos.r0.block(0,0,3,1);
831 }
832 p_FiffChInfo.coord_frame = FIFFV_COORD_HEAD;
833 }
834 //
835 // Unit and exponent
836 //
837 p_FiffChInfo.unit = t_pInt32[18];
838 p_FiffChInfo.unit_mul = t_pInt32[19];
839
840 //
841 // Handle the channel name
842 //
843 const char* orig = static_cast<const char*>(this->data());
844 p_FiffChInfo.ch_name = QString::fromUtf8(orig + 80).replace(" ","");
845
846 return p_FiffChInfo;
847 }
848}
849
850// //=========================================================================================================
851// /**
852// * to fiff OLD PACK
853// */
854// inline fiff_coord_trans_t toCoordTrans() const
855// {
856
857// }
858
859//=============================================================================================================
860
861inline QList< QSharedPointer<FiffDirEntry> > FiffTag::toDirEntry() const
862{
863// tag.data = struct('kind',{},'type',{},'size',{},'pos',{});
864 QList< QSharedPointer<FiffDirEntry> > p_ListFiffDir;
865 if(this->isMatrix() || this->getType() != FIFFT_DIR_ENTRY_STRUCT || this->data() == nullptr)
866 return p_ListFiffDir;
867 else
868 {
869 QSharedPointer<FiffDirEntry> t_pFiffDirEntry;
870 qint32* t_pInt32 = (qint32*)this->data();
871 for (int k = 0; k < this->size()/16; ++k)
872 {
873 t_pFiffDirEntry = QSharedPointer<FiffDirEntry>(new FiffDirEntry);
874 t_pFiffDirEntry->kind = t_pInt32[k*4];//fread(fid,1,'int32');
875 t_pFiffDirEntry->type = t_pInt32[k*4+1];//fread(fid,1,'uint32');
876 t_pFiffDirEntry->size = t_pInt32[k*4+2];//fread(fid,1,'int32');
877 t_pFiffDirEntry->pos = t_pInt32[k*4+3];//fread(fid,1,'int32');
878 p_ListFiffDir.append(t_pFiffDirEntry);
879 }
880 }
881 return p_ListFiffDir;
882}
883
884//=============================================================================================================
885// MATRIX
886//=============================================================================================================
887
888//=============================================================================================================
889
890inline Eigen::MatrixXi FiffTag::toIntMatrix() const
891{
892 if(!this->isMatrix() || this->getType() != FIFFT_INT || this->data() == nullptr)
893 return Eigen::MatrixXi();
894
895 qint32 ndim;
896 QVector<qint32> dims;
897 this->getMatrixDimensions(ndim, dims);
898
899 if (ndim != 2)
900 {
901 printf("Only two-dimensional matrices are supported at this time");
902 return Eigen::MatrixXi();
903 }
904
905 //MatrixXd p_Matrix = Map<MatrixXd>( (float*)this->data,p_dims[0], p_dims[1]);
906 // --> Use copy constructor instead --> slower performance but higher memory management reliability
907 Eigen::MatrixXi p_Matrix(Eigen::Map<Eigen::MatrixXi>( (int*)this->data(),dims[0], dims[1]));
908
909 return p_Matrix;
910}
911
912//=============================================================================================================
913
914inline Eigen::MatrixXf FiffTag::toFloatMatrix() const
915{
916 if(!this->isMatrix() || this->getType() != FIFFT_FLOAT || this->data() == nullptr)
917 return Eigen::MatrixXf();//NULL;
918
920 {
921 printf("Error in FiffTag::toFloatMatrix(): Matrix is not dense!\n");
922 return Eigen::MatrixXf();//NULL;
923 }
924
925 qint32 ndim;
926 QVector<qint32> dims;
927 this->getMatrixDimensions(ndim, dims);
928
929 if (ndim != 2)
930 {
931 printf("Only two-dimensional matrices are supported at this time");
932 return Eigen::MatrixXf();//NULL;
933 }
934
935 // --> Use copy constructor instead --> slower performance but higher memory management reliability
936 Eigen::MatrixXf p_Matrix((Eigen::Map<Eigen::MatrixXf>( (float*)this->data(),dims[0], dims[1])));
937
938 return p_Matrix;
939}
940
941//=============================================================================================================
942
943inline Eigen::SparseMatrix<double> FiffTag::toSparseFloatMatrix() const
944{
945 if(!this->isMatrix() || this->getType() != FIFFT_FLOAT || this->data() == nullptr)
946 return Eigen::SparseMatrix<double>();//NULL;
947
949 {
950 printf("Error in FiffTag::toSparseFloatMatrix(): Matrix is not sparse!\n");
951 return Eigen::SparseMatrix<double>();//NULL;
952 }
953
954 qint32 ndim;
955 QVector<qint32> dims;
956 this->getMatrixDimensions(ndim, dims);
957
958 if (ndim != 2)
959 {
960 printf("Only two-dimensional matrices are supported at this time");
961 return Eigen::SparseMatrix<double>();//NULL;
962 }
963
964 qint32 nnz = dims[0];
965 qint32 nrow = dims[1];
966 qint32 ncol = dims[2];
967
968 using T = Eigen::Triplet<double>;
969 std::vector<T> tripletList;
970 tripletList.reserve(nnz);
971
972 float *t_pFloat = (float*)this->data();
973 int *t_pInt = (int*)this->data();
974 qint32 offset1 = nnz;
975 qint32 offset2 = 2*nnz;
977 {
978 //
979 // CCS
980 //
981 qWarning("Warning in FiffTag::toSparseFloatMatrix(): CCS has to be debugged - never done before.");
982 qint32 p = 0;
983 for(qint32 j = 0; j < ncol; ++j)
984 {
985 while( p < t_pInt[offset2+j+1])
986 {
987// tripletList[p] = T(tripletList[p].row(), j, tripletList[p].value());
988 tripletList.push_back(T(t_pInt[offset1+p], j, static_cast<double>(t_pFloat[p])));
989 ++p;
990 }
991 }
992 }
993 else
994 {
995 //
996 // RCS
997 //
998 qint32 p = 0;
999 for(qint32 j = 0; j < nrow; ++j)
1000 {
1001 while( p < t_pInt[offset2+j+1])
1002 {
1003// tripletList[p] = T(j, tripletList[p].col(), tripletList[p].value());
1004 tripletList.push_back(T(j, t_pInt[offset1+p], static_cast<double>(t_pFloat[p])));
1005 ++p;
1006 }
1007 }
1008 }
1009
1010// std::cout << "Size: " << tripletList.size() << std::endl;
1011// qint32 offsetTest = tripletList.size() - 10;
1012// for(qint32 i = 0; i < 10; ++i)
1013// std::cout << std::endl << tripletList[offsetTest + i].row() << " " << tripletList[offsetTest + i].col() << " " << tripletList[offsetTest + i].value();
1014
1015 Eigen::SparseMatrix<double> p_Matrix(nrow, ncol);
1016 p_Matrix.setFromTriplets(tripletList.begin(), tripletList.end());
1017
1018 return p_Matrix;
1019}
1020} // NAMESPACE
1021
1022#endif // FIFF_TAG_H
FiffChPos class declaration.
Fiff library export/import macros.
#define FIFFSHARED_EXPORT
Definition fiff_global.h:52
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
FiffDirEntry 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)
FiffChInfo class declaration.
FiffId class declaration.
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
Old fiff_type declarations - replace them.
FiffCoordTrans class declaration.
FiffDigPoint 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:914
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:723
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:890
quint16 * toUnsignedShort() const
Definition fiff_tag.h:548
FiffChInfo toChInfo() const
Definition fiff_tag.h:765
qint16 * toDauPack16() const
Definition fiff_tag.h:632
FiffDigPoint toDigPoint() const
Definition fiff_tag.h:697
qint32 * toInt() const
Definition fiff_tag.h:578
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
double * toDouble() const
Definition fiff_tag.h:612
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:943
FiffId toFiffID() const
Definition fiff_tag.h:676
fiff_int_t type
Definition fiff_tag.h:512
static qint32 storageSize()
Definition fiff_tag.h:524
FiffTag & operator=(const FiffTag &other)=default
float * toFloat() const
Definition fiff_tag.h:602
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:861