83: QDataStream(p_pIODevice)
85 this->setFloatingPointPrecision(QDataStream::SinglePrecision);
86 this->setByteOrder(QDataStream::BigEndian);
87 this->setVersion(QDataStream::Qt_5_0);
93 QIODevice::OpenMode mode)
96 this->setFloatingPointPrecision(QDataStream::SinglePrecision);
97 this->setByteOrder(QDataStream::BigEndian);
98 this->setVersion(QDataStream::Qt_5_0);
105 QFile* t_pFile = qobject_cast<QFile*>(this->device());
108 p_sFileName = t_pFile->fileName();
110 p_sFileName = QString(
"TCPSocket");
165 *
this << (qint32)datasize;
184 aspect_kinds.clear();
185 QList<FiffDirNode::SPtr>::ConstIterator ev;
190 for (ev = evoked_node.begin(); ev != evoked_node.end(); ++ev) {
191 for (k = 0; k < (*ev)->nent(); ++k) {
192 kind = (*ev)->dir[k]->kind;
193 pos = (*ev)->dir[k]->pos;
196 comments.append(t_pTag->toString());
200 for (k = 0; k < my_aspect->nent(); ++k) {
201 kind = my_aspect->dir[k]->kind;
202 pos = my_aspect->dir[k]->pos;
205 aspect_kinds.append(*t_pTag->toInt());
210 if (comments.size() != aspect_kinds.size() || comments.size() == 0) {
211 qWarning(
"Dataset names in FIF file could not be found.");
216 for (k = 0; k < aspect_kinds.size(); ++k) {
217 t += QString(
"%1 - \"%2\" (").arg(k).arg(comments[k]);
219 t += QString(
"FIFFV_ASPECT_AVERAGE)\n");
221 t += QString(
"FIFFV_ASPECT_STD_ERR)\n");
223 t += QString(
"unknown)\n");
239 if (!this->device()->
open(mode)) {
240 qCritical(
"Cannot open %s\n", t_sFileName.toUtf8().constData());
244 if (!check_beginning(t_pTag))
251 qCritical(
"FIFF file should start with FIFF_FILE_ID!");
252 this->device()->close();
255 m_id = t_pTag->toFiffID();
259 qWarning(
"Fiff::open: file does have a directory pointer");
260 this->device()->close();
267 qInfo(
"Creating tag directory for %s...", t_sFileName.toUtf8().constData());
269 qint32 dirpos = *t_pTag->toInt();
275 m_dir = this->make_dir(&ok);
277 qCritical(
"Could not create tag directory!");
281 if (!this->
read_tag(t_pTag, dirpos)) {
282 qCritical(
"Could not read the tag directory (file probably damaged)!");
285 m_dir = t_pTag->toDirEntry();
291 if (m_dir[m_dir.size() - 2]->kind ==
FIFF_DIR) {
293 m_dir[m_dir.size() - 1]->kind = -1;
294 m_dir[m_dir.size() - 1]->type = -1;
295 m_dir[m_dir.size() - 1]->size = -1;
296 m_dir[m_dir.size() - 1]->pos = -1;
302 if ((this->m_dirtree = this->
make_subtree(m_dir)) ==
nullptr)
305 this->m_dirtree->parent.clear();
310 this->device()->seek(SEEK_SET);
318 if (this->device()->isOpen())
319 this->device()->close();
332 QList<FiffDirEntry::SPtr>
dir;
335 node->dir_tree = dentry;
341 if (!this->
read_tag(t_pTag, dentry[current]->pos))
344 node->type = *t_pTag->toInt();
346 node->id = this->
id();
351 for (; current < dentry.size(); ++current) {
356 QList<FiffDirEntry::SPtr> sub_dentry = dentry.mid(current);
359 child->parent = node;
360 node->children.append(child);
366 }
else if (dentry[current]->kind == -1)
368 else if (level == 0) {
375 if (!this->
read_tag(t_pTag, dentry[current]->pos))
377 node->id = t_pTag->toFiffID();
428 for (insert = -1, b = 0; insert_blocks[b] >= 0; b++) {
429 for (k = 0; k <
nent(); k++) {
433 if (*(t_pTag->toInt()) == insert_blocks[b]) {
443 qCritical(
"Suitable place for environment insertion not found.");
451 if (where < 0 || where >=
nent() - 1) {
452 qCritical(
"illegal insertion point in fiff_insert_after!");
457 QList<FiffDirEntry::SPtr> old_dir =
dir();
458 QList<FiffDirEntry::SPtr> this_ent = old_dir.mid(where);
460 if (!
read_tag(t_pTagNext, this_ent[0]->pos))
465 qint64 next_tmp = device()->pos();
469 device()->seek(device()->size());
473 QList<FiffDirEntry::SPtr> new_dir = old_dir.mid(0, where + 1);
475 qint64 old_end = device()->pos();
484 new_this->size = 1 * 4;
486 new_dir.append(new_this);
491 new_this->size = 5 * 4;
493 new_dir.append(new_this);
498 new_this->size = workingDir.size();
500 new_dir.append(new_this);
505 new_this->size = command.size();
507 new_dir.append(new_this);
512 new_this->size = 1 * 4;
514 new_dir.append(new_this);
519 new_dir.append(old_dir.mid(where + 1));
523 t_pTagNext->next = (qint32)old_end;
540 QList<FiffDirNode::SPtr> covs = p_Node->dir_tree_find(
FIFFB_MNE_COV);
541 if (covs.size() == 0) {
542 qWarning(
"No covariance matrices found");
550 bool success =
false;
553 bool diagmat =
false;
560 for (p = 0; p < covs.size(); ++p) {
562 if (success && *tag->toInt() == cov_kind) {
568 qWarning(
"Covariance matrix dimension not found.\n");
575 nfree = *tag->toInt();
579 if (names.size() != dim) {
580 qWarning(
"Number of names does not match covariance matrix dimension\n");
586 qWarning(
"No covariance matrix data found\n");
593 cov_diag = Map<const VectorXd>(tag->toDouble(), dim);
595 cov_diag = Map<const VectorXf>(tag->toFloat(), dim).cast<
double>();
597 qCritical(
"Illegal data type for covariance matrix\n");
602 qInfo(
"\t%d x %d diagonal covariance (kind = %d) found.\n", dim, dim, cov_kind);
606 nn = dim * (dim + 1) / 2;
608 vals = Map<const VectorXd>(tag->toDouble(), nn);
610 vals = Map<const VectorXf>(tag->toFloat(), nn).cast<
double>();
612 qDebug() << tag->getInfo();
620 cov = MatrixXd::Zero(dim, dim);
624 for (qint32 j = 0; j < dim; ++j) {
625 for (qint32 k = 0; k <= j; ++k) {
630 for (qint32 j = 0; j < dim; ++j)
631 for (qint32 k = j + 1; k < dim; ++k)
632 cov(j, k) = cov(k, j);
635 qInfo(
"\t%d x %d full covariance (kind = %d) found.\n", dim, dim, cov_kind);
639 qDebug() <<
"ToDo: FiffStream::read_cov - this needs to be debugged.\n";
641 qInfo(
"\t%d x %d sparse covariance (kind = %d) found.\n", dim, dim, cov_kind);
679 eig = VectorXd(Map<const VectorXd>(tag1->toDouble(), dim));
680 eigvec = tag2->toFloatMatrix().cast<
double>();
681 eigvec.transposeInPlace();
686 QList<FiffProj> projs = this->
read_proj(current);
696 p_covData.
kind = cov_kind;
697 p_covData.
diag = diagmat;
699 p_covData.
names = names;
701 if (cov_diag.size() > 0)
702 p_covData.
data = cov_diag;
703 else if (cov.size() > 0)
704 p_covData.
data = cov;
705 else if (cov_sparse.size() > 0)
706 p_covData.
data = cov_sparse;
708 p_covData.
projs = projs;
709 p_covData.
bads = bads;
710 p_covData.
nfree = nfree;
712 p_covData.
eigvec = eigvec;
719 qInfo(
"Did not find the desired covariance matrix\n");
727 QList<FiffCtfComp> compdata;
730 qint32 i, k, p, col, row;
733 for (k = 0; k < t_qListComps.size(); ++k) {
740 for (p = 0; p < node->nent(); ++p) {
741 kind = node->dir[p]->kind;
742 pos = node->dir[p]->pos;
749 qWarning(
"Compensation type not found\n");
756 one.
ctfkind = *t_pTag->toInt();
763 else if (one.
ctfkind == 1194476114)
765 else if (one.
ctfkind == 1194541650)
767 else if (one.
ctfkind == 1194479433)
769 else if (one.
ctfkind == 1194544969)
774 for (p = 0; p < node->nent(); ++p) {
775 kind = node->dir[p]->kind;
776 pos = node->dir[p]->pos;
786 calibrated = (bool)*t_pTag->toInt();
789 one.
rowcals = MatrixXd::Ones(1, mat->data.rows());
790 one.
colcals = MatrixXd::Ones(1, mat->data.cols());
798 QStringList ch_names;
799 for (p = 0; p < p_Chs.size(); ++p)
800 ch_names.append(p_Chs[p].ch_name);
803 MatrixXd col_cals(mat->data.cols(), 1);
805 for (col = 0; col < mat->data.cols(); ++col) {
807 for (i = 0; i < ch_names.size(); ++i) {
808 if (QString::compare(mat->col_names.at(col), ch_names.at(i)) == 0) {
814 qWarning(
"Channel %s is not available in data", mat->col_names.at(col).toUtf8().constData());
816 }
else if (count > 1) {
817 qWarning(
"Ambiguous channel %s", mat->col_names.at(col).toUtf8().constData());
820 col_cals(col, 0) = 1.0f / (p_Chs[p].range * p_Chs[p].cal);
825 MatrixXd row_cals(mat->data.rows(), 1);
827 for (row = 0; row < mat->data.rows(); ++row) {
829 for (i = 0; i < ch_names.size(); ++i) {
830 if (QString::compare(mat->row_names.at(row), ch_names.at(i)) == 0) {
837 qWarning(
"Channel %s is not available in data", mat->row_names.at(row).toUtf8().constData());
839 }
else if (count > 1) {
840 qWarning(
"Ambiguous channel %s", mat->row_names.at(row).toUtf8().constData());
844 row_cals(row, 0) =
static_cast<double>(p_Chs[p].range) * p_Chs[p].cal;
846 mat->data = row_cals.asDiagonal() * mat->data * col_cals.asDiagonal();
851 compdata.append(one);
854 if (compdata.size() > 0)
855 qInfo(
"\tRead %lld compensation matrices\n",
static_cast<long long>(compdata.size()));
870 QList<FiffDirNode::SPtr> t_qListDigData = p_Node->dir_tree_find(
FIFFB_ISOTRAK);
873 if (t_qListDigData.isEmpty()) {
876 if (t_qListDigData.isEmpty()) {
877 qWarning(
"No Isotrak data found in %s", this->
streamName().toLatin1().data());
887 for (
int k = 0; k < t_qListDigData.first()->
nent(); ++k) {
888 kind = t_qListDigData.first()->dir[k]->kind;
889 pos = t_qListDigData.first()->dir[k]->pos;
894 p_digData.
points.append(t_pTag->toDigPoint());
903 npoint = p_digData.
points.size();
906 qWarning(
"No digitizer data in %s", this->
streamName().toLatin1().data());
910 for (
auto& dig : p_digData.
points) {
916 p_digData.
npoint = npoint;
918 for (
int k = 0; k < p_digData.
npoint; k++) {
919 p_digData.
active.append(1);
930 p_InfoForward.
clear();
937 if (parent_meg.size() == 0) {
938 qWarning(
"No parent MEG information found in operator\n");
944 QList<FiffChInfo> chs;
949 for (qint32 k = 0; k < parent_meg[0]->nent(); ++k) {
950 kind = parent_meg[0]->dir[k]->kind;
951 pos = parent_meg[0]->dir[k]->pos;
954 chs.append(t_pTag->toChInfo());
962 p_InfoForward.
chs = chs;
963 for (qint32 c = 0; c < p_InfoForward.
chs.size(); ++c)
964 p_InfoForward.
ch_names << p_InfoForward.
chs[c].ch_name;
966 p_InfoForward.
nchan = chs.size();
972 cand = t_pTag->toCoordTrans();
978 qWarning(
"MEG device/head coordinate transformation not found");
980 qWarning(
"MEG/head coordinate transformation not found.\n");
1000 QList<FiffDirNode::SPtr> meas = p_Node->dir_tree_find(
FIFFB_MEAS);
1002 if (meas.size() == 0) {
1003 qWarning(
"Could not find measurement data\n");
1007 QList<FiffDirNode::SPtr> meas_info = meas[0]->dir_tree_find(
FIFFB_MEAS_INFO);
1008 if (meas_info.count() == 0) {
1009 qWarning(
"Could not find measurement info\n");
1019 float sfreq = -1.0f;
1020 float linefreq = -1.0f;
1021 QList<FiffChInfo> chs;
1022 float lowpass = -1.0f;
1023 float highpass = -1.0f;
1026 QString proj_name =
"";
1027 QString xplotter_layout =
"";
1029 QString utc_offset =
"";
1032 QString experimenter =
"";
1033 QString description =
"";
1040 QList<FiffCoordTrans> all_coord_trans;
1049 for (qint32 k = 0; k < meas_info[0]->nent(); ++k) {
1050 kind = meas_info[0]->dir[k]->kind;
1051 pos = meas_info[0]->dir[k]->pos;
1055 nchan = *t_pTag->toInt();
1059 sfreq = *t_pTag->toFloat();
1063 linefreq = *t_pTag->toFloat();
1067 chs.append(t_pTag->toChInfo());
1071 lowpass = *t_pTag->toFloat();
1075 highpass = *t_pTag->toFloat();
1079 meas_date[0] = t_pTag->toInt()[0];
1080 meas_date[1] = t_pTag->toInt()[1];
1085 cand = t_pTag->toCoordTrans();
1086 all_coord_trans.append(cand);
1094 proj_id = *t_pTag->toInt();
1098 proj_name = t_pTag->toString();
1102 xplotter_layout = t_pTag->toString();
1106 experimenter = t_pTag->toString();
1110 description = t_pTag->toString();
1116 gantry_angle =
static_cast<fiff_int_t>(*t_pTag->toFloat());
1117 }
else if (t_pTag->getType() ==
FIFFT_INT) {
1118 gantry_angle = *t_pTag->toInt();
1123 utc_offset = t_pTag->toString();
1131 qWarning(
"Number of channels in not defined\n");
1135 qWarning(
"Sampling frequency is not defined\n");
1139 qWarning(
"Line frequency is not defined\n");
1141 if (chs.size() == 0) {
1142 qWarning(
"Channel information not defined\n");
1145 if (chs.size() != nchan) {
1146 qWarning(
"Incorrect number of channel definitions found\n");
1151 QList<FiffDirNode::SPtr> hpi_result = meas_info[0]->dir_tree_find(
FIFFB_HPI_RESULT);
1152 if (hpi_result.size() == 1) {
1153 for (qint32 k = 0; k < hpi_result[0]->nent(); ++k) {
1154 kind = hpi_result[0]->dir[k]->kind;
1155 pos = hpi_result[0]->dir[k]->pos;
1158 cand = t_pTag->toCoordTrans();
1170 QList<FiffDirNode::SPtr> isotrak = meas_info[0]->dir_tree_find(
FIFFB_ISOTRAK);
1172 QList<FiffDigPoint> dig;
1177 if (isotrak.size() == 1) {
1178 for (k = 0; k < isotrak[0]->nent(); ++k) {
1179 kind = isotrak[0]->dir[k]->kind;
1180 pos = isotrak[0]->dir[k]->pos;
1183 dig.append(t_pTag->toDigPoint());
1187 coord_frame = *t_pTag->toInt();
1190 dig_trans = t_pTag->toCoordTrans();
1195 for (k = 0; k < dig.size(); ++k)
1196 dig[k].coord_frame = coord_frame;
1199 if (dig_trans.
from != coord_frame && dig_trans.
to != coord_frame)
1205 QList<FiffDirNode::SPtr> acqpars = meas_info[0]->dir_tree_find(
FIFFB_DACQ_PARS);
1208 if (acqpars.size() == 1) {
1209 for (k = 0; k < acqpars[0]->nent(); ++k) {
1210 kind = acqpars[0]->dir[k]->kind;
1211 pos = acqpars[0]->dir[k]->pos;
1214 acq_pars = t_pTag->toString();
1217 acq_stim = t_pTag->toString();
1224 QList<FiffProj> projs = this->
read_proj(meas_info[0]);
1228 QList<FiffCtfComp> comps = this->
read_ctf_comp(meas_info[0], chs);
1237 if (p_Node->id.version != -1)
1245 if (meas_info[0]->parent_id.version == -1) {
1246 if (meas_info[0]->
id.version == -1) {
1247 if (meas[0]->
id.version == -1) {
1248 if (meas[0]->parent_id.version == -1)
1251 info.
meas_id = meas[0]->parent_id;
1255 info.
meas_id = meas_info[0]->id;
1257 info.
meas_id = meas_info[0]->parent_id;
1259 if (meas_date[0] == -1) {
1271 if (highpass != -1.0f)
1276 if (lowpass != -1.0f)
1286 for (qint32 c = 0; c < info.
nchan; ++c)
1328 QList<FiffDirNode::SPtr> hpi_meas = meas_info[0]->dir_tree_find(
FIFFB_HPI_MEAS);
1329 if (!hpi_meas.isEmpty()) {
1330 QList<FiffDirNode::SPtr> hpi_coils = hpi_meas[0]->dir_tree_find(
FIFFB_HPI_COIL);
1332 for (qint32 c = 0; c < hpi_coils.size(); ++c) {
1333 for (qint32 e = 0; e < hpi_coils[c]->nent(); ++e) {
1338 this->
read_tag(t_pTag, hpi_coils[c]->
dir[e]->pos);
1345 p_NodeInfo = meas[0];
1360 bool found_it =
false;
1362 for (
int k = 0; k < node->nchild(); ++k) {
1364 if (node->children[k]->has_tag(matkind)) {
1365 node = node->children[k];
1372 qWarning(
"Fiff::read_named_matrix: Desired named matrix (kind = %d) not available\n", matkind);
1376 if (!node->has_tag(matkind)) {
1377 qWarning(
"Desired named matrix (kind = %d) not available", matkind);
1386 if (!node->find_tag(
this, matkind, t_pTag)) {
1387 qWarning(
"Matrix data missing.\n");
1391 mat.
data = t_pTag->toFloatMatrix().cast<
double>();
1392 mat.
data.transposeInPlace();
1399 if (*t_pTag->toInt() != mat.
nrow) {
1400 qWarning(
"Number of rows in matrix data and FIFF_MNE_NROW tag do not match");
1404 if (*t_pTag->toInt() != mat.
ncol) {
1405 qWarning(
"Number of columns in matrix data and FIFF_MNE_NCOL tag do not match");
1411 row_names = t_pTag->toString();
1415 col_names = t_pTag->toString();
1420 if (!row_names.isEmpty())
1423 if (!col_names.isEmpty())
1427 qWarning(
"FiffStream::read_named_matrix - Number of rows in matrix data and row names do not match\n");
1431 qWarning(
"FiffStream::read_named_matrix - Number of columns in matrix data and column names do not match\n");
1441 QList<FiffProj> projdata;
1445 QList<FiffDirNode::SPtr> t_qListNodes = p_Node->dir_tree_find(
FIFFB_PROJ);
1446 if (t_qListNodes.size() == 0)
1450 t_qListNodes[0]->find_tag(
this,
FIFF_NCHAN, t_pTag);
1453 global_nchan = *t_pTag->toInt();
1456 QList<FiffDirNode::SPtr> t_qListItems = t_qListNodes[0]->dir_tree_find(
FIFFB_PROJ_ITEM);
1457 for (qint32 i = 0; i < t_qListItems.size(); ++i) {
1462 t_pFiffDirTreeItem->find_tag(
this,
FIFF_NCHAN, t_pTag);
1464 nchan = *t_pTag->toInt();
1466 nchan = global_nchan;
1471 desc = t_pTag->toString();
1473 t_pFiffDirTreeItem->find_tag(
this,
FIFF_NAME, t_pTag);
1475 desc = t_pTag->toString();
1477 qWarning(
"Projection item description missing\n");
1495 kind = *t_pTag->toInt();
1497 qWarning(
"Projection item kind missing");
1503 nvec = *t_pTag->toInt();
1505 qWarning(
"Number of projection vectors not specified\n");
1513 qWarning(
"Projection item channel list missing\n");
1519 data = t_pTag->toFloatMatrix().cast<
double>();
1520 data.transposeInPlace();
1522 qWarning(
"Projection item data missing\n");
1528 active = *t_pTag->toInt();
1532 if (data.cols() != names.size()) {
1533 qWarning(
"Number of channel names does not match the size of data matrix\n");
1540 QStringList defaultList;
1541 FiffNamedMatrix t_fiffNamedMatrix(nvec, nchan, defaultList, names, data);
1543 FiffProj one(kind, active, desc, t_fiffNamedMatrix);
1545 projdata.append(one);
1548 if (projdata.size() > 0) {
1549 qInfo(
"\tRead a total of %lld projection items:\n",
static_cast<long long>(projdata.size()));
1550 for (qint32 k = 0; k < projdata.size(); ++k) {
1551 qInfo(
"\t\t%s (%d x %d) %s\n", projdata[k].desc.toUtf8().constData(), projdata[k].data->nrow, projdata[k].data->ncol, projdata[k].active ?
"active" :
"idle");
1563 this->device()->seek(pos);
1572 if (p_pTag->size() > 0) {
1573 this->readRawData(p_pTag->data(), p_pTag->size());
1578 this->device()->seek(p_pTag->next);
1589 p_pTag = std::make_unique<FiffTag>();
1599 *
this >> p_pTag->kind;
1600 *
this >> p_pTag->type;
1603 p_pTag->resize(size);
1604 *
this >> p_pTag->next;
1609 QTcpSocket* t_qTcpSocket = qobject_cast<QTcpSocket*>(this->device());
1611 this->skipRawData(p_pTag->size());
1613 if (p_pTag->next > 0) {
1614 if (!this->device()->seek(p_pTag->next)) {
1618 }
else if (p_pTag->size() > 0 && p_pTag->next ==
FIFFV_NEXT_SEQ) {
1619 if (!this->device()->seek(this->device()->pos() + p_pTag->size())) {
1633 while (this->device()->bytesAvailable() < 16)
1634 this->device()->waitForReadyRead(10);
1640 while (this->device()->bytesAvailable() < p_pTag->size())
1641 this->device()->waitForReadyRead(10);
1655 this->device()->seek(pos);
1658 p_pTag = std::make_unique<FiffTag>();
1663 *
this >> p_pTag->kind;
1664 *
this >> p_pTag->type;
1667 p_pTag->resize(size);
1668 *
this >> p_pTag->next;
1676 if (this->byteOrder() == QDataStream::LittleEndian) {
1684 if (p_pTag->size() > 0) {
1685 this->readRawData(p_pTag->data(), p_pTag->size());
1692 this->device()->seek(p_pTag->next);
1701 bool allow_maxshield,
1702 bool is_littleEndian)
1708 QString t_sFileName = t_pStream->streamName();
1710 if (is_littleEndian) {
1712 t_pStream->setByteOrder(QDataStream::LittleEndian);
1715 qInfo(
"Opening raw data %s...\n", t_sFileName.toUtf8().constData());
1717 if (!t_pStream->open()) {
1726 if (!t_pStream->read_meas_info(t_pStream->dirtree(), info, meas))
1732 QList<FiffDirNode::SPtr> raw = meas->dir_tree_find(
FIFFB_RAW_DATA);
1733 if (raw.size() == 0) {
1735 if (allow_maxshield) {
1740 qInfo(
"Maxshield data found\n");
1742 if (raw.size() == 0) {
1743 qWarning(
"No raw data in %s\n", t_sFileName.toUtf8().constData());
1747 if (raw.size() == 0) {
1748 qWarning(
"No raw data in %s\n", t_sFileName.toUtf8().constData());
1759 data.
file = t_pStream;
1766 QList<FiffDirEntry::SPtr>
dir = raw[0]->dir;
1776 if (
dir.isEmpty()) {
1777 qWarning(
"No directory entries in raw data block of %s\n", t_sFileName.toUtf8().constData());
1786 qWarning(
"Measurement info of %s reports %d channels; cannot read raw data\n", t_sFileName.toUtf8().constData(), nchan);
1794 t_pStream->read_tag(t_pTag,
dir[first]->pos);
1795 first_samp = *t_pTag->toInt();
1805 t_pStream->read_tag(t_pTag,
dir[first]->pos);
1806 first_skip = *t_pTag->toInt();
1813 QList<FiffRawDir> rawdir;
1817 for (qint32 k = first; k <
nent; ++k) {
1820 t_pStream->read_tag(t_pTag, ent->pos);
1821 nskip = *t_pTag->toInt();
1826 switch (ent->type) {
1828 nsamp = ent->size / (2 * nchan);
1831 nsamp = ent->size / (2 * nchan);
1834 nsamp = ent->size / (4 * nchan);
1837 nsamp = ent->size / (4 * nchan);
1840 nsamp = ent->size / (8 * nchan);
1843 qWarning(
"Cannot handle data buffers of type %d\n", ent->type);
1849 if (first_skip > 0) {
1850 first_samp += nsamp * first_skip;
1861 t_RawDir.
first = first_samp;
1862 t_RawDir.
last = first_samp + nskip * nsamp - 1;
1863 t_RawDir.
nsamp = nskip * nsamp;
1864 rawdir.append(t_RawDir);
1865 first_samp = first_samp + nskip * nsamp;
1873 t_RawDir.
first = first_samp;
1874 t_RawDir.
last = first_samp + nsamp - 1;
1875 t_RawDir.
nsamp = nsamp;
1876 rawdir.append(t_RawDir);
1877 first_samp += nsamp;
1886 for (qint32 k = 0; k < data.
info.
nchan; ++k)
1887 cals[k] =
static_cast<double>(data.
info.
chs[k].range) * data.
info.
chs[k].cal;
1894 qInfo(
"\tRange : %d ... %d = %9.3f ... %9.3f secs",
1908 return p_sNameList.replace(
" ",
"").split(
":");
1923 QString t_sFileName = p_pStream->streamName();
1925 if (!p_IODevice.isOpen()) {
1926 if (!p_pStream->device()->open(QIODevice::WriteOnly)) {
1927 qWarning(
"Cannot write to %s\n", t_sFileName.toUtf8().constData());
1929 return p_pEmptyStream;
1951 QString t_sFileName = t_pStream->streamName();
1958 QFile* t_pFile = qobject_cast<QFile*>(&p_IODevice);
1959 if (t_pFile !=
nullptr && !t_pFile->exists()) {
1960 qCritical(
"Cannot open %s for update: no such file", t_sFileName.toUtf8().constData());
1967 if (!t_pStream->open(QIODevice::ReadWrite)) {
1968 qCritical(
"Cannot open %s\n", t_sFileName.toUtf8().constData());
1973 long dirpos, pointerpos;
1975 QFile* file = qobject_cast<QFile*>(t_pStream->device());
1977 if (file !=
nullptr) {
1981 pointerpos = t_pStream->dir()[t_pStream->nent() - 2]->pos;
1982 if (!t_pStream->read_tag(t_pTag, pointerpos)) {
1983 qCritical(
"Could not read last tag in the directory list!");
1989 t_pStream->write_tag(t_pTag, pointerpos);
1994 pointerpos = t_pStream->dir()[1]->pos;
1995 if (!t_pStream->read_tag(t_pTag, pointerpos)) {
1996 qCritical(
"Could not read directory pointer!");
2003 dirpos = *t_pTag->toInt();
2008 t_pStream->write_dir_pointer(-1, pointerpos);
2012 file->resize(dirpos);
2017 t_pStream->device()->seek(file->size());
2036 if (sel.cols() == 0) {
2037 sel.resize(1, info.
chs.size());
2038 for (qint32 k = 0; k < info.
chs.size(); ++k)
2042 QList<FiffChInfo> chs;
2044 for (qint32 k = 0; k < sel.cols(); ++k)
2045 chs << info.
chs.at(sel(0, k));
2071 QList<fiff_int_t> blocks;
2073 bool have_hpi_result =
false;
2074 bool have_isotrak =
false;
2075 if (blocks.size() > 0 && !info.
filename.isEmpty()) {
2079 if (!t_pStream2->open()) {
2080 qDebug() <<
"Failed to open file. Returning early";
2084 for (qint32 k = 0; k < blocks.size(); ++k) {
2085 QList<FiffDirNode::SPtr> nodes = t_pStream2->dirtree()->dir_tree_find(blocks[k]);
2088 have_hpi_result =
true;
2091 have_isotrak =
true;
2116 if (!have_hpi_result) {
2118 t_pStream->write_coord_trans(info.
dev_head_t);
2121 t_pStream->write_coord_trans(info.
ctf_head_t);
2126 if (info.
dig.size() > 0 && !have_isotrak) {
2128 for (qint32 k = 0; k < info.
dig.size(); ++k)
2129 t_pStream->write_dig_point(info.
dig[k]);
2138 t_pStream->write_proj(info.
projs);
2142 t_pStream->write_ctf_comp(info.
comps);
2146 if (info.
bads.size() > 0) {
2171 cals = RowVectorXd(nchan);
2172 for (qint32 k = 0; k < nchan; ++k) {
2176 chs[k].scanNo = k + 1;
2180 cals[k] = chs[k].cal;
2181 t_pStream->write_ch_info(chs[k]);
2202 this->device()->seek(pos);
2204 QFile* file = qobject_cast<QFile*>(this->device());
2206 this->device()->seek(file->size());
2208 pos = this->device()->pos();
2212 *this << static_cast<qint32>(p_pTag->kind);
2213 *this << static_cast<qint32>(p_pTag->type);
2214 *this << static_cast<qint32>(datasize);
2215 *this << static_cast<qint32>(p_pTag->next);
2222 auto fileTag = std::make_unique<FiffTag>(*p_pTag);
2224 this->writeRawData(fileTag->data(), datasize);
2259 *
this << (qint32)datasize;
2265 *
this << (qint32)ch.
scanNo;
2266 *
this << (qint32)ch.
logNo;
2267 *
this << (qint32)ch.
kind;
2280 *
this << (qint32)ch.
unit;
2289 ch_name = ch.
ch_name.mid(0, 15);
2293 len = ch_name.size();
2295 this->writeRawData(ch_name.toUtf8().constData(), len);
2298 const char* chNull =
"";
2299 for (qint32 i = 0; i < 16 - len; ++i)
2300 this->writeRawData(chNull, 1);
2319 for (i = 0; i < 3; ++i)
2320 *
this << chpos.
r0[i];
2322 for (i = 0; i < 3; ++i)
2323 *
this << chpos.
ex[i];
2325 for (i = 0; i < 3; ++i)
2326 *
this << chpos.
ey[i];
2328 for (i = 0; i < 3; ++i)
2329 *
this << chpos.
ez[i];
2352 *
this << (qint32)datasize;
2358 *
this << (qint32)trans.
from;
2359 *
this << (qint32)trans.
to;
2365 for (r = 0; r < 3; ++r)
2366 for (c = 0; c < 3; ++c)
2367 *
this <<
static_cast<float>(trans.
trans(r, c));
2368 for (r = 0; r < 3; ++r)
2369 *
this <<
static_cast<float>(trans.
trans(r, 3));
2374 for (r = 0; r < 3; ++r)
2375 for (c = 0; c < 3; ++c)
2376 *
this <<
static_cast<float>(trans.
invtrans(r, c));
2377 for (r = 0; r < 3; ++r)
2378 *
this <<
static_cast<float>(trans.
invtrans(r, 3));
2396 if (p_FiffCov.
nfree > 0)
2401 if (p_FiffCov.
names.size() > 0)
2414 qint32 dim = p_FiffCov.
dim;
2415 qint32 n = dim * (dim + 1) / 2;
2420 VectorXd vals = VectorXd::Zero(n);
2422 for (qint32 i = 0; i < dim; ++i)
2423 for (qint32 j = 0; j <= i; ++j)
2424 vals(count++) = p_FiffCov.
data(i, j);
2432 if (p_FiffCov.
eig.size() > 0 && p_FiffCov.
eigvec.size() > 0) {
2443 if (p_FiffCov.
bads.size() > 0) {
2462 if (comps.size() <= 0)
2468 for (qint32 k = 0; k < comps.size(); ++k) {
2481 if (comps[k].save_calibrated) {
2482 comp.
data->data = (comp.
rowcals.asDiagonal()).inverse() * comp.
data->data * (comp.
colcals.asDiagonal()).inverse();
2510 *
this << (qint32)datasize;
2516 *
this << (qint32)dig.
kind;
2517 *
this << (qint32)dig.
ident;
2518 for (qint32 i = 0; i < 3; ++i)
2532 this->device()->seek(pos);
2534 QFile* file = qobject_cast<QFile*>(this->device());
2536 this->device()->seek(file->size());
2538 pos = this->device()->pos();
2544 *
this << (qint32)datasize;
2545 *
this << (qint32)next;
2570 this->device()->seek(pos);
2572 QFile* file = qobject_cast<QFile*>(this->device());
2574 this->device()->seek(file->size());
2577 pos = this->device()->pos();
2584 *
this << (qint32)datasize;
2590 for (qint32 i = 0; i <
nent; ++i) {
2591 *
this << (qint32)
dir[i]->kind;
2592 *
this << (qint32)
dir[i]->type;
2593 *
this << (qint32)
dir[i]->size;
2594 *
this << (qint32)
dir[i]->pos;
2606 qint32 datasize = nel * 8;
2608 *
this << (qint32)kind;
2610 *
this << (qint32)datasize;
2619 for (qint32 i = 0; i < nel; ++i) {
2621 memcpy(&bits, &data[i],
sizeof(
double));
2634 qint32 datasize = nel * 4;
2636 *
this << (qint32)kind;
2638 *
this << (qint32)datasize;
2641 for (qint32 i = 0; i < nel; ++i)
2653 qint32 numel = mat.rows() * mat.cols();
2657 *
this << (qint32)kind;
2659 *
this << (qint32)datasize;
2664 for (i = 0; i < mat.rows(); ++i)
2665 for (j = 0; j < mat.cols(); ++j)
2669 dims[0] = mat.cols();
2670 dims[1] = mat.rows();
2673 for (i = 0; i < 3; ++i)
2693 qint32 nnzm = mat.nonZeros();
2694 qint32 ncol = mat.cols();
2695 fiff_int_t datasize = 4 * nnzm + 4 * nnzm + 4 * (ncol + 1) + 4 * 4;
2699 using T = Eigen::Triplet<float>;
2701 s.reserve(mat.nonZeros());
2702 for (
int k = 0; k < mat.outerSize(); ++k)
2703 for (SparseMatrix<float>::InnerIterator it(mat, k); it; ++it)
2704 s.push_back(T(it.row(), it.col(), it.value()));
2709 std::vector<qint32> cols, starts;
2712 for (i = 0; i < s.size(); ++i) {
2713 if ((
signed)s[i].col() != v_old) {
2715 cols.push_back(s[i].col());
2716 starts.push_back(i);
2720 *
this << (qint32)kind;
2722 *
this << (qint32)datasize;
2728 for (i = 0; i < s.size(); ++i)
2729 *
this << s[i].value();
2734 for (i = 0; i < s.size(); ++i)
2735 *
this << s[i].row();
2740 RowVectorXi ptrs = RowVectorXi::Ones(ncol + 1);
2743 for (k = 0; k < cols.size(); ++k)
2744 ptrs[cols[k]] = starts[k];
2749 for (k = ncol; k >= 1; --k)
2750 if (ptrs[k - 1] < 0)
2751 ptrs[k - 1] = ptrs[k];
2753 for (i = 0; i < (quint32)ptrs.size(); ++i)
2759 dims[0] = mat.nonZeros();
2760 dims[1] = mat.rows();
2761 dims[2] = mat.cols();
2764 for (i = 0; i < 4; ++i)
2784 qint32 nnzm = mat.nonZeros();
2785 qint32 nrow = mat.rows();
2786 fiff_int_t datasize = 4 * nnzm + 4 * nnzm + 4 * (nrow + 1) + 4 * 4;
2790 using T = Eigen::Triplet<float>;
2792 s.reserve(mat.nonZeros());
2793 for (
int k = 0; k < mat.outerSize(); ++k)
2794 for (SparseMatrix<float>::InnerIterator it(mat, k); it; ++it)
2795 s.push_back(T(it.row(), it.col(), it.value()));
2800 std::vector<qint32> rows, starts;
2803 for (i = 0; i < s.size(); ++i) {
2804 if ((
signed)s[i].row() != v_old) {
2806 rows.push_back(s[i].row());
2807 starts.push_back(i);
2814 *
this << (qint32)kind;
2816 *
this << (qint32)datasize;
2822 for (i = 0; i < s.size(); ++i)
2823 *
this << s[i].value();
2828 for (i = 0; i < s.size(); ++i)
2829 *
this << s[i].col();
2834 RowVectorXi ptrs = RowVectorXi::Ones(nrow + 1);
2837 for (k = 0; k < rows.size(); ++k)
2838 ptrs[rows[k]] = starts[k];
2844 for (k = nrow; k >= 1; --k)
2845 if (ptrs[k - 1] < 0)
2846 ptrs[k - 1] = ptrs[k];
2849 for (i = 0; i < (quint32)ptrs.size(); ++i)
2856 dims[0] = mat.nonZeros();
2857 dims[1] = mat.rows();
2858 dims[2] = mat.cols();
2861 for (i = 0; i < 4; ++i)
2886 *
this << (qint32)kind;
2888 *
this << (qint32)datasize;
2895 data[1] = t_id.
machid[0];
2896 data[2] = t_id.
machid[1];
2900 for (qint32 i = 0; i < 5; ++i)
2929 QList<FiffChInfo> chs;
2930 for (k = 0; k < p_FiffInfoBase.
nchan; ++k)
2931 chs << p_FiffInfoBase.
chs[k];
2933 for (k = 0; k < p_FiffInfoBase.
nchan; ++k) {
2937 chs[k].scanNo = k + 1;
2944 bool have_hpi_result =
false;
2949 if (!have_hpi_result) {
2959 if (p_FiffInfoBase.
bads.size() > 0) {
2978 *
this << (qint32)kind;
2980 *
this << (qint32)datasize;
2981 *
this << (qint32)next;
2983 for (qint32 i = 0; i < nel; ++i)
2998 qint32 numel = mat.rows() * mat.cols();
3002 *
this << (qint32)kind;
3004 *
this << (qint32)datasize;
3009 for (i = 0; i < mat.rows(); ++i)
3010 for (j = 0; j < mat.cols(); ++j)
3014 dims[0] = mat.cols();
3015 dims[1] = mat.rows();
3018 for (i = 0; i < 3; ++i)
3028 QString all = data.join(
":");
3057 if (projs.size() <= 0)
3062 for (qint32 k = 0; k < projs.size(); ++k) {
3067 float fValue = 0.0f;
3073 qint32 bValue = (qint32)projs[k].active;
3090 if (p_FiffEvokedSet.
evoked.isEmpty())
3106 float sfreq = p_FiffEvokedSet.
info.
sfreq;
3109 for (
int k = 0; k < p_FiffEvokedSet.
info.
nchan; ++k) {
3118 if (!p_FiffEvokedSet.
info.
projs.isEmpty())
3121 if (!p_FiffEvokedSet.
info.
bads.isEmpty())
3126 for (
int j = 0; j < p_FiffEvokedSet.
evoked.size(); ++j) {
3134 int first = evoked.
first;
3137 int last = evoked.
last;
3145 int nave = evoked.
nave;
3149 Eigen::VectorXd decal(evoked.
data.rows());
3150 for (
int k = 0; k < decal.size(); ++k) {
3151 const double cal = k < p_FiffEvokedSet.
info.
chs.size() ? p_FiffEvokedSet.
info.
chs[k].cal : 1.0;
3152 decal[k] = cal != 0.0 ? 1.0 / cal : 1.0;
3154 Eigen::MatrixXf floatData = (decal.asDiagonal() * evoked.
data).cast<
float>();
3170 const RowVectorXd& cals)
3172 if (buf.rows() != cals.cols()) {
3173 qWarning(
"buffer and calibration sizes do not match\n");
3177 using T = Eigen::Triplet<double>;
3178 std::vector<T> tripletList;
3179 tripletList.reserve(cals.cols());
3180 for (qint32 i = 0; i < cals.cols(); ++i)
3181 tripletList.push_back(T(i, i, 1.0 / cals[i]));
3183 SparseMatrix<double> inv_calsMat(cals.cols(), cals.cols());
3184 inv_calsMat.setFromTriplets(tripletList.begin(), tripletList.end());
3186 MatrixXf tmp = (inv_calsMat * buf).cast<float>();
3194 const SparseMatrix<double>& mult)
3196 if (buf.rows() != mult.cols()) {
3197 qWarning(
"buffer and mult sizes do not match\n");
3201 SparseMatrix<double> inv_mult(mult.rows(), mult.cols());
3202 for (
int k = 0; k < inv_mult.outerSize(); ++k)
3203 for (SparseMatrix<double>::InnerIterator it(mult, k); it; ++it)
3204 inv_mult.coeffRef(it.row(), it.col()) = 1 / it.value();
3206 MatrixXf tmp = (inv_mult * buf).cast<float>();
3215 MatrixXf tmp = buf.cast<
float>();
3223 const QString& data)
3227 const QByteArray bytes = data.toUtf8();
3229 *
this << (qint32)kind;
3231 *
this << (qint32)datasize;
3234 this->writeRawData(bytes.constData(), datasize);
3243 const QByteArray bytes = data.toUtf8();
3247 *
this << 4 + (qint32)datasize;
3251 this->writeRawData(bytes.constData(), datasize);
3256QList<FiffDirEntry::SPtr> FiffStream::make_dir(
bool* ok)
3259 QList<FiffDirEntry::SPtr>
dir;
3267 if (!this->device()->seek(SEEK_SET))
3276 if (this->status() != QDataStream::Ok) {
3277 this->resetStatus();
3289 t_pFiffDirEntry->kind = t_pTag->kind;
3290 t_pFiffDirEntry->type = t_pTag->type;
3291 t_pFiffDirEntry->size = t_pTag->size();
3294 dir.append(t_pFiffDirEntry);
3295 if (t_pTag->next < 0)
3302 t_pFiffDirEntry->kind = -1;
3303 t_pFiffDirEntry->type = -1;
3304 t_pFiffDirEntry->size = -1;
3305 t_pFiffDirEntry->pos = -1;
3306 dir.append(t_pFiffDirEntry);
3318 QFile srcFile(fromPath);
3320 if (!srcStream.
open()) {
3321 qWarning(
"FiffStream::copyProcessingHistory - Cannot parse source FIFF file %s",
3322 fromPath.toUtf8().constData());
3328 if (histNodes.isEmpty()) {
3329 qWarning(
"FiffStream::copyProcessingHistory - No processing history block found in %s",
3330 fromPath.toUtf8().constData());
3342 std::vector<Item> items;
3344 items.push_back({node->type, 0,
nullptr});
3345 for (
int i = 0; i < node->nent(); ++i) {
3346 const int kind = node->dir[i]->kind;
3350 if (srcStream.
read_tag(tag, node->dir[i]->pos))
3351 items.push_back({0, 0, std::move(tag)});
3353 for (
int c = 0; c < node->nchild(); ++c)
3354 collect(node->children[c]);
3355 items.push_back({0, node->type,
nullptr});
3357 collect(histNodes[0]);
3361 QFile dstFile(toPath);
3364 qWarning(
"FiffStream::copyProcessingHistory - Cannot open destination file %s for update",
3365 toPath.toUtf8().constData());
3370 const fiff_long_t lastPos = dstStream->dir()[dstStream->nent() - 2]->pos;
3372 if (!dstStream->read_tag(lastTag, lastPos)) {
3377 dstStream->write_tag(lastTag, lastPos);
3378 dstStream->device()->seek(dstStream->device()->size());
3380 for (
const Item& item : items) {
3381 if (item.blockStart)
3382 dstStream->start_block(item.blockStart);
3383 else if (item.blockEnd)
3384 dstStream->end_block(item.blockEnd);
3386 dstStream->write_tag(item.tag);
3389 dstStream->end_file();
3402 qWarning(
"Fiff::open: file does not start with a file id tag\n");
3407 qWarning(
"Fiff::open: file does not start with a file id tag\n");
3410 if (p_pTag->size() != 20) {
3411 qWarning(
"Fiff::open: file does not start with a file id tag\n");
FIFF channel descriptor record (FIFF_CH_INFO): per-channel logical/scanner numbers,...
#define FIFF_MNE_COV_KIND
#define FIFF_MNE_COORD_FRAME
#define FIFF_MNE_CTF_COMP_KIND
#define FIFFV_COORD_DEVICE
#define FIFF_MNE_COV_DIAG
#define FIFFB_MNE_CTF_COMP_DATA
#define FIFF_MNE_CTF_COMP_CALIBRATED
#define FIFF_MNE_ROW_NAMES
#define FIFF_MNE_COV_EIGENVALUES
#define FIFF_MNE_PROJ_ITEM_ACTIVE
#define FIFFV_MNE_COORD_CTF_HEAD
#define FIFF_MNE_COL_NAMES
#define FIFF_MNE_ENV_WORKING_DIR
#define FIFF_MNE_ENV_COMMAND_LINE
#define FIFF_MNE_RT_COMMAND
#define FIFF_MNE_CTF_COMP_DATA
#define FIFF_MNE_CH_NAME_LIST
#define FIFFB_MNE_CTF_COMP
#define FIFF_MNE_COV_NFREE
#define FIFFB_MNE_PARENT_MEAS_FILE
#define FIFF_MNE_COV_EIGENVECTORS
#define FIFFV_COORD_UNKNOWN
#define FIFFB_MNE_BAD_CHANNELS
#define FIFFB_MNE_NAMED_MATRIX
#define FIFF_MNE_FILE_NAME
FIFF tag: the 16-byte tag header (kind, type, size, next) plus its decoded payload.
Set of averaged evoked responses sharing a FiffInfo, plus the ave-style category / rejection descript...
FIFF binary tag-stream layer: wraps a QIODevice to read and write FIFF tags, directories,...
Full FIFF measurement metadata: everything from FIFFB_MEAS / FIFFB_MEAS_INFO needed to interpret a re...
4x4 affine FIFF coordinate transform (FIFF_COORD_TRANS) annotated with source/destination coordinate-...
#define FIFF_GANTRY_ANGLE
#define FIFF_PARENT_BLOCK_ID
#define FIFFV_PROJ_ITEM_FIELD
#define FIFF_XPLOTTER_LAYOUT
#define FIFFB_PROCESSING_HISTORY
#define FIFFT_MATRIX_FLOAT
#define FIFFT_CH_INFO_STRUCT
#define FIFF_EXPERIMENTER
#define FIFFT_RCS_MATRIX_FLOAT
#define FIFFT_CCS_MATRIX_FLOAT
#define FIFF_FIRST_SAMPLE
#define FIFFV_ASPECT_AVERAGE
#define FIFF_HPI_COIL_FREQ
#define FIFFB_SMSH_RAW_DATA
#define FIFF_PROJ_ITEM_TIME
#define FIFFV_LITTLE_ENDIAN
#define FIFFB_PROCESSED_DATA
#define FIFFV_ASPECT_STD_ERR
#define FIFF_PROJ_ITEM_VECTORS
#define FIFF_PROJ_ITEM_KIND
#define FIFFB_HPI_SUBSYSTEM
#define FIFFB_CONTINUOUS_DATA
#define FIFFV_NATIVE_ENDIAN
#define FIFF_PROJ_ITEM_CH_NAME_LIST
#define FIFFT_DIR_ENTRY_STRUCT
#define FIFFT_COORD_TRANS_STRUCT
#define FIFFT_DIG_POINT_STRUCT
#define FIFF_PROJ_ITEM_NVEC
return FiffCoordTrans(from_frame, to_frame, R, moveVec)
Coil-frame position record embedded inside FIFF_CH_INFO: coil location and 3x3 EX/EY/EZ orientation t...
Recursive node of the parsed FIFF block tree (FIFFB_* hierarchy with directory entries and children).
Single digitization point (FIFF_DIG_POINT) with kind (cardinal/HPI/EEG/extra), identifier and 3D coor...
FIFF continuous raw recording: FiffInfo plus a directory of FIFF_DATA_BUFFER tags for random-access s...
High-level digitization data: dig points plus the device→head transform and fitting metadata that tog...
128-bit FIFF identifier record (machine ID + creation time) used to stamp files, blocks and parent re...
CTF / 4D Neuroimaging software gradient-compensation matrix block (FIFFB_MNE_CTF_COMP_DATA).
Noise / data covariance matrix as stored under FIFFB_MNE_COV, with channel names, kind,...
Minimal measurement-info subset (channel list, sampling rate, basic transforms) shared by FIFF reader...
Header-only Eigen matrix text I/O — round-trips dense matrices to whitespace-separated ASCII for cros...
General numerical helpers: GCD, log2, histogram binning, baseline rescaling, sparsity tests.
Static linear-algebra helpers: SVD-based conditioning, block-diagonal assembly, sorted index pairs.
FIFF file I/O, in-memory data structures and high-level readers/writers.
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
Per-channel FIFF descriptor: identifiers, kind, calibration, coil type, channel-frame coil position a...
Channel coil-frame placement: origin r0 (m) and orthonormal axes ex / ey / ez in FIFFV_COORD_DEVICE.
Labelled 4x4 FIFF affine: source frame, destination frame, rotation, translation and cached inverse.
Eigen::Matrix< float, 4, 4, Eigen::DontAlign > invtrans
Eigen::Matrix< float, 4, 4, Eigen::DontAlign > trans
FIFF noise / data covariance: matrix, channel names, kind, applied projectors, bads,...
One CTF software-gradient compensation matrix: grade kind, calibration flag and the gradiometer × ref...
FiffNamedMatrix::SDPtr data
One digitizer point: kind (cardinal/HPI/EEG/extra), ident, 3D position in FIFFV_COORD_HEAD.
Registration-ready digitization data: dig points, device→head transform and HPI fit metadata.
QList< FIFFLIB::FiffDigPoint > points
Directory entry: tag kind + on-disk type + byte size + absolute file offset (16-byte record).
QSharedPointer< FiffDirEntry > SPtr
Recursive FIFF block-tree node: block kind, block ID, directly contained directory entries and child ...
QSharedPointer< FiffDirNode > SPtr
static bool copy_tree(QSharedPointer< FiffStream > &p_pStreamIn, const FiffId &in_id, const QList< QSharedPointer< FiffDirNode > > &p_Nodes, QSharedPointer< FiffStream > &p_pStreamOut)
Single averaged evoked response: time axis, data, baseline, channel info and averaging metadata.
Set of FiffEvoked instances sharing one FiffInfo, plus channel-picking and compensation helpers.
QList< FiffEvoked > evoked
128-bit FIFF identifier: hardware machine ID plus creation time, stamped on every file and block.
static FiffId new_file_id()
Full FIFF measurement info: per-channel descriptors, sampling and filter setup, projectors,...
QList< float > hpi_coil_freqs
QList< FiffCtfComp > comps
QList< FiffDigPoint > dig
Stripped FIFF measurement info: channel list, sampling rate, device→head transform and bad-channel li...
QList< FiffCoordTrans > all_coord_trans
FiffCoordTrans ctf_head_t
FiffCoordTrans dev_head_t
FIFF named matrix: dense / sparse Eigen matrix plus row-name and column-name string lists.
QSharedDataPointer< FiffNamedMatrix > SDPtr
Single SSP projection item: kind, active flag, desired flag and the named projection vector matrix.
Continuous FIFF raw recording: FiffInfo plus a random-access directory of FIFF_DATA_BUFFER tags.
QList< FiffRawDir > rawdir
Per-buffer raw-data directory entry: data kind, first sample, sample count, on-disk tag position.
bool write_raw_buffer(const Eigen::MatrixXd &buf, const Eigen::RowVectorXd &cals)
fiff_long_t write_cov(const FiffCov &p_FiffCov)
bool read_cov(const FiffDirNode::SPtr &p_Node, fiff_int_t cov_kind, FiffCov &p_covData)
fiff_long_t write_dir_entries(const QList< FiffDirEntry::SPtr > &dir, fiff_long_t pos=-1)
fiff_long_t start_block(fiff_int_t kind)
fiff_long_t write_float_matrix(fiff_int_t kind, const Eigen::MatrixXf &mat)
fiff_long_t write_proj(const QList< FiffProj > &projs)
fiff_long_t write_int_matrix(fiff_int_t kind, const Eigen::MatrixXi &mat)
QSharedPointer< FiffStream > SPtr
bool read_rt_tag(std::unique_ptr< FiffTag > &p_pTag)
bool read_tag_data(std::unique_ptr< FiffTag > &p_pTag, fiff_long_t pos=-1)
bool read_meas_info_base(const FiffDirNode::SPtr &p_Node, FiffInfoBase &p_InfoForward)
fiff_long_t write_tag(const std::unique_ptr< FiffTag > &p_pTag, fiff_long_t pos=-1)
static bool copyProcessingHistory(const QString &fromPath, const QString &toPath)
void write_bad_channels(const QStringList &bads)
fiff_long_t write_dig_point(const FiffDigPoint &dig)
fiff_long_t write_int(fiff_int_t kind, const fiff_int_t *data, fiff_int_t nel=1, fiff_int_t next=FIFFV_NEXT_SEQ)
static bool setup_read_raw(QIODevice &p_IODevice, FiffRawData &data, bool allow_maxshield=true, bool is_littleEndian=false)
QList< FiffCtfComp > read_ctf_comp(const FiffDirNode::SPtr &p_Node, const QList< FiffChInfo > &p_Chs)
fiff_long_t write_float(fiff_int_t kind, const float *data, fiff_int_t nel=1)
fiff_long_t write_id(fiff_int_t kind, const FiffId &id=FiffId::getDefault())
fiff_long_t write_float_sparse_rcs(fiff_int_t kind, const Eigen::SparseMatrix< float > &mat)
fiff_long_t write_ch_pos(const FiffChPos &chpos)
void write_rt_command(fiff_int_t command, const QString &data)
fiff_long_t write_coord_trans(const FiffCoordTrans &trans)
bool get_evoked_entries(const QList< FiffDirNode::SPtr > &evoked_node, QStringList &comments, QList< fiff_int_t > &aspect_kinds, QString &t)
fiff_long_t write_name_list(fiff_int_t kind, const QStringList &data)
bool read_meas_info(const FiffDirNode::SPtr &p_Node, FiffInfo &p_Info, FiffDirNode::SPtr &p_NodeInfo)
bool open(QIODevice::OpenModeFlag mode=QIODevice::ReadOnly)
fiff_long_t read_tag_info(std::unique_ptr< FiffTag > &p_pTag, bool p_bDoSkip=true)
fiff_long_t write_named_matrix(fiff_int_t kind, const FiffNamedMatrix &mat)
FiffStream(QIODevice *p_pIODevice)
static QStringList split_name_list(QString p_sNameList)
fiff_long_t write_string(fiff_int_t kind, const QString &data)
QStringList read_bad_channels(const FiffDirNode::SPtr &p_Node)
fiff_long_t write_evoked_set(const FiffEvokedSet &p_FiffEvokedSet)
const FiffDirNode::SPtr & dirtree() const
bool read_digitizer_data(const FiffDirNode::SPtr &p_Node, FiffDigitizerData &p_digData)
static FiffStream::SPtr start_writing_raw(QIODevice &p_IODevice, const FiffInfo &info, Eigen::RowVectorXd &cals, Eigen::MatrixXi sel=defaultMatrixXi, bool bResetRange=true)
fiff_long_t write_dir_pointer(fiff_int_t dirpos, fiff_long_t pos=-1, fiff_int_t next=FIFFV_NEXT_SEQ)
static FiffStream::SPtr start_file(QIODevice &p_IODevice)
fiff_long_t write_info_base(const FiffInfoBase &p_FiffInfoBase)
fiff_long_t end_block(fiff_int_t kind, fiff_int_t next=FIFFV_NEXT_SEQ)
fiff_long_t write_float_sparse_ccs(fiff_int_t kind, const Eigen::SparseMatrix< float > &mat)
fiff_long_t write_ch_info(const FiffChInfo &ch)
fiff_long_t write_ctf_comp(const QList< FiffCtfComp > &comps)
bool read_tag(std::unique_ptr< FiffTag > &p_pTag, fiff_long_t pos=-1)
fiff_long_t write_double(fiff_int_t kind, const double *data, fiff_int_t nel=1)
bool attach_env(const QString &workingDir, const QString &command)
QList< FiffProj > read_proj(const FiffDirNode::SPtr &p_Node)
static FiffStream::SPtr open_update(QIODevice &p_IODevice)
FiffDirNode::SPtr make_subtree(QList< FiffDirEntry::SPtr > &dentry)
bool read_named_matrix(const FiffDirNode::SPtr &p_Node, fiff_int_t matkind, FiffNamedMatrix &mat)
void finish_writing_raw()
QList< FiffDirEntry::SPtr > & dir()
std::unique_ptr< FiffTag > UPtr
static void convert_tag_data(const FiffTag::UPtr &tag, int from_endian, int to_endian)
static std::vector< Eigen::Triplet< T > > sortrows(const std::vector< Eigen::Triplet< T > > &A, qint32 column=0)
static bool issparse(Eigen::VectorXd &v)