v2.0.0
Loading...
Searching...
No Matches
mne_proj_op.h
Go to the documentation of this file.
1//=============================================================================================================
18
19#ifndef MNEPROJOP_H
20#define MNEPROJOP_H
21
22//=============================================================================================================
23// INCLUDES
24//=============================================================================================================
25
26#include "mne_global.h"
27#include "mne_named_matrix.h"
28#include "mne_proj_item.h"
29
30#include <fiff/fiff_types.h>
31#include <fiff/fiff_stream.h>
32#include <fiff/fiff_dir_node.h>
33
34//=============================================================================================================
35// EIGEN INCLUDES
36//=============================================================================================================
37
38#include <Eigen/Core>
39
40//=============================================================================================================
41// QT INCLUDES
42//=============================================================================================================
43
44#include <QSharedPointer>
45#include <QTextStream>
46
47#include <memory>
48
49//=============================================================================================================
50// DEFINE NAMESPACE MNELIB
51//=============================================================================================================
52
53namespace MNELIB
54{
55
56class MNECovMatrix;
57
58//=============================================================================================================
71{
72public:
73 typedef QSharedPointer<MNEProjOp> SPtr;
74 typedef QSharedPointer<const MNEProjOp> ConstSPtr;
75
76 //=========================================================================================================
82 MNEProjOp();
83
84 //=========================================================================================================
88 ~MNEProjOp();
89
90 //=========================================================================================================
97 void free_proj();
98
109
120 void add_item_active(const MNENamedMatrix* vecs, int kind, const QString& desc, bool is_active);
121
131 void add_item(const MNENamedMatrix* vecs, int kind, const QString& desc);
132
140 std::unique_ptr<MNEProjOp> dup() const;
141
154 static std::unique_ptr<MNEProjOp> create_average_eeg_ref(const QList<FIFFLIB::FiffChInfo>& chs, int nch);
155
166 int affect(const QStringList& list, int nlist);
167
178 int affect_chs(const QList<FIFFLIB::FiffChInfo>& chs, int nChan);
179
192 int project_vector(Eigen::Ref<Eigen::VectorXf> vec, bool do_complement);
193
203 static std::unique_ptr<MNEProjOp> read_from_node(FIFFLIB::FiffStream::SPtr& stream,
204 const FIFFLIB::FiffDirNode::SPtr& start);
205
215 static std::unique_ptr<MNEProjOp> read(const QString& name);
216
235 static bool makeProjection(const QList<QString>& projnames,
236 const QList<FIFFLIB::FiffChInfo>& chs,
237 int nch,
238 std::unique_ptr<MNEProjOp>& result);
239
250 void report_data(QTextStream& out, const QString& tag, bool list_data, const QStringList& exclude);
251
259 void report(QTextStream& out, const QString& tag);
260
261 //=========================================================================================================
271 int assign_channels(const QStringList& list, int nlist);
272
273 //=========================================================================================================
284 int make_proj_bad(const QStringList& bad);
285
286 //=========================================================================================================
293 int make_proj();
294
295 //=========================================================================================================
304 int project_dvector(Eigen::Ref<Eigen::VectorXd> vec, bool do_complement);
305
306 //=========================================================================================================
315 int apply_cov(MNECovMatrix* c);
316
317public:
318 QList<MNELIB::MNEProjItem> items;
319 int nitems;
320 QStringList names;
321 int nch;
322 int nvec;
323 Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> proj_data;
324};
325
326} // NAMESPACE MNELIB
327
328#endif // MNEPROJOP_H
FIFF binary tag-stream layer: wraps a QIODevice to read and write FIFF tags, directories,...
Recursive node of the parsed FIFF block tree (FIFFB_* hierarchy with directory entries and children).
Primitive scalar typedefs and forward-compatible aliases backing the FIFF type system.
Row/column-labelled dense matrix used wherever FIFF stores per-channel data.
Single SSP projection vector with kind/active flag and channel labels.
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).
QSharedPointer< FiffDirNode > SPtr
QSharedPointer< FiffStream > SPtr
Covariance matrix storage.
A dense matrix with named rows and columns.
Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > proj_data
QStringList names
void report_data(QTextStream &out, const QString &tag, bool list_data, const QStringList &exclude)
void free_proj()
Release the compiled projector data.
static std::unique_ptr< MNEProjOp > read(const QString &name)
int affect_chs(const QList< FIFFLIB::FiffChInfo > &chs, int nChan)
void add_item_active(const MNENamedMatrix *vecs, int kind, const QString &desc, bool is_active)
Add a projection item with an explicit active/inactive state.
static bool makeProjection(const QList< QString > &projnames, const QList< FIFFLIB::FiffChInfo > &chs, int nch, std::unique_ptr< MNEProjOp > &result)
Load and combine SSP projection operators from files for the selected channels.
int apply_cov(MNECovMatrix *c)
int affect(const QStringList &list, int nlist)
MNEProjOp()
Default constructor.
int make_proj_bad(const QStringList &bad)
QSharedPointer< const MNEProjOp > ConstSPtr
Definition mne_proj_op.h:74
MNEProjOp * combine(MNEProjOp *from)
Append all projection items from another operator.
int project_vector(Eigen::Ref< Eigen::VectorXf > vec, bool do_complement)
int project_dvector(Eigen::Ref< Eigen::VectorXd > vec, bool do_complement)
QSharedPointer< MNEProjOp > SPtr
Definition mne_proj_op.h:73
void add_item(const MNENamedMatrix *vecs, int kind, const QString &desc)
Add a projection item that is active by default.
std::unique_ptr< MNEProjOp > dup() const
Create a deep copy of this projection operator.
int assign_channels(const QStringList &list, int nlist)
static std::unique_ptr< MNEProjOp > create_average_eeg_ref(const QList< FIFFLIB::FiffChInfo > &chs, int nch)
Create an average EEG reference projector.
static std::unique_ptr< MNEProjOp > read_from_node(FIFFLIB::FiffStream::SPtr &stream, const FIFFLIB::FiffDirNode::SPtr &start)
Read all linear projection items from a FIFF tree node.
QList< MNELIB::MNEProjItem > items
void report(QTextStream &out, const QString &tag)