MNE-CPP  beta 1.0
mne_sourcespace.h
Go to the documentation of this file.
1 //=============================================================================================================
36 #ifndef MNE_SOURCESPACE_H
37 #define MNE_SOURCESPACE_H
38 
39 //*************************************************************************************************************
40 //=============================================================================================================
41 // MNE INCLUDES
42 //=============================================================================================================
43 
44 #include "mne_global.h"
45 #include "mne_hemisphere.h"
46 
47 
48 //*************************************************************************************************************
49 //=============================================================================================================
50 // FIFF INCLUDES
51 //=============================================================================================================
52 
53 #include <fiff/fiff_types.h>
54 #include <fiff/fiff_dir_tree.h>
55 #include <fiff/fiff.h>
56 
57 
58 //*************************************************************************************************************
59 //=============================================================================================================
60 // STL INCLUDES
61 //=============================================================================================================
62 
63 #include <algorithm>
64 #include <vector>
65 
66 
67 //*************************************************************************************************************
68 //=============================================================================================================
69 // QT INCLUDES
70 //=============================================================================================================
71 
72 #include <QList>
73 #include <QFile>
74 
75 
76 //*************************************************************************************************************
77 //=============================================================================================================
78 // FORWARD DECLARATIONS
79 //=============================================================================================================
80 
81 namespace FSLIB
82 {
83 class Label;
84 }
85 
86 
87 //*************************************************************************************************************
88 //=============================================================================================================
89 // DEFINE NAMESPACE MNE
90 //=============================================================================================================
91 
92 namespace MNELIB
93 {
94 
95 //*************************************************************************************************************
96 //=============================================================================================================
97 // USED NAMESPACES
98 //=============================================================================================================
99 
100 using namespace FSLIB;
101 using namespace FIFFLIB;
102 
103 
104 //*************************************************************************************************************
105 //=============================================================================================================
106 // FORWARD DECLARATIONS
107 //=============================================================================================================
108 
109 //=============================================================================================================
115 class MNESHARED_EXPORT MNESourceSpace
116 {
117 public:
118  typedef QSharedPointer<MNESourceSpace> SPtr;
119  typedef QSharedPointer<const MNESourceSpace> ConstSPtr;
121  //=========================================================================================================
125  MNESourceSpace();
126 
127  //=========================================================================================================
133  MNESourceSpace(const MNESourceSpace &p_MNESourceSpace);
134 
135  //=========================================================================================================
139  ~MNESourceSpace();
140 
141  //=========================================================================================================
145  void clear();
146 
147  //=========================================================================================================
153  inline bool isEmpty() const;
154 
155  //=========================================================================================================
165  static qint32 find_source_space_hemi(MNEHemisphere& p_Hemisphere);
166 
167  //=========================================================================================================
173  QList<VectorXi> get_vertno() const;
174 
175  //=========================================================================================================
185  QList<VectorXi> label_src_vertno_sel(const Label &p_label, VectorXi &src_sel) const;
186 
187  //=========================================================================================================
198  static bool patch_info(MNEHemisphere &p_Hemisphere);//VectorXi& nearest, QList<VectorXi>& pinfo);@param [in] nearest The nearest vector of the source space.@param [out] pinfo The requested patch information.
199 
200  //=========================================================================================================
208  MNESourceSpace pick_regions(const QList<Label> &p_qListLabels) const;
209 
210  //=========================================================================================================
223  static bool readFromStream(FiffStream::SPtr& p_pStream, bool add_geom, FiffDirTree& p_Tree, MNESourceSpace& p_SourceSpace);
224 
225  //=========================================================================================================
231  inline qint32 size() const;
232 
233  //=========================================================================================================
248  bool transform_source_space_to(fiff_int_t dest, FiffCoordTrans& trans);
249 
250  //=========================================================================================================
258  void writeToStream(FiffStream* p_pStream);
259 
260  //=========================================================================================================
268  MNEHemisphere& operator[] (qint32 idx);
269 
270  //=========================================================================================================
278  const MNEHemisphere& operator[] (qint32 idx) const;
279 
280  //=========================================================================================================
288  MNEHemisphere& operator[] (QString idt);
289 
290  //=========================================================================================================
298  const MNEHemisphere& operator[] (QString idt) const;
299 
300 private:
301 
302  //=========================================================================================================
312  static bool complete_source_space_info(MNEHemisphere& p_Hemisphere);
313 
314  //=========================================================================================================
322  static bool add_geometry_info(MNEHemisphere& p_Hemisphere);
323 
324  //=========================================================================================================
336  static bool read_source_space(FiffStream* p_pStream, const FiffDirTree& p_Tree, MNEHemisphere& p_Hemisphere);
337 
338 private:
339  QList<MNEHemisphere> m_qListHemispheres;
340 };
341 
342 //*************************************************************************************************************
343 //=============================================================================================================
344 // INLINE DEFINITIONS
345 //=============================================================================================================
346 
347 inline bool MNESourceSpace::isEmpty() const
348 {
349  return m_qListHemispheres.size() == 0;
350 }
351 
352 
353 //*************************************************************************************************************
354 
355 inline qint32 MNESourceSpace::size() const
356 {
357  return m_qListHemispheres.size();
358 }
359 
360 } // NAMESPACE
361 
362 
363 #endif // MNE_SOURCESPACE_H
QSharedPointer< const MNESourceSpace > ConstSPtr
Source Space descritpion.
Old fiff_type declarations - replace them.
FiffDirTree class declaration, which provides fiff dir tree processing methods.
MNEHemisphere class declaration.
QSharedPointer< FiffStream > SPtr
Definition: fiff_stream.h:132
Hemisphere provides geometry information.
Directory tree structure.
Definition: fiff_dir_tree.h:80
Definition: fiff.h:98
QSharedPointer< MNESourceSpace > SPtr
Coordinate transformation description.
FIFF class declaration, which provides static wrapper functions to stay consistent with mne matlab to...
Freesurfer/MNE label.
Definition: label.h:97
FIFF File I/O routines.
Definition: fiff_stream.h:129