94: QDataStream(p_pIODevice)
96 this->setFloatingPointPrecision(QDataStream::SinglePrecision);
97 this->setByteOrder(QDataStream::BigEndian);
98 this->setVersion(QDataStream::Qt_5_0);
104 QIODevice::OpenMode mode)
105: QDataStream(a, mode)
107 this->setFloatingPointPrecision(QDataStream::SinglePrecision);
108 this->setByteOrder(QDataStream::BigEndian);
109 this->setVersion(QDataStream::Qt_5_0);
116 QFile* t_pFile = qobject_cast<QFile*>(this->device());
119 p_sFileName = t_pFile->fileName();
121 p_sFileName = QString(
"TCPSocket");
176 *
this << (qint32)datasize;
195 aspect_kinds.clear();
196 QList<FiffDirNode::SPtr>::ConstIterator ev;
201 for(ev = evoked_node.begin(); ev != evoked_node.end(); ++ev)
203 for(k = 0; k < (*ev)->nent(); ++k)
205 kind = (*ev)->dir[k]->kind;
206 pos = (*ev)->dir[k]->pos;
210 comments.append(t_pTag->toString());
214 for(k = 0; k < my_aspect->nent(); ++k)
216 kind = my_aspect->dir[k]->kind;
217 pos = my_aspect->dir[k]->pos;
221 aspect_kinds.append(*t_pTag->toInt());
226 if(comments.size() != aspect_kinds.size() || comments.size() == 0)
228 qWarning(
"Dataset names in FIF file could not be found.");
233 for(k = 0; k < aspect_kinds.size(); ++k)
235 t += QString(
"%1 - \"%2\" (").arg(k).arg(comments[k]);
237 t += QString(
"FIFFV_ASPECT_AVERAGE)\n");
239 t += QString(
"FIFFV_ASPECT_STD_ERR)\n");
241 t += QString(
"unknown)\n");
257 if (!this->device()->
open(mode))
259 qCritical(
"Cannot open %s\n", t_sFileName.toUtf8().constData());
263 if(!check_beginning(t_pTag))
270 qCritical(
"FIFF file should start with FIFF_FILE_ID!");
271 this->device()->close();
274 m_id = t_pTag->toFiffID();
278 qWarning(
"Fiff::open: file does have a directory pointer");
279 this->device()->close();
286 qInfo(
"Creating tag directory for %s...", t_sFileName.toUtf8().constData());
288 qint32 dirpos = *t_pTag->toInt();
294 m_dir = this->make_dir(&ok);
296 qCritical (
"Could not create tag directory!");
301 if(!this->
read_tag(t_pTag, dirpos)) {
302 qCritical(
"Could not read the tag directory (file probably damaged)!");
305 m_dir = t_pTag->toDirEntry();
311 if (m_dir[m_dir.size()-2]->kind ==
FIFF_DIR) {
313 m_dir[m_dir.size()-1]->kind = -1;
314 m_dir[m_dir.size()-1]->type = -1;
315 m_dir[m_dir.size()-1]->size = -1;
316 m_dir[m_dir.size()-1]->pos = -1;
322 if((this->m_dirtree = this->
make_subtree(m_dir)) ==
nullptr)
325 this->m_dirtree->parent.clear();
330 this->device()->seek(SEEK_SET);
338 if(this->device()->isOpen())
339 this->device()->close();
352 QList<FiffDirEntry::SPtr>
dir;
355 node->dir_tree = dentry;
361 if (!this->
read_tag(t_pTag,dentry[current]->pos))
364 node->type = *t_pTag->toInt();
367 node->id = this->
id();
372 for (; current < dentry.size(); ++current) {
377 QList<FiffDirEntry::SPtr> sub_dentry = dentry.mid(current);
380 child->parent = node;
381 node->children.append(child);
389 else if (dentry[current]->kind == -1)
391 else if (level == 0) {
398 if (!this->
read_tag(t_pTag,dentry[current]->pos))
400 node->id = t_pTag->toFiffID();
451 for (insert = -1, b = 0; insert_blocks[b] >= 0; b++) {
452 for (k = 0; k <
nent(); k++) {
456 if (*(t_pTag->toInt()) == insert_blocks[b]) {
466 qCritical(
"Suitable place for environment insertion not found.");
474 if (where < 0 || where >=
nent()-1) {
475 qCritical(
"illegal insertion point in fiff_insert_after!");
480 QList<FiffDirEntry::SPtr> old_dir =
dir();
481 QList<FiffDirEntry::SPtr> this_ent = old_dir.mid(where);
483 if (!
read_tag(t_pTagNext, this_ent[0]->pos))
488 qint64 next_tmp = device()->pos();
492 device()->seek(device()->size());
496 QList<FiffDirEntry::SPtr> new_dir = old_dir.mid(0, where+1);
498 qint64 old_end = device()->pos();
507 new_this->size = 1 * 4;
509 new_dir.append(new_this);
514 new_this->size = 5 * 4;
516 new_dir.append(new_this);
521 new_this->size = workingDir.size();
523 new_dir.append(new_this);
528 new_this->size = command.size();
530 new_dir.append(new_this);
535 new_this->size = 1 * 4;
537 new_dir.append(new_this);
542 new_dir.append(old_dir.mid(where+1));
546 t_pTagNext->next = (qint32)old_end;
563 QList<FiffDirNode::SPtr> covs = p_Node->dir_tree_find(
FIFFB_MNE_COV);
564 if (covs.size() == 0)
566 qWarning(
"No covariance matrices found");
574 bool success =
false;
577 bool diagmat =
false;
584 for(p = 0; p < covs.size(); ++p)
587 if (success && *tag->toInt() == cov_kind)
595 qWarning(
"Covariance matrix dimension not found.\n");
602 nfree = *tag->toInt();
607 if (names.size() != dim)
609 qWarning(
"Number of names does not match covariance matrix dimension\n");
617 qWarning(
"No covariance matrix data found\n");
627 cov_diag = Map<VectorXd>(tag->toDouble(),dim);
631 cov_diag = Map<VectorXf>(tag->toFloat(),dim).cast<
double>();
634 qCritical(
"Illegal data type for covariance matrix\n");
639 qInfo(
"\t%d x %d diagonal covariance (kind = %d) found.\n", dim, dim, cov_kind);
648 vals = Map<VectorXd>(tag->toDouble(),nn);
652 vals = Map<VectorXf>(tag->toFloat(),nn).cast<
double>();
656 qDebug() << tag->getInfo();
665 cov = MatrixXd::Zero(dim,dim);
669 for(qint32 j = 0; j < dim; ++j)
671 for(qint32 k = 0; k <= j; ++k)
677 for(qint32 j = 0; j < dim; ++j)
678 for(qint32 k = j+1; k < dim; ++k)
682 qInfo(
"\t%d x %d full covariance (kind = %d) found.\n", dim, dim, cov_kind);
688 qDebug() <<
"ToDo: FiffStream::read_cov - this needs to be debugged.\n";
690 qInfo(
"\t%d x %d sparse covariance (kind = %d) found.\n", dim, dim, cov_kind);
729 eig = VectorXd(Map<VectorXd>(tag1->toDouble(),dim));
730 eigvec = tag2->toFloatMatrix().cast<
double>();
731 eigvec.transposeInPlace();
736 QList<FiffProj> projs = this->
read_proj(current);
746 p_covData.
kind = cov_kind;
747 p_covData.
diag = diagmat;
749 p_covData.
names = names;
751 if(cov_diag.size() > 0)
752 p_covData.
data = cov_diag;
753 else if(cov.size() > 0)
754 p_covData.
data = cov;
755 else if(cov_sparse.size() > 0)
756 p_covData.
data = cov_sparse;
758 p_covData.
projs = projs;
759 p_covData.
bads = bads;
760 p_covData.
nfree = nfree;
762 p_covData.
eigvec = eigvec;
769 qInfo(
"Did not find the desired covariance matrix\n");
777 QList<FiffCtfComp> compdata;
780 qint32 i, k, p, col, row;
783 for (k = 0; k < t_qListComps.size(); ++k)
791 for(p = 0; p < node->nent(); ++p)
793 kind = node->dir[p]->kind;
794 pos = node->dir[p]->pos;
803 qWarning(
"Compensation type not found\n");
810 one.
ctfkind = *t_pTag->toInt();
817 else if (one.
ctfkind == 1194476114)
819 else if (one.
ctfkind == 1194541650)
821 else if (one.
ctfkind == 1194479433)
823 else if (one.
ctfkind == 1194544969)
828 for (p = 0; p < node->nent(); ++p)
830 kind = node->dir[p]->kind;
831 pos = node->dir[p]->pos;
842 calibrated = (bool)*t_pTag->toInt();
845 one.
rowcals = MatrixXd::Ones(1,mat->data.rows());
846 one.
colcals = MatrixXd::Ones(1,mat->data.cols());
855 QStringList ch_names;
856 for (p = 0; p < p_Chs.size(); ++p)
857 ch_names.append(p_Chs[p].ch_name);
860 MatrixXd col_cals(mat->data.cols(), 1);
862 for (col = 0; col < mat->data.cols(); ++col)
865 for (i = 0; i < ch_names.size(); ++i)
867 if (QString::compare(mat->col_names.at(col),ch_names.at(i)) == 0)
875 qWarning(
"Channel %s is not available in data",mat->col_names.at(col).toUtf8().constData());
880 qWarning(
"Ambiguous channel %s",mat->col_names.at(col).toUtf8().constData());
883 col_cals(col,0) = 1.0f/(p_Chs[p].range*p_Chs[p].cal);
888 MatrixXd row_cals(mat->data.rows(), 1);
890 for (row = 0; row < mat->data.rows(); ++row)
893 for (i = 0; i < ch_names.size(); ++i)
895 if (QString::compare(mat->row_names.at(row),ch_names.at(i)) == 0)
904 qWarning(
"Channel %s is not available in data",mat->row_names.at(row).toUtf8().constData());
909 qWarning(
"Ambiguous channel %s",mat->row_names.at(row).toUtf8().constData());
913 row_cals(row, 0) = p_Chs[p].range*p_Chs[p].cal;
915 mat->data = row_cals.asDiagonal()* mat->data *col_cals.asDiagonal();
920 compdata.append(one);
923 if (compdata.size() > 0)
924 qInfo(
"\tRead %lld compensation matrices\n",compdata.size());
939 QList<FiffDirNode::SPtr> t_qListDigData = p_Node->dir_tree_find(
FIFFB_ISOTRAK);
942 if(t_qListDigData.isEmpty()) {
945 if(t_qListDigData.isEmpty()) {
946 qWarning(
"No Isotrak data found in %s", this->
streamName().toLatin1().data());
956 for (
int k = 0; k < t_qListDigData.first()->
nent(); ++k) {
957 kind = t_qListDigData.first()->dir[k]->kind;
958 pos = t_qListDigData.first()->dir[k]->pos;
963 p_digData.
points.append(t_pTag->toDigPoint());
972 npoint = p_digData.
points.size();
975 qWarning(
"No digitizer data in %s", this->
streamName().toLatin1().data());
979 for (
auto& dig : p_digData.
points){
985 p_digData.
npoint = npoint;
987 for (
int k = 0; k < p_digData.
npoint; k++) {
988 p_digData.
active.append(1);
999 p_InfoForward.
clear();
1006 if (parent_meg.size() == 0)
1008 qWarning(
"No parent MEG information found in operator\n");
1014 QList<FiffChInfo> chs;
1019 for (qint32 k = 0; k < parent_meg[0]->nent(); ++k)
1021 kind = parent_meg[0]->dir[k]->kind;
1022 pos = parent_meg[0]->dir[k]->pos;
1026 chs.append( t_pTag->toChInfo() );
1034 p_InfoForward.
chs = chs;
1035 for (qint32 c = 0; c < p_InfoForward.
chs.size(); ++c)
1036 p_InfoForward.
ch_names << p_InfoForward.
chs[c].ch_name;
1038 p_InfoForward.
nchan = chs.size();
1045 cand = t_pTag->toCoordTrans();
1051 qWarning(
"MEG device/head coordinate transformation not found");
1054 qWarning(
"MEG/head coordinate transformation not found.\n");
1074 QList<FiffDirNode::SPtr> meas = p_Node->dir_tree_find(
FIFFB_MEAS);
1076 if (meas.size() == 0)
1078 qWarning(
"Could not find measurement data\n");
1082 QList<FiffDirNode::SPtr> meas_info = meas[0]->dir_tree_find(
FIFFB_MEAS_INFO);
1083 if (meas_info.count() == 0) {
1084 qWarning(
"Could not find measurement info\n");
1094 float sfreq = -1.0f;
1095 float linefreq = -1.0f;
1096 QList<FiffChInfo> chs;
1097 float lowpass = -1.0f;
1098 float highpass = -1.0f;
1101 QString proj_name =
"";
1102 QString xplotter_layout =
"";
1104 QString utc_offset =
"";
1107 QString experimenter =
"";
1108 QString description =
"";
1123 for (qint32 k = 0; k < meas_info[0]->nent(); ++k)
1125 kind = meas_info[0]->dir[k]->kind;
1126 pos = meas_info[0]->dir[k]->pos;
1131 nchan = *t_pTag->toInt();
1135 sfreq = *t_pTag->toFloat();
1139 linefreq = *t_pTag->toFloat();
1143 chs.append( t_pTag->toChInfo() );
1147 lowpass = *t_pTag->toFloat();
1151 highpass = *t_pTag->toFloat();
1155 meas_date[0] = t_pTag->toInt()[0];
1156 meas_date[1] = t_pTag->toInt()[1];
1161 cand = t_pTag->toCoordTrans();
1169 proj_id = *t_pTag->toInt();
1173 proj_name = t_pTag->toString();
1177 xplotter_layout = t_pTag->toString();
1181 experimenter = t_pTag->toString();
1185 description = t_pTag->toString();
1189 gantry_angle = *t_pTag->toInt();
1193 utc_offset = t_pTag->toString();
1202 qWarning(
"Number of channels in not defined\n");
1207 qWarning(
"Sampling frequency is not defined\n");
1212 qWarning(
"Line frequency is not defined\n");
1214 if (chs.size() == 0)
1216 qWarning(
"Channel information not defined\n");
1219 if (chs.size() != nchan)
1221 qWarning(
"Incorrect number of channel definitions found\n");
1227 QList<FiffDirNode::SPtr> hpi_result = meas_info[0]->dir_tree_find(
FIFFB_HPI_RESULT);
1228 if (hpi_result.size() == 1)
1230 for( qint32 k = 0; k < hpi_result[0]->nent(); ++k)
1232 kind = hpi_result[0]->dir[k]->kind;
1233 pos = hpi_result[0]->dir[k]->pos;
1237 cand = t_pTag->toCoordTrans();
1249 QList<FiffDirNode::SPtr> isotrak = meas_info[0]->dir_tree_find(
FIFFB_ISOTRAK);
1251 QList<FiffDigPoint> dig;
1256 if (isotrak.size() == 1)
1258 for (k = 0; k < isotrak[0]->nent(); ++k)
1260 kind = isotrak[0]->dir[k]->kind;
1261 pos = isotrak[0]->dir[k]->pos;
1265 dig.append(t_pTag->toDigPoint());
1272 qDebug() <<
"NEEDS To BE DEBBUGED: FIFF_MNE_COORD_FRAME" << t_pTag->getType();
1273 coord_frame = *t_pTag->toInt();
1278 qDebug() <<
"NEEDS To BE DEBBUGED: FIFF_COORD_TRANS" << t_pTag->getType();
1279 dig_trans = t_pTag->toCoordTrans();
1284 for(k = 0; k < dig.size(); ++k)
1285 dig[k].coord_frame = coord_frame;
1288 if (dig_trans.
from != coord_frame && dig_trans.
to != coord_frame)
1294 QList<FiffDirNode::SPtr> acqpars = meas_info[0]->dir_tree_find(
FIFFB_DACQ_PARS);
1297 if (acqpars.size() == 1)
1299 for( k = 0; k < acqpars[0]->nent(); ++k)
1301 kind = acqpars[0]->dir[k]->kind;
1302 pos = acqpars[0]->dir[k]->pos;
1306 acq_pars = t_pTag->toString();
1311 acq_stim = t_pTag->toString();
1318 QList<FiffProj> projs = this->
read_proj(meas_info[0]);
1322 QList<FiffCtfComp> comps = this->
read_ctf_comp(meas_info[0], chs);
1331 if (p_Node->id.version != -1)
1339 if (meas_info[0]->parent_id.version == -1)
1341 if (meas_info[0]->
id.version == -1)
1343 if (meas[0]->
id.version == -1)
1345 if (meas[0]->parent_id.version == -1)
1348 info.
meas_id = meas[0]->parent_id;
1354 info.
meas_id = meas_info[0]->id;
1357 info.
meas_id = meas_info[0]->parent_id;
1359 if (meas_date[0] == -1)
1374 if (highpass != -1.0f)
1379 if (lowpass != -1.0f)
1389 for (qint32 c = 0; c < info.
nchan; ++c)
1427 p_NodeInfo = meas[0];
1442 bool found_it =
false;
1445 for (
int k = 0; k < node->nchild(); ++k)
1449 if(node->children[k]->has_tag(matkind))
1451 node = node->children[k];
1459 qWarning(
"Fiff::read_named_matrix: Desired named matrix (kind = %d) not available\n",matkind);
1465 if (!node->has_tag(matkind))
1467 qWarning(
"Desired named matrix (kind = %d) not available",matkind);
1476 if(!node->find_tag(
this, matkind, t_pTag))
1478 qWarning(
"Matrix data missing.\n");
1484 mat.
data = t_pTag->toFloatMatrix().cast<
double>();
1485 mat.
data.transposeInPlace();
1492 if (*t_pTag->toInt() != mat.
nrow)
1494 qWarning(
"Number of rows in matrix data and FIFF_MNE_NROW tag do not match");
1498 if (*t_pTag->toInt() != mat.
ncol)
1500 qWarning(
"Number of columns in matrix data and FIFF_MNE_NCOL tag do not match");
1506 row_names = t_pTag->toString();
1510 col_names = t_pTag->toString();
1515 if (!row_names.isEmpty())
1518 if (!col_names.isEmpty())
1523 qWarning(
"FiffStream::read_named_matrix - Number of rows in matrix data and row names do not match\n");
1528 qWarning(
"FiffStream::read_named_matrix - Number of columns in matrix data and column names do not match\n");
1538 QList<FiffProj> projdata;
1542 QList<FiffDirNode::SPtr> t_qListNodes = p_Node->dir_tree_find(
FIFFB_PROJ);
1543 if ( t_qListNodes.size() == 0 )
1547 t_qListNodes[0]->find_tag(
this,
FIFF_NCHAN, t_pTag);
1550 global_nchan = *t_pTag->toInt();
1553 QList<FiffDirNode::SPtr> t_qListItems = t_qListNodes[0]->dir_tree_find(
FIFFB_PROJ_ITEM);
1554 for ( qint32 i = 0; i < t_qListItems.size(); ++i)
1560 t_pFiffDirTreeItem->find_tag(
this,
FIFF_NCHAN, t_pTag);
1562 nchan = *t_pTag->toInt();
1564 nchan = global_nchan;
1570 qDebug() <<
"read_proj: this has to be debugged";
1571 desc = t_pTag->toString();
1575 t_pFiffDirTreeItem->find_tag(
this,
FIFF_NAME, t_pTag);
1577 desc = t_pTag->toString();
1580 qWarning(
"Projection item description missing\n");
1599 kind = *t_pTag->toInt();
1603 qWarning(
"Projection item kind missing");
1610 nvec = *t_pTag->toInt();
1614 qWarning(
"Number of projection vectors not specified\n");
1625 qWarning(
"Projection item channel list missing\n");
1632 data = t_pTag->toFloatMatrix().cast<
double>();
1633 data.transposeInPlace();
1637 qWarning(
"Projection item data missing\n");
1643 active = *t_pTag->toInt();
1647 if (data.cols() != names.size())
1649 qWarning(
"Number of channel names does not match the size of data matrix\n");
1656 QStringList defaultList;
1657 FiffNamedMatrix t_fiffNamedMatrix(nvec, nchan, defaultList, names, data);
1659 FiffProj one(kind, active, desc, t_fiffNamedMatrix);
1661 projdata.append(one);
1664 if (projdata.size() > 0)
1666 qInfo(
"\tRead a total of %lld projection items:\n", projdata.size());
1667 for(qint32 k = 0; k < projdata.size(); ++k)
1669 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");
1682 this->device()->seek(pos);
1691 if (p_pTag->size() > 0)
1693 this->readRawData(p_pTag->data(), p_pTag->size());
1698 this->device()->seek(p_pTag->next);
1709 p_pTag = std::make_unique<FiffTag>();
1719 *
this >> p_pTag->kind;
1720 *
this >> p_pTag->type;
1723 p_pTag->resize(size);
1724 *
this >> p_pTag->next;
1730 QTcpSocket* t_qTcpSocket = qobject_cast<QTcpSocket*>(this->device());
1733 this->skipRawData(p_pTag->size());
1737 if (p_pTag->next > 0)
1739 if(!this->device()->seek(p_pTag->next)) {
1746 if(!this->device()->seek(this->device()->pos()+p_pTag->size())) {
1760 while(this->device()->bytesAvailable() < 16)
1761 this->device()->waitForReadyRead(10);
1767 while(this->device()->bytesAvailable() < p_pTag->size())
1768 this->device()->waitForReadyRead(10);
1782 this->device()->seek(pos);
1785 p_pTag = std::make_unique<FiffTag>();
1790 *
this >> p_pTag->kind;
1791 *
this >> p_pTag->type;
1794 p_pTag->resize(size);
1795 *
this >> p_pTag->next;
1803 if (this->byteOrder() == QDataStream::LittleEndian){
1811 if (p_pTag->size() > 0)
1813 this->readRawData(p_pTag->data(), p_pTag->size());
1820 this->device()->seek(p_pTag->next);
1829 bool allow_maxshield,
1830 bool is_littleEndian)
1836 QString t_sFileName = t_pStream->streamName();
1838 if(is_littleEndian){
1840 t_pStream->setByteOrder(QDataStream::LittleEndian);
1843 qInfo(
"Opening raw data %s...\n",t_sFileName.toUtf8().constData());
1845 if(!t_pStream->open()){
1854 if(!t_pStream->read_meas_info(t_pStream->dirtree(), info, meas))
1860 QList<FiffDirNode::SPtr> raw = meas->dir_tree_find(
FIFFB_RAW_DATA);
1861 if (raw.size() == 0)
1870 qInfo(
"Maxshield data found\n");
1872 if (raw.size() == 0)
1874 qWarning(
"No raw data in %s\n", t_sFileName.toUtf8().constData());
1880 if (raw.size() == 0)
1882 qWarning(
"No raw data in %s\n", t_sFileName.toUtf8().constData());
1893 data.
file = t_pStream;
1900 QList<FiffDirEntry::SPtr>
dir = raw[0]->dir;
1912 t_pStream->read_tag(t_pTag,
dir[first]->pos);
1913 first_samp = *t_pTag->toInt();
1924 t_pStream->read_tag(t_pTag,
dir[first]->pos);
1925 first_skip = *t_pTag->toInt();
1932 QList<FiffRawDir> rawdir;
1937 for (qint32 k = first; k <
nent; ++k)
1942 t_pStream->read_tag(t_pTag, ent->pos);
1943 nskip = *t_pTag->toInt();
1953 nsamp = ent->size/(2*nchan);
1956 nsamp = ent->size/(2*nchan);
1959 nsamp = ent->size/(4*nchan);
1962 nsamp = ent->size/(4*nchan);
1965 qWarning(
"Cannot handle data buffers of type %d\n",ent->type);
1973 first_samp += nsamp*first_skip;
1983 t_RawDir.
first = first_samp;
1984 t_RawDir.
last = first_samp + nskip*nsamp - 1;
1985 t_RawDir.
nsamp = nskip*nsamp;
1986 rawdir.append(t_RawDir);
1987 first_samp = first_samp + nskip*nsamp;
1996 t_RawDir.
first = first_samp;
1997 t_RawDir.
last = first_samp + nsamp - 1;
1998 t_RawDir.
nsamp = nsamp;
1999 rawdir.append(t_RawDir);
2000 first_samp += nsamp;
2010 for (qint32 k = 0; k < data.
info.
nchan; ++k)
2018 qInfo(
"\tRange : %d ... %d = %9.3f ... %9.3f secs",
2032 return p_sNameList.replace(
" ",
"").split(
":");
2047 QString t_sFileName = p_pStream->streamName();
2049 if(!p_IODevice.isOpen())
2051 if(!p_pStream->device()->open(QIODevice::WriteOnly))
2053 qWarning(
"Cannot write to %s\n", t_sFileName.toUtf8().constData());
2055 return p_pEmptyStream;
2078 QString t_sFileName = t_pStream->streamName();
2083 if(!t_pStream->open(QIODevice::ReadWrite)) {
2084 qCritical(
"Cannot open %s\n", t_sFileName.toUtf8().constData());
2089 long dirpos,pointerpos;
2091 QFile *file = qobject_cast<QFile *>(t_pStream->device());
2093 if (file !=
nullptr) {
2097 pointerpos = t_pStream->dir()[t_pStream->nent()-2]->pos;
2098 if(!t_pStream->read_tag(t_pTag,pointerpos)){
2099 qCritical(
"Could not read last tag in the directory list!");
2105 t_pStream->write_tag(t_pTag,pointerpos);
2110 pointerpos = t_pStream->dir()[1]->pos;
2111 if(!t_pStream->read_tag(t_pTag,pointerpos)){
2112 qCritical(
"Could not read directory pointer!");
2119 dirpos = *t_pTag->toInt();
2124 t_pStream->write_dir_pointer(-1, pointerpos);
2128 file->resize(dirpos);
2133 t_pStream->device()->seek(file->size());
2154 sel.resize(1,info.
nchan);
2155 for (k = 0; k < info.
nchan; ++k)
2159 QList<FiffChInfo> chs;
2161 for(k = 0; k < sel.cols(); ++k)
2162 chs << info.
chs.at(sel(0,k));
2186 QList<fiff_int_t> blocks;
2188 bool have_hpi_result =
false;
2189 bool have_isotrak =
false;
2190 if (blocks.size() > 0 && !info.
filename.isEmpty())
2195 if(!t_pStream2->open()){
2196 qDebug() <<
"Failed to open file. Returning early";
2200 for(qint32 k = 0; k < blocks.size(); ++k)
2202 QList<FiffDirNode::SPtr> nodes = t_pStream2->dirtree()->dir_tree_find(blocks[k]);
2205 have_hpi_result =
true;
2208 have_isotrak =
true;
2234 if (!have_hpi_result)
2237 t_pStream->write_coord_trans(info.
dev_head_t);
2240 t_pStream->write_coord_trans(info.
ctf_head_t);
2245 if (info.
dig.size() > 0 && !have_isotrak)
2248 for (qint32 k = 0; k < info.
dig.size(); ++k)
2249 t_pStream->write_dig_point(info.
dig[k]);
2258 t_pStream->write_proj(info.
projs);
2262 t_pStream->write_ctf_comp(info.
comps);
2266 if (info.
bads.size() > 0)
2292 cals = RowVectorXd(nchan);
2293 for(k = 0; k < nchan; ++k)
2298 chs[k].scanNo = k+1;
2302 cals[k] = chs[k].cal;
2303 t_pStream->write_ch_info(chs[k]);
2324 this->device()->seek(pos);
2327 QFile* file = qobject_cast<QFile*> (this->device());
2329 this->device()->seek(file->size());
2331 pos = this->device()->pos();
2335 *this << static_cast<qint32>(p_pTag->kind);
2336 *this << static_cast<qint32>(p_pTag->type);
2337 *this << static_cast<qint32>(datasize);
2338 *this << static_cast<qint32>(p_pTag->next);
2347 this->writeRawData(p_pTag->data(),datasize);
2382 *
this << (qint32)datasize;
2388 *
this << (qint32)ch.
scanNo;
2389 *
this << (qint32)ch.
logNo;
2390 *
this << (qint32)ch.
kind;
2403 *
this << (qint32)ch.
unit;
2412 ch_name = ch.
ch_name.mid(0, 15);
2416 len = ch_name.size();
2418 this->writeRawData(ch_name.toUtf8().constData(),len);
2421 const char* chNull =
"";
2422 for(qint32 i = 0; i < 16-len; ++i)
2423 this->writeRawData(chNull,1);
2442 for(i = 0; i < 3; ++i)
2443 *
this << chpos.
r0[i];
2445 for(i = 0; i < 3; ++i)
2446 *
this << chpos.
ex[i];
2448 for(i = 0; i < 3; ++i)
2449 *
this << chpos.
ey[i];
2451 for(i = 0; i < 3; ++i)
2452 *
this << chpos.
ez[i];
2475 *
this << (qint32)datasize;
2481 *
this << (qint32)trans.
from;
2482 *
this << (qint32)trans.
to;
2488 for (r = 0; r < 3; ++r)
2489 for (c = 0; c < 3; ++c)
2490 *
this <<
static_cast<float>(trans.
trans(r,c));
2491 for (r = 0; r < 3; ++r)
2492 *
this <<
static_cast<float>(trans.
trans(r,3));
2497 for (r = 0; r < 3; ++r)
2498 for (c = 0; c < 3; ++c)
2499 *
this <<
static_cast<float>(trans.
invtrans(r,c));
2500 for (r = 0; r < 3; ++r)
2501 *
this <<
static_cast<float>(trans.
invtrans(r,3));
2519 if (p_FiffCov.
nfree > 0)
2524 if(p_FiffCov.
names.size() > 0)
2538 qint32 dim = p_FiffCov.
dim;
2539 qint32 n = dim*(dim+1)/2;
2543 for(qint32 i = 0; i < dim; ++i)
2544 for(qint32 j = 0; j <= i; ++j)
2545 vals(count++) = p_FiffCov.
data(i,j);
2553 if(p_FiffCov.
eig.size() > 0 && p_FiffCov.
eigvec.size() > 0)
2565 if(p_FiffCov.
bads.size() > 0)
2585 if (comps.size() <= 0)
2591 for(qint32 k = 0; k < comps.size(); ++k)
2605 if(comps[k].save_calibrated) {
2606 comp.
data->data = (comp.
rowcals.asDiagonal()).inverse()* comp.
data->data * (comp.
colcals.asDiagonal()).inverse();
2634 *
this << (qint32)datasize;
2640 *
this << (qint32)dig.
kind;
2641 *
this << (qint32)dig.
ident;
2642 for(qint32 i = 0; i < 3; ++i)
2656 this->device()->seek(pos);
2659 QFile* file = qobject_cast<QFile*> (this->device());
2661 this->device()->seek(file->size());
2663 pos = this->device()->pos();
2669 *
this << (qint32)datasize;
2670 *
this << (qint32)next;
2695 this->device()->seek(pos);
2698 QFile* file = qobject_cast<QFile*> (this->device());
2700 this->device()->seek(file->size());
2703 pos = this->device()->pos();
2710 *
this << (qint32)datasize;
2716 for(qint32 i = 0; i <
nent; ++i) {
2717 *
this << (qint32)
dir[i]->kind;
2718 *
this << (qint32)
dir[i]->type;
2719 *
this << (qint32)
dir[i]->size;
2720 *
this << (qint32)
dir[i]->pos;
2732 qint32 datasize = nel * 8;
2734 *
this << (qint32)kind;
2736 *
this << (qint32)datasize;
2745 for(qint32 i = 0; i < nel; ++i)
2748 memcpy(&bits, &data[i],
sizeof(
double));
2761 qint32 datasize = nel * 4;
2763 *
this << (qint32)kind;
2765 *
this << (qint32)datasize;
2768 for(qint32 i = 0; i < nel; ++i)
2780 qint32 numel = mat.rows() * mat.cols();
2784 *
this << (qint32)kind;
2786 *
this << (qint32)datasize;
2791 for(i = 0; i < mat.rows(); ++i)
2792 for(j = 0; j < mat.cols(); ++j)
2796 dims[0] = mat.cols();
2797 dims[1] = mat.rows();
2800 for(i = 0; i < 3; ++i)
2820 qint32 nnzm = mat.nonZeros();
2821 qint32 ncol = mat.cols();
2822 fiff_int_t datasize = 4*nnzm + 4*nnzm + 4*(ncol+1) + 4*4;
2826 using T = Eigen::Triplet<float>;
2828 s.reserve(mat.nonZeros());
2829 for (
int k=0; k < mat.outerSize(); ++k)
2830 for (SparseMatrix<float>::InnerIterator it(mat,k); it; ++it)
2831 s.push_back(T(it.row(), it.col(), it.value()));
2836 std::vector<qint32> cols, starts;
2839 for(i = 0; i < s.size(); ++i)
2841 if((
signed) s[i].col() != v_old)
2844 cols.push_back(s[i].col());
2845 starts.push_back(i);
2849 *
this << (qint32)kind;
2851 *
this << (qint32)datasize;
2857 for(i = 0; i < s.size(); ++i)
2858 *
this << s[i].value();
2863 for(i = 0; i < s.size(); ++i)
2864 *
this << s[i].row();
2869 RowVectorXi ptrs = RowVectorXi::Ones(ncol+1);
2872 for(k = 0; k < cols.size(); ++k)
2873 ptrs[cols[k]] = starts[k];
2878 for(k = ncol; k >= 1; --k)
2880 ptrs[k-1] = ptrs[k];
2882 for(i = 0; i < (quint32)ptrs.size(); ++i)
2888 dims[0] = mat.nonZeros();
2889 dims[1] = mat.rows();
2890 dims[2] = mat.cols();
2893 for(i = 0; i < 4; ++i)
2913 qint32 nnzm = mat.nonZeros();
2914 qint32 nrow = mat.rows();
2915 fiff_int_t datasize = 4*nnzm + 4*nnzm + 4*(nrow+1) + 4*4;
2919 using T = Eigen::Triplet<float>;
2921 s.reserve(mat.nonZeros());
2922 for (
int k=0; k < mat.outerSize(); ++k)
2923 for (SparseMatrix<float>::InnerIterator it(mat,k); it; ++it)
2924 s.push_back(T(it.row(), it.col(), it.value()));
2929 std::vector<qint32> rows, starts;
2932 for(i = 0; i < s.size(); ++i)
2934 if((
signed) s[i].row() != v_old)
2937 rows.push_back(s[i].row());
2938 starts.push_back(i);
2945 *
this << (qint32)kind;
2947 *
this << (qint32)datasize;
2953 for(i = 0; i < s.size(); ++i)
2954 *
this << s[i].value();
2959 for(i = 0; i < s.size(); ++i)
2960 *
this << s[i].col();
2965 RowVectorXi ptrs = RowVectorXi::Ones(nrow+1);
2968 for(k = 0; k < rows.size(); ++k)
2969 ptrs[rows[k]] = starts[k];
2975 for(k = nrow; k >= 1; --k)
2977 ptrs[k-1] = ptrs[k];
2980 for(i = 0; i < (quint32)ptrs.size(); ++i)
2987 dims[0] = mat.nonZeros();
2988 dims[1] = mat.rows();
2989 dims[2] = mat.cols();
2992 for(i = 0; i < 4; ++i)
3017 *
this << (qint32)kind;
3019 *
this << (qint32)datasize;
3026 data[1] = t_id.
machid[0];
3027 data[2] = t_id.
machid[1];
3031 for(qint32 i = 0; i < 5; ++i)
3060 QList<FiffChInfo> chs;
3061 for(k = 0; k < p_FiffInfoBase.
nchan; ++k)
3062 chs << p_FiffInfoBase.
chs[k];
3064 for(k = 0; k < p_FiffInfoBase.
nchan; ++k)
3069 chs[k].scanNo = k+1;
3076 bool have_hpi_result =
false;
3081 if (!have_hpi_result)
3092 if (p_FiffInfoBase.
bads.size() > 0)
3112 *
this << (qint32)kind;
3114 *
this << (qint32)datasize;
3115 *
this << (qint32)next;
3117 for(qint32 i = 0; i < nel; ++i)
3132 qint32 numel = mat.rows() * mat.cols();
3136 *
this << (qint32)kind;
3138 *
this << (qint32)datasize;
3143 for(i = 0; i < mat.rows(); ++i)
3144 for(j = 0; j < mat.cols(); ++j)
3148 dims[0] = mat.cols();
3149 dims[1] = mat.rows();
3152 for(i = 0; i < 3; ++i)
3162 QString all = data.join(
":");
3191 if (projs.size() <= 0)
3196 for(qint32 k = 0; k < projs.size(); ++k)
3203 float fValue = 0.0f;
3209 qint32 bValue = (qint32)projs[k].active;
3226 if (p_FiffEvokedSet.
evoked.isEmpty())
3237 for (
int j = 0; j < p_FiffEvokedSet.
evoked.size(); ++j) {
3250 int nave = evoked.
nave;
3253 int first = evoked.
first;
3256 int last = evoked.
last;
3259 Eigen::MatrixXf floatData = evoked.
data.cast<
float>();
3260 for (
int ch = 0; ch < floatData.rows(); ++ch) {
3262 static_cast<int>(floatData.cols()));
3278 const RowVectorXd& cals)
3280 if (buf.rows() != cals.cols())
3282 qWarning(
"buffer and calibration sizes do not match\n");
3286 using T = Eigen::Triplet<double>;
3287 std::vector<T> tripletList;
3288 tripletList.reserve(cals.cols());
3289 for(qint32 i = 0; i < cals.cols(); ++i)
3290 tripletList.push_back(T(i, i, 1.0/cals[i]));
3292 SparseMatrix<double> inv_calsMat(cals.cols(), cals.cols());
3293 inv_calsMat.setFromTriplets(tripletList.begin(), tripletList.end());
3295 MatrixXf tmp = (inv_calsMat*buf).cast<float>();
3303 const SparseMatrix<double>& mult)
3305 if (buf.rows() != mult.cols()) {
3306 qWarning(
"buffer and mult sizes do not match\n");
3310 SparseMatrix<double> inv_mult(mult.rows(), mult.cols());
3311 for (
int k=0; k<inv_mult.outerSize(); ++k)
3312 for (SparseMatrix<double>::InnerIterator it(mult,k); it; ++it)
3313 inv_mult.coeffRef(it.row(),it.col()) = 1/it.value();
3315 MatrixXf tmp = (inv_mult*buf).cast<float>();
3324 MatrixXf tmp = buf.cast<
float>();
3332 const QString& data)
3337 *
this << (qint32)kind;
3339 *
this << (qint32)datasize;
3342 this->writeRawData(data.toUtf8().constData(),datasize);
3354 *
this << 4+(qint32)datasize;
3358 this->writeRawData(data.toUtf8().constData(),datasize);
3363QList<FiffDirEntry::SPtr> FiffStream::make_dir(
bool *ok)
3366 QList<FiffDirEntry::SPtr>
dir;
3373 if(!this->device()->seek(SEEK_SET))
3382 if (this->status() != QDataStream::Ok) {
3383 this->resetStatus();
3395 t_pFiffDirEntry->kind = t_pTag->kind;
3396 t_pFiffDirEntry->type = t_pTag->type;
3397 t_pFiffDirEntry->size = t_pTag->size();
3400 dir.append(t_pFiffDirEntry);
3401 if (t_pTag->next < 0)
3408 t_pFiffDirEntry->kind = -1;
3409 t_pFiffDirEntry->type = -1;
3410 t_pFiffDirEntry->size = -1;
3411 t_pFiffDirEntry->pos = -1;
3412 dir.append(t_pFiffDirEntry);
3426 qWarning(
"Fiff::open: file does not start with a file id tag\n");
3432 qWarning(
"Fiff::open: file does not start with a file id tag\n");
3435 if (p_pTag->size() != 20)
3437 qWarning(
"Fiff::open: file does not start with a file id tag\n");
FiffChPos class declaration.
FiffTag class declaration, which provides fiff tag I/O and processing methods.
FiffInfo class declaration.
#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
FiffStream class declaration.
FiffDigitizerData class declaration.
FiffInfoBase class declaration.
FiffRawData class declaration.
FiffDirNode class declaration, which provides fiff dir tree processing methods.
FiffCtfComp class declaration.
FiffChInfo class declaration.
FiffId class declaration.
FiffCov class declaration.
FiffEvokedSet class declaration.
#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 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
FiffCoordTrans class declaration.
FiffDigPoint class declaration.
IOUtils class declaration.
Linalg class declaration.
Numerics class declaration.
FIFF file I/O and data structures (raw, epochs, evoked, covariance, forward).
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
Measurement channel position and coil type.
Coordinate transformation description.
Eigen::Matrix< float, 4, 4, Eigen::DontAlign > trans
Eigen::Matrix< float, 4, 4, Eigen::DontAlign > invtrans
CTF software compensation data.
FiffNamedMatrix::SDPtr data
Digitization point description.
Digitization points container and description.
QList< FIFFLIB::FiffDigPoint > points
Directory entry description.
QSharedPointer< FiffDirEntry > SPtr
Directory node structure.
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)
QList< FiffEvoked > evoked
Universally unique identifier.
static FiffId new_file_id()
FIFF measurement file information.
QList< FiffCtfComp > comps
QList< FiffDigPoint > dig
FiffCoordTrans ctf_head_t
FiffCoordTrans dev_head_t
QSharedDataPointer< FiffNamedMatrix > SDPtr
FIFF raw measurement data.
QList< FiffRawDir > rawdir
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)
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)