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) {
117 QList<FiffDirNode::SPtr> temp;
128 std::unique_ptr<FiffId>&
id,
133 QList<FiffChInfo>& chp,
144 std::unique_ptr<FiffId>&
id,
149 QList<FiffChInfo>& chp,
154 QList<FiffChInfo> ch;
159 QList<FiffDirNode::SPtr> hpi;
162 fiff_int_t kind, pos;
163 bool found_meas_date =
false;
172 qCritical (
"Meas. block not found!");
177 qCritical (
"Meas. info not found!");
183 if (!meas->id.isEmpty()) {
184 id = std::make_unique<FiffId>();
185 id->version = meas->id.version;
186 id->machid[0] = meas->id.machid[0];
187 id->machid[1] = meas->id.machid[1];
188 id->time = meas->id.time;
195 for (k = 0; k < meas_info->nent(); k++) {
196 kind = meas_info->dir[k]->kind;
197 pos = meas_info->dir[k]->pos;
201 if (!stream->read_tag(t_pTag,pos))
203 *
nchan = *t_pTag->toInt();
205 for (j = 0; j < *
nchan; j++) {
209 to_find = to_find + *
nchan - 1;
213 if (!stream->read_tag(t_pTag,pos))
215 *
sfreq = *t_pTag->toFloat();
220 if (!stream->read_tag(t_pTag,pos))
227 if (!stream->read_tag(t_pTag,pos))
234 if (!stream->read_tag(t_pTag,pos))
237 this_ch = t_pTag->toChInfo();
239 qCritical (
"FIFF_CH_INFO : scan # out of range!");
243 ch[this_ch.
scanNo-1] = this_ch;
248 if (!stream->read_tag(t_pTag,pos))
253 found_meas_date =
true;
258 if (!stream->read_tag(t_pTag,pos))
276 if (hpi.size() > 0 &&
trans.isEmpty())
277 for (k = 0; k < hpi[0]->nent(); k++)
279 if (!stream->read_tag(t_pTag,hpi[0]->dir[k]->pos))
298 qCritical (
"Not all essential tags were found!");
305 if (!found_meas_date) {
316int MNERawInfo::load(
const QString& name,
int allow_maxshield, std::unique_ptr<MNERawInfo>& infop)
322 QList<FiffChInfo> chs;
324 std::unique_ptr<FiffId>
id;
325 QList<FiffDirEntry::SPtr>
rawDir;
326 std::unique_ptr<MNERawInfo> info;
338 if(!stream->open()) {
342 if (raw->isEmpty()) {
343 if (allow_maxshield) {
345 if (raw->isEmpty()) {
346 qCritical(
"No raw data in this file.");
352 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++) {
399 info->buf_size = raw->dir[k]->size/(
nchan*
sizeof(fiff_short_t));
401 info->buf_size = raw->dir[k]->size/(
nchan*
sizeof(fiff_float_t));
403 info->buf_size = raw->dir[k]->size/(
nchan*
sizeof(fiff_int_t));
405 qCritical(
"We are not prepared to handle raw data type: %d",raw->dir[k]->type);
411 if (info->buf_size <= 0) {
412 qCritical(
"No raw data buffers available.");
416 info->ndir = raw->nent();
417 infop = std::move(info);
Subset of FIFF measurement info needed by the legacy raw-data path.
return FiffCoordTrans(from_frame, to_frame, R, moveVec)
#define FIFFV_COORD_DEVICE
#define FIFFB_SMSH_RAW_DATA
#define FIFFB_CONTINUOUS_DATA
FIFF tag: the 16-byte tag header (kind, type, size, next) plus its decoded payload.
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