Skip to main content

MNESourceSpaces

Namespace: MNELIB  ·  Library: MNE Library

#include <mne/mne_source_spaces.h>

class MNELIB::MNESourceSpaces

Container pairing the left and right cortical source spaces (and optional discrete / volume source spaces) of a subject as written by mne_setup_source_space.

List of MNESourceSpace objects forming a subject source space.

src/examples/ex_mne_api/main.cpp
QFile srcFile(data + "/subjects/sample/bem/sample-oct-6-src.fif");
FiffStream::SPtr stream(new FiffStream(&srcFile));
MNESourceSpaces src;
stream->open();
MNESourceSpaces::readFromStream(stream, true, src); // add_geom: normals, triangle data and patches
stream->close();
const auto& lh = dynamic_cast<const MNEHemisphere&>(src[0]);
QList<VectorXi> vertno = src.get_vertno(); // used vertices per hemisphere

Public Methods​

MNESourceSpaces()​

Default constructor.


MNESourceSpaces(p_MNESourceSpaces)​

Copy constructor.

Parameters:

  • p_MNESourceSpaces : const MNESourceSpaces & MNE forward solution.

operator=(other)​

Copy assignment.

Every member has value semantics, so the compiler-generated member-wise assignment is correct. It is declared explicitly because declaring a copy constructor and/or a destructor deprecates the implicitly generated one.

Parameters:

Returns:


~MNESourceSpaces()​

Destroys the MNE forward solution.


clear()​

Initializes MNE source space.


isEmpty()​

True if MNE Source Space is empty.

Returns:

  • bool — true if MNE Source Space is empty.

get_vertno()​

Returns the Zero based (different to MATLAB) indices of the used vertices of both hemispheres.

Returns:

  • QList< Eigen::VectorXi > — the hemisphere vertices.

label_src_vertno_sel(p_label, src_sel)​

Find vertex numbers and indices from label.

Parameters:

  • p_label : const FsLabel & Source space label.

  • src_sel : Eigen::VectorXi & array of int (idx.size() = vertno[0].size() + vertno[1].size()). Indices of the selected vertices in sourse space

Returns:

  • QList< Eigen::VectorXi > — vertno list of length 2 Vertex numbers for lh and rh.

pick_regions(p_qListLabels)​

Reduces a source space to selected regions.

Parameters:

  • p_qListLabels : const QList< FsLabel > & ROIs.

Returns:


size()​

Returns the number of stored hemispheres 0, 1 or 2.

Returns:

  • qint32 — number of stored hemispheres.

transform_source_space_to(dest, trans)​

Parameters:

  • dest : FIFFLIB::fiff_int_t destination check code.

  • trans : FiffCoordTrans & transformation information.

Returns:

  • bool — true if succeeded, false otherwise.

writeToStream(p_pStream)​

Parameters:

  • p_pStream : *FiffStream ** The stream to write to.

append(space)​

Appends a deep copy of the given source space.

Parameters:


operator[](idx)​

Subscript operator [] to access source spaces by index.

Parameters:

  • idx : qint32 the source space index (0 or 1).

Returns:

  • MNESourceSpace & — Reference to the source space at the given index.

operator[](idx)​

Subscript operator [] to access source spaces by index.

Parameters:

  • idx : qint32 the source space index (0 or 1).

Returns:

  • const MNESourceSpace & — Const reference to the source space at the given index.

operator[](idt)​

Subscript operator [] to access source spaces by hemisphere identifier.

Parameters:

  • idt : QString the hemisphere identifier ("lh" or "rh").

Returns:

  • MNESourceSpace & — Reference to the source space for the given hemisphere.

operator[](idt)​

Subscript operator [] to access source spaces by hemisphere identifier.

Parameters:

  • idt : QString the hemisphere identifier ("lh" or "rh").

Returns:

  • const MNESourceSpace & — Const reference to the source space for the given hemisphere.

hemisphereAt(idx)​

Safe downcast to MNEHemisphere at the given index.

Parameters:

  • idx : qint32 the source space index.

Returns:


hemisphereAt(idx)​

Safe downcast to MNEHemisphere at the given index (const).

Parameters:

  • idx : qint32 the source space index.

Returns:


at(idx)​

Access the underlying shared_ptr at the given index.

Parameters:

  • idx : qint32 the source space index.

Returns:


at(idx)​

Access the underlying shared_ptr at the given index (const).

Parameters:

  • idx : qint32 the source space index.

Returns:


Static Methods​

find_source_space_hemi(p_SourceSpace)​

Parameters:

Returns:

  • qint32 — the deduced hemisphere id.

patch_info(p_Hemisphere)​

Parameters:

Returns:

  • bool — true if succeeded, false otherwise.

readFromStream(p_pStream, add_geom, p_SourceSpace)​

Parameters:

  • p_pStream : FIFFLIB::FiffStream::SPtr & The opened fif file.

  • add_geom : bool Add geometry information to the source spaces.

  • p_SourceSpace : MNESourceSpaces & The read source spaces.

Returns:

  • bool — true if succeeded, false otherwise.

Example​

Used in examples​

ex_mne_api​

MNE library: BEM surfaces, surface projection, ICP, source spaces and epochs.

src/examples/ex_mne_api/main.cpp, line 197
QFile srcFile(data + "/subjects/sample/bem/sample-oct-6-src.fif");
FiffStream::SPtr stream(new FiffStream(&srcFile));
MNESourceSpaces src;
stream->open();
MNESourceSpaces::readFromStream(stream, true, src); // add_geom: normals, triangle data and patches
stream->close();
const auto& lh = dynamic_cast<const MNEHemisphere&>(src[0]);
QList<VectorXi> vertno = src.get_vertno(); // used vertices per hemisphere
// mne.read_source_spaces: lh 155407 vertices, 4098 in use (8192 used triangles), vertno 14, 54, 59; rh 156866 / 4098
ok &= expect(src.size() == 2 && lh.np == 155407 && lh.nuse == 4098 && lh.nuse_tri == 8192 && lh.coord_frame == FIFFV_COORD_MRI && vertno[0].head(3) == Vector3i(14, 54, 59) && src[1].np == 156866 && vertno[1].size() == 4098 && lh.pinfo.size() == 4098,
"MNESourceSpaces/MNEHemisphere: oct-6 source space with patches like mne.read_source_spaces");

Authors of this file​