v2.0.0
Loading...
Searching...
No Matches
fiff_tag.h
Go to the documentation of this file.
1//=============================================================================================================
35
36#ifndef FIFF_TAG_H
37#define FIFF_TAG_H
38
39//=============================================================================================================
40// DEFINES
41//=============================================================================================================
42
43/* NOTE:
44 The architecture is now deduced from the operating system, which is
45 a bit stupid way, since the same operating system can me run on various
46 architectures. This may need revision later on. */
47
48#if defined(DARWIN)
49
50#if defined(__LITTLE_ENDIAN__)
51#define INTEL_X86_ARCH
52#else
53#define BIG_ENDIAN_ARCH
54#endif
55
56#else
57
58#if defined(__hpux) || defined(__Lynx__) || defined(__sun)
59#define BIG_ENDIAN_ARCH
60#else
61#if defined(__linux) || defined(WIN32) || defined(__APPLE__)
62#define INTEL_X86_ARCH
63#endif
64
65#endif
66#endif
67
68#define NATIVE_ENDIAN FIFFV_LITTLE_ENDIAN
69
70#ifdef INTEL_X86_ARCH
71#define NATIVE_ENDIAN FIFFV_LITTLE_ENDIAN
72#endif
73
74#ifdef BIG_ENDIAN_ARCH
75#define NATIVE_ENDIAN FIFFV_BIG_ENDIAN
76#endif
77
78//=============================================================================================================
79// INCLUDES
80//=============================================================================================================
81
82#include "fiff_global.h"
83#include "fiff_constants.h"
84#include "fiff_file.h"
85#include "fiff_types.h"
86#include "fiff_id.h"
87#include "fiff_coord_trans.h"
88#include "fiff_ch_info.h"
89#include "fiff_ch_pos.h"
90#include "fiff_dir_entry.h"
91#include "fiff_dig_point.h"
92
93//=============================================================================================================
94// EIGEN INCLUDES
95//=============================================================================================================
96
97#include <Eigen/Core>
98#include <Eigen/SparseCore>
99
100//=============================================================================================================
101// QT INCLUDES
102//=============================================================================================================
103
104#include <QDebug>
105#include <QByteArray>
106#include <QList>
107#include <QSharedPointer>
108#include <QVector>
109
110//=============================================================================================================
111// STL INCLUDES
112//=============================================================================================================
113
114#include <iostream>
115#include <memory>
116
117//=============================================================================================================
118// DEFINE NAMESPACE FIFFLIB
119//=============================================================================================================
120
121namespace FIFFLIB
122{
123
124class FiffStream;
125class FiffDirNode;
126
127//=============================================================================================================
128// FORWARD DECLARATIONS
129//=============================================================================================================
130//
131// The magic hexadecimal values
132//
133#define IS_MATRIX 0xFFFF0000
134#define MATRIX_CODING_DENSE 0x00004000
135#define MATRIX_CODING_CCS 0x00004010
136#define MATRIX_CODING_RCS 0x00004020
137#define DATA_TYPE 0x0000FFFF
138
139//const fiff_int_t IS_MATRIX = 4294901760; /**< Is Matrix encoding. ffff0000. */
140//const fiff_int_t MATRIX_CODING_DENSE = 16384; /**< MATRIX_CODING_DENSE encoding. 4000. */
141//const fiff_int_t MATRIX_CODING_CCS = 16400; /**< MATRIX_CODING_CCS encoding. 4010. */
142//const fiff_int_t MATRIX_CODING_RCS = 16416; /**< MATRIX_CODING_RCS encoding. 4020. */
143//const fiff_int_t DATA_TYPE = 65535; /**< DATA_TYPE encoding. ffff. */
144
145//=============================================================================================================
160class FIFFSHARED_EXPORT FiffTag : public QByteArray
161{
162public:
163 using SPtr = QSharedPointer<FiffTag>;
164 using ConstSPtr = QSharedPointer<const FiffTag>;
165 using UPtr = std::unique_ptr<FiffTag>;
166 using ConstUPtr = std::unique_ptr<const FiffTag>;
167
168 //=========================================================================================================
172 FiffTag();
173
174 //=========================================================================================================
180 FiffTag(const FiffTag& p_FiffTag) = default;
181
182 //=========================================================================================================
188 FiffTag(FiffTag&& other) = default;
189
190 //=========================================================================================================
198 FiffTag& operator=(const FiffTag& other) = default;
199
200 //=========================================================================================================
208 FiffTag& operator=(FiffTag&& other) = default;
209
210 //=========================================================================================================
214 ~FiffTag() = default;
215
216 //=========================================================================================================
223
224 //=========================================================================================================
230 bool isMatrix() const;
231
232 //=========================================================================================================
242 bool getMatrixDimensions(qint32& p_ndim, QVector<qint32>& p_Dims) const;
243
244 //=========================================================================================================
250 fiff_int_t getType() const;
251
252 //=========================================================================================================
258 QString getInfo() const;
259
260 //
261 // Simple types
262 //
263 //=========================================================================================================
270 inline quint8* toByte() const;
271
272 //=========================================================================================================
279 inline quint16* toUnsignedShort() const;
280
281 //=========================================================================================================
288 inline qint16* toShort() const;
289
290 //=========================================================================================================
297 inline quint32* toUnsignedInt() const;
298
299 //=========================================================================================================
306 inline qint32* toInt() const;
307
308 //=========================================================================================================
315 inline qint32* toJulian() const;
316
317 //=========================================================================================================
324 inline const float* toFloat() const;
325
326 //=========================================================================================================
333 inline const double* toDouble() const;
334
335 //=========================================================================================================
341 inline QString toString() const;
342
343 //=========================================================================================================
350 inline qint16* toDauPack16() const;
351
352 //
353 // Structures
354 //
355 //=========================================================================================================
361 inline FiffId toFiffID() const;
362
363 //=========================================================================================================
369 inline FiffDigPoint toDigPoint() const;
370
371 //=========================================================================================================
377 inline FiffCoordTrans toCoordTrans() const;
378
379 //=========================================================================================================
385 inline FiffChInfo toChInfo() const;
386
387 // //=========================================================================================================
388 // /**
389 // * to fiff OLD PACK
390 // */
391 // inline fiff_coord_trans_t toCoordTrans() const;
392
393 //=========================================================================================================
399 inline QList<QSharedPointer<FiffDirEntry>> toDirEntry() const;
400
401 //
402 // MATRIX
403 //
404 //=========================================================================================================
410 inline Eigen::MatrixXi toIntMatrix() const;
411
412 //=========================================================================================================
420 inline Eigen::MatrixXf toFloatMatrix() const;
421
422 //=========================================================================================================
430 inline Eigen::SparseMatrix<double> toSparseFloatMatrix() const;
431
432 //
433 //from fiff_combat.c
434 //
435
436 //=========================================================================================================
442 static void convert_ch_pos(FiffChPos* pos);
443
444 /*
445 * Data type conversions for the little endian systems.
446 */
457 static void convert_matrix_from_file_data(const FiffTag::UPtr& tag);
458
459 //=========================================================================================================
465 static void convert_matrix_to_file_data(const FiffTag::UPtr& tag);
466
467 //
468 // Data type conversions for the little endian systems.
469 //
470 //=========================================================================================================
484 static void convert_tag_data(const FiffTag::UPtr& tag, int from_endian, int to_endian);
485
486 //
487 // from fiff_type_spec.c
488 //
489 //=========================================================================================================
498
499 //=========================================================================================================
508
509 //=========================================================================================================
518
519 //=========================================================================================================
526 inline static qint32 storageSize();
527
528public:
537};
538
539//=============================================================================================================
540// INLINE DEFINITIONS
541//=============================================================================================================
542
543inline qint32 FiffTag::storageSize()
544{
545 // On-disk layout: kind, type, size, next (4 x fiff_int_t)
546 // Note: 'size' is not a class member (QByteArray::size() is used at runtime),
547 // but it is part of the on-disk wire format.
548 return sizeof(FiffTag::kind) + sizeof(FiffTag::type) + sizeof(fiff_int_t) /* size field on disk */
549 + sizeof(FiffTag::next);
550}
551
552//=============================================================================================================
553// Simple types
554//=============================================================================================================
555
556inline quint8* FiffTag::toByte() const
557{
558 if (this->isMatrix() || this->getType() != FIFFT_BYTE)
559 return nullptr;
560 else
561 return (quint8*)this->data();
562}
563
564//=============================================================================================================
565
566inline quint16* FiffTag::toUnsignedShort() const
567{
568 if (this->isMatrix() || this->getType() != FIFFT_USHORT)
569 return nullptr;
570 else
571 return (quint16*)this->data();
572}
573
574//=============================================================================================================
575
576inline qint16* FiffTag::toShort() const
577{
578 if (this->isMatrix() || this->getType() != FIFFT_SHORT)
579 return nullptr;
580 else
581 return (qint16*)this->data();
582}
583
584//=============================================================================================================
585
586inline quint32* FiffTag::toUnsignedInt() const
587{
588 if (this->isMatrix() || this->getType() != FIFFT_UINT)
589 return nullptr;
590 else
591 return (quint32*)this->data();
592}
593
594//=============================================================================================================
595
596inline qint32* FiffTag::toInt() const
597{
598 if (this->isMatrix() || this->getType() != FIFFT_INT) {
599 qWarning("Expected an integer tag : %d (found data type %d instead)\n", this->kind, this->getType());
600 return nullptr;
601 } else
602 return (qint32*)this->data();
603}
604
605//=============================================================================================================
606
607inline qint32* FiffTag::toJulian() const
608{
609 if (this->isMatrix() || this->getType() != FIFFT_JULIAN) {
610 qWarning("Expected a julian tag : %d (found data type %d instead)\n", this->kind, this->getType());
611 return nullptr;
612 } else
613 return (qint32*)this->data();
614}
615
616//=============================================================================================================
617
618inline const float* FiffTag::toFloat() const
619{
620 if (this->isMatrix() || this->getType() != FIFFT_FLOAT)
621 return nullptr;
622 else
623 return reinterpret_cast<const float*>(this->data());
624}
625
626//=============================================================================================================
627
628inline const double* FiffTag::toDouble() const
629{
630 if (this->isMatrix() || this->getType() != FIFFT_DOUBLE)
631 return nullptr;
632 else
633 return reinterpret_cast<const double*>(this->data());
634}
635
636//=============================================================================================================
637
638inline QString FiffTag::toString() const
639{
640 if (this->isMatrix() || this->getType() != FIFFT_STRING)
641 return nullptr;
642 else
643 return *this;
644}
645
646//=============================================================================================================
647
648inline qint16* FiffTag::toDauPack16() const
649{
650 if (this->isMatrix() || this->getType() != FIFFT_DAU_PACK16)
651 return nullptr;
652 else
653 return (qint16*)this->data();
654}
655
656//=============================================================================================================
657// Structures
658//=============================================================================================================
659
661{
662 FiffId p_fiffID;
663 if (this->isMatrix() || this->getType() != FIFFT_ID_STRUCT || this->data() == nullptr)
664 return p_fiffID;
665 else {
666 const qint32* t_pInt32 = (qint32*)this->data();
667
668 p_fiffID.version = t_pInt32[0];
669 p_fiffID.machid[0] = t_pInt32[1];
670 p_fiffID.machid[1] = t_pInt32[2];
671 p_fiffID.time.secs = t_pInt32[3];
672 p_fiffID.time.usecs = t_pInt32[4];
673
674 return p_fiffID;
675 }
676}
677
678//=============================================================================================================
679
681{
682 FiffDigPoint t_fiffDigPoint;
683 if (this->isMatrix() || this->getType() != FIFFT_DIG_POINT_STRUCT || this->data() == nullptr)
684 return t_fiffDigPoint;
685 else {
686 auto* t_pInt32 = reinterpret_cast<const qint32*>(this->data());
687
688 t_fiffDigPoint.kind = t_pInt32[0];
689 t_fiffDigPoint.ident = t_pInt32[1];
690
691 auto* t_pFloat = reinterpret_cast<const float*>(this->data());
692 t_fiffDigPoint.r[0] = t_pFloat[2];
693 t_fiffDigPoint.r[1] = t_pFloat[3];
694 t_fiffDigPoint.r[2] = t_pFloat[4];
695 t_fiffDigPoint.coord_frame = 0;
696
697 return t_fiffDigPoint;
698 }
699}
700
701//=============================================================================================================
702
704{
705 FiffCoordTrans p_FiffCoordTrans;
706 if (this->isMatrix() || this->getType() != FIFFT_COORD_TRANS_STRUCT || this->data() == nullptr)
707 return p_FiffCoordTrans;
708 else {
709 auto* t_pInt32 = reinterpret_cast<const qint32*>(this->data());
710 p_FiffCoordTrans.from = t_pInt32[0];
711 p_FiffCoordTrans.to = t_pInt32[1];
712
713 p_FiffCoordTrans.trans.setIdentity(4, 4);
714 auto* t_pFloat = reinterpret_cast<const float*>(this->data());
715 int count = 0;
716 int r, c;
717 for (r = 0; r < 3; ++r) {
718 p_FiffCoordTrans.trans(r, 3) = t_pFloat[11 + r];
719 for (c = 0; c < 3; ++c) {
720 p_FiffCoordTrans.trans(r, c) = t_pFloat[2 + count];
721 ++count;
722 }
723 }
724
725 p_FiffCoordTrans.invtrans.setIdentity(4, 4);
726 count = 0;
727 for (r = 0; r < 3; ++r) {
728 p_FiffCoordTrans.invtrans(r, 3) = t_pFloat[23 + r];
729 for (c = 0; c < 3; ++c) {
730 p_FiffCoordTrans.invtrans(r, c) = t_pFloat[14 + count];
731 ++count;
732 }
733 }
734
735 return p_FiffCoordTrans;
736 }
737}
738
739//=========================================================================================================
744{
745 FiffChInfo p_FiffChInfo;
746
747 if (this->isMatrix() || this->getType() != FIFFT_CH_INFO_STRUCT || this->data() == nullptr)
748 return p_FiffChInfo;
749 else {
750 auto* t_pInt32 = reinterpret_cast<const qint32*>(this->data());
751 p_FiffChInfo.scanNo = t_pInt32[0];
752 p_FiffChInfo.logNo = t_pInt32[1];
753 p_FiffChInfo.kind = t_pInt32[2];
754 auto* t_pFloat = reinterpret_cast<const float*>(this->data());
755 p_FiffChInfo.range = t_pFloat[3];
756 p_FiffChInfo.cal = t_pFloat[4];
757
758 p_FiffChInfo.chpos.coil_type = t_pInt32[5];
759
760 //
761 // Read the coil coordinate system definition
762 //
763 qint32 r;
764 // r0
765 for (r = 0; r < 3; ++r)
766 p_FiffChInfo.chpos.r0[r] = t_pFloat[6 + r];
767 // ex
768 for (r = 0; r < 3; ++r)
769 p_FiffChInfo.chpos.ex[r] = t_pFloat[6 + 3 + r];
770 // ey
771 for (r = 0; r < 3; ++r)
772 p_FiffChInfo.chpos.ey[r] = t_pFloat[6 + 6 + r];
773 // ez
774 for (r = 0; r < 3; ++r)
775 p_FiffChInfo.chpos.ez[r] = t_pFloat[6 + 9 + r];
776
777 p_FiffChInfo.coord_frame = FIFFV_COORD_UNKNOWN;
778
779 //
780 // Convert loc into a more useful format
781 //
782 if (p_FiffChInfo.kind == FIFFV_MEG_CH || p_FiffChInfo.kind == FIFFV_REF_MEG_CH) {
783 p_FiffChInfo.coil_trans.setIdentity(4, 4);
784 // r0
785 for (r = 0; r < 3; ++r)
786 p_FiffChInfo.coil_trans(r, 3) = p_FiffChInfo.chpos.r0[r];
787 // ex
788 for (r = 0; r < 3; ++r)
789 p_FiffChInfo.coil_trans(r, 0) = p_FiffChInfo.chpos.ex[r];
790 // ey
791 for (r = 0; r < 3; ++r)
792 p_FiffChInfo.coil_trans(r, 1) = p_FiffChInfo.chpos.ey[r];
793 // ez
794 for (r = 0; r < 3; ++r)
795 p_FiffChInfo.coil_trans(r, 2) = p_FiffChInfo.chpos.ez[r];
796
797 p_FiffChInfo.coord_frame = FIFFV_COORD_DEVICE;
798 } else if (p_FiffChInfo.kind == FIFFV_EEG_CH) {
799 if (p_FiffChInfo.chpos.ex.norm() > 0) {
800 p_FiffChInfo.eeg_loc.block(0, 0, 3, 1) = p_FiffChInfo.chpos.r0.block(0, 0, 3, 1);
801 p_FiffChInfo.eeg_loc.block(0, 1, 3, 1) = p_FiffChInfo.chpos.ex.block(0, 0, 3, 1);
802 } else {
803 p_FiffChInfo.eeg_loc.block(0, 0, 3, 1) = p_FiffChInfo.chpos.r0.block(0, 0, 3, 1);
804 }
805 p_FiffChInfo.coord_frame = FIFFV_COORD_HEAD;
806 }
807 //
808 // Unit and exponent
809 //
810 p_FiffChInfo.unit = t_pInt32[18];
811 p_FiffChInfo.unit_mul = t_pInt32[19];
812
813 //
814 // Handle the channel name
815 //
816 const char* orig = static_cast<const char*>(this->data());
817 p_FiffChInfo.ch_name = QString::fromUtf8(orig + 80).replace(" ", "");
818
819 return p_FiffChInfo;
820 }
821}
822
823// //=========================================================================================================
824// /**
825// * to fiff OLD PACK
826// */
827// inline fiff_coord_trans_t toCoordTrans() const
828// {
829
830// }
831
832//=============================================================================================================
833
834inline QList<QSharedPointer<FiffDirEntry>> FiffTag::toDirEntry() const
835{
836 // tag.data = struct('kind',{},'type',{},'size',{},'pos',{});
837 QList<QSharedPointer<FiffDirEntry>> p_ListFiffDir;
838 if (this->isMatrix() || this->getType() != FIFFT_DIR_ENTRY_STRUCT || this->data() == nullptr)
839 return p_ListFiffDir;
840 else {
841 QSharedPointer<FiffDirEntry> t_pFiffDirEntry;
842 qint32* t_pInt32 = (qint32*)this->data();
843 for (int k = 0; k < this->size() / 16; ++k) {
844 t_pFiffDirEntry = QSharedPointer<FiffDirEntry>(new FiffDirEntry);
845 t_pFiffDirEntry->kind = t_pInt32[k * 4]; //fread(fid,1,'int32');
846 t_pFiffDirEntry->type = t_pInt32[k * 4 + 1]; //fread(fid,1,'uint32');
847 t_pFiffDirEntry->size = t_pInt32[k * 4 + 2]; //fread(fid,1,'int32');
848 t_pFiffDirEntry->pos = t_pInt32[k * 4 + 3]; //fread(fid,1,'int32');
849 p_ListFiffDir.append(t_pFiffDirEntry);
850 }
851 }
852 return p_ListFiffDir;
853}
854
855//=============================================================================================================
856// MATRIX
857//=============================================================================================================
858
859//=============================================================================================================
860
861inline Eigen::MatrixXi FiffTag::toIntMatrix() const
862{
863 if (!this->isMatrix() || this->getType() != FIFFT_INT || this->data() == nullptr)
864 return Eigen::MatrixXi();
865
866 qint32 ndim;
867 QVector<qint32> dims;
868 this->getMatrixDimensions(ndim, dims);
869
870 if (ndim != 2) {
871 qWarning("Only two-dimensional matrices are supported at this time");
872 return Eigen::MatrixXi();
873 }
874
875 // Use copy constructor instead --> slower performance but higher memory management reliability
876 Eigen::MatrixXi p_Matrix(Eigen::Map<const Eigen::MatrixXi>(reinterpret_cast<const int*>(this->data()), dims[0], dims[1]));
877
878 return p_Matrix;
879}
880
881//=============================================================================================================
882
883inline Eigen::MatrixXf FiffTag::toFloatMatrix() const
884{
885 if (!this->isMatrix() || this->getType() != FIFFT_FLOAT || this->data() == nullptr)
886 return Eigen::MatrixXf(); //NULL;
887
889 qWarning("Error in FiffTag::toFloatMatrix(): Matrix is not dense!");
890 return Eigen::MatrixXf();
891 }
892
893 qint32 ndim;
894 QVector<qint32> dims;
895 this->getMatrixDimensions(ndim, dims);
896
897 if (ndim != 2) {
898 qWarning("Only two-dimensional matrices are supported at this time");
899 return Eigen::MatrixXf();
900 }
901
902 // Use copy constructor instead --> slower performance but higher memory management reliability
903 Eigen::MatrixXf p_Matrix(Eigen::Map<const Eigen::MatrixXf>(reinterpret_cast<const float*>(this->data()), dims[0], dims[1]));
904
905 return p_Matrix;
906}
907
908//=============================================================================================================
909
910inline Eigen::SparseMatrix<double> FiffTag::toSparseFloatMatrix() const
911{
912 if (!this->isMatrix() || this->getType() != FIFFT_FLOAT || this->data() == nullptr)
913 return Eigen::SparseMatrix<double>(); //NULL;
914
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 qWarning("Only two-dimensional matrices are supported at this time");
926 return Eigen::SparseMatrix<double>();
927 }
928
929 qint32 nnz = dims[0];
930 qint32 nrow = dims[1];
931 qint32 ncol = dims[2];
932
933 using T = Eigen::Triplet<double>;
934 std::vector<T> tripletList;
935 tripletList.reserve(nnz);
936
937 auto* t_pFloat = reinterpret_cast<const float*>(this->data());
938 auto* t_pInt = reinterpret_cast<const int*>(this->data());
939 qint32 offset1 = nnz;
940 qint32 offset2 = 2 * nnz;
942 //
943 // CCS
944 //
945 qWarning("Warning in FiffTag::toSparseFloatMatrix(): CCS has to be debugged - never done before.");
946 qint32 p = 0;
947 for (qint32 j = 0; j < ncol; ++j) {
948 while (p < t_pInt[offset2 + j + 1]) {
949 // tripletList[p] = T(tripletList[p].row(), j, tripletList[p].value());
950 tripletList.push_back(T(t_pInt[offset1 + p], j, static_cast<double>(t_pFloat[p])));
951 ++p;
952 }
953 }
954 } else {
955 //
956 // RCS
957 //
958 qint32 p = 0;
959 for (qint32 j = 0; j < nrow; ++j) {
960 while (p < t_pInt[offset2 + j + 1]) {
961 // tripletList[p] = T(j, tripletList[p].col(), tripletList[p].value());
962 tripletList.push_back(T(j, t_pInt[offset1 + p], static_cast<double>(t_pFloat[p])));
963 ++p;
964 }
965 }
966 }
967
968 // std::cout << "Size: " << tripletList.size() << std::endl;
969 // qint32 offsetTest = tripletList.size() - 10;
970 // for(qint32 i = 0; i < 10; ++i)
971 // std::cout << std::endl << tripletList[offsetTest + i].row() << " " << tripletList[offsetTest + i].col() << " " << tripletList[offsetTest + i].value();
972
973 Eigen::SparseMatrix<double> p_Matrix(nrow, ncol);
974 p_Matrix.setFromTriplets(tripletList.begin(), tripletList.end());
975
976 return p_Matrix;
977}
978} // NAMESPACE
979
980#endif // FIFF_TAG_H
FIFF channel descriptor record (FIFF_CH_INFO): per-channel logical/scanner numbers,...
Symbolic FIFF tag, block, value, unit and channel-type constants shared across FIFFLIB.
#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
4x4 affine FIFF coordinate transform (FIFF_COORD_TRANS) annotated with source/destination coordinate-...
FIFF tag-kind, block-kind and type-code numerical definitions, authoritative for FIFFLIB.
#define FIFFT_ID_STRUCT
Definition fiff_file.h:241
#define FIFFTS_MC_RCS
Definition fiff_file.h:263
#define FIFFT_CH_INFO_STRUCT
Definition fiff_file.h:240
#define FIFFT_UINT
Definition fiff_file.h:229
#define FIFFT_INT
Definition fiff_file.h:224
#define FIFFT_SHORT
Definition fiff_file.h:223
#define FIFFT_BYTE
Definition fiff_file.h:222
#define FIFFT_DAU_PACK16
Definition fiff_file.h:236
#define FIFFTS_MC_CCS
Definition fiff_file.h:262
#define FIFFT_DOUBLE
Definition fiff_file.h:226
#define FIFFT_USHORT
Definition fiff_file.h:228
#define FIFFT_JULIAN
Definition fiff_file.h:227
#define FIFFT_FLOAT
Definition fiff_file.h:225
#define FIFFT_STRING
Definition fiff_file.h:231
#define FIFFTS_MC_DENSE
Definition fiff_file.h:261
#define FIFFT_DIR_ENTRY_STRUCT
Definition fiff_file.h:242
#define FIFFT_COORD_TRANS_STRUCT
Definition fiff_file.h:245
#define FIFFT_DIG_POINT_STRUCT
Definition fiff_file.h:243
Export/import macros and build-info accessors for the FIFFLIB shared library.
#define FIFFSHARED_EXPORT
Definition fiff_global.h:44
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)
Coil-frame position record embedded inside FIFF_CH_INFO: coil location and 3x3 EX/EY/EZ orientation t...
Single entry of the FIFF tag directory: kind, type, byte size and absolute file position.
Single digitization point (FIFF_DIG_POINT) with kind (cardinal/HPI/EEG/extra), identifier and 3D coor...
128-bit FIFF identifier record (machine ID + creation time) used to stamp files, blocks and parent re...
Primitive scalar typedefs and forward-compatible aliases backing the FIFF type system.
FIFF file I/O, in-memory data structures and high-level readers/writers.
qint32 fiff_int_t
Definition fiff_types.h:86
Per-channel FIFF descriptor: identifiers, kind, calibration, coil type, channel-frame coil position a...
Eigen::Matrix< float, 3, 2, Eigen::DontAlign > eeg_loc
Eigen::Matrix< float, 4, 4, Eigen::DontAlign > coil_trans
Channel coil-frame placement: origin r0 (m) and orthonormal axes ex / ey / ez in FIFFV_COORD_DEVICE.
Definition fiff_ch_pos.h:65
Eigen::Vector3f r0
fiff_int_t coil_type
Eigen::Vector3f ey
Eigen::Vector3f ex
Eigen::Vector3f ez
Labelled 4x4 FIFF affine: source frame, destination frame, rotation, translation and cached inverse.
Eigen::Matrix< float, 4, 4, Eigen::DontAlign > invtrans
Eigen::Matrix< float, 4, 4, Eigen::DontAlign > trans
One digitizer point: kind (cardinal/HPI/EEG/extra), ident, 3D position in FIFFV_COORD_HEAD.
Directory entry: tag kind + on-disk type + byte size + absolute file offset (16-byte record).
128-bit FIFF identifier: hardware machine ID plus creation time, stamped on every file and block.
Definition fiff_id.h:69
fiff_int_t machid[2]
Definition fiff_id.h:193
FiffTime time
Definition fiff_id.h:194
fiff_int_t version
Definition fiff_id.h:192
static fiff_int_t fiff_type_matrix_coding(fiff_int_t type)
Definition fiff_tag.cpp:686
~FiffTag()=default
QString toString() const
Definition fiff_tag.h:638
qint16 * toShort() const
Definition fiff_tag.h:576
QSharedPointer< FiffTag > SPtr
Definition fiff_tag.h:163
Eigen::MatrixXf toFloatMatrix() const
Definition fiff_tag.h:883
quint32 * toUnsignedInt() const
Definition fiff_tag.h:586
fiff_int_t kind
Definition fiff_tag.h:529
FiffTag(FiffTag &&other)=default
std::unique_ptr< FiffTag > UPtr
Definition fiff_tag.h:165
FiffCoordTrans toCoordTrans() const
Definition fiff_tag.h:703
std::unique_ptr< const FiffTag > ConstUPtr
Definition fiff_tag.h:166
qint32 * toJulian() const
Definition fiff_tag.h:607
fiff_int_t getMatrixCoding() const
Definition fiff_tag.cpp:58
Eigen::MatrixXi toIntMatrix() const
Definition fiff_tag.h:861
quint16 * toUnsignedShort() const
Definition fiff_tag.h:566
FiffChInfo toChInfo() const
Definition fiff_tag.h:743
qint16 * toDauPack16() const
Definition fiff_tag.h:648
FiffDigPoint toDigPoint() const
Definition fiff_tag.h:680
qint32 * toInt() const
Definition fiff_tag.h:596
const double * toDouble() const
Definition fiff_tag.h:628
const float * toFloat() const
Definition fiff_tag.h:618
static void convert_tag_data(const FiffTag::UPtr &tag, int from_endian, int to_endian)
Definition fiff_tag.cpp:417
static void convert_matrix_to_file_data(const FiffTag::UPtr &tag)
Definition fiff_tag.cpp:342
FiffTag & operator=(FiffTag &&other)=default
QString getInfo() const
Definition fiff_tag.cpp:117
quint8 * toByte() const
Definition fiff_tag.h:556
bool isMatrix() const
Definition fiff_tag.cpp:65
fiff_int_t getType() const
Definition fiff_tag.cpp:106
Eigen::SparseMatrix< double > toSparseFloatMatrix() const
Definition fiff_tag.h:910
FiffId toFiffID() const
Definition fiff_tag.h:660
fiff_int_t type
Definition fiff_tag.h:531
static qint32 storageSize()
Definition fiff_tag.h:543
FiffTag & operator=(const FiffTag &other)=default
static void convert_matrix_from_file_data(const FiffTag::UPtr &tag)
Definition fiff_tag.cpp:265
fiff_int_t next
Definition fiff_tag.h:533
static void convert_ch_pos(FiffChPos *pos)
Definition fiff_tag.cpp:250
FiffTag(const FiffTag &p_FiffTag)=default
QSharedPointer< const FiffTag > ConstSPtr
Definition fiff_tag.h:164
bool getMatrixDimensions(qint32 &p_ndim, QVector< qint32 > &p_Dims) const
Definition fiff_tag.cpp:75
QList< QSharedPointer< FiffDirEntry > > toDirEntry() const
Definition fiff_tag.h:834