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//=============================================================================================================
88{
89public:
90 typedef QSharedPointer<InvSourceEstimate> SPtr;
91 typedef QSharedPointer<const InvSourceEstimate> ConstSPtr;
92
93 //=========================================================================================================
98
99 //=========================================================================================================
108 InvSourceEstimate(const Eigen::MatrixXd &p_sol, const Eigen::VectorXi &p_vertices, float p_tmin, float p_tstep);
109
110 //=========================================================================================================
116 InvSourceEstimate(const InvSourceEstimate& p_SourceEstimate);
117
118 //=========================================================================================================
125 InvSourceEstimate(QIODevice &p_IODevice);
126
127 //=========================================================================================================
131 void clear();
132
133 //=========================================================================================================
140 InvSourceEstimate reduce(qint32 start, qint32 n);
141
142 //=========================================================================================================
153 static bool read(QIODevice &p_IODevice, InvSourceEstimate& p_stc);
154
155 //=========================================================================================================
163 bool write(QIODevice &p_IODevice);
164
165 //=========================================================================================================
178 static InvSourceEstimate read_w(const QString& path);
179
180 //=========================================================================================================
188 void write_w(const QString& path) const;
189
190 //=========================================================================================================
196 inline bool isEmpty() const;
197
198 //=========================================================================================================
206 InvSourceEstimate& operator= (const InvSourceEstimate &rhs);
207
208 //=========================================================================================================
214 int samples() const;
215
216 //=========================================================================================================
225 Eigen::VectorXi getIndicesByLabel(const QList<FSLIB::FsLabel> &lPickedLabels, bool bIsClustered) const;
226
227public:
228 Eigen::MatrixXd data;
229 Eigen::VectorXi vertices;
230 Eigen::RowVectorXf times;
231 float tmin;
232 float tstep;
233
234 // --- Metadata ---
238
239 // --- Positions (for discrete source spaces: sEEG contacts, ECoG electrodes, custom ROIs) ---
240 Eigen::MatrixX3f positions;
241
242 // --- Coupling layer (e.g. RAP-MUSIC correlated N-tuples on the grid) ---
243 std::vector<InvSourceCoupling> couplings;
244
245 // --- Focal layer (e.g. ECD off-grid dipoles) ---
246 std::vector<InvFocalDipole> focalDipoles;
247
248 // --- Connectivity layer (pairwise source connectivity) ---
249 std::vector<InvConnectivity> connectivity;
250
251 //=========================================================================================================
257 inline bool hasGridData() const;
258
259 //=========================================================================================================
265 inline bool hasCouplings() const;
266
267 //=========================================================================================================
273 inline bool hasFocalDipoles() const;
274
275 //=========================================================================================================
281 inline bool hasPositions() const;
282
283 //=========================================================================================================
289 inline bool hasConnectivity() const;
290
291private:
292 //=========================================================================================================
296 void update_times();
297};
298
299//=============================================================================================================
300// INLINE DEFINITIONS
301//=============================================================================================================
302
303inline bool InvSourceEstimate::isEmpty() const
304{
305 return tstep == -1;
306}
307
308//=============================================================================================================
309
311{
312 return data.size() > 0;
313}
314
315//=============================================================================================================
316
318{
319 return !couplings.empty();
320}
321
322//=============================================================================================================
323
325{
326 return !focalDipoles.empty();
327}
328
329//=============================================================================================================
330
332{
333 return positions.rows() > 0;
334}
335
336//=============================================================================================================
337
339{
340 return !connectivity.empty();
341}
342} //NAMESPACE
343
344#endif // INV_SOURCE_ESTIMATE_H
Reader and in-memory representation of a FreeSurfer/MNE surface label (.label).
Lightweight pairwise source-connectivity container that travels alongside a source estimate.
Single off-grid focal dipole result with free position, moment and fit-quality metrics.
Container for an N-tuple of correlated grid sources discovered by RAP-/TRAP-MUSIC.
Strongly-typed enumerations that tag a source estimate with the inverse method, source-space type,...
INVLIB library export/import macros, build-info accessors, and namespace docstring for the inverse-so...
#define INVSHARED_EXPORT
Definition inv_global.h:38
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)
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