v2.0.0
Loading...
Searching...
No Matches
mne_source_spaces.cpp
Go to the documentation of this file.
1//=============================================================================================================
36
37//=============================================================================================================
38// INCLUDES
39//=============================================================================================================
40
41#include "mne_source_spaces.h"
42#include "mne_nearest.h"
43
44#include <utils/mnemath.h>
45#include <fs/label.h>
46
47#include <iostream>
48
49//=============================================================================================================
50// QT INCLUDES
51//=============================================================================================================
52
53#include <QFile>
54
55//=============================================================================================================
56// USED NAMESPACES
57//=============================================================================================================
58
59using namespace UTILSLIB;
60using namespace FSLIB;
61using namespace MNELIB;
62using namespace Eigen;
63using namespace FIFFLIB;
64
65//=============================================================================================================
66// DEFINE MEMBER METHODS
67//=============================================================================================================
68
72
73//=============================================================================================================
74
76{
77 m_sourceSpaces.reserve(p_MNESourceSpaces.m_sourceSpaces.size());
78 for (const auto& sp : p_MNESourceSpaces.m_sourceSpaces)
79 m_sourceSpaces.push_back(sp->clone());
80}
81
82//=============================================================================================================
83
87
88//=============================================================================================================
89
91{
92 m_sourceSpaces.clear();
93}
94
95//=============================================================================================================
96
97QList<VectorXi> MNESourceSpaces::get_vertno() const
98{
99 QList<VectorXi> p_vertices;
100 for(qint32 i = 0; i < static_cast<qint32>(m_sourceSpaces.size()); ++i)
101 p_vertices.push_back(m_sourceSpaces[i]->vertno);
102 return p_vertices;
103}
104
105//=============================================================================================================
106
107QList<VectorXi> MNESourceSpaces::label_src_vertno_sel(const Label &p_label, VectorXi &src_sel) const
108{
109// if(src[0].['type'] != 'surf')
110// return Exception('Label are only supported with surface source spaces')
111
112 QList<VectorXi> vertno;
113 vertno << this->m_sourceSpaces[0]->vertno << this->m_sourceSpaces[1]->vertno;
114
115 if (p_label.hemi == 0) //lh
116 {
117 VectorXi vertno_sel = MNEMath::intersect(vertno[0], p_label.vertices, src_sel);
118 vertno[0] = vertno_sel;
119 vertno[1] = VectorXi();
120 }
121 else if (p_label.hemi == 1) //rh
122 {
123 VectorXi vertno_sel = MNEMath::intersect(vertno[1], p_label.vertices, src_sel);
124 src_sel.array() += p_label.vertices.size();
125 vertno[0] = VectorXi();
126 vertno[1] = vertno_sel;
127 }
128
129// if (p_label.hemi == 0) //lh
130// {
131// VectorXi vertno_sel = MNEMath::intersect(vertno[0], p_label.vertices[0], src_sel);
132// vertno[0] = vertno_sel;
133// vertno[1] = VectorXi();
134// }
135// else if (p_label.hemi == 1) //rh
136// {
137// VectorXi vertno_sel = MNEMath::intersect(vertno[1], p_label.vertices[1], src_sel);
138// src_sel.array() += p_label.vertices[0].size();
139// vertno[0] = VectorXi();
140// vertno[1] = vertno_sel;
141// }
142// else if (p_label.hemi == 2) //both
143// {
144// VectorXi src_sel_lh, src_sel_rh;
145// VectorXi vertno_sel_lh = MNEMath::intersect(vertno[0], p_label.vertices[0], src_sel_lh);
146// VectorXi vertno_sel_rh = MNEMath::intersect(vertno[1], p_label.vertices[1], src_sel_rh);
147// src_sel.resize(src_sel_lh.size() + src_sel_rh.size());
148// src_sel.block(0,0,src_sel_lh.size(),1) = src_sel_lh;
149// src_sel.block(src_sel_lh.size(),0,src_sel_rh.size(),1) = src_sel_rh;
150// vertno[0] = vertno_sel_lh;
151// vertno[0] = vertno_sel_rh;
152// }
153 else
154 {
155 qWarning("Unknown hemisphere type\n");
156 vertno[0] = VectorXi::Zero(0);
157 vertno[1] = VectorXi::Zero(0);
158 }
159
160 return vertno;
161}
162
163//=============================================================================================================
164
165MNESourceSpaces MNESourceSpaces::pick_regions(const QList<Label> &p_qListLabels) const
166{
167 Q_UNUSED(p_qListLabels);
168
169 MNESourceSpaces selectedSrc(*this);
170
171 for(qint32 h = 0; h < 2; ++h)
172 {
173 auto& srcSpace = *selectedSrc.m_sourceSpaces[h];
174 const auto& origSpace = *this->m_sourceSpaces[h];
175 auto* selHemi = dynamic_cast<MNEHemisphere*>(&srcSpace);
176 auto* origHemi = dynamic_cast<const MNEHemisphere*>(&origSpace);
177
178 VectorXi selVertices;
179
180 //get vertices indeces for new selection
181 qint32 iSize = 0;
182 for(qint32 i = 0; i < p_qListLabels.size(); ++i)
183 {
184 if(p_qListLabels[i].hemi == h)
185 {
186 VectorXi currentSelection;
187
188 MNEMath::intersect(origSpace.vertno, p_qListLabels[i].vertices, currentSelection);
189
190 selVertices.conservativeResize(iSize+currentSelection.size());
191 selVertices.block(iSize,0,currentSelection.size(),1) = currentSelection;
192 iSize = selVertices.size();
193 }
194 }
195
196 MNEMath::sort(selVertices, false);
197
198 VectorXi newVertno(selVertices.size());
199
200 srcSpace.inuse = VectorXi::Zero(srcSpace.np);
201
202 for(qint32 i = 0; i < selVertices.size(); ++i)
203 {
204 srcSpace.inuse[selVertices[i]] = 1;
205 newVertno[i] = origSpace.vertno[selVertices[i]];
206 }
207
208 srcSpace.nuse = selVertices.size();
209 srcSpace.vertno = newVertno;
210
211 //
212 // Tris
213 //
214 VectorXi idx_select = VectorXi::Zero(origSpace.use_itris.rows());
215 for(qint32 i = 0; i < 3; ++i)
216 {
217 VectorXi tri_dim = origSpace.use_itris.col(i);
218 VectorXi idx_dim;
219 MNEMath::intersect(tri_dim, newVertno, idx_dim);
220
221 for(qint32 j = 0; j < idx_dim.size(); ++j)
222 idx_select[idx_dim[j]] = 1;
223 }
224
225 qint32 countSel = 0;
226 for(qint32 i = 0; i < idx_select.size(); ++i)
227 if(idx_select[i] == 1)
228 ++countSel;
229
230 srcSpace.nuse_tri = countSel;
231
232 MatrixX3i use_tris_new(countSel,3);
233 MatrixX3d use_tri_cent_new(countSel,3);
234 MatrixX3d use_tri_nn_new(countSel,3);
235 VectorXd use_tri_area_new(countSel);
236
237 countSel = 0;
238 for(qint32 i = 0; i < idx_select.size(); ++i)
239 {
240 if(idx_select[i] == 1)
241 {
242 use_tris_new.row(countSel) = origSpace.use_itris.row(i);
243 if (origHemi && selHemi) {
244 use_tri_cent_new.row(countSel) = origHemi->use_tri_cent.row(i);
245 use_tri_nn_new.row(countSel) = origHemi->use_tri_nn.row(i);
246 use_tri_area_new[countSel] = origHemi->use_tri_area[i];
247 }
248 ++countSel;
249 }
250 }
251
252 srcSpace.use_itris = use_tris_new;
253 if (selHemi) {
254 selHemi->use_tri_cent = use_tri_cent_new;
255 selHemi->use_tri_nn = use_tri_nn_new;
256 selHemi->use_tri_area = use_tri_area_new;
257 }
258 }
259
260 return selectedSrc;
261}
262
263//=============================================================================================================
264
266 bool add_geom,
267 MNESourceSpaces& p_SourceSpace)
268{
269// if (p_pSourceSpace != NULL)
270// delete p_pSourceSpace;
271 p_SourceSpace = MNESourceSpaces();
272
273 //
274 // Open the file, create directory
275 //
276 bool open_here = false;
277 QFile t_file;//ToDo TCPSocket;
278
279 if (!p_pStream->device()->isOpen())
280 {
281 QString t_sFileName = p_pStream->streamName();
282
283 t_file.setFileName(t_sFileName);
284 p_pStream = FiffStream::SPtr(new FiffStream(&t_file));
285 if(!p_pStream->open())
286 return false;
287 open_here = true;
288// if(t_pDir)
289// delete t_pDir;
290 }
291 //
292 // Find all source spaces
293 //
294 QList<FiffDirNode::SPtr> spaces = p_pStream->dirtree()->dir_tree_find(FIFFB_MNE_SOURCE_SPACE);
295 if (spaces.size() == 0)
296 {
297 if(open_here)
298 p_pStream->close();
299 std::cout << "No source spaces found";
300 return false;
301 }
302
303 for(int k = 0; k < spaces.size(); ++k)
304 {
305 auto p_Hemisphere = std::make_shared<MNEHemisphere>();
306 printf("\tReading a source space...");
307 MNESourceSpaces::read_source_space(p_pStream, spaces[k], *p_Hemisphere);
308 printf("\t[done]\n" );
309 if (add_geom)
310 p_Hemisphere->complete_source_space_info();
311
312 p_SourceSpace.m_sourceSpaces.push_back(p_Hemisphere);
313
314// src(k) = this;
315 }
316
317 printf("\t%lld source spaces read\n", spaces.size());
318
319 if(open_here)
320 p_pStream->close();
321
322 return true;
323}
324
325//=============================================================================================================
326
328{
329 return p_SourceSpace.find_source_space_hemi();
330}
331
332//=============================================================================================================
333
335{
336 for(size_t k = 0; k < this->m_sourceSpaces.size(); ++k)
337 {
338 auto* hemi = dynamic_cast<MNEHemisphere*>(m_sourceSpaces[k].get());
339 if(hemi) {
340 if(!hemi->transform_hemisphere_to(dest,trans))
341 {
342 printf("Could not transform source space.\n");
343 return false;
344 }
345 }
346 }
347 return true;
348}
349
350//=============================================================================================================
351
352bool MNESourceSpaces::read_source_space(FiffStream::SPtr& p_pStream, const FiffDirNode::SPtr& p_Tree, MNEHemisphere& p_Hemisphere)
353{
354 p_Hemisphere.clear();
355
356 FiffTag::SPtr t_pTag;
357
358 //=====================================================================
359 if(!p_Tree->find_tag(p_pStream, FIFF_MNE_SOURCE_SPACE_ID, t_pTag))
360 p_Hemisphere.id = FIFFV_MNE_SURF_UNKNOWN;
361 else
362 p_Hemisphere.id = *t_pTag->toInt();
363
364// qDebug() << "Read SourceSpace ID; type:" << t_pTag->getType() << "value:" << *t_pTag->toInt();
365
366 //=====================================================================
367 if(!p_Tree->find_tag(p_pStream, FIFF_MNE_SOURCE_SPACE_NPOINTS, t_pTag))
368 {
369 p_pStream->close();
370 std::cout << "error: Number of vertices not found."; //ToDo: throw error.
371 return false;
372 }
373// qDebug() << "Number of vertice; type:" << t_pTag->getType() << "value:" << *t_pTag->toInt();
374 p_Hemisphere.np = *t_pTag->toInt();
375
376 //=====================================================================
377 if(!p_Tree->find_tag(p_pStream, FIFF_BEM_SURF_NTRI, t_pTag))
378 {
379 if(!p_Tree->find_tag(p_pStream, FIFF_MNE_SOURCE_SPACE_NTRI, t_pTag))
380 p_Hemisphere.ntri = 0;
381 else
382 p_Hemisphere.ntri = *t_pTag->toInt();
383 }
384 else
385 {
386 p_Hemisphere.ntri = *t_pTag->toInt();
387 }
388// qDebug() << "Number of Tris; type:" << t_pTag->getType() << "value:" << *t_pTag->toInt();
389
390 //=====================================================================
391 if(!p_Tree->find_tag(p_pStream, FIFF_MNE_COORD_FRAME, t_pTag))
392 {
393 p_pStream->close();
394 std::cout << "Coordinate frame information not found."; //ToDo: throw error.
395 return false;
396 }
397 p_Hemisphere.coord_frame = *t_pTag->toInt();
398// qDebug() << "Coord Frame; type:" << t_pTag->getType() << "value:" << *t_pTag->toInt();
399
400 //=====================================================================
401 //
402 // Vertices, normals, and triangles
403 //
404 if(!p_Tree->find_tag(p_pStream, FIFF_MNE_SOURCE_SPACE_POINTS, t_pTag))
405 {
406 p_pStream->close();
407 std::cout << "Vertex data not found."; //ToDo: throw error.
408 return false;
409 }
410
411 p_Hemisphere.rr = t_pTag->toFloatMatrix().transpose();
412 qint32 rows_rr = p_Hemisphere.rr.rows();
413// qDebug() << "last element rr: " << p_Hemisphere.rr(rows_rr-1, 0) << p_Hemisphere.rr(rows_rr-1, 1) << p_Hemisphere.rr(rows_rr-1, 2);
414
415 if (rows_rr != p_Hemisphere.np)
416 {
417 p_pStream->close();
418 std::cout << "Vertex information is incorrect."; //ToDo: throw error.
419 return false;
420 }
421// qDebug() << "Source Space Points; type:" << t_pTag->getType();
422
423 //=====================================================================
424 if(!p_Tree->find_tag(p_pStream, FIFF_MNE_SOURCE_SPACE_NORMALS, t_pTag))
425 {
426 p_pStream->close();
427 std::cout << "Vertex normals not found."; //ToDo: throw error.
428 return false;
429 }
430
431 p_Hemisphere.nn = t_pTag->toFloatMatrix().transpose();
432 qint32 rows_nn = p_Hemisphere.nn.rows();
433
434 if (rows_nn != p_Hemisphere.np)
435 {
436 p_pStream->close();
437 std::cout << "Vertex normal information is incorrect."; //ToDo: throw error.
438 return false;
439 }
440// qDebug() << "Source Space Normals; type:" << t_pTag->getType();
441
442 //=====================================================================
443 if (p_Hemisphere.ntri > 0)
444 {
445 if(!p_Tree->find_tag(p_pStream, FIFF_BEM_SURF_TRIANGLES, t_pTag))
446 {
447 if(!p_Tree->find_tag(p_pStream, FIFF_MNE_SOURCE_SPACE_TRIANGLES, t_pTag))
448 {
449 p_pStream->close();
450 std::cout << "Triangulation not found."; //ToDo: throw error.
451 return false;
452 }
453 else
454 {
455 p_Hemisphere.itris = t_pTag->toIntMatrix().transpose();
456 p_Hemisphere.itris.array() -= 1;//0 based indizes
457 }
458 }
459 else
460 {
461 p_Hemisphere.itris = t_pTag->toIntMatrix().transpose();
462 p_Hemisphere.itris.array() -= 1;//0 based indizes
463 }
464 if (p_Hemisphere.itris.rows() != p_Hemisphere.ntri)
465 {
466 p_pStream->close();
467 std::cout << "Triangulation information is incorrect."; //ToDo: throw error.
468 return false;
469 }
470 }
471 else
472 {
473 MatrixXi p_defaultMatrix(0, 0);
474 p_Hemisphere.itris = p_defaultMatrix;
475 }
476// qDebug() << "Triangles; type:" << t_pTag->getType() << "rows:" << p_Hemisphere.itris.rows() << "cols:" << p_Hemisphere.itris.cols();
477
478 //
479 // Which vertices are active
480 //
481 if(!p_Tree->find_tag(p_pStream, FIFF_MNE_SOURCE_SPACE_NUSE, t_pTag))
482 {
483 p_Hemisphere.nuse = 0;
484 p_Hemisphere.inuse = VectorXi::Zero(p_Hemisphere.nuse);
485 VectorXi p_defaultVector;
486 p_Hemisphere.vertno = p_defaultVector;
487 }
488 else
489 {
490 p_Hemisphere.nuse = *t_pTag->toInt();
491 if(!p_Tree->find_tag(p_pStream, FIFF_MNE_SOURCE_SPACE_SELECTION, t_pTag))
492 {
493 p_pStream->close();
494 std::cout << "Source selection information missing."; //ToDo: throw error.
495 return false;
496 }
497 p_Hemisphere.inuse = VectorXi(Map<VectorXi>(t_pTag->toInt(), t_pTag->size()/4, 1));//use copy constructor, for the sake of easy memory management
498
499 p_Hemisphere.vertno = VectorXi::Zero(p_Hemisphere.nuse);
500 if (p_Hemisphere.inuse.rows() != p_Hemisphere.np)
501 {
502 p_pStream->close();
503 std::cout << "Incorrect number of entries in source space selection."; //ToDo: throw error.
504 return false;
505 }
506 int pp = 0;
507 for (int p = 0; p < p_Hemisphere.np; ++p)
508 {
509 if(p_Hemisphere.inuse(p) == 1)
510 {
511 p_Hemisphere.vertno(pp) = p;
512 ++pp;
513 }
514 }
515 }
516// qDebug() << "Vertices; type:" << t_pTag->getType() << "nuse:" << p_Hemisphere.nuse;
517
518 //
519 // Use triangulation
520 //
521 FiffTag::SPtr t_pTag1;
522 FiffTag::SPtr t_pTag2;
523 if(!p_Tree->find_tag(p_pStream, FIFF_MNE_SOURCE_SPACE_NUSE_TRI, t_pTag1) || !p_Tree->find_tag(p_pStream, FIFF_MNE_SOURCE_SPACE_USE_TRIANGLES, t_pTag2))
524 {
525 MatrixX3i p_defaultMatrix;
526 p_Hemisphere.nuse_tri = 0;
527 p_Hemisphere.use_itris = p_defaultMatrix;
528 }
529 else
530 {
531 p_Hemisphere.nuse_tri = *t_pTag1->toInt();
532 p_Hemisphere.use_itris = t_pTag2->toIntMatrix().transpose();
533 p_Hemisphere.use_itris.array() -= 1; //0 based indizes
534 }
535// qDebug() << "triangulation; type:" << t_pTag2->getType() << "use_itris:" << p_Hemisphere.use_itris.rows()<< "x" << p_Hemisphere.use_itris.cols();
536
537 //
538 // Patch-related information
539 //
540 if(!p_Tree->find_tag(p_pStream, FIFF_MNE_SOURCE_SPACE_NEAREST, t_pTag1) || !p_Tree->find_tag(p_pStream, FIFF_MNE_SOURCE_SPACE_NEAREST_DIST, t_pTag2))
541 {
542 p_Hemisphere.nearest.clear();
543 }
544 else
545 {
546 //res.nearest = tag1.data + 1;
547 VectorXi nearestIdx = VectorXi(Map<VectorXi>(t_pTag1->toInt(), t_pTag1->size()/4, 1));
548 VectorXd nearestDist = VectorXd((Map<VectorXf>(t_pTag2->toFloat(), t_pTag1->size()/4, 1)).cast<double>());
549 p_Hemisphere.setNearestData(nearestIdx, nearestDist);
550 }
551
552// patch_info(p_Hemisphere.nearest, p_Hemisphere.pinfo);
553 if (p_Hemisphere.compute_patch_info())
554 printf("\tPatch information added...");
555
556 //
557 // Distances
558 //
559 if(!p_Tree->find_tag(p_pStream, FIFF_MNE_SOURCE_SPACE_DIST, t_pTag1) || !p_Tree->find_tag(p_pStream, FIFF_MNE_SOURCE_SPACE_DIST_LIMIT, t_pTag2))
560 {
561 p_Hemisphere.dist = FiffSparseMatrix();
562 p_Hemisphere.dist_limit = 0;
563 }
564 else
565 {
566 auto dist_lower = FiffSparseMatrix::fiff_get_float_sparse_matrix(t_pTag1);
567 if (dist_lower) {
568 auto dist_full = dist_lower->mne_add_upper_triangle_rcs();
569 if (dist_full) {
570 p_Hemisphere.dist = std::move(*dist_full);
571 }
572 }
573 p_Hemisphere.dist_limit = *t_pTag2->toFloat(); //ToDo Check if this is realy always a float and not a matrix
574 }
575
576 return true;
577}
578
579//=============================================================================================================
580
582{
583 return p_Hemisphere.compute_patch_info();
584}
585
586//=============================================================================================================
587
588bool MNESourceSpaces::complete_source_space_info(MNEHemisphere& p_Hemisphere)
589{
590 return p_Hemisphere.complete_source_space_info();
591}
592
593//=============================================================================================================
594
596{
597 for(size_t h = 0; h < m_sourceSpaces.size(); ++h)
598 {
599 printf("\tWrite a source space... ");
601 auto* hemi = dynamic_cast<MNEHemisphere*>(m_sourceSpaces[h].get());
602 if (hemi)
603 hemi->writeToStream(p_pStream);
605 printf("[done]\n");
606 }
607 printf("\t%zu source spaces written\n", m_sourceSpaces.size());
608}
609
610//=============================================================================================================
611
613{
614 if(static_cast<qint32>(m_sourceSpaces.size()) > idx)
615 return *m_sourceSpaces[idx];
616 else
617 {
618 qWarning("Warning: Index out of bound! Returning last element.");
619 return *m_sourceSpaces.back();
620 }
621}
622
623//=============================================================================================================
624
626{
627 if(static_cast<qint32>(m_sourceSpaces.size()) > idx)
628 return *m_sourceSpaces[idx];
629 else
630 {
631 qWarning("Warning: Index out of bound! Returning last element.");
632 return *m_sourceSpaces.back();
633 }
634}
635
636//=============================================================================================================
637
639{
640 if(idt.compare("lh") == 0)
641 return *m_sourceSpaces[0];
642 else if(idt.compare("rh") == 0)
643 return *m_sourceSpaces[1];
644 else
645 {
646 qWarning("Warning: Identifier is not 'lh' or 'rh'! Returning 'lh'.");
647 return *m_sourceSpaces[0];
648 }
649}
650
651//=============================================================================================================
652
654{
655 if(idt.compare("lh") == 0)
656 return *m_sourceSpaces[0];
657 else if(idt.compare("rh") == 0)
658 return *m_sourceSpaces[1];
659 else
660 {
661 qWarning("Warning: Identifier is not 'lh' or 'rh'! Returning 'lh'.");
662 return *m_sourceSpaces[0];
663 }
664}
665
666//=============================================================================================================
667
669{
670 if(idx >= 0 && idx < static_cast<qint32>(m_sourceSpaces.size()))
671 return dynamic_cast<MNEHemisphere*>(m_sourceSpaces[idx].get());
672 return nullptr;
673}
674
675//=============================================================================================================
676
678{
679 if(idx >= 0 && idx < static_cast<qint32>(m_sourceSpaces.size()))
680 return dynamic_cast<const MNEHemisphere*>(m_sourceSpaces[idx].get());
681 return nullptr;
682}
683
684//=============================================================================================================
685
686std::shared_ptr<MNESourceSpace>& MNESourceSpaces::at(qint32 idx)
687{
688 return m_sourceSpaces.at(idx);
689}
690
691//=============================================================================================================
692
693const std::shared_ptr<MNESourceSpace>& MNESourceSpaces::at(qint32 idx) const
694{
695 return m_sourceSpaces.at(idx);
696}
#define FIFF_MNE_SOURCE_SPACE_ID
#define FIFF_MNE_SOURCE_SPACE_DIST_LIMIT
#define FIFF_MNE_COORD_FRAME
#define FIFFV_MNE_SURF_UNKNOWN
#define FIFF_MNE_SOURCE_SPACE_SELECTION
#define FIFF_MNE_SOURCE_SPACE_USE_TRIANGLES
#define FIFF_MNE_SOURCE_SPACE_NUSE_TRI
#define FIFF_MNE_SOURCE_SPACE_NORMALS
#define FIFF_MNE_SOURCE_SPACE_NEAREST_DIST
#define FIFF_MNE_SOURCE_SPACE_DIST
#define FIFF_MNE_SOURCE_SPACE_POINTS
#define FIFF_MNE_SOURCE_SPACE_NTRI
#define FIFFB_MNE_SOURCE_SPACE
#define FIFF_MNE_SOURCE_SPACE_NPOINTS
#define FIFF_MNE_SOURCE_SPACE_TRIANGLES
#define FIFF_MNE_SOURCE_SPACE_NUSE
#define FIFF_MNE_SOURCE_SPACE_NEAREST
#define FIFF_BEM_SURF_TRIANGLES
Definition fiff_file.h:736
#define FIFF_BEM_SURF_NTRI
Definition fiff_file.h:734
MNEMath class declaration.
MNESourceSpaces class declaration.
MNENearest class declaration.
Label class declaration.
Core MNE data structures (source spaces, source estimates, hemispheres).
FreeSurfer surface and annotation I/O.
FIFF file I/O and data structures (raw, epochs, evoked, covariance, forward).
qint32 fiff_int_t
Definition fiff_types.h:89
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
Definition buildinfo.h:45
Coordinate transformation description.
QSharedPointer< FiffDirNode > SPtr
static FiffSparseMatrix::UPtr fiff_get_float_sparse_matrix(FIFFLIB::FiffTag::SPtr &tag)
FIFF File I/O routines.
fiff_long_t start_block(fiff_int_t kind)
fiff_long_t end_block(fiff_int_t kind, fiff_int_t next=FIFFV_NEXT_SEQ)
QSharedPointer< FiffStream > SPtr
QSharedPointer< FiffTag > SPtr
Definition fiff_tag.h:155
Freesurfer/MNE label.
Definition label.h:81
Eigen::VectorXi vertices
Definition label.h:166
qint32 hemi
Definition label.h:169
Hemisphere provides geometry information.
void writeToStream(FIFFLIB::FiffStream *p_pStream)
This defines a source space.
qint32 find_source_space_hemi() const
QList< Eigen::VectorXi > label_src_vertno_sel(const FSLIB::Label &p_label, Eigen::VectorXi &src_sel) const
void writeToStream(FIFFLIB::FiffStream *p_pStream)
MNESourceSpaces pick_regions(const QList< FSLIB::Label > &p_qListLabels) const
bool transform_source_space_to(FIFFLIB::fiff_int_t dest, FIFFLIB::FiffCoordTrans &trans)
MNEHemisphere * hemisphereAt(qint32 idx)
static bool patch_info(MNEHemisphere &p_Hemisphere)
static qint32 find_source_space_hemi(MNESourceSpace &p_SourceSpace)
MNESourceSpace & operator[](qint32 idx)
static bool readFromStream(FIFFLIB::FiffStream::SPtr &p_pStream, bool add_geom, MNESourceSpaces &p_SourceSpace)
std::shared_ptr< MNESourceSpace > & at(qint32 idx)
QList< Eigen::VectorXi > get_vertno() const
void setNearestData(const Eigen::VectorXi &nearestIdx, const Eigen::VectorXd &nearestDist)
FIFFLIB::FiffSparseMatrix dist
std::vector< MNENearest > nearest
static Eigen::VectorXi sort(Eigen::Matrix< T, Eigen::Dynamic, 1 > &v, bool desc=true)
Definition mnemath.h:499
static Eigen::VectorXi intersect(const Eigen::VectorXi &v1, const Eigen::VectorXi &v2, Eigen::VectorXi &idx_sel)
Definition mnemath.cpp:194