v2.0.0
Loading...
Searching...
No Matches
fiff_dig_point_set.h
Go to the documentation of this file.
1//=============================================================================================================
26
27#ifndef FIFFLIB_FIFF_DIG_POINT_SET_H
28#define FIFFLIB_FIFF_DIG_POINT_SET_H
29
30//=============================================================================================================
31// INCLUDES
32//=============================================================================================================
33
34#include "fiff_global.h"
35
36//=============================================================================================================
37// QT INCLUDES
38//=============================================================================================================
39
40#include <QSharedPointer>
41#include <QIODevice>
42#include <QList>
43#include <QStringList>
44
45#include "fiff_stream.h"
46#include "fiff_dig_point.h"
47#include <memory>
48
49//=============================================================================================================
50// EIGEN INCLUDES
51//=============================================================================================================
52
53//=============================================================================================================
54// FORWARD DECLARATIONS
55//=============================================================================================================
56
57//=============================================================================================================
58// DEFINE NAMESPACE FIFFLIB
59//=============================================================================================================
60
61namespace FIFFLIB
62{
63
64//=============================================================================================================
65// FIFFLIB FORWARD DECLARATIONS
66//=============================================================================================================
67
68class FiffDigPoint;
69class FiffDirNode;
70
71//=============================================================================================================
81
83{
84public:
85 using SPtr = QSharedPointer<FiffDigPointSet>;
86 using ConstSPtr = QSharedPointer<const FiffDigPointSet>;
87 using UPtr = std::unique_ptr<FiffDigPointSet>;
88 using ConstUPtr = std::unique_ptr<const FiffDigPointSet>;
89
90 //=========================================================================================================
95
96 //=========================================================================================================
102 FiffDigPointSet(const FiffDigPointSet& p_FiffDigPointSet);
103
104 //=========================================================================================================
115 FiffDigPointSet& operator=(const FiffDigPointSet& other) = default;
116
117 //=========================================================================================================
123 FiffDigPointSet(QList<FIFFLIB::FiffDigPoint> pointList);
124
125 //=========================================================================================================
131 FiffDigPointSet(QIODevice& p_IODevice);
132
133 //=========================================================================================================
138
139 //=========================================================================================================
148 static bool readFromStream(FiffStream::SPtr& p_Stream, FiffDigPointSet& p_Dig);
149
150 //=========================================================================================================
168 static bool readPolhemusIsotrak(const QString& path,
169 FiffDigPointSet& dig,
170 const QStringList& chNames = QStringList(),
171 const QString& unit = QStringLiteral("m"));
172
173 //=========================================================================================================
186 static bool readPolhemusFastscan(const QString& path,
187 Eigen::MatrixX3d& points,
188 const QString& unit = QStringLiteral("mm"),
189 bool requireHeader = true);
190
191 //=========================================================================================================
206 static bool readCaptrak(const QString& path, FiffDigPointSet& dig, QStringList* chNames = nullptr);
207
208 //=========================================================================================================
224 static bool readEgi(const QString& path, FiffDigPointSet& dig, QStringList* chNames = nullptr);
225
226 //=========================================================================================================
240 static bool readLocalite(const QString& path,
241 FiffDigPointSet& dig,
242 QStringList* chNames = nullptr,
243 const QString& nasion = QString(),
244 const QString& lpa = QString(),
245 const QString& rpa = QString());
246
247 //=========================================================================================================
259 static bool readNeuroscanDat(const QString& path, FiffDigPointSet& dig, QStringList* chNames = nullptr);
260
261 //=========================================================================================================
265 inline void clear();
266
267 //=========================================================================================================
273 inline bool isEmpty() const;
274
275 //=========================================================================================================
281 inline qint32 size() const;
282
283 //=========================================================================================================
291 bool write(QIODevice& p_IODevice);
292
293 //=========================================================================================================
305 bool write(const QString& filePath, QString* errorMessage = nullptr);
306
307 //=========================================================================================================
313 void writeToStream(FiffStream* p_pStream);
314
315 //=========================================================================================================
323 const FiffDigPoint& operator[](qint32 idx) const;
324
325 //=========================================================================================================
333 FiffDigPoint& operator[](qint32 idx);
334
335 //=========================================================================================================
343 FiffDigPointSet pickTypes(QList<int> includeTypes) const;
344
345 //=========================================================================================================
354
355 //=========================================================================================================
364
365 //=========================================================================================================
372 void applyTransform(const FiffCoordTrans& coordTrans, bool bApplyInverse = false);
373
374 //=========================================================================================================
381 bool transformToHead();
382
383 //=========================================================================================================
389 QList<FiffDigPoint> getList();
390
391protected:
392private:
393 QList<FiffDigPoint> m_qListDigPoint;
394};
395
396//=============================================================================================================
397// INLINE DEFINITIONS
398//=============================================================================================================
399
401{
402 m_qListDigPoint.clear();
403}
404
405//=============================================================================================================
406
407inline bool FiffDigPointSet::isEmpty() const
408{
409 return m_qListDigPoint.size() == 0;
410}
411
412//=============================================================================================================
413
414inline qint32 FiffDigPointSet::size() const
415{
416 return m_qListDigPoint.size();
417}
418} // namespace FIFFLIB
419
420#ifndef metatype_fiffdigpointset
421#define metatype_fiffdigpointset
423#endif
424
425#ifndef metatype_fiffdigpointset_sptr
426#define metatype_fiffdigpointset_sptr
428#endif
429
430#endif // FIFFLIB_FIFF_DIG_POINT_SET_H
FIFF binary tag-stream layer: wraps a QIODevice to read and write FIFF tags, directories,...
Q_DECLARE_METATYPE(FIFFLIB::FiffDigPointSet)
Export/import macros and build-info accessors for the FIFFLIB shared library.
#define FIFFSHARED_EXPORT
Definition fiff_global.h:44
Single digitization point (FIFF_DIG_POINT) with kind (cardinal/HPI/EEG/extra), identifier and 3D coor...
FIFF file I/O, in-memory data structures and high-level readers/writers.
Labelled 4x4 FIFF affine: source frame, destination frame, rotation, translation and cached inverse.
One digitizer point: kind (cardinal/HPI/EEG/extra), ident, 3D position in FIFFV_COORD_HEAD.
Collection of FiffDigPoint records as parsed from a FIFFB_ISOTRAK block.
std::unique_ptr< FiffDigPointSet > UPtr
static bool readPolhemusFastscan(const QString &path, Eigen::MatrixX3d &points, const QString &unit=QStringLiteral("mm"), bool requireHeader=true)
bool write(QIODevice &p_IODevice)
static bool readPolhemusIsotrak(const QString &path, FiffDigPointSet &dig, const QStringList &chNames=QStringList(), const QString &unit=QStringLiteral("m"))
static bool readLocalite(const QString &path, FiffDigPointSet &dig, QStringList *chNames=nullptr, const QString &nasion=QString(), const QString &lpa=QString(), const QString &rpa=QString())
const FiffDigPoint & operator[](qint32 idx) const
FiffDigPointSet & operator<<(const FiffDigPoint &dig)
static bool readEgi(const QString &path, FiffDigPointSet &dig, QStringList *chNames=nullptr)
FiffDigPointSet pickTypes(QList< int > includeTypes) const
static bool readCaptrak(const QString &path, FiffDigPointSet &dig, QStringList *chNames=nullptr)
std::unique_ptr< const FiffDigPointSet > ConstUPtr
void applyTransform(const FiffCoordTrans &coordTrans, bool bApplyInverse=false)
FiffDigPointSet & operator=(const FiffDigPointSet &other)=default
static bool readNeuroscanDat(const QString &path, FiffDigPointSet &dig, QStringList *chNames=nullptr)
QSharedPointer< FiffDigPointSet > SPtr
void writeToStream(FiffStream *p_pStream)
static bool readFromStream(FiffStream::SPtr &p_Stream, FiffDigPointSet &p_Dig)
QSharedPointer< const FiffDigPointSet > ConstSPtr
QList< FiffDigPoint > getList()
Recursive FIFF block-tree node: block kind, block ID, directly contained directory entries and child ...
FIFF tag-stream reader/writer: wraps a QIODevice and exposes typed read_* / write_* methods for every...
QSharedPointer< FiffStream > SPtr