v2.0.0
Loading...
Searching...
No Matches
inv_source_estimate.h
Go to the documentation of this file.
1
2//=============================================================================================================
37
38#ifndef INV_SOURCE_ESTIMATE_H
39#define INV_SOURCE_ESTIMATE_H
40
41//=============================================================================================================
42// INCLUDES
43//=============================================================================================================
44
45#include "inv_global.h"
46#include "inv_types.h"
47#include "inv_focal_dipole.h"
48#include "inv_source_coupling.h"
49#include "inv_connectivity.h"
50
51#include <fs/fs_label.h>
52
53//=============================================================================================================
54// STL INCLUDES
55//=============================================================================================================
56
57#include <vector>
58
59//=============================================================================================================
60// EIGEN INCLUDES
61//=============================================================================================================
62
63#include <Eigen/Core>
64
65//=============================================================================================================
66// QT INCLUDES
67//=============================================================================================================
68
69#include <QSharedPointer>
70#include <QList>
71#include <QIODevice>
72
73//=============================================================================================================
74// FORWARD DECLARATIONS
75//=============================================================================================================
76
77//=============================================================================================================
78// DEFINE NAMESPACE INVLIB
79//=============================================================================================================
80
81namespace INVLIB
82{
83
84//=============================================================================================================
85// MNELIB FORWARD DECLARATIONS
86//=============================================================================================================
87
88//=============================================================================================================
95{
96public:
97 typedef QSharedPointer<InvSourceEstimate> SPtr;
98 typedef QSharedPointer<const InvSourceEstimate> ConstSPtr;
99
100 //=========================================================================================================
105
106 //=========================================================================================================
115 InvSourceEstimate(const Eigen::MatrixXd &p_sol, const Eigen::VectorXi &p_vertices, float p_tmin, float p_tstep);
116
117 //=========================================================================================================
123 InvSourceEstimate(const InvSourceEstimate& p_SourceEstimate);
124
125 //=========================================================================================================
132 InvSourceEstimate(QIODevice &p_IODevice);
133
134 //=========================================================================================================
138 void clear();
139
140 //=========================================================================================================
147 InvSourceEstimate reduce(qint32 start, qint32 n);
148
149 //=========================================================================================================
160 static bool read(QIODevice &p_IODevice, InvSourceEstimate& p_stc);
161
162 //=========================================================================================================
170 bool write(QIODevice &p_IODevice);
171
172 //=========================================================================================================
185 static InvSourceEstimate read_w(const QString& path);
186
187 //=========================================================================================================
195 void write_w(const QString& path) const;
196
197 //=========================================================================================================
203 inline bool isEmpty() const;
204
205 //=========================================================================================================
213 InvSourceEstimate& operator= (const InvSourceEstimate &rhs);
214
215 //=========================================================================================================
221 int samples() const;
222
223 //=========================================================================================================
232 Eigen::VectorXi getIndicesByLabel(const QList<FSLIB::FsLabel> &lPickedLabels, bool bIsClustered) const;
233
234public:
235 Eigen::MatrixXd data;
236 Eigen::VectorXi vertices;
237 Eigen::RowVectorXf times;
238 float tmin;
239 float tstep;
240
241 // --- Metadata ---
245
246 // --- Positions (for discrete source spaces: sEEG contacts, ECoG electrodes, custom ROIs) ---
247 Eigen::MatrixX3f positions;
248
249 // --- Coupling layer (e.g. RAP-MUSIC correlated N-tuples on the grid) ---
250 std::vector<InvSourceCoupling> couplings;
251
252 // --- Focal layer (e.g. ECD off-grid dipoles) ---
253 std::vector<InvFocalDipole> focalDipoles;
254
255 // --- Connectivity layer (pairwise source connectivity) ---
256 std::vector<InvConnectivity> connectivity;
257
258 //=========================================================================================================
264 inline bool hasGridData() const;
265
266 //=========================================================================================================
272 inline bool hasCouplings() const;
273
274 //=========================================================================================================
280 inline bool hasFocalDipoles() const;
281
282 //=========================================================================================================
288 inline bool hasPositions() const;
289
290 //=========================================================================================================
296 inline bool hasConnectivity() const;
297
298private:
299 //=========================================================================================================
303 void update_times();
304};
305
306//=============================================================================================================
307// INLINE DEFINITIONS
308//=============================================================================================================
309
310inline bool InvSourceEstimate::isEmpty() const
311{
312 return tstep == -1;
313}
314
315//=============================================================================================================
316
318{
319 return data.size() > 0;
320}
321
322//=============================================================================================================
323
325{
326 return !couplings.empty();
327}
328
329//=============================================================================================================
330
332{
333 return !focalDipoles.empty();
334}
335
336//=============================================================================================================
337
339{
340 return positions.rows() > 0;
341}
342
343//=============================================================================================================
344
346{
347 return !connectivity.empty();
348}
349} //NAMESPACE
350
351#endif // INV_SOURCE_ESTIMATE_H
InvFocalDipole struct declaration for off-grid dipole results (e.g. ECD dipole fit).
inverse library export/import macros.
#define INVSHARED_EXPORT
Definition inv_global.h:52
InvConnectivity struct for pairwise source connectivity results.
InvSourceCoupling struct declaration for correlated source groups (e.g. RAP-MUSIC dipole tuples).
Inverse library type enumerations.
FsLabel class declaration.
Inverse source estimation (MNE, dSPM, sLORETA, dipole fitting).
InvEstimateMethod
Definition inv_types.h:50
InvOrientationType
Definition inv_types.h:84
InvSourceSpaceType
Definition inv_types.h:71
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)
static InvSourceEstimate read_w(const QString &path)
bool write(QIODevice &p_IODevice)
QSharedPointer< InvSourceEstimate > SPtr
InvSourceSpaceType sourceSpaceType
QSharedPointer< const InvSourceEstimate > ConstSPtr
InvOrientationType orientationType
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