v2.0.0
Loading...
Searching...
No Matches
inv_source_estimate.h
Go to the documentation of this file.
1//=============================================================================================================
25
26#ifndef INV_SOURCE_ESTIMATE_H
27#define INV_SOURCE_ESTIMATE_H
28
29//=============================================================================================================
30// INCLUDES
31//=============================================================================================================
32
33#include "inv_global.h"
34#include "inv_types.h"
35#include "inv_focal_dipole.h"
36#include "inv_source_coupling.h"
37#include "inv_connectivity.h"
38
39#include <fs/fs_label.h>
40
41//=============================================================================================================
42// STL INCLUDES
43//=============================================================================================================
44
45#include <vector>
46
47//=============================================================================================================
48// EIGEN INCLUDES
49//=============================================================================================================
50
51#include <Eigen/Core>
52
53//=============================================================================================================
54// QT INCLUDES
55//=============================================================================================================
56
57#include <QSharedPointer>
58#include <QList>
59#include <QIODevice>
60
61//=============================================================================================================
62// FORWARD DECLARATIONS
63//=============================================================================================================
64
65//=============================================================================================================
66// DEFINE NAMESPACE INVLIB
67//=============================================================================================================
68
69namespace INVLIB
70{
71
72//=============================================================================================================
73// MNELIB FORWARD DECLARATIONS
74//=============================================================================================================
75
76//=============================================================================================================
92{
93public:
94 typedef QSharedPointer<InvSourceEstimate> SPtr;
95 typedef QSharedPointer<const InvSourceEstimate> ConstSPtr;
96
97 //=========================================================================================================
102
103 //=========================================================================================================
112 InvSourceEstimate(const Eigen::MatrixXd& p_sol, const Eigen::VectorXi& p_vertices, float p_tmin, float p_tstep);
113
114 //=========================================================================================================
120 InvSourceEstimate(const InvSourceEstimate& p_SourceEstimate);
121
122 //=========================================================================================================
129 InvSourceEstimate(QIODevice& p_IODevice);
130
131 //=========================================================================================================
135 void clear();
136
137 //=========================================================================================================
146 InvSourceEstimate reduce(qint32 start, qint32 n);
147
148 //=========================================================================================================
159 static bool read(QIODevice& p_IODevice, InvSourceEstimate& p_stc);
160
161 //=========================================================================================================
171 bool write(QIODevice& p_IODevice);
172
173 //=========================================================================================================
190 bool writeHemispherePair(const QString& sBasePath);
191
192 //=========================================================================================================
205 static InvSourceEstimate read_w(const QString& path);
206
207 //=========================================================================================================
215 void write_w(const QString& path) const;
216
217 //=========================================================================================================
223 inline bool isEmpty() const;
224
225 //=========================================================================================================
234
235 //=========================================================================================================
241 int samples() const;
242
243 //=========================================================================================================
252 Eigen::VectorXi getIndicesByLabel(const QList<FSLIB::FsLabel>& lPickedLabels, bool bIsClustered) const;
253
254public:
255 Eigen::MatrixXd data;
256 Eigen::VectorXi vertices;
257 Eigen::RowVectorXf times;
258 float tmin;
259 float tstep;
261
262 // --- Metadata ---
266
267 // --- Positions (for discrete source spaces: sEEG contacts, ECoG electrodes, custom ROIs) ---
268 Eigen::MatrixX3f positions;
269
270 // --- Coupling layer (e.g. RAP-MUSIC correlated N-tuples on the grid) ---
271 std::vector<InvSourceCoupling> couplings;
272
273 // --- Focal layer (e.g. ECD off-grid dipoles) ---
274 std::vector<InvFocalDipole> focalDipoles;
275
276 // --- Connectivity layer (pairwise source connectivity) ---
277 std::vector<InvConnectivity> connectivity;
278
279 //=========================================================================================================
285 inline bool hasGridData() const;
286
287 //=========================================================================================================
293 inline bool hasCouplings() const;
294
295 //=========================================================================================================
301 inline bool hasFocalDipoles() const;
302
303 //=========================================================================================================
309 inline bool hasPositions() const;
310
311 //=========================================================================================================
317 inline bool hasConnectivity() const;
318
319private:
320 //=========================================================================================================
324 void update_times();
325};
326
327//=============================================================================================================
328// INLINE DEFINITIONS
329//=============================================================================================================
330
331inline bool InvSourceEstimate::isEmpty() const
332{
333 return tstep == -1;
334}
335
336//=============================================================================================================
337
339{
340 return data.size() > 0;
341}
342
343//=============================================================================================================
344
346{
347 return !couplings.empty();
348}
349
350//=============================================================================================================
351
353{
354 return !focalDipoles.empty();
355}
356
357//=============================================================================================================
358
360{
361 return positions.rows() > 0;
362}
363
364//=============================================================================================================
365
367{
368 return !connectivity.empty();
369}
370} //NAMESPACE
371
372#endif // INV_SOURCE_ESTIMATE_H
Lightweight pairwise source-connectivity container that travels alongside a source estimate.
Strongly-typed enumerations that tag a source estimate with the inverse method, source-space type,...
Single off-grid focal dipole result with free position, moment and fit-quality metrics.
INVLIB library export/import macros, build-info accessors, and namespace docstring for the inverse-so...
#define INVSHARED_EXPORT
Definition inv_global.h:38
Container for an N-tuple of correlated grid sources discovered by RAP-/TRAP-MUSIC.
Reader and in-memory representation of a FreeSurfer/MNE surface label (.label).
Inverse source estimation (MNE, dSPM, sLORETA, dipole fitting).
InvEstimateMethod
Definition inv_types.h:37
InvOrientationType
Definition inv_types.h:71
InvSourceSpaceType
Definition inv_types.h:58
std::vector< InvSourceCoupling > couplings
std::vector< InvFocalDipole > focalDipoles
Eigen::VectorXi getIndicesByLabel(const QList< FSLIB::FsLabel > &lPickedLabels, bool bIsClustered) const
static bool read(QIODevice &p_IODevice, InvSourceEstimate &p_stc)
InvSourceEstimate & operator=(const InvSourceEstimate &rhs)
static InvSourceEstimate read_w(const QString &path)
bool write(QIODevice &p_IODevice)
QSharedPointer< InvSourceEstimate > SPtr
InvSourceSpaceType sourceSpaceType
QSharedPointer< const InvSourceEstimate > ConstSPtr
InvOrientationType orientationType
bool writeHemispherePair(const QString &sBasePath)
InvSourceEstimate(const Eigen::MatrixXd &p_sol, const Eigen::VectorXi &p_vertices, float p_tmin, float p_tstep)
std::vector< InvConnectivity > connectivity
InvSourceEstimate reduce(qint32 start, qint32 n)
void write_w(const QString &path) const