88 if (tmp_node->parent ==
nullptr)
90 tmp_node = tmp_node->parent;
104 if (tmp_node->parent ==
nullptr)
106 tmp_node = tmp_node->parent;
108 for (k = 0; k < tmp_node->nchild(); k++)
110 return (tmp_node->children[k]);
119 QList<FiffDirNode::SPtr> temp;
121 if (temp.size() == 0) {
137 QList<FiffDirNode::SPtr> temp;
148 std::unique_ptr<FiffId>&
id,
153 QList<FiffChInfo>& chp,
164 std::unique_ptr<FiffId>&
id,
169 QList<FiffChInfo>& chp,
174 QList<FiffChInfo> ch;
179 QList<FiffDirNode::SPtr> hpi;
183 bool found_meas_date =
false;
192 qCritical (
"Meas. block not found!");
197 qCritical (
"Meas. info not found!");
203 if (!meas->id.isEmpty()) {
204 id = std::make_unique<FiffId>();
205 id->version = meas->id.version;
206 id->machid[0] = meas->id.machid[0];
207 id->machid[1] = meas->id.machid[1];
208 id->time = meas->id.time;
215 for (k = 0; k < meas_info->nent(); k++) {
216 kind = meas_info->dir[k]->kind;
217 pos = meas_info->dir[k]->pos;
221 if (!stream->read_tag(t_pTag,pos))
223 *
nchan = *t_pTag->toInt();
225 for (j = 0; j < *
nchan; j++) {
229 to_find = to_find + *
nchan - 1;
233 if (!stream->read_tag(t_pTag,pos))
235 *
sfreq = *t_pTag->toFloat();
240 if (!stream->read_tag(t_pTag,pos))
247 if (!stream->read_tag(t_pTag,pos))
254 if (!stream->read_tag(t_pTag,pos))
257 this_ch = t_pTag->toChInfo();
259 qCritical (
"FIFF_CH_INFO : scan # out of range!");
263 ch[this_ch.
scanNo-1] = this_ch;
268 if (!stream->read_tag(t_pTag,pos))
273 found_meas_date =
true;
278 if (!stream->read_tag(t_pTag,pos))
296 if (hpi.size() > 0 &&
trans.isEmpty())
297 for (k = 0; k < hpi[0]->nent(); k++)
299 if (!stream->read_tag(t_pTag,hpi[0]->dir[k]->pos))
318 qCritical (
"Not all essential tags were found!");
325 if (!found_meas_date) {
336int MNERawInfo::load(
const QString& name,
int allow_maxshield, std::unique_ptr<MNERawInfo>& infop)
342 QList<FiffChInfo> chs;
344 std::unique_ptr<FiffId>
id;
345 QList<FiffDirEntry::SPtr>
rawDir;
346 std::unique_ptr<MNERawInfo> info;
358 if(!stream->open()) {
362 if (raw->isEmpty()) {
363 if (allow_maxshield) {
365 if (raw->isEmpty()) {
366 qCritical(
"No raw data in this file.");
372 qCritical(
"No raw data in this file.");
398 info = std::make_unique<MNERawInfo>();
399 info->filename = name;
403 info->trans = std::make_unique<FiffCoordTrans>(
trans);
409 info->id = std::make_unique<FiffId>(*
id);
416 for (k = 0; k < raw->nent(); k++) {
425 qCritical(
"We are not prepared to handle raw data type: %d",raw->dir[k]->type);
431 if (info->buf_size <= 0) {
432 qCritical(
"No raw data buffers available.");
436 info->ndir = raw->nent();
437 infop = std::move(info);
#define FIFFB_SMSH_RAW_DATA
#define FIFFB_CONTINUOUS_DATA
FiffTag class declaration, which provides fiff tag I/O and processing methods.
#define FIFFV_COORD_DEVICE
MNERawInfo class declaration.
Core MNE data structures (source spaces, source estimates, hemispheres).
FIFF file I/O and data structures (raw, epochs, evoked, covariance, forward).
Coordinate transformation description.
QSharedPointer< FiffDirNode > SPtr
QSharedPointer< FiffStream > SPtr
std::unique_ptr< FiffTag > UPtr
Time stamp record storing seconds and microseconds since epoch.
FIFFLIB::FiffTime start_time
QList< FIFFLIB::FiffDirEntry::SPtr > rawDir
MNERawInfo()
Constructs a default MNERawInfo.
static FIFFLIB::FiffDirNode::SPtr find_maxshield(const FIFFLIB::FiffDirNode::SPtr &node)
static FIFFLIB::FiffDirNode::SPtr find_meas_info(const FIFFLIB::FiffDirNode::SPtr &node)
static int load(const QString &name, int allow_maxshield, std::unique_ptr< MNERawInfo > &infop)
static int get_meas_info(FIFFLIB::FiffStream::SPtr &stream, FIFFLIB::FiffDirNode::SPtr &node, std::unique_ptr< FIFFLIB::FiffId > &id, int *nchan, float *sfreq, float *highpass, float *lowpass, QList< FIFFLIB::FiffChInfo > &chp, FIFFLIB::FiffCoordTrans &trans, FIFFLIB::FiffTime &start_time)
static FIFFLIB::FiffDirNode::SPtr find_raw(const FIFFLIB::FiffDirNode::SPtr &node)
static FIFFLIB::FiffDirNode::SPtr find_meas(const FIFFLIB::FiffDirNode::SPtr &node)
std::unique_ptr< FIFFLIB::FiffId > id
~MNERawInfo()
Destroys the MNERawInfo and releases owned resources.
std::unique_ptr< FIFFLIB::FiffCoordTrans > trans
static FiffCoordTrans readFromTag(const std::unique_ptr< FiffTag > &tag)