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

This defines a source space. More...

#include <mne_source_space.h>

Public Types

using SPtr = std::shared_ptr<MNESourceSpace>
using ConstSPtr = std::shared_ptr<const MNESourceSpace>
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

 MNESourceSpace (int np=0)
 ~MNESourceSpace () override
virtual MNESourceSpace::SPtr clone () const
void enable_all_sources ()
int is_left_hemi () const
qint32 find_source_space_hemi () const
void update_inuse (Eigen::VectorXi new_inuse)
int transform_source_space (const FIFFLIB::FiffCoordTrans &t)
int add_patch_stats ()
void rearrange_source_space ()
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 std::unique_ptr< MNESourceSpacecreate_source_space (int np)
static std::unique_ptr< MNESourceSpaceload_surface (const QString &surf_file, const QString &curv_file)
static std::unique_ptr< MNESourceSpaceload_surface_geom (const QString &surf_file, const QString &curv_file, int add_geometry, int check_too_many_neighbors)
static MNESourceSpacemake_volume_source_space (const MNESurface &surf, float grid, float exclude, float mindist)
static int filter_source_spaces (const MNESurface &surf, float limit, const FIFFLIB::FiffCoordTrans &mri_head_t, std::vector< std::unique_ptr< MNESourceSpace > > &spaces, QTextStream *filtered)
static void filter_source_space (FilterThreadArg *arg)
static int filter_source_spaces (float limit, const QString &bemfile, const FIFFLIB::FiffCoordTrans &mri_head_t, std::vector< std::unique_ptr< MNESourceSpace > > &spaces, QTextStream *filtered, bool use_threads)
static int read_source_spaces (const QString &name, std::vector< std::unique_ptr< MNESourceSpace > > &spaces)
static int transform_source_spaces_to (int coord_frame, const FIFFLIB::FiffCoordTrans &t, std::vector< std::unique_ptr< MNESourceSpace > > &spaces)
static int restrict_sources_to_labels (std::vector< std::unique_ptr< MNESourceSpace > > &spaces, const QStringList &labels, int nlabel)
static int read_label (const QString &label, Eigen::VectorXi &sel)
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 source space.

Implements the MNE Source Space (Replaces typedef mneSurfaceOrVolume mneSourceSpace; struct of MNE-C mne_types.h).

Definition at line 76 of file mne_source_space.h.

Inheritance diagram for MNELIB::MNESourceSpace:
Inheritance graph

Member Typedef Documentation

◆ ConstSPtr

using MNELIB::MNESourceSpace::ConstSPtr = std::shared_ptr<const MNESourceSpace>

Const shared pointer type for MNESourceSpace.

Definition at line 80 of file mne_source_space.h.

◆ SPtr

using MNELIB::MNESourceSpace::SPtr = std::shared_ptr<MNESourceSpace>

Shared pointer type for MNESourceSpace.

Definition at line 79 of file mne_source_space.h.

Constructor & Destructor Documentation

◆ MNESourceSpace()

MNESourceSpace::MNESourceSpace ( int np = 0)

Constructs the MNE Source Space

Definition at line 889 of file mne_source_space.cpp.

◆ ~MNESourceSpace()

MNESourceSpace::~MNESourceSpace ( )
override

Destroys the MNE Source Space

Definition at line 938 of file mne_source_space.cpp.

Member Function Documentation

◆ add_patch_stats()

int MNESourceSpace::add_patch_stats ( )

Compute patch statistics (areas, normals, deviations).

Returns
OK on success, FAIL on error.

Definition at line 1066 of file mne_source_space.cpp.

◆ clone()

MNESourceSpace::SPtr MNESourceSpace::clone ( ) const
virtual

Creates a deep copy of this source space, preserving the actual derived type.

Returns
a shared_ptr to the cloned source space.

Reimplemented in MNELIB::MNEHemisphere.

Definition at line 944 of file mne_source_space.cpp.

◆ create_source_space()

std::unique_ptr< MNESourceSpace > MNESourceSpace::create_source_space ( int np)
static

Create a new source space with np vertices and all associated data initialized to defaults.

Parameters
[in]npNumber of vertices.
Returns
Unique pointer to the newly allocated source space.

Definition at line 1168 of file mne_source_space.cpp.

◆ enable_all_sources()

void MNESourceSpace::enable_all_sources ( )

Enable all source points (set inuse to TRUE, nuse = np).

Definition at line 972 of file mne_source_space.cpp.

◆ filter_source_space()

void MNESourceSpace::filter_source_space ( FilterThreadArg * arg)
static

Definition at line 1676 of file mne_source_space.cpp.

◆ filter_source_spaces() [1/2]

int MNESourceSpace::filter_source_spaces ( const MNESurface & surf,
float limit,
const FIFFLIB::FiffCoordTrans & mri_head_t,
std::vector< std::unique_ptr< MNESourceSpace > > & spaces,
QTextStream * filtered )
static

Definition at line 1585 of file mne_source_space.cpp.

◆ filter_source_spaces() [2/2]

int MNESourceSpace::filter_source_spaces ( float limit,
const QString & bemfile,
const FIFFLIB::FiffCoordTrans & mri_head_t,
std::vector< std::unique_ptr< MNESourceSpace > > & spaces,
QTextStream * filtered,
bool use_threads )
static

Definition at line 1752 of file mne_source_space.cpp.

◆ find_source_space_hemi()

qint32 MNESourceSpace::find_source_space_hemi ( ) const

Returns the hemisphere id (FIFFV_MNE_SURF_LEFT_HEMI or FIFFV_MNE_SURF_RIGHT_HEMI) for this source space, based on the average x-coordinate of all vertices.

Returns
the deduced hemisphere id.

Definition at line 1001 of file mne_source_space.cpp.

◆ is_left_hemi()

int MNESourceSpace::is_left_hemi ( ) const

Determine whether this source space is on the left hemisphere based on the average x-coordinate of all vertices.

Returns
TRUE if left hemisphere, FALSE otherwise.

Definition at line 983 of file mne_source_space.cpp.

◆ load_surface()

std::unique_ptr< MNESourceSpace > MNESourceSpace::load_surface ( const QString & surf_file,
const QString & curv_file )
static

Load a FreeSurfer surface from disk, adding full geometry information.

Parameters
[in]surf_filePath to the FreeSurfer surface file.
[in]curv_filePath to the curvature file (may be empty).
Returns
Unique pointer to the loaded source space, or nullptr on error.

Definition at line 1215 of file mne_source_space.cpp.

◆ load_surface_geom()

std::unique_ptr< MNESourceSpace > MNESourceSpace::load_surface_geom ( const QString & surf_file,
const QString & curv_file,
int add_geometry,
int check_too_many_neighbors )
static

Load a FreeSurfer surface from disk, optionally adding geometry information.

Parameters
[in]surf_filePath to the FreeSurfer surface file.
[in]curv_filePath to the curvature file (may be empty).
[in]add_geometryWhether to compute full geometry info.
[in]check_too_many_neighborsWhether to error on excess neighbors.
Returns
Unique pointer to the loaded source space, or nullptr on error.

Definition at line 1223 of file mne_source_space.cpp.

◆ make_volume_source_space()

MNESourceSpace * MNESourceSpace::make_volume_source_space ( const MNESurface & surf,
float grid,
float exclude,
float mindist )
static

Create a volumetric source space by laying out a 3D grid of points within the bounding box of a surface, filtering out points that lie outside the surface or closer than mindist to the surface, and establishing 26-neighbor connectivity.

Parameters
[in]surfThe bounding surface (e.g. inner skull).
[in]gridGrid spacing in meters.
[in]excludeExclusion radius from the center of mass (m).
[in]mindistMinimum distance from the surface (m).
Returns
A new volumetric source space, or NULL on failure. Caller takes ownership.

Definition at line 1320 of file mne_source_space.cpp.

◆ read_label()

int MNESourceSpace::read_label ( const QString & label,
Eigen::VectorXi & sel )
static

Definition at line 2250 of file mne_source_space.cpp.

◆ read_source_spaces()

int MNESourceSpace::read_source_spaces ( const QString & name,
std::vector< std::unique_ptr< MNESourceSpace > > & spaces )
static

Definition at line 1838 of file mne_source_space.cpp.

◆ rearrange_source_space()

void MNESourceSpace::rearrange_source_space ( )

Rearrange source space after filtering: recount nuse, rebuild vertno, and recompute patch statistics if nearest info is available.

Definition at line 1144 of file mne_source_space.cpp.

◆ restrict_sources_to_labels()

int MNESourceSpace::restrict_sources_to_labels ( std::vector< std::unique_ptr< MNESourceSpace > > & spaces,
const QStringList & labels,
int nlabel )
static

Definition at line 2179 of file mne_source_space.cpp.

◆ transform_source_space()

int MNESourceSpace::transform_source_space ( const FIFFLIB::FiffCoordTrans & t)

Transform this source space into another coordinate frame.

Parameters
[in]tThe coordinate transformation to apply.
Returns
OK on success, FAIL on error.

Definition at line 1040 of file mne_source_space.cpp.

◆ transform_source_spaces_to()

int MNESourceSpace::transform_source_spaces_to ( int coord_frame,
const FIFFLIB::FiffCoordTrans & t,
std::vector< std::unique_ptr< MNESourceSpace > > & spaces )
static

Definition at line 2137 of file mne_source_space.cpp.

◆ update_inuse()

void MNESourceSpace::update_inuse ( Eigen::VectorXi new_inuse)

Update the active vertex (inuse) vector and recompute vertno.

Parameters
[in]new_inuseNew in-use vector (size np).

Definition at line 1012 of file mne_source_space.cpp.


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