74 qint32 kind = this->
chs[idx].kind;
100 throw std::invalid_argument(
"Unknown channel type");
120RowVectorXi
FiffInfoBase::pick_types(
const QString meg,
bool eeg,
bool stim,
const QStringList& include,
const QStringList& exclude)
const
122 RowVectorXi pick = RowVectorXi::Zero(this->
nchan);
126 for(k = 0; k < this->
nchan; ++k)
128 kind = this->
chs[k].kind;
132 if(meg.compare(
"all") == 0) {
134 }
else if(meg.compare(
"grad") == 0 && this->chs[k].unit ==
FIFF_UNIT_T_M) {
136 }
else if(meg.compare(
"mag") == 0 && this->chs[k].unit ==
FIFF_UNIT_T) {
148 QStringList myinclude;
149 for(k = 0; k < this->nchan; ++k)
158 if (include.size() > 0)
160 for (k = 0; k < include.size(); ++k)
162 myinclude << include[k];
179 return this->
pick_types(QString(
"all"), eeg, stim, include, exclude);
181 return this->
pick_types(QString(
""), eeg, stim, include, exclude);
188 RowVectorXi sel = RowVectorXi::Zero(
ch_names.size());
190 QStringList t_includedSelection;
193 for(qint32 k = 0; k <
ch_names.size(); ++k)
195 if( (include.size() == 0 || include.contains(
ch_names[k])) && !exclude.contains(
ch_names[k]))
198 if(!t_includedSelection.contains(
ch_names[k]))
206 sel.conservativeResize(count);
223 for(qint32 i = 0; i < sel->size(); ++i)
226 res.
chs.append(this->
chs[idx]);
229 res.
nchan = sel->size();
237 QList<FiffChInfo>& meg_compp,
239 QList<FiffChInfo>& eegp,
244 for (
int k = 0; k <
nchan; k++) {
249 meg_compp.append(
chs[k]);
264 QStringList lChannelTypes;
266 for(
int i = 0; i <
chs.size(); ++i)
268 switch(
chs.at(i).kind) {
271 if(!lChannelTypes.contains(
"grad")) {
272 lChannelTypes <<
"grad";
275 if(!lChannelTypes.contains(
"mag")) {
276 lChannelTypes <<
"mag";
283 if(!lChannelTypes.contains(
"ref_meg")) {
284 lChannelTypes <<
"ref_meg";
290 if(!lChannelTypes.contains(
"eeg")) {
291 lChannelTypes <<
"eeg";
297 if(!lChannelTypes.contains(
"ecg")) {
298 lChannelTypes <<
"ecg";
303 if(!lChannelTypes.contains(
"emg")) {
304 lChannelTypes <<
"emg";
309 if(!lChannelTypes.contains(
"eog")) {
310 lChannelTypes <<
"eog";
316 if(!lChannelTypes.contains(
"stim")) {
317 lChannelTypes <<
"stim";
323 if(!lChannelTypes.contains(
"misc")) {
324 lChannelTypes <<
"misc";
331 return lChannelTypes;
338 if (name.isEmpty()) {
344 if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
345 qCritical() <<
"Cannot open bad channel file:" << name;
350 QTextStream in(&file);
351 while (!in.atEnd()) {
352 QString line = in.readLine().trimmed();
353 if (line.isEmpty() || line.startsWith(
'#'))
358 if (file.error() != QFileDevice::NoError) {
359 qCritical() <<
"Error reading bad channel file:" << name;
Minimal measurement-info subset (channel list, sampling rate, basic transforms) shared by FIFF reader...
FIFF file I/O, in-memory data structures and high-level readers/writers.
Labelled 4x4 FIFF affine: source frame, destination frame, rotation, translation and cached inverse.
128-bit FIFF identifier: hardware machine ID plus creation time, stamped on every file and block.
QList< FiffCoordTrans > all_coord_trans
static Eigen::RowVectorXi pick_channels(const QStringList &ch_names, const QStringList &include=defaultQStringList, const QStringList &exclude=defaultQStringList)
QString channel_type(qint32 idx) const
FiffInfoBase pick_info(const Eigen::RowVectorXi *sel=nullptr) const
FiffCoordTrans ctf_head_t
QStringList get_channel_types()
Eigen::RowVectorXi pick_types(const QString meg, bool eeg=false, bool stim=false, const QStringList &include=defaultQStringList, const QStringList &exclude=defaultQStringList) const
void mne_read_meg_comp_eeg_ch_info(QList< FiffChInfo > &megp, int &nmegp, QList< FiffChInfo > &meg_compp, int &nmeg_compp, QList< FiffChInfo > &eegp, int &neegp, FiffCoordTrans &meg_head_t, FiffId &idp) const
static bool readBadChannelsFromFile(const QString &name, QStringList &listOut)
FiffCoordTrans dev_head_t