v2.0.0
Loading...
Searching...
No Matches
mne_source_space.h
Go to the documentation of this file.
1//=============================================================================================================
22
23#ifndef MNESOURCESPACE_H
24#define MNESOURCESPACE_H
25
26//=============================================================================================================
27// INCLUDES
28//=============================================================================================================
29
30#include "mne_global.h"
32
33//=============================================================================================================
34// EIGEN INCLUDES
35//=============================================================================================================
36
37#include <Eigen/Core>
38
39//=============================================================================================================
40// STL INCLUDES
41//=============================================================================================================
42
43#include <memory>
44
45//=============================================================================================================
46// DEFINE NAMESPACE MNELIB
47//=============================================================================================================
48
49namespace MNELIB
50{
51
52//=============================================================================================================
53// FORWARD DECLARATIONS
54//=============================================================================================================
55
56class MNEHemisphere;
57
58//=============================================================================================================
69{
70public:
71 using SPtr = std::shared_ptr<MNESourceSpace>;
72 using ConstSPtr = std::shared_ptr<const MNESourceSpace>;
73 using UPtr = std::unique_ptr<MNESourceSpace>;
74
75 //=========================================================================================================
81 MNESourceSpace(int np = 0);
82
83 //=========================================================================================================
87 ~MNESourceSpace() override;
88
89 //=========================================================================================================
95 virtual MNESourceSpace::SPtr clone() const;
96
97 //=========================================================================================================
101 void enable_all_sources();
102
103 //=========================================================================================================
110 bool is_left_hemi() const;
111
112 //=========================================================================================================
119 qint32 find_source_space_hemi() const;
120
121 //=========================================================================================================
127 void update_inuse(Eigen::VectorXi new_inuse);
128
129 //=========================================================================================================
137
138 //=========================================================================================================
144 int add_patch_stats();
145
146 //=========================================================================================================
152
153 //=========================================================================================================
161 static std::unique_ptr<MNESourceSpace> create_source_space(int np);
162
163 //=========================================================================================================
171 static std::unique_ptr<MNESourceSpace> load_surface(const QString& surf_file,
172 const QString& curv_file);
173
174 //=========================================================================================================
184 static std::unique_ptr<MNESourceSpace> load_surface_geom(const QString& surf_file,
185 const QString& curv_file,
186 bool add_geometry,
187 bool check_too_many_neighbors);
188
189 //=========================================================================================================
203 static std::unique_ptr<MNESourceSpace> make_volume_source_space(const MNESurface& surf,
204 float grid,
205 float exclude,
206 float mindist);
207
208 //=========================================================================================================
209 // Source-space filtering, I/O, and label helpers (moved from MNESurfaceOrVolume)
210 //=========================================================================================================
211
212 static int filter_source_spaces(const MNESurface& surf,
213 float limit,
214 const FIFFLIB::FiffCoordTrans& mri_head_t,
215 std::vector<std::unique_ptr<MNESourceSpace>>& spaces,
216 QTextStream* filtered);
217
218 static void filter_source_space(FilterThreadArg* arg);
219
220 static int filter_source_spaces(float limit,
221 const QString& bemfile,
222 const FIFFLIB::FiffCoordTrans& mri_head_t,
223 std::vector<std::unique_ptr<MNESourceSpace>>& spaces,
224 QTextStream* filtered,
225 bool use_threads);
226
227 static int read_source_spaces(const QString& name,
228 std::vector<std::unique_ptr<MNESourceSpace>>& spaces);
229
232 std::vector<std::unique_ptr<MNESourceSpace>>& spaces);
233
234 static int restrict_sources_to_labels(std::vector<std::unique_ptr<MNESourceSpace>>& spaces,
235 const QStringList& labels,
236 int nlabel);
237
238 static int read_label(const QString& label,
239 Eigen::VectorXi& sel);
240
241 //=========================================================================================================
250 int writeToStream(FIFFLIB::FiffStream::SPtr& stream, bool selected_only) const;
251
252 //=========================================================================================================
267 static MNEHemisphere icoDownsample(const MNEHemisphere& hemi, int icoGrade);
268
269 //=========================================================================================================
281 static QList<Eigen::VectorXi> gradeToVertices(const QString& subjectsDir, const QString& subject, int grade);
282
283private:
292 int writeVolumeInfo(FIFFLIB::FiffStream::SPtr& stream, bool selected_only) const;
293};
294
295//=============================================================================================================
296// INLINE DEFINITIONS
297//=============================================================================================================
298} // NAMESPACE MNELIB
299
300#endif // MNESOURCESPACE_H
Discriminated geometry container that can represent either a triangulated surface or a discrete/volum...
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).
Labelled 4x4 FIFF affine: source frame, destination frame, rotation, translation and cached inverse.
QSharedPointer< FiffStream > SPtr
Thread-local arguments for parallel raw data filtering (channel range, filter kernel,...
Hemisphere provides geometry information.
virtual MNESourceSpace::SPtr clone() const
std::unique_ptr< MNESourceSpace > UPtr
static std::unique_ptr< MNESourceSpace > load_surface(const QString &surf_file, const QString &curv_file)
qint32 find_source_space_hemi() const
static QList< Eigen::VectorXi > gradeToVertices(const QString &subjectsDir, const QString &subject, int grade)
std::shared_ptr< MNESourceSpace > SPtr
static std::unique_ptr< MNESourceSpace > make_volume_source_space(const MNESurface &surf, float grid, float exclude, float mindist)
static int restrict_sources_to_labels(std::vector< std::unique_ptr< MNESourceSpace > > &spaces, const QStringList &labels, int nlabel)
static int filter_source_spaces(const MNESurface &surf, float limit, const FIFFLIB::FiffCoordTrans &mri_head_t, std::vector< std::unique_ptr< MNESourceSpace > > &spaces, QTextStream *filtered)
static int read_source_spaces(const QString &name, std::vector< std::unique_ptr< MNESourceSpace > > &spaces)
static std::unique_ptr< MNESourceSpace > create_source_space(int np)
static std::unique_ptr< MNESourceSpace > load_surface_geom(const QString &surf_file, const QString &curv_file, bool add_geometry, bool check_too_many_neighbors)
static MNEHemisphere icoDownsample(const MNEHemisphere &hemi, int icoGrade)
static void filter_source_space(FilterThreadArg *arg)
int writeToStream(FIFFLIB::FiffStream::SPtr &stream, bool selected_only) const
std::shared_ptr< const MNESourceSpace > ConstSPtr
int transform_source_space(const FIFFLIB::FiffCoordTrans &t)
static int read_label(const QString &label, Eigen::VectorXi &sel)
static int transform_source_spaces_to(int coord_frame, const FIFFLIB::FiffCoordTrans &t, std::vector< std::unique_ptr< MNESourceSpace > > &spaces)
void update_inuse(Eigen::VectorXi new_inuse)
Lightweight triangulated surface (vertices, triangles, normals).
Definition mne_surface.h:68
MNESurfaceOrVolume()
Constructs the MNE FsSurface or Volume.