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

Collection of channel derivations. More...

#include <mne_deriv_set.h>

Public Types

using Definition = QPair<QString, QMap<QString, double>>

Public Member Functions

 MNEDerivSet ()=default
 MNEDerivSet (MNEDerivSet &&)=default
MNEDerivSet & operator= (MNEDerivSet &&)=default
 ~MNEDerivSet ()=default
 MNEDerivSet (const MNEDerivSet &other)
MNEDerivSet & operator= (const MNEDerivSet &other)
bool write (const QString &path) const
QList< Definition > definitions () const
void append (const MNEDerivSet &other)
std::unique_ptr< MNEDeriv > match (const QStringList &chNames) const
int count () const

Static Public Member Functions

static std::optional< MNEDerivSet > read (const QString &path)
static std::optional< MNEDerivSet > readText (const QString &path)
static MNEDerivSet fromDefinitions (const QList< Definition > &definitions, const QString &name=QString())

Public Attributes

std::vector< std::unique_ptr< MNEDeriv > > derivs

Detailed Description

Collection of channel derivations.

Definition at line 62 of file mne_deriv_set.h.

Member Typedef Documentation

◆ Definition

using MNELIB::MNEDerivSet::Definition = QPair<QString, QMap<QString, double>>

Derived channel name and the weight of every input channel.

Definition at line 66 of file mne_deriv_set.h.

Constructor & Destructor Documentation

◆ MNEDerivSet() [1/3]

MNELIB::MNEDerivSet::MNEDerivSet ( )
default

◆ MNEDerivSet() [2/3]

MNELIB::MNEDerivSet::MNEDerivSet ( MNEDerivSet && )
default

◆ ~MNEDerivSet()

MNELIB::MNEDerivSet::~MNEDerivSet ( )
default

◆ MNEDerivSet() [3/3]

MNELIB::MNEDerivSet::MNEDerivSet ( const MNEDerivSet & other)
inline

Copies the set including every derivation.

Parameters
[in]otherThe set to copy.

Definition at line 79 of file mne_deriv_set.h.

Member Function Documentation

◆ append()

void MNEDerivSet::append ( const MNEDerivSet & other)

Appends copies of the derivations of another set (MNE-C mne_merge_deriv_sets).

Parameters
[in]otherThe derivations to append.

Definition at line 284 of file mne_deriv_set.cpp.

◆ count()

int MNEDerivSet::count ( ) const

Returns the number of derived channels over all derivations (MNE-C mne_count_deriv).

Returns
The total number of rows.

Definition at line 341 of file mne_deriv_set.cpp.

◆ definitions()

QList< MNEDerivSet::Definition > MNEDerivSet::definitions ( ) const

Returns every derivation of the set as definitions, in file order.

Returns
Derived channel names with the weights of their inputs.

Definition at line 265 of file mne_deriv_set.cpp.

◆ fromDefinitions()

MNEDerivSet MNEDerivSet::fromDefinitions ( const QList< Definition > & definitions,
const QString & name = QString() )
static

Builds one derivation from definitions such as those of dsp::ChannelDerivation.

Parameters
[in]definitionsDerived channel names with the weights of their inputs.
[in]nameShort name of the derivation.
Returns
A set with one derivation; input channels appear in order of first use.

Definition at line 234 of file mne_deriv_set.cpp.

◆ match()

std::unique_ptr< MNEDeriv > MNEDerivSet::match ( const QStringList & chNames) const

Keeps the derivations whose inputs are all among chNames and merges them into one derivation whose columns are exactly chNames (MNE-C mne_match_merge_deriv).

Parameters
[in]chNamesChannel names of a recording, in data order.
Returns
The merged derivation with MNEDeriv::in_use set, or nullptr if nothing matched.

Definition at line 293 of file mne_deriv_set.cpp.

◆ operator=() [1/2]

MNEDerivSet & MNELIB::MNEDerivSet::operator= ( const MNEDerivSet & other)
inline

Replaces the derivations by copies of those of another set.

Parameters
[in]otherThe set to copy.
Returns
This set.

Definition at line 92 of file mne_deriv_set.h.

◆ operator=() [2/2]

MNEDerivSet & MNELIB::MNEDerivSet::operator= ( MNEDerivSet && )
default

◆ read()

std::optional< MNEDerivSet > MNEDerivSet::read ( const QString & path)
static

Reads every derivation stored in the FIFFB_MNE_DERIVATIONS blocks of a file (MNE-C mne_read_deriv).

Parameters
[in]pathA derivation file written by write() or MNE-C mne_make_derivations.
Returns
The set (empty if the file holds no derivations), or no value if the file cannot be read.

Definition at line 137 of file mne_deriv_set.cpp.

◆ readText()

std::optional< MNEDerivSet > MNEDerivSet::readText ( const QString & path)
static

Reads MNE-C's text syntax (mne_make_derivations –in).

Each derivation is name = followed by terms joined by + and -; a term is a channel name optionally preceded by a weight and *, e.g. "EEG 001-EEG 002" = "EEG 001" - "EEG 002". Names with spaces are quoted, tokens are separated by white space and # starts a comment line. Weights of the same input channel add up; derivations whose weights are all zero are dropped.

Parameters
[in]pathThe text file.
Returns
One derivation holding all definitions, or no value on a syntax error.

Definition at line 163 of file mne_deriv_set.cpp.

◆ write()

bool MNEDerivSet::write ( const QString & path) const

Writes the set as a FIFFB_MNE_DERIVATIONS block (MNE-C mne_write_deriv_file).

Parameters
[in]pathThe output file.
Returns
True if the file was written; an empty set is not written.

Definition at line 243 of file mne_deriv_set.cpp.

Member Data Documentation

◆ derivs

std::vector<std::unique_ptr<MNEDeriv> > MNELIB::MNEDerivSet::derivs

The derivations, owned.

Definition at line 183 of file mne_deriv_set.h.


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