v2.0.0
Loading...
Searching...
No Matches
mne_cluster_info.h
Go to the documentation of this file.
1//=============================================================================================================
22
23#ifndef MNE_CLUSTER_INFO_H
24#define MNE_CLUSTER_INFO_H
25
26//=============================================================================================================
27// INCLUDES
28//=============================================================================================================
29
30#include "mne_global.h"
31
32//=============================================================================================================
33// EIGEN INCLUDES
34//=============================================================================================================
35
36#include <Eigen/Core>
37
38//=============================================================================================================
39// QT INCLUDES
40//=============================================================================================================
41
42#include <QSharedPointer>
43#include <QList>
44
45//=============================================================================================================
46// DEFINE NAMESPACE MNELIB
47//=============================================================================================================
48
49namespace MNELIB
50{
51
52//=============================================================================================================
62{
63public:
64 typedef QSharedPointer<MNEClusterInfo> SPtr;
65 typedef QSharedPointer<const MNEClusterInfo> ConstSPtr;
66
67 //=========================================================================================================
72
73 //=========================================================================================================
77 void clear();
78
79 //=========================================================================================================
85 inline bool isEmpty() const;
86
87 //=========================================================================================================
93 inline qint32 numClust() const;
94
95 //=========================================================================================================
102 void write(QString p_sFileName) const;
103
112 friend bool operator==(const MNEClusterInfo& a, const MNEClusterInfo& b);
113
114public:
115 QList<QString> clusterLabelNames;
116 QList<qint32> clusterLabelIds;
117 QList<qint32> centroidVertno;
118 QList<Eigen::Vector3f> centroidSource_rr;
119 QList<Eigen::VectorXi> clusterVertnos;
120 QList<Eigen::MatrixX3f> clusterSource_rr;
121 QList<Eigen::VectorXd> clusterDistances;
122};
123
124//=============================================================================================================
125// INLINE DEFINITIONS
126//=============================================================================================================
127
128inline bool MNEClusterInfo::isEmpty() const
129{
130 return !(this->clusterVertnos.size() > 0);
131}
132
133//=============================================================================================================
134
135inline qint32 MNEClusterInfo::numClust() const
136{
137 return this->clusterVertnos.size();
138}
139
140//=============================================================================================================
141
142inline bool operator==(const MNEClusterInfo& a, const MNEClusterInfo& b)
143{
144 if (a.centroidSource_rr.size() == b.centroidSource_rr.size()) {
145 for (int i = 0; i < a.centroidSource_rr.size(); ++i) {
146 if (!a.centroidSource_rr.at(i).isApprox(b.centroidSource_rr.at(i), 0.0001f)) {
147 return false;
148 }
149 }
150 } else {
151 return false;
152 }
153
154 if (a.clusterVertnos.size() == b.clusterVertnos.size()) {
155 for (int i = 0; i < a.clusterVertnos.size(); ++i) {
156 if (!a.clusterVertnos.at(i).isApprox(b.clusterVertnos.at(i))) {
157 return false;
158 }
159 }
160 } else {
161 return false;
162 }
163
164 if (a.clusterSource_rr.size() == b.clusterSource_rr.size()) {
165 for (int i = 0; i < a.clusterSource_rr.size(); ++i) {
166 if (!a.clusterSource_rr.at(i).isApprox(b.clusterSource_rr.at(i), 0.0001f)) {
167 return false;
168 }
169 }
170 } else {
171 return false;
172 }
173
174 if (a.clusterDistances.size() == b.clusterDistances.size()) {
175 for (int i = 0; i < a.clusterDistances.size(); ++i) {
176 if (!a.clusterDistances.at(i).isApprox(b.clusterDistances.at(i))) {
177 return false;
178 }
179 }
180 } else {
181 return false;
182 }
183
184 return (a.clusterLabelNames == b.clusterLabelNames &&
187}
188} // NAMESPACE
189
190#endif // MNE_CLUSTER_INFO_H
MNELIB shared-library export/import macros and library build metadata.
#define MNESHARED_EXPORT
Definition mne_global.h:40
Core MNE data structures (source spaces, source estimates, hemispheres).
bool operator==(const MNEClusterInfo &a, const MNEClusterInfo &b)
QList< Eigen::VectorXd > clusterDistances
QList< QString > clusterLabelNames
QList< qint32 > clusterLabelIds
QList< Eigen::MatrixX3f > clusterSource_rr
QList< Eigen::VectorXi > clusterVertnos
QSharedPointer< const MNEClusterInfo > ConstSPtr
QSharedPointer< MNEClusterInfo > SPtr
void write(QString p_sFileName) const
friend bool operator==(const MNEClusterInfo &a, const MNEClusterInfo &b)
QList< qint32 > centroidVertno
QList< Eigen::Vector3f > centroidSource_rr