v2.0.0
Loading...
Searching...
No Matches
INVLIB::InvSourceEstimate Class Reference

Source-space inverse-solution container with dense grid plus optional focal-dipole, coupling and connectivity layers. More...

#include <inv_source_estimate.h>

Public Types

typedef QSharedPointer< InvSourceEstimate > SPtr
typedef QSharedPointer< const InvSourceEstimate > ConstSPtr

Public Member Functions

 InvSourceEstimate ()
 InvSourceEstimate (const Eigen::MatrixXd &p_sol, const Eigen::VectorXi &p_vertices, float p_tmin, float p_tstep)
 InvSourceEstimate (const InvSourceEstimate &p_SourceEstimate)
 InvSourceEstimate (QIODevice &p_IODevice)
void clear ()
InvSourceEstimate reduce (qint32 start, qint32 n)
bool write (QIODevice &p_IODevice)
bool writeHemispherePair (const QString &sBasePath)
void write_w (const QString &path) const
bool isEmpty () const
InvSourceEstimate & operator= (const InvSourceEstimate &rhs)
int samples () const
Eigen::VectorXi getIndicesByLabel (const QList< FSLIB::FsLabel > &lPickedLabels, bool bIsClustered) const
bool hasGridData () const
bool hasCouplings () const
bool hasFocalDipoles () const
bool hasPositions () const
bool hasConnectivity () const

Static Public Member Functions

static bool read (QIODevice &p_IODevice, InvSourceEstimate &p_stc)
static InvSourceEstimate read_w (const QString &path)

Public Attributes

Eigen::MatrixXd data
Eigen::VectorXi vertices
Eigen::RowVectorXf times
float tmin
float tstep
int nVerticesLh
InvEstimateMethod method
InvSourceSpaceType sourceSpaceType
InvOrientationType orientationType
Eigen::MatrixX3f positions
std::vector< InvSourceCoupling > couplings
std::vector< InvFocalDipole > focalDipoles
std::vector< InvConnectivity > connectivity

Detailed Description

Source-space inverse-solution container with dense grid plus optional focal-dipole, coupling and connectivity layers.

Central source-space container produced by every INVLIB inverse solver. Carries the dense (n_sources × n_times) data matrix plus vertex indices, time origin and step, and optional focal dipoles, coupling groups and connectivity layers so one value can represent the output of any algorithm in INVLIB. Replaces mneStcDataRec of MNE-C and implements round-trip STC / W binary I/O with mne-python and mne-c.

Definition at line 91 of file inv_source_estimate.h.

Inheritance diagram for INVLIB::InvSourceEstimate:
Inheritance graph

Member Typedef Documentation

◆ ConstSPtr

Const shared pointer type for InvSourceEstimate.

Definition at line 95 of file inv_source_estimate.h.

◆ SPtr

Shared pointer type for InvSourceEstimate.

Definition at line 94 of file inv_source_estimate.h.

Constructor & Destructor Documentation

◆ InvSourceEstimate() [1/4]

InvSourceEstimate::InvSourceEstimate ( )

Default constructor

Definition at line 50 of file inv_source_estimate.cpp.

◆ InvSourceEstimate() [2/4]

INVLIB::InvSourceEstimate::InvSourceEstimate ( const Eigen::MatrixXd & p_sol,
const Eigen::VectorXi & p_vertices,
float p_tmin,
float p_tstep )

Constructs a source estimation from given data

Parameters
[in]p_solSource amplitudes (sources x time points).
[in]p_verticesSource space vertex numbers of the rows of p_sol.
[in]p_tminTime of the first sample in seconds.
[in]p_tstepTime between samples in seconds.

◆ InvSourceEstimate() [3/4]

InvSourceEstimate::InvSourceEstimate ( const InvSourceEstimate & p_SourceEstimate)

Copy constructor.

Parameters
[in]p_SourceEstimateSource estimate data which should be copied.

Definition at line 77 of file inv_source_estimate.cpp.

◆ InvSourceEstimate() [4/4]

InvSourceEstimate::InvSourceEstimate ( QIODevice & p_IODevice)

Constructs a source estimation, by reading from a IO device.

Parameters
[in]p_IODeviceIO device to read from the source estimation.

Definition at line 96 of file inv_source_estimate.cpp.

Member Function Documentation

◆ clear()

void InvSourceEstimate::clear ( )

Initializes source estimate.

Definition at line 111 of file inv_source_estimate.cpp.

◆ getIndicesByLabel()

VectorXi InvSourceEstimate::getIndicesByLabel ( const QList< FSLIB::FsLabel > & lPickedLabels,
bool bIsClustered ) const

Returns the indices of sources in the data matrix based on their beloning label.

Parameters
[in]lPickedLabelsThe labels base the selection on.
[in]bIsClusteredWhether the source space was clustered.
Returns
the indices.

Definition at line 448 of file inv_source_estimate.cpp.

◆ hasConnectivity()

bool INVLIB::InvSourceEstimate::hasConnectivity ( ) const
inline

Returns true if the estimate contains connectivity results.

Returns
true if connectivity data is present.

Definition at line 366 of file inv_source_estimate.h.

◆ hasCouplings()

bool INVLIB::InvSourceEstimate::hasCouplings ( ) const
inline

Returns true if the estimate contains source coupling annotations (e.g. RAP-MUSIC pairs/N-tuples).

Returns
true if couplings are present.

Definition at line 345 of file inv_source_estimate.h.

◆ hasFocalDipoles()

bool INVLIB::InvSourceEstimate::hasFocalDipoles ( ) const
inline

Returns true if the estimate contains focal (off-grid) dipole results.

Returns
true if focal dipoles are present.

Definition at line 352 of file inv_source_estimate.h.

◆ hasGridData()

bool INVLIB::InvSourceEstimate::hasGridData ( ) const
inline

Returns true if the estimate contains grid-based data (distributed methods or RAP-MUSIC amplitudes).

Returns
true if grid data is present.

Definition at line 338 of file inv_source_estimate.h.

◆ hasPositions()

bool INVLIB::InvSourceEstimate::hasPositions ( ) const
inline

Returns true if the estimate carries explicit source positions (discrete source space).

Returns
true if positions are present.

Definition at line 359 of file inv_source_estimate.h.

◆ isEmpty()

bool INVLIB::InvSourceEstimate::isEmpty ( ) const
inline

Returns whether SourceEstimate is empty.

Returns
true if is empty, false otherwise.

Definition at line 331 of file inv_source_estimate.h.

◆ operator=()

InvSourceEstimate & InvSourceEstimate::operator= ( const InvSourceEstimate & rhs)

Assignment Operator

Parameters
[in]rhsSourceEstimate which should be assigned.
Returns
the copied source estimate.

Definition at line 417 of file inv_source_estimate.cpp.

◆ read()

bool InvSourceEstimate::read ( QIODevice & p_IODevice,
InvSourceEstimate & p_stc )
static

mne_read_stc_file

Reads a source estimate from a given file

Parameters
[in]p_IODeviceIO device to red the stc from.
[in,out]p_stcthe read stc.
Returns
true if successful, false otherwise.

Definition at line 156 of file inv_source_estimate.cpp.

◆ read_w()

InvSourceEstimate InvSourceEstimate::read_w ( const QString & path)
static

Read a .w file (single time-point source estimate).

The .w format stores vertex indices (3-byte big-endian) and float values (4-byte big-endian) for a single time point.

Parameters
[in]pathPath to the .w file.
Returns
The source estimate with single-column data.
Since
2.2.0

Definition at line 320 of file inv_source_estimate.cpp.

◆ reduce()

InvSourceEstimate InvSourceEstimate::reduce ( qint32 start,
qint32 n )

Reduces the source estimate to selected samples.

Parameters
[in]startThe start index to cut the estimate from.
[in]nNumber of samples to cut from start index.
Returns
Copy of this estimate restricted to samples [start, start + n), with tmin updated accordingly.

Definition at line 130 of file inv_source_estimate.cpp.

◆ samples()

int InvSourceEstimate::samples ( ) const

Returns the number of samples.

Returns
the number of samples.

Definition at line 441 of file inv_source_estimate.cpp.

◆ write()

bool InvSourceEstimate::write ( QIODevice & p_IODevice)

mne_write_stc_file

Writes a stc file

Parameters
[in]p_IODeviceIO device to write the stc to.
Returns
True if successful, false if the device could not be opened for writing.

Definition at line 212 of file inv_source_estimate.cpp.

◆ write_w()

void InvSourceEstimate::write_w ( const QString & path) const

Write the first time point of this source estimate to a .w file.

Parameters
[in]pathPath to the .w file to write.
Since
2.2.0

Definition at line 363 of file inv_source_estimate.cpp.

◆ writeHemispherePair()

bool InvSourceEstimate::writeHemispherePair ( const QString & sBasePath)

Write the estimate as an MNE-C / MNE-Python compatible hemisphere pair.

MNE-Python expects a surface source estimate to be stored as two files, "<base>-lh.stc" and "<base>-rh.stc", each containing only the vertices of its own hemisphere. This writes exactly that, splitting at nVerticesLh.

Parameters
[in]sBasePathPath without the "-lh.stc"/"-rh.stc" suffix. A trailing "-lh.stc", "-rh.stc" or ".stc" is stripped if present.
Returns
true when both files were written, false otherwise. Fails when nVerticesLh is unknown (-1) or out of range, since the split point cannot then be determined.

Definition at line 258 of file inv_source_estimate.cpp.

Member Data Documentation

◆ connectivity

std::vector<InvConnectivity> INVLIB::InvSourceEstimate::connectivity

Pairwise connectivity matrices between sources (one per metric / freq band).

Definition at line 277 of file inv_source_estimate.h.

◆ couplings

std::vector<InvSourceCoupling> INVLIB::InvSourceEstimate::couplings

Correlated source groups overlaid on the grid.

Definition at line 271 of file inv_source_estimate.h.

◆ data

Eigen::MatrixXd INVLIB::InvSourceEstimate::data

Matrix of shape [n_dipoles x n_times] which contains the data in source space.

Definition at line 255 of file inv_source_estimate.h.

◆ focalDipoles

std::vector<InvFocalDipole> INVLIB::InvSourceEstimate::focalDipoles

Off-grid focal dipoles (ECD results).

Definition at line 274 of file inv_source_estimate.h.

◆ method

InvEstimateMethod INVLIB::InvSourceEstimate::method

The inverse method that produced this estimate.

Definition at line 263 of file inv_source_estimate.h.

◆ nVerticesLh

int INVLIB::InvSourceEstimate::nVerticesLh

Number of leading entries in vertices/data that belong to the left hemisphere. -1 when unknown, which is the case for non surface source spaces.

Definition at line 260 of file inv_source_estimate.h.

◆ orientationType

InvOrientationType INVLIB::InvSourceEstimate::orientationType

Orientation constraint used (fixed, free, loose).

Definition at line 265 of file inv_source_estimate.h.

◆ positions

Eigen::MatrixX3f INVLIB::InvSourceEstimate::positions

3D positions (m) in head coordinates, one row per source. Empty when positions live in an external source space.

Definition at line 268 of file inv_source_estimate.h.

◆ sourceSpaceType

InvSourceSpaceType INVLIB::InvSourceEstimate::sourceSpaceType

Source space type (surface, volume, mixed, discrete).

Definition at line 264 of file inv_source_estimate.h.

◆ times

Eigen::RowVectorXf INVLIB::InvSourceEstimate::times

The time vector with n_times steps.

Definition at line 257 of file inv_source_estimate.h.

◆ tmin

float INVLIB::InvSourceEstimate::tmin

Time starting point.

Definition at line 258 of file inv_source_estimate.h.

◆ tstep

float INVLIB::InvSourceEstimate::tstep

Time steps within the times vector.

Definition at line 259 of file inv_source_estimate.h.

◆ vertices

Eigen::VectorXi INVLIB::InvSourceEstimate::vertices

The indices of the dipoles in the different source spaces. In the clustered case, holds the ROI indices.

Definition at line 256 of file inv_source_estimate.h.


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