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

A dense matrix with named rows and columns. More...

#include <mne_named_matrix.h>

Public Types

typedef QSharedPointer< MNENamedMatrixSPtr
typedef QSharedPointer< const MNENamedMatrixConstSPtr

Public Member Functions

 MNENamedMatrix ()
 Default constructor.
 MNENamedMatrix (const MNENamedMatrix &p_MneNamedMatrix)
 Copy constructor.
 ~MNENamedMatrix ()
 Destructor.
std::unique_ptr< MNENamedMatrixpick (const QStringList &pickrowlist, int picknrow, const QStringList &pickcollist, int pickncol) const
 Create a sub-matrix by picking named rows and columns.

Static Public Member Functions

static std::unique_ptr< MNENamedMatrixbuild (int nrow, int ncol, const QStringList &rowlist, const QStringList &collist, const Eigen::MatrixXf &data)
 Factory: build a named matrix from its constituent parts.
static std::unique_ptr< MNENamedMatrixread (QSharedPointer< FIFFLIB::FiffStream > &stream, const QSharedPointer< FIFFLIB::FiffDirNode > &node, int kind)
 Factory: read a named matrix from a FIFF file.

Public Attributes

int nrow
int ncol
QStringList rowlist
QStringList collist
Eigen::MatrixXf data

Detailed Description

A dense matrix with named rows and columns.

MNENamedMatrix associates a dense float matrix (Eigen::MatrixXf) with optional row and column name lists (QStringList). It is the C++ equivalent of the MNE-C mneNamedMatrixRec struct, and is used throughout the library to represent projection vectors, CTF compensation matrices, and forward-solution gain matrices.

The class provides factory methods to:

  • build() a matrix from its constituent parts,
  • read() a matrix from a FIFF stream, and
  • pick() a sub-matrix by selecting named rows and/or columns.

All factory methods return std::unique_ptr<MNENamedMatrix> for clear ownership.

Note
This class is functionally similar to FIFFLIB::FiffNamedMatrix. A future consolidation of both types is planned.

Definition at line 101 of file mne_named_matrix.h.

Member Typedef Documentation

◆ ConstSPtr

typedef QSharedPointer<const MNENamedMatrix> MNELIB::MNENamedMatrix::ConstSPtr

Const shared pointer type for MNENamedMatrix.

Definition at line 105 of file mne_named_matrix.h.

◆ SPtr

Shared pointer type for MNENamedMatrix.

Definition at line 104 of file mne_named_matrix.h.

Constructor & Destructor Documentation

◆ MNENamedMatrix() [1/2]

MNENamedMatrix::MNENamedMatrix ( )

Default constructor.

Creates an empty named matrix with zero rows and columns and no associated name lists.

Definition at line 64 of file mne_named_matrix.cpp.

◆ MNENamedMatrix() [2/2]

MNENamedMatrix::MNENamedMatrix ( const MNENamedMatrix & p_MneNamedMatrix)

Copy constructor.

Performs a deep copy of all members: dimensions, name lists, and matrix data.

Parameters
[in]p_MneNamedMatrixThe named matrix to copy.

Definition at line 72 of file mne_named_matrix.cpp.

◆ ~MNENamedMatrix()

MNENamedMatrix::~MNENamedMatrix ( )

Destructor.

All members (Eigen::MatrixXf, QStringList) are value types and clean themselves up automatically.

Definition at line 83 of file mne_named_matrix.cpp.

Member Function Documentation

◆ build()

std::unique_ptr< MNENamedMatrix > MNENamedMatrix::build ( int nrow,
int ncol,
const QStringList & rowlist,
const QStringList & collist,
const Eigen::MatrixXf & data )
static

Factory: build a named matrix from its constituent parts.

Assembles an MNENamedMatrix from dimension counts, optional row/column name lists, and a dense data matrix.

Parameters
[in]nrowNumber of rows (must match data.rows()).
[in]ncolNumber of columns (must match data.cols()).
[in]rowlistName list for the rows (may be empty).
[in]collistName list for the columns (may be empty).
[in]dataDense float matrix to store.
Returns
A unique pointer to the newly created named matrix.

Definition at line 89 of file mne_named_matrix.cpp.

◆ pick()

std::unique_ptr< MNENamedMatrix > MNENamedMatrix::pick ( const QStringList & pickrowlist,
int picknrow,
const QStringList & pickcollist,
int pickncol ) const

Create a sub-matrix by picking named rows and columns.

Selects a subset of this matrix's rows and columns by matching their names against the supplied pick-lists. If a pick-list is empty, all rows (or columns) of the original are retained.

Parameters
[in]pickrowlistRow names to select (empty = keep all rows).
[in]picknrowExpected number of picked rows (used when pickrowlist is empty).
[in]pickcollistColumn names to select (empty = keep all columns).
[in]pickncolExpected number of picked columns (used when pickcollist is empty).
Returns
A unique pointer to the picked sub-matrix, or nullptr if a requested name was not found.

Definition at line 106 of file mne_named_matrix.cpp.

◆ read()

std::unique_ptr< MNENamedMatrix > MNENamedMatrix::read ( QSharedPointer< FIFFLIB::FiffStream > & stream,
const QSharedPointer< FIFFLIB::FiffDirNode > & node,
int kind )
static

Factory: read a named matrix from a FIFF file.

Reads a two-dimensional tagged matrix of the given kind from node (or its first FIFFB_MNE_NAMED_MATRIX child). Row and column name lists are read from the associated FIFF_MNE_ROW_NAMES and FIFF_MNE_COL_NAMES tags when present.

Parameters
[in]streamOpen FIFF stream to read from.
[in]nodeDirectory node that contains (or is) the named-matrix block.
[in]kindFIFF tag kind that identifies the matrix data (e.g. FIFF_MNE_FORWARD_SOLUTION).
Returns
A unique pointer to the read matrix, or nullptr on failure.

Definition at line 204 of file mne_named_matrix.cpp.

Member Data Documentation

◆ collist

QStringList MNELIB::MNENamedMatrix::collist

Name list for the columns (may be empty if unnamed).

Definition at line 200 of file mne_named_matrix.h.

◆ data

Eigen::MatrixXf MNELIB::MNENamedMatrix::data

Dense data matrix of dimension nrow x ncol.

Definition at line 201 of file mne_named_matrix.h.

◆ ncol

int MNELIB::MNENamedMatrix::ncol

Number of columns in data.

Definition at line 198 of file mne_named_matrix.h.

◆ nrow

int MNELIB::MNENamedMatrix::nrow

Number of rows in data.

Definition at line 197 of file mne_named_matrix.h.

◆ rowlist

QStringList MNELIB::MNENamedMatrix::rowlist

Name list for the rows (may be empty if unnamed).

Definition at line 199 of file mne_named_matrix.h.


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