v2.0.0
Loading...
Searching...
No Matches
MNELIB::MNESurface Class Reference

This defines a surface. More...

#include <mne_surface.h>

Public Types

typedef std::shared_ptr< MNESurfaceSPtr
typedef std::shared_ptr< const MNESurfaceConstSPtr
Public Types inherited from MNELIB::MNESurfaceOrVolume
typedef QSharedPointer< MNESurfaceOrVolumeSPtr
typedef QSharedPointer< const MNESurfaceOrVolumeConstSPtr
typedef Eigen::Matrix< float, Eigen::Dynamic, 3, Eigen::RowMajor > PointsT
typedef Eigen::Matrix< float, Eigen::Dynamic, 3, Eigen::RowMajor > NormalsT
typedef Eigen::Matrix< int, Eigen::Dynamic, 3, Eigen::RowMajor > TrianglesT

Public Member Functions

 MNESurface ()
 ~MNESurface ()
double sum_solids (const Eigen::Vector3f &from) const
void triangle_coords (const Eigen::Vector3f &r, int tri, float &x, float &y, float &z) const
int nearest_triangle_point (const Eigen::Vector3f &r, const MNEProjData *user, int tri, float &x, float &y, float &z) const
int nearest_triangle_point (const Eigen::Vector3f &r, int tri, float &x, float &y, float &z) const
Eigen::Vector3f project_to_triangle (int tri, float p, float q) const
Eigen::Vector3f project_to_triangle (int best, const Eigen::Vector3f &r) const
int project_to_surface (const MNEProjData *proj_data, const Eigen::Vector3f &r, float &distp) const
void find_closest_on_surface_approx (const PointsT &r, int np, Eigen::VectorXi &nearest_tri, Eigen::VectorXf &dist, int nstep) const
void decide_search_restriction (MNEProjData &p, int approx_best, int nstep, const Eigen::Vector3f &r) const
void activate_neighbors (int start, Eigen::VectorXi &act, int nstep) const
Public Member Functions inherited from MNELIB::MNESurfaceOrVolume
 MNESurfaceOrVolume ()
 Constructs the MNE Surface or Volume.
virtual ~MNESurfaceOrVolume ()
 Destroys the MNE Surface or Volume description.
 MNESurfaceOrVolume (const MNESurfaceOrVolume &)=default
MNESurfaceOrVolumeoperator= (const MNESurfaceOrVolume &)=default
 MNESurfaceOrVolume (MNESurfaceOrVolume &&)=default
MNESurfaceOrVolumeoperator= (MNESurfaceOrVolume &&)=default
void add_uniform_curv ()
void add_triangle_data ()
void compute_surface_cm ()
void calculate_vertex_distances ()
int add_vertex_normals ()
int add_geometry_info (int do_normals, int check_too_many_neighbors)
int add_geometry_info (int do_normals)
int add_geometry_info2 (int do_normals)
Eigen::VectorXi nearestVertIdx () const
Eigen::VectorXd nearestDistVec () const
void setNearestData (const Eigen::VectorXi &nearestIdx, const Eigen::VectorXd &nearestDist)

Static Public Member Functions

static MNESurfaceread_bem_surface (const QString &name, int which, int add_geometry, float *sigmap)
static MNESurfaceread_bem_surface2 (const QString &name, int which, int add_geometry, float *sigmap)
static MNESurfaceread_bem_surface (const QString &name, int which, int add_geometry, float *sigmap, bool check_too_many_neighbors)
Static Public Member Functions inherited from MNELIB::MNESurfaceOrVolume
static double solid_angle (const Eigen::Vector3f &from, const MNELIB::MNETriangle &tri)
static void compute_cm (const PointsT &rr, int np, float(&cm)[3])

Additional Inherited Members

Public Attributes inherited from MNELIB::MNESurfaceOrVolume
int type
QString subject
int id
int coord_frame
std::optional< MNEVolGeomvol_geom
std::optional< MNEMghTagGroupmgh_tags
int np
PointsT rr
NormalsT nn
float cm [3]
Eigen::VectorXi inuse
Eigen::VectorXi vertno
int nuse
std::vector< Eigen::VectorXi > neighbor_vert
Eigen::VectorXi nneighbor_vert
std::vector< Eigen::VectorXf > vert_dist
float sigma
int ntri
std::vector< MNETriangletris
TrianglesT itris
float tot_area
int nuse_tri
std::vector< MNETriangleuse_tris
TrianglesT use_itris
std::vector< Eigen::VectorXi > neighbor_tri
Eigen::VectorXi nneighbor_tri
std::vector< MNENearestnearest
std::vector< std::optional< MNEPatchInfo > > patches
FIFFLIB::FiffSparseMatrix dist
float dist_limit
Eigen::VectorXf curv
Eigen::VectorXf val
std::optional< FIFFLIB::FiffCoordTransvoxel_surf_RAS_t
int vol_dims [3]
float voxel_size [3]
std::optional< FIFFLIB::FiffSparseMatrixinterpolator
QString MRI_volume
std::optional< FIFFLIB::FiffCoordTransMRI_voxel_surf_RAS_t
std::optional< FIFFLIB::FiffCoordTransMRI_surf_RAS_RAS_t
int MRI_vol_dims [3]

Detailed Description

This defines a surface.

Implements the MNE Surface (Replaces typedef mneSurfaceOrVolume mneSurface; struct of MNE-C mne_types.h).

Definition at line 78 of file mne_surface.h.

Inheritance diagram for MNELIB::MNESurface:
Inheritance graph

Member Typedef Documentation

◆ ConstSPtr

typedef std::shared_ptr<const MNESurface> MNELIB::MNESurface::ConstSPtr

Const shared pointer type for MNESurface.

Definition at line 82 of file mne_surface.h.

◆ SPtr

typedef std::shared_ptr<MNESurface> MNELIB::MNESurface::SPtr

Shared pointer type for MNESurface.

Definition at line 81 of file mne_surface.h.

Constructor & Destructor Documentation

◆ MNESurface()

MNESurface::MNESurface ( )

Constructs the MNE Surface

Definition at line 103 of file mne_surface.cpp.

◆ ~MNESurface()

MNESurface::~MNESurface ( )

Destroys the MNE Surface

Definition at line 109 of file mne_surface.cpp.

Member Function Documentation

◆ activate_neighbors()

void MNESurface::activate_neighbors ( int start,
Eigen::VectorXi & act,
int nstep ) const

Recursively mark neighboring triangles as active.

Parameters
[in]startStarting vertex index.
[in,out]actTriangle activation array.
[in]nstepRecursive expansion steps.

Definition at line 388 of file mne_surface.cpp.

◆ decide_search_restriction()

void MNESurface::decide_search_restriction ( MNEProjData & p,
int approx_best,
int nstep,
const Eigen::Vector3f & r ) const

Set up the triangle activation mask for a restricted surface search.

Parameters
[in,out]pThe projection data whose mask is set.
[in]approx_bestApproximate best triangle, or negative for brute-force.
[in]nstepNeighborhood expansion levels.
[in]rThe query point.

Definition at line 335 of file mne_surface.cpp.

◆ find_closest_on_surface_approx()

void MNESurface::find_closest_on_surface_approx ( const PointsT & r,
int np,
Eigen::VectorXi & nearest_tri,
Eigen::VectorXf & dist,
int nstep ) const

For each point, find the closest point on the surface using neighborhood-restricted search.

Parameters
[in]rArray of np point coordinates.
[in]npNumber of points.
[in,out]nearest_triBest triangle index for each point.
[out]distDistance to the surface for each point.
[in]nstepNumber of neighborhood expansion steps.

Definition at line 308 of file mne_surface.cpp.

◆ nearest_triangle_point() [1/2]

int MNESurface::nearest_triangle_point ( const Eigen::Vector3f & r,
const MNEProjData * user,
int tri,
float & x,
float & y,
float & z ) const

Find the nearest point on a triangle to a given point.

Parameters
[in]rThe point.
[in]userOptional MNEProjData restricting active triangles (may be NULL).
[in]triTriangle index.
[out]xCoordinate along first edge.
[out]yCoordinate along second edge.
[out]zDistance from the triangle.
Returns
TRUE if the triangle is active, FALSE if inactive.

Definition at line 156 of file mne_surface.cpp.

◆ nearest_triangle_point() [2/2]

int MNESurface::nearest_triangle_point ( const Eigen::Vector3f & r,
int tri,
float & x,
float & y,
float & z ) const

Find the nearest point on a triangle (simplified, no projection data).

Parameters
[in]rThe point.
[in]triTriangle index.
[out]xCoordinate along first edge.
[out]yCoordinate along second edge.
[out]zDistance from the triangle.
Returns
TRUE always.

Definition at line 253 of file mne_surface.cpp.

◆ project_to_surface()

int MNESurface::project_to_surface ( const MNEProjData * proj_data,
const Eigen::Vector3f & r,
float & distp ) const

Project a point onto the nearest triangle of the surface.

Parameters
[in]proj_dataOptional MNEProjData restricting active triangles (may be NULL).
[in]rThe 3D point to project.
[out]distpReceives the signed distance to the surface.
Returns
Index of the closest triangle, or -1 if none found.

Definition at line 282 of file mne_surface.cpp.

◆ project_to_triangle() [1/2]

Eigen::Vector3f MNESurface::project_to_triangle ( int best,
const Eigen::Vector3f & r ) const

Find the nearest point on a given triangle and return the projected 3D coordinates.

Parameters
[in]bestTriangle index.
[in]rThe source point.
Returns
The projected 3D point.

Definition at line 273 of file mne_surface.cpp.

◆ project_to_triangle() [2/2]

Eigen::Vector3f MNESurface::project_to_triangle ( int tri,
float p,
float q ) const

Compute 3D position on a triangle from barycentric coordinates.

Parameters
[in]triTriangle index.
[in]pBarycentric coordinate along first edge.
[in]qBarycentric coordinate along second edge.
Returns
The 3D point on the triangle.

Definition at line 260 of file mne_surface.cpp.

◆ read_bem_surface() [1/2]

MNESurface * MNESurface::read_bem_surface ( const QString & name,
int which,
int add_geometry,
float * sigmap )
static

Read a BEM surface from a FIFF file (excess-neighbor checking enabled).

Parameters
[in]namePath to the BEM FIFF file.
[in]whichSurface ID to load (-1 loads the first found).
[in]add_geometryIf non-zero, compute full geometry info.
[out]sigmapIf non-null, receives the surface conductivity.
Returns
The loaded surface, or NULL on failure. Caller takes ownership.

Definition at line 405 of file mne_surface.cpp.

◆ read_bem_surface() [2/2]

MNESurface * MNESurface::read_bem_surface ( const QString & name,
int which,
int add_geometry,
float * sigmap,
bool check_too_many_neighbors )
static

Read a BEM surface from a FIFF file.

Parameters
[in]namePath to the BEM FIFF file.
[in]whichSurface ID to load (-1 loads the first found).
[in]add_geometryIf non-zero, compute full geometry info.
[out]sigmapIf non-null, receives the surface conductivity.
[in]check_too_many_neighborsFail on excess neighbor count.
Returns
The loaded surface, or NULL on failure. Caller takes ownership.

Definition at line 419 of file mne_surface.cpp.

◆ read_bem_surface2()

MNESurface * MNESurface::read_bem_surface2 ( const QString & name,
int which,
int add_geometry,
float * sigmap )
static

Read a BEM surface from a FIFF file (excess-neighbor checking disabled).

Parameters
[in]namePath to the BEM FIFF file.
[in]whichSurface ID to load (-1 loads the first found).
[in]add_geometryIf non-zero, compute full geometry info.
[out]sigmapIf non-null, receives the surface conductivity.
Returns
The loaded surface, or NULL on failure. Caller takes ownership.

Definition at line 412 of file mne_surface.cpp.

◆ sum_solids()

double MNESurface::sum_solids ( const Eigen::Vector3f & from) const

Sum the solid angles of all triangles as seen from a given point. ~4pi if inside, ~0 if outside.

Parameters
[in]fromThe test point.
Returns
Total solid angle in steradians.

Definition at line 117 of file mne_surface.cpp.

◆ triangle_coords()

void MNESurface::triangle_coords ( const Eigen::Vector3f & r,
int tri,
float & x,
float & y,
float & z ) const

Compute barycentric-like coordinates of a point relative to a triangle.

Parameters
[in]rThe point.
[in]triTriangle index.
[out]xBarycentric coordinate along first edge.
[out]yBarycentric coordinate along second edge.
[out]zSigned perpendicular distance from the plane.

Definition at line 130 of file mne_surface.cpp.


The documentation for this class was generated from the following files: