76: m_qListBemSurface(p_MNEBem.m_qListBemSurface)
90 std::cout <<
"Could not read the bem surfaces\n";
108 m_qListBemSurface.clear();
118 bool open_here =
false;
121 if (!p_pStream->device()->isOpen())
123 QString t_sFileName = p_pStream->streamName();
125 t_file.setFileName(t_sFileName);
127 if(!p_pStream->open())
140 QList<FiffDirNode::SPtr> bem = p_pStream->dirtree()->dir_tree_find(
FIFFB_BEM);
143 qCritical() <<
"No BEM block found!";
151 QList<FiffDirNode::SPtr> bemsurf = p_pStream->dirtree()->dir_tree_find(
FIFFB_BEM_SURF);
152 if(bemsurf.isEmpty())
154 qCritical() <<
"No BEM surfaces found!";
162 for(
int k = 0; k < bemsurf.size(); ++k)
165 qInfo(
"\tReading a BEM surface...");
172 qInfo(
"\t[done]\n" );
174 p_Bem.m_qListBemSurface.append(p_BemSurface);
178 qInfo(
"\t%lld bem surfaces read\n", bemsurf.size());
191 p_BemSurface.
clear();
202 p_BemSurface.
id = *t_pTag->toInt();
210 p_BemSurface.
sigma = 1.0;
214 p_BemSurface.
sigma = *t_pTag->toFloat();
223 std::cout <<
"np not found!";
228 p_BemSurface.
np = *t_pTag->toInt();
237 std::cout <<
"ntri not found!";
242 p_BemSurface.
ntri = *t_pTag->toInt();
250 qWarning() <<
"FIFF_MNE_COORD_FRAME not found, trying FIFF_BEM_COORD_FRAME.";
254 std::cout <<
"Coordinate frame information not found.";
277 std::cout <<
"Vertex data not found.";
281 p_BemSurface.
rr = t_pTag->toFloatMatrix().transpose();
282 qint32 rows_rr = p_BemSurface.
rr.rows();
284 if (rows_rr != p_BemSurface.
np)
287 std::cout <<
"Vertex information is incorrect.";
299 std::cout <<
"Vertex normals not found.";
303 p_BemSurface.
nn = t_pTag->toFloatMatrix().transpose();
307 p_BemSurface.
nn = t_pTag->toFloatMatrix().transpose();
310 if (p_BemSurface.
nn.rows() != p_BemSurface.
np)
313 std::cout <<
"Vertex normal information is incorrect.";
320 if (p_BemSurface.
ntri > 0)
327 std::cout <<
"Triangulation not found.";
332 p_BemSurface.
itris = t_pTag->toIntMatrix().transpose();
333 p_BemSurface.
itris -= MatrixXi::Constant(p_BemSurface.
itris.rows(),3,1);
338 p_BemSurface.
itris = t_pTag->toIntMatrix().transpose();
339 p_BemSurface.
itris -= MatrixXi::Constant(p_BemSurface.
itris.rows(),3,1);
342 if (p_BemSurface.
itris.rows() != p_BemSurface.
ntri)
345 std::cout <<
"Triangulation information is incorrect.";
351 MatrixXi p_defaultMatrix(0, 0);
352 p_BemSurface.
itris = p_defaultMatrix;
368 qInfo(
"Write BEM surface in %s...\n", t_pStream->streamName().toUtf8().constData());
370 t_pStream->end_file();
378 for(qint32 h = 0; h < m_qListBemSurface.size(); ++h)
380 qInfo(
"\tWrite a bem surface... ");
382 m_qListBemSurface[h].writeToStream(p_pStream);
386 qInfo(
"\t%lld bem surfaces written\n", m_qListBemSurface.size());
394 if (idx>=m_qListBemSurface.length())
396 qWarning(
"Warning: Required surface doesn't exist! Returning surface '0'.");
399 return m_qListBemSurface[idx];
406 if (idx >= m_qListBemSurface.length())
408 qWarning(
"Warning: Required surface doesn't exist! Returning surface '0'.");
411 return m_qListBemSurface[idx];
418 this->m_qListBemSurface.append(surf);
426 this->m_qListBemSurface.append(*surf);
435 QList<MatrixXf> vertList;
436 for (
int i=0; i<this->m_qListBemSurface.size(); i++)
438 vertList.append(this->m_qListBemSurface[i].rr);
443 for (
int i=0; i<this->m_qListBemSurface.size(); i++)
445 this->m_qListBemSurface[i].rr = vertList.at(i);
455 for (
int i=0; i<this->m_qListBemSurface.size(); i++)
457 vert = this->m_qListBemSurface[i].rr;
459 this->m_qListBemSurface[i].rr = vert;
469 for (
int i=0; i<this->m_qListBemSurface.size(); i++)
471 vert = this->m_qListBemSurface[i].rr;
473 this->m_qListBemSurface[i].rr = vert;
#define FIFF_MNE_COORD_FRAME
#define FIFF_MNE_SOURCE_SPACE_NORMALS
#define FIFF_MNE_SOURCE_SPACE_TRIANGLES
#define FIFFV_BEM_SURF_ID_UNKNOWN
#define FIFF_BEM_SURF_NNODE
#define FIFF_BEM_SURF_NODES
#define FIFF_BEM_SURF_TRIANGLES
#define FIFF_BEM_COORD_FRAME
#define FIFF_BEM_SURF_NTRI
#define FIFF_BEM_SURF_NORMALS
MNEBem class declaration.
FsLabel class declaration.
Core MNE data structures (source spaces, source estimates, hemispheres).
FreeSurfer surface and annotation I/O.
FIFF file I/O and data structures (raw, epochs, evoked, covariance, forward).
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
Coordinate transformation description.
Eigen::MatrixX3f apply_inverse_trans(const Eigen::MatrixX3f &rr, bool do_move=true) const
Eigen::MatrixX3f apply_trans(const Eigen::MatrixX3f &rr, bool do_move=true) const
QSharedPointer< FiffDirNode > SPtr
fiff_long_t start_block(fiff_int_t kind)
QSharedPointer< FiffStream > SPtr
static FiffStream::SPtr start_file(QIODevice &p_IODevice)
fiff_long_t end_block(fiff_int_t kind, fiff_int_t next=FIFFV_NEXT_SEQ)
std::unique_ptr< FiffTag > UPtr
Eigen::MatrixXf calculate(const Eigen::MatrixXf &sLm, const Eigen::MatrixXf &dLm, const Eigen::MatrixXf &sVert)
void invtransform(const FIFFLIB::FiffCoordTrans &trans)
void transform(const FIFFLIB::FiffCoordTrans &trans)
static bool readBemSurface(FIFFLIB::FiffStream::SPtr &p_pStream, const FIFFLIB::FiffDirNode::SPtr &p_Tree, MNEBemSurface &p_BemSurface)
void writeToStream(FIFFLIB::FiffStream *p_pStream)
void warp(const Eigen::MatrixXf &sLm, const Eigen::MatrixXf &dLm)
void write(QIODevice &p_IODevice)
static bool readFromStream(FIFFLIB::FiffStream::SPtr &p_pStream, bool add_geom, MNEBem &p_Bem)
const MNEBemSurface & operator[](qint32 idx) const
MNEBem & operator<<(const MNEBemSurface &surf)
BEM surface provides geometry information.