v2.0.0
Loading...
Searching...
No Matches
mne.cpp
Go to the documentation of this file.
1//=============================================================================================================
23
24//=============================================================================================================
25// INCLUDES
26//=============================================================================================================
27
28#include "mne.h"
29#include <fiff/fiff.h>
30
31//=============================================================================================================
32// QT INCLUDES
33//=============================================================================================================
34
35#include <QDebug>
36
37//=============================================================================================================
38// USED NAMESPACES
39//=============================================================================================================
40
41using namespace MNELIB;
42using namespace Eigen;
43using namespace FIFFLIB;
44
45//=============================================================================================================
46// DEFINE MEMBER METHODS
47//=============================================================================================================
48
49// read_events, read_events_from_fif, read_events_from_ascii, write_events_to_fif,
50// write_events_to_ascii implementations moved to FiffEvents class in fiff_events.cpp
51
52//=============================================================================================================
53
55 fiff_int_t dest_comp,
56 bool keep_comp)
57{
58 // Set up projection
59 if (raw.info.projs.size() == 0) {
60 qInfo("No projector specified for these data\n");
61 } else {
62 // Activate the projection items
63 for (qint32 k = 0; k < raw.info.projs.size(); ++k) {
64 raw.info.projs[k].active = true;
65 }
66
67 qInfo("%lld projection items activated\n",raw.info.projs.size());
68 // Create the projector
69// fiff_int_t nproj = MNE::make_projector_info(raw.info, raw.proj); Using the member function instead
70 fiff_int_t nproj = raw.info.make_projector(raw.proj);
71
72 if (nproj == 0) {
73 qInfo("The projection vectors do not apply to these channels\n");
74 } else {
75 qInfo("Created an SSP operator (subspace dimension = %d)\n",nproj);
76 }
77 }
78
79 // Set up the CTF compensator
80// qint32 current_comp = MNE::get_current_comp(raw.info);
81 qint32 current_comp = raw.info.get_current_comp();
82 if (current_comp > 0)
83 qInfo("Current compensation grade : %d\n",current_comp);
84
85 if (keep_comp)
86 dest_comp = current_comp;
87
88 if (current_comp != dest_comp)
89 {
90 qDebug() << "This part needs to be debugged";
91 if(MNE::make_compensator(raw.info, current_comp, dest_comp, raw.comp))
92 {
93// raw.info.chs = MNE::set_current_comp(raw.info.chs,dest_comp);
94 raw.info.set_current_comp(dest_comp);
95 qInfo("Appropriate compensator added to change to grade %d.\n",dest_comp);
96 }
97 else
98 {
99 qCritical("Could not make the compensator\n");
100 return;
101 }
102 }
103}
104
105//=============================================================================================================
106
107// compute_proj implementation moved to FiffProj::compute_from_raw in fiff_proj.cpp
Static MNE facade providing matlab-toolbox-compatible high-level helpers across MNELIB.
Static MATLAB-style FIFF facade: thin wrapper functions kept for parity with the historical mne-matla...
Core MNE data structures (source spaces, source estimates, hemispheres).
FIFF file I/O, in-memory data structures and high-level readers/writers.
void set_current_comp(fiff_int_t value)
Definition fiff_info.h:301
qint32 make_projector(Eigen::MatrixXd &proj) const
Definition fiff_info.h:287
qint32 get_current_comp()
QList< FiffProj > projs
Definition fiff_info.h:277
FiffCtfComp comp
Eigen::MatrixXd proj
FiffInfo info
static bool make_compensator(const FIFFLIB::FiffInfo &info, FIFFLIB::fiff_int_t from, FIFFLIB::fiff_int_t to, FIFFLIB::FiffCtfComp &ctf_comp, bool exclude_comp_chs=false)
Definition mne.h:187
static void setup_compensators(FIFFLIB::FiffRawData &raw, FIFFLIB::fiff_int_t dest_comp, bool keep_comp)
Definition mne.cpp:54