v2.0.0
Loading...
Searching...
No Matches
mne.cpp
Go to the documentation of this file.
1//=============================================================================================================
37
38//=============================================================================================================
39// INCLUDES
40//=============================================================================================================
41
42#include "mne.h"
43#include <fiff/fiff.h>
44
45//=============================================================================================================
46// QT INCLUDES
47//=============================================================================================================
48
49#include <QDebug>
50
51//=============================================================================================================
52// USED NAMESPACES
53//=============================================================================================================
54
55using namespace MNELIB;
56using namespace Eigen;
57using namespace FIFFLIB;
58
59//=============================================================================================================
60// DEFINE MEMBER METHODS
61//=============================================================================================================
62
63// read_events, read_events_from_fif, read_events_from_ascii, write_events_to_fif,
64// write_events_to_ascii implementations moved to FiffEvents class in fiff_events.cpp
65
66//=============================================================================================================
67
69 fiff_int_t dest_comp,
70 bool keep_comp)
71{
72 // Set up projection
73 if (raw.info.projs.size() == 0) {
74 printf("No projector specified for these data\n");
75 } else {
76 // Activate the projection items
77 for (qint32 k = 0; k < raw.info.projs.size(); ++k) {
78 raw.info.projs[k].active = true;
79 }
80
81 printf("%lld projection items activated\n",raw.info.projs.size());
82 // Create the projector
83// fiff_int_t nproj = MNE::make_projector_info(raw.info, raw.proj); Using the member function instead
84 fiff_int_t nproj = raw.info.make_projector(raw.proj);
85
86 if (nproj == 0) {
87 printf("The projection vectors do not apply to these channels\n");
88 } else {
89 printf("Created an SSP operator (subspace dimension = %d)\n",nproj);
90 }
91 }
92
93 // Set up the CTF compensator
94// qint32 current_comp = MNE::get_current_comp(raw.info);
95 qint32 current_comp = raw.info.get_current_comp();
96 if (current_comp > 0)
97 printf("Current compensation grade : %d\n",current_comp);
98
99 if (keep_comp)
100 dest_comp = current_comp;
101
102 if (current_comp != dest_comp)
103 {
104 qDebug() << "This part needs to be debugged";
105 if(MNE::make_compensator(raw.info, current_comp, dest_comp, raw.comp))
106 {
107// raw.info.chs = MNE::set_current_comp(raw.info.chs,dest_comp);
108 raw.info.set_current_comp(dest_comp);
109 printf("Appropriate compensator added to change to grade %d.\n",dest_comp);
110 }
111 else
112 {
113 printf("Could not make the compensator\n");
114 return;
115 }
116 }
117}
118
119//=============================================================================================================
120
121// compute_proj implementation moved to FiffProj::compute_from_raw in fiff_proj.cpp
FIFF class declaration, which provides static wrapper functions to stay consistent with mne matlab to...
MNE class declaration, which provides static wrapper functions to stay consistent with mne matlab too...
Core MNE data structures (source spaces, source estimates, hemispheres).
FIFF file I/O and data structures (raw, epochs, evoked, covariance, forward).
qint32 fiff_int_t
Definition fiff_types.h:89
void set_current_comp(fiff_int_t value)
Definition fiff_info.h:280
qint32 make_projector(Eigen::MatrixXd &proj) const
Definition fiff_info.h:266
qint32 get_current_comp()
QList< FiffProj > projs
Definition fiff_info.h:256
FIFF raw measurement data.
Eigen::MatrixXd proj
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:211
static void setup_compensators(FIFFLIB::FiffRawData &raw, FIFFLIB::fiff_int_t dest_comp, bool keep_comp)
Definition mne.cpp:68