63 using namespace FIFFLIB;
64 using namespace Eigen;
82 : m_qListDigPoint(p_FiffDigPointSet.m_qListDigPoint)
89 : m_qListDigPoint(pointList)
104 qInfo() <<
"[FiffDigPointSet::FiffDigPointSet] Could not read the FiffDigPointSet";
107 qInfo(
"[FiffDigPointSet::FiffDigPointSet] %i digitizer Points read from file.", this->
size());
123 bool open_here =
false;
125 if (!p_pStream->device()->isOpen()) {
126 QString t_sFileName = p_pStream->streamName();
128 if(!p_pStream->open())
131 printf(
"Opening header data %s...\n",t_sFileName.toUtf8().constData());
140 fiff_int_t kind = -1;
147 QList<FiffDirNode::SPtr> isotrak = p_pStream->dirtree()->dir_tree_find(FIFFB_ISOTRAK);
149 fiff_int_t coord_frame = FIFFV_COORD_HEAD;
153 if (isotrak.size() == 1)
155 for (
k = 0;
k < isotrak[0]->nent(); ++
k)
157 kind = isotrak[0]->dir[
k]->kind;
158 pos = isotrak[0]->dir[
k]->pos;
161 p_pStream->read_tag(t_pTag, pos);
162 p_Dig.m_qListDigPoint.append(t_pTag->toDigPoint());
168 p_pStream->read_tag(t_pTag, pos);
169 qDebug() <<
"NEEDS To BE DEBBUGED: FIFF_MNE_COORD_FRAME" << t_pTag->getType();
170 coord_frame = *t_pTag->toInt();
174 p_pStream->read_tag(t_pTag, pos);
175 qDebug() <<
"NEEDS To BE DEBBUGED: FIFF_COORD_TRANS" << t_pTag->getType();
176 dig_trans = t_pTag->toCoordTrans();
181 for(
k = 0;
k < p_Dig.
size(); ++
k)
183 p_Dig[
k].coord_frame = coord_frame;
206 printf(
"Write Digitizer Points in %s...\n", t_pStream->streamName().toUtf8().constData());
208 t_pStream->end_file();
219 for(qint32 h = 0; h < m_qListDigPoint.size(); ++h)
224 printf(
"\t%lld digitizer points written\n", m_qListDigPoint.size());
234 if (idx>=m_qListDigPoint.length())
236 qWarning(
"Warning: Required DigPoint doesn't exist! Returning DigPoint '0'.");
239 return m_qListDigPoint[idx];
246 if (idx >= m_qListDigPoint.length())
248 qWarning(
"Warning: Required DigPoint doesn't exist! Returning DigPoint '0'.");
251 return m_qListDigPoint[idx];
260 for(
int i = 0; i < m_qListDigPoint.size(); ++i) {
261 if(includeTypes.contains(m_qListDigPoint[i].kind)) {
262 pickedSet << m_qListDigPoint[i];
273 this->m_qListDigPoint.append(dig);
281 this->m_qListDigPoint.append(*dig);
290 for(
int i = 0; i < m_qListDigPoint.size(); ++i) {
291 tempvec(0) = m_qListDigPoint.at(i).r[0];
292 tempvec(1) = m_qListDigPoint.at(i).r[1];
293 tempvec(2) = m_qListDigPoint.at(i).r[2];
296 tempvec = coordTrans.
invtrans * tempvec;
298 tempvec = coordTrans.
trans * tempvec;
300 m_qListDigPoint[i].r[0] = tempvec(0);
301 m_qListDigPoint[i].r[1] = tempvec(1);
302 m_qListDigPoint[i].r[2] = tempvec(2);
310 return m_qListDigPoint;