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>
using UPtr = std::unique_ptr<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 ()
bool 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 ()
int writeToStream (FIFFLIB::FiffStream::SPtr &stream, bool selected_only) const
Public Member Functions inherited from MNELIB::MNESurfaceOrVolume
 MNESurfaceOrVolume ()
 Constructs the MNE FsSurface or Volume.
virtual ~MNESurfaceOrVolume ()
 Destroys the MNE FsSurface 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 (bool do_normals, bool check_too_many_neighbors)
int add_geometry_info (bool do_normals)
int add_geometry_info2 (bool do_normals)
Eigen::VectorXi nearestVertIdx () const
Eigen::VectorXd nearestDistVec () const
void setNearestData (const Eigen::VectorXi &nearestIdx, const Eigen::VectorXd &nearestDist)
Eigen::Map< const Eigen::Vector3f > point (int k) const
Eigen::Map< Eigen::Vector3f > point (int k)
Eigen::Map< const Eigen::Vector3f > normal (int k) const

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, bool add_geometry, bool 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 MNEHemisphere icoDownsample (const MNEHemisphere &hemi, int icoGrade)
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 78 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 82 of file mne_source_space.h.

◆ SPtr

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

Shared pointer type for MNESourceSpace.

Definition at line 81 of file mne_source_space.h.

◆ UPtr

using MNELIB::MNESourceSpace::UPtr = std::unique_ptr<MNESourceSpace>

Unique pointer type for MNESourceSpace.

Definition at line 83 of file mne_source_space.h.

Constructor & Destructor Documentation

◆ MNESourceSpace()

MNESourceSpace::MNESourceSpace ( int np = 0)

Constructs the MNE Source Space

Definition at line 781 of file mne_source_space.cpp.

◆ ~MNESourceSpace()

MNESourceSpace::~MNESourceSpace ( )
override

Destroys the MNE Source Space

Definition at line 830 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 958 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 836 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 1060 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 864 of file mne_source_space.cpp.

◆ filter_source_space()

void MNESourceSpace::filter_source_space ( FilterThreadArg * arg)
static

Definition at line 1522 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 1432 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 1597 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 893 of file mne_source_space.cpp.

◆ icoDownsample()

MNEHemisphere MNESourceSpace::icoDownsample ( const MNEHemisphere & hemi,
int icoGrade )
static

Downsample a hemisphere source space to an icosahedral subdivision of the given grade.

For each vertex of the icosahedron at the requested grade, the nearest vertex in the hemisphere is found and marked as in-use.

Parameters
[in]hemiThe hemisphere to downsample.
[in]icoGradeIcosahedral subdivision grade (0-7).
Returns
A new MNEHemisphere with the downsampled vertex selection.
Since
2.2.0

Definition at line 2380 of file mne_source_space.cpp.

◆ is_left_hemi()

bool 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 875 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 1107 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,
bool add_geometry,
bool 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 1115 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 1195 of file mne_source_space.cpp.

◆ read_label()

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

Definition at line 2076 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 1680 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 1036 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 2009 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 932 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 1967 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 904 of file mne_source_space.cpp.

◆ writeToStream()

int MNESourceSpace::writeToStream ( FIFFLIB::FiffStream::SPtr & stream,
bool selected_only ) const

Write this source space to a FIFF stream.

Parameters
[in]streamThe FIFF output stream.
[in]selected_onlyIf true, write only the vertices that are in use.
Returns
FIFF_OK on success, FIFF_FAIL on error.

Definition at line 2215 of file mne_source_space.cpp.


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