68 if (tmp_node->parent ==
nullptr)
70 tmp_node = tmp_node->parent;
84 if (tmp_node->parent ==
nullptr)
86 tmp_node = tmp_node->parent;
88 for (k = 0; k < tmp_node->nchild(); k++)
90 return (tmp_node->children[k]);
99 QList<FiffDirNode::SPtr> temp;
101 if (temp.size() == 0) {
116 QList<FiffDirNode::SPtr> temp;
127 std::unique_ptr<FiffId>&
id,
132 QList<FiffChInfo>& chp,
143 std::unique_ptr<FiffId>&
id,
148 QList<FiffChInfo>& chp,
153 QList<FiffChInfo> ch;
158 QList<FiffDirNode::SPtr> hpi;
162 bool found_meas_date =
false;
171 qCritical(
"Meas. block not found!");
176 qCritical(
"Meas. info not found!");
182 if (!meas->id.isEmpty()) {
183 id = std::make_unique<FiffId>();
184 id->version = meas->id.version;
185 id->machid[0] = meas->id.machid[0];
186 id->machid[1] = meas->id.machid[1];
187 id->time = meas->id.time;
194 for (k = 0; k < meas_info->nent(); k++) {
195 kind = meas_info->dir[k]->kind;
196 pos = meas_info->dir[k]->pos;
199 if (!stream->read_tag(t_pTag, pos))
201 *
nchan = *t_pTag->toInt();
203 for (j = 0; j < *
nchan; j++) {
207 to_find = to_find + *
nchan - 1;
211 if (!stream->read_tag(t_pTag, pos))
213 *
sfreq = *t_pTag->toFloat();
218 if (!stream->read_tag(t_pTag, pos))
225 if (!stream->read_tag(t_pTag, pos))
232 if (!stream->read_tag(t_pTag, pos))
235 this_ch = t_pTag->toChInfo();
237 qCritical(
"FIFF_CH_INFO : scan # out of range!");
240 ch[this_ch.
scanNo - 1] = this_ch;
245 if (!stream->read_tag(t_pTag, pos))
250 found_meas_date =
true;
255 if (!stream->read_tag(t_pTag, pos))
273 if (hpi.size() > 0 &&
trans.isEmpty())
274 for (k = 0; k < hpi[0]->nent(); k++)
276 if (!stream->read_tag(t_pTag, hpi[0]->dir[k]->pos))
295 qCritical(
"Not all essential tags were found!");
302 if (!found_meas_date) {
313int MNERawInfo::load(
const QString& name,
int allow_maxshield, std::unique_ptr<MNERawInfo>& infop)
319 QList<FiffChInfo> chs;
321 std::unique_ptr<FiffId>
id;
322 QList<FiffDirEntry::SPtr>
rawDir;
323 std::unique_ptr<MNERawInfo> info;
335 if (!stream->open()) {
340 if (raw->isEmpty()) {
341 if (allow_maxshield) {
343 if (raw->isEmpty()) {
344 qCritical(
"No raw data in this file.");
350 qCritical(
"No raw data in this file.");
378 info = std::make_unique<MNERawInfo>();
379 info->filename = name;
383 info->trans = std::make_unique<FiffCoordTrans>(
trans);
389 info->id = std::make_unique<FiffId>(*
id);
396 for (k = 0; k < raw->nent(); k++) {
405 info->buf_size = raw->dir[k]->size / (
nchan *
sizeof(double));
407 qCritical(
"We are not prepared to handle raw data type: %d", raw->dir[k]->type);
414 if (info->buf_size <= 0) {
415 qCritical(
"No raw data buffers available.");
420 info->ndir = raw->nent();
421 infop = std::move(info);
#define FIFFV_COORD_DEVICE
FIFF tag: the 16-byte tag header (kind, type, size, next) plus its decoded payload.
#define FIFFB_SMSH_RAW_DATA
#define FIFFB_CONTINUOUS_DATA
return FiffCoordTrans(from_frame, to_frame, R, moveVec)
Subset of FIFF measurement info needed by the legacy raw-data path.
Core MNE data structures (source spaces, source estimates, hemispheres).
FIFF file I/O, in-memory data structures and high-level readers/writers.
Per-channel FIFF descriptor: identifiers, kind, calibration, coil type, channel-frame coil position a...
Labelled 4x4 FIFF affine: source frame, destination frame, rotation, translation and cached inverse.
static FiffCoordTrans readFromTag(const std::unique_ptr< FiffTag > &tag)
QSharedPointer< FiffDirNode > SPtr
FIFF tag-stream reader/writer: wraps a QIODevice and exposes typed read_* / write_* methods for every...
QSharedPointer< FiffStream > SPtr
std::unique_ptr< FiffTag > UPtr
FIFF time stamp: Unix seconds plus a microsecond fraction matching the on-disk fiffTimeRec record.
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