MNE-CPP 0.1.9
A Framework for Electrophysiology
Loading...
Searching...
No Matches
mne_hemisphere.h
Go to the documentation of this file.
1//=============================================================================================================
37#ifndef MNE_HEMISPHERE_H
38#define MNE_HEMISPHERE_H
39
40//=============================================================================================================
41// INCLUDES
42//=============================================================================================================
43
44#include "mne_global.h"
45#include "mne_cluster_info.h"
46
47#include <fiff/fiff_types.h>
48#include <fiff/fiff.h>
49
50//=============================================================================================================
51// EIGEN INCLUDES
52//=============================================================================================================
53
54#include <Eigen/Core>
55#include <Eigen/SparseCore>
56
57//=============================================================================================================
58// QT INCLUDES
59//=============================================================================================================
60
61#include <QList>
62
63//=============================================================================================================
64// DEFINE NAMESPACE MNELIB
65//=============================================================================================================
66
67namespace MNELIB
68{
69
70//=============================================================================================================
71// FORWARD DECLARATIONS
72//=============================================================================================================
73
74//=============================================================================================================
81{
82public:
83 typedef QSharedPointer<MNEHemisphere> SPtr;
84 typedef QSharedPointer<const MNEHemisphere> ConstSPtr;
86 //=========================================================================================================
91
92 //=========================================================================================================
98 MNEHemisphere(const MNEHemisphere& p_MNEHemisphere);
99
100 //=========================================================================================================
105
106 //=========================================================================================================
114 bool add_geometry_info();
115
116 //=========================================================================================================
120 void clear();
121
122 //=========================================================================================================
130 Eigen::MatrixXf& getTriCoords(float p_fScaling = 1.0f);
131
132 //=========================================================================================================
138 inline bool isClustered() const;
139
140 //=========================================================================================================
154 bool transform_hemisphere_to(FIFFLIB::fiff_int_t dest, const FIFFLIB::FiffCoordTrans &p_Trans);
155
156 //=========================================================================================================
166 void writeToStream(FIFFLIB::FiffStream* p_pStream);
167
168 //ToDo write(IODevice &)
169
177 friend bool operator== (const MNEHemisphere &a, const MNEHemisphere &b);
178
179public:
180 FIFFLIB::fiff_int_t type;
181 FIFFLIB::fiff_int_t id;
182 FIFFLIB::fiff_int_t np;
183 FIFFLIB::fiff_int_t ntri;
184 FIFFLIB::fiff_int_t coord_frame;
185 Eigen::MatrixX3f rr;
186 Eigen::MatrixX3f nn;
187 Eigen::MatrixX3i tris;
188 FIFFLIB::fiff_int_t nuse;
189 Eigen::VectorXi inuse;
190 Eigen::VectorXi vertno;
191 qint32 nuse_tri;
192 Eigen::MatrixX3i use_tris;
193 Eigen::VectorXi nearest;
194 Eigen::VectorXd nearest_dist;
195 QList<Eigen::VectorXi> pinfo;
196 Eigen::VectorXi patch_inds;
198 Eigen::SparseMatrix<double> dist;
199 Eigen::MatrixX3d tri_cent;
200 Eigen::MatrixX3d tri_nn;
201 Eigen::VectorXd tri_area;
202 Eigen::MatrixX3d use_tri_cent;
203 Eigen::MatrixX3d use_tri_nn;
204 Eigen::VectorXd use_tri_area;
206 QVector<QVector<int> > neighbor_tri;
207 QVector<QVector<int> > neighbor_vert;
210private:
211 // Newly added
212 Eigen::MatrixXf m_TriCoords;
213};
214
215//=============================================================================================================
216// INLINE DEFINITIONS
217//=============================================================================================================
218
219inline bool MNEHemisphere::isClustered() const
220{
221 return !cluster_info.isEmpty();
222}
223
224//=============================================================================================================
225
226inline bool operator== (const MNEHemisphere &a, const MNEHemisphere &b)
227{
228 if(a.pinfo.size() == b.pinfo.size()) {
229 for(int i = 0; i < a.pinfo.size(); ++i) {
230 if(!a.pinfo.at(i).isApprox(b.pinfo.at(i))) {
231 return false;
232 }
233 }
234 } else {
235 return false;
236 }
237
238 return (a.type == b.type &&
239 a.id == b.id &&
240 a.np == b.np &&
241 a.ntri == b.ntri &&
242 a.coord_frame == b.coord_frame &&
243 a.rr.isApprox(b.rr, 0.0001f) &&
244 a.nn.isApprox(b.nn, 0.0001f) &&
245 a.tris.isApprox(b.tris) &&
246 a.nuse == b.nuse &&
247 a.inuse.isApprox(b.inuse) &&
248 a.vertno.isApprox(b.vertno) &&
249 a.nuse_tri == b.nuse_tri &&
250 a.use_tris.isApprox(b.use_tris) &&
251 a.nearest.isApprox(b.nearest) &&
252 a.nearest_dist.isApprox(b.nearest_dist, 0.0001) &&
253 a.patch_inds.isApprox(b.patch_inds) &&
254 //a.dist_limit == b.dist_limit && //TODO: We still not sure if dist_limit can also be a matrix. This needs to be debugged
255 a.dist.isApprox(b.dist, 0.0001) &&
256 a.tri_cent.isApprox(b.tri_cent, 0.0001) &&
257 a.tri_nn.isApprox(b.tri_nn, 0.0001) &&
258 a.tri_area.isApprox(b.tri_area, 0.0001) &&
259 a.use_tri_cent.isApprox(b.use_tri_cent, 0.0001) &&
260 a.use_tri_nn.isApprox(b.use_tri_nn, 0.0001) &&
261 a.use_tri_area.isApprox(b.use_tri_area, 0.0001) &&
262 a.neighbor_tri == b.neighbor_tri &&
264 a.cluster_info == b.cluster_info &&
265 a.m_TriCoords.isApprox(b.m_TriCoords, 0.0001f));
266}
267} // NAMESPACE
268
269#endif // MNE_HEMISPHERE_H
FIFF class declaration, which provides static wrapper functions to stay consistent with mne matlab to...
Definitions for describing the objects in a FIFF file.
mne library export/import macros.
#define MNESHARED_EXPORT
Definition mne_global.h:56
MNEClusterInfo class declaration, which provides cluster information.
Coordinate transformation description.
FIFF File I/O routines.
cluster information
Hemisphere provides geometry information.
QSharedPointer< MNEHemisphere > SPtr
Eigen::VectorXi vertno
Eigen::MatrixX3d tri_cent
QVector< QVector< int > > neighbor_tri
FIFFLIB::fiff_int_t ntri
FIFFLIB::fiff_int_t id
Eigen::VectorXi inuse
FIFFLIB::fiff_int_t type
FIFFLIB::fiff_int_t nuse
Eigen::VectorXd use_tri_area
Eigen::VectorXi nearest
Eigen::MatrixX3d use_tri_cent
QSharedPointer< const MNEHemisphere > ConstSPtr
Eigen::MatrixX3i tris
Eigen::MatrixX3f nn
Eigen::VectorXd nearest_dist
QVector< QVector< int > > neighbor_vert
Eigen::MatrixX3d tri_nn
Eigen::MatrixX3i use_tris
FIFFLIB::fiff_int_t np
Eigen::MatrixX3f rr
MNEClusterInfo cluster_info
Eigen::MatrixX3d use_tri_nn
FIFFLIB::fiff_int_t coord_frame
Eigen::VectorXd tri_area
Eigen::SparseMatrix< double > dist
QList< Eigen::VectorXi > pinfo
Eigen::VectorXi patch_inds