FiffProj
Namespace: FIFFLIB · Library: FIFF Library
mne.Projection in MNE-Python.
#include <fiff/fiff_proj.h>
class FIFFLIB::FiffProj
Single SSP projection item: kind, active flag, desired flag and the named projection vector matrix.
Maps one FIFFB_PROJ_ITEM block to a C++ value: description, kind, nvec, active, plus a FiffNamedMatrix whose row names are the channels the projector acts on. Multiple FiffProj instances form the info['projs'] list and are combined into one projection operator by make_projector when raw / evoked data is loaded.
const FiffProj& pca = info.projs[0]; // "PCA-v1", 1 vector over 102 magnetometers, inactive
QList<FiffProj> projs = info.projs;
FiffProj::activate_projs(projs);
Public Methods
FiffProj()
Default constructor.
FiffProj(p_FiffProj)
Copy constructor.
Parameters:
- p_FiffProj : const FiffProj & SSP projector data which should be copied.
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:
- other : const FiffProj & Object to assign from.
Returns:
- FiffProj & — reference to this object.
FiffProj(p_kind, p_active, p_desc, p_data)
Constructor.
Parameters:
-
p_kind : fiff_int_t Projection kind (FIFFV_PROJ_ITEM_* constant).
-
p_active : bool Whether the projector is already applied to the data.
-
p_desc : QString Human-readable description of the projector.
-
p_data : FiffNamedMatrix & Projection vectors with channel names; a deep copy is stored.
~FiffProj()
Destroys the FiffProj.
Static Methods
activate_projs(p_qListFiffProj)
Set all projections to active.
Parameters:
- p_qListFiffProj : QList< FiffProj > & activates projectors in place.
make_projector(projs, ch_names, proj, bads, U)
mne_make_projector
ToDo move this to fiff_proj; Before: check if info is needed and if make_projector_info should be also moved.
Make an SSP operator
Parameters:
-
projs : const QList< FiffProj > & A set of projection vectors.
-
ch_names : const QStringList & A cell array of channel names.
-
proj : Eigen::MatrixXd & The projection operator to apply to the data.
-
bads : const QStringList & Bad channels to exclude.
-
U : Eigen::MatrixXd & The orthogonal basis of the projection vectors (optional).
Returns:
- fiff_int_t — nproj - How many items in the projector.
compute_from_raw(raw, events, eventCode, tmin, tmax, nGrad, nMag, nEeg, mapReject)
compute_from_raw
Create SSP (Signal-Space Projection) operators from raw data via SVD. Ported from make_ssp.c (MNE-C).
Parameters:
-
raw : const FiffRawData & The raw data.
-
events : const Eigen::MatrixXi & Event matrix (nEvents x 3).
-
eventCode : int Which event code to select epochs for.
-
tmin : float Start of epoch relative to event (seconds).
-
tmax : float End of epoch relative to event (seconds).
-
nGrad : int Number of gradiometer projection vectors.
-
nMag : int Number of magnetometer projection vectors.
-
nEeg : int Number of EEG projection vectors.
-
mapReject : const QMap< QString, double > & Rejection thresholds (key = channel type string, value = threshold).
Returns:
compute_from_evoked(evoked, nGrad, nMag, nEeg)
Create SSP operators from averaged artifact data (mne.compute_proj_evoked).
For each of gradiometers, magnetometers and EEG (bad channels excluded) the leading left singular vectors of the evoked data become inactive projectors named like "planar-<tmin>-<tmax>-PCA-01", "axial-..." and "eeg-...".
Parameters:
-
evoked : const FiffEvoked & The averaged artifact.
-
nGrad : int Number of gradiometer projection vectors.
-
nMag : int Number of magnetometer projection vectors.
-
nEeg : int Number of EEG projection vectors.
Returns:
Example
- Full source:
src/examples/ex_fiff_api/main.cpp - Build target:
ex_fiff_api(runs under CTest) - Data: mne-cpp-test-data
Used in examples
ex_fiff_api
FIFF library: measurement info, channels, digitizer, transforms, projectors, covariance, events,.
const FiffProj& pca = info.projs[0]; // "PCA-v1", 1 vector over 102 magnetometers, inactive
QList<FiffProj> projs = info.projs;
FiffProj::activate_projs(projs);
ok &= expect(pca.desc == "PCA-v1" && !pca.active && pca.data->nrow == 1 && pca.data->ncol == 102 && projs[0].active,
"FiffProj/FiffNamedMatrix: PCA-v1 is 1 x 102 and inactive until activated");
ex_mne_api
MNE library: BEM surfaces, surface projection, ICP, source spaces and epochs.
MatrixXi eventsBack;
MNE::read_events(eveName, rawFile.fileName(), eventsBack);
QList<FiffProj> projs = raw.info.projs; // stored inactive in the raw file
FiffProj::activate_projs(projs);
MatrixXd ssp; // like mne._fiff.proj.make_projector(info['projs'], ch_names, bads)
const int nProj = MNE::make_projector(projs, raw.info.ch_names, ssp, raw.info.bads);
// mne.find_events: 25 events, first at sample 13988 with code 2; make_projector: 4 vectors, trace 372 of 376
ok &= expect(eventsBack.rows() == 25 && eventsBack(0, 0) == 13988 && eventsBack(0, 2) == 2 && nProj == 4 && near(ssp.trace(), 372.0, 1e-9) && near(ssp.norm(), 19.28730152198591, 1e-9),
"MNE: event file round trip and SSP projector like mne.find_events / make_projector");
ex_dsp_rt
DSP real-time workers: averaging, covariance, noise spectrum, connectivity, HPI fitting and inverse operators.
ok &= hpiRaw.read_raw_segment(hpiData, hpiTimes, hpiRaw.first_samp, hpiRaw.first_samp + 399);
MatrixXd projectors = MatrixXd::Identity(hpiInfo->nchan, hpiInfo->nchan);
FiffInfo projInfo = *hpiInfo;
for (FiffProj& proj : projInfo.projs) {
proj.active = true;
}
projInfo.make_projector(projectors);
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>
- Christof Pieloth <pieloth@labp.htwk-leipzig.de>
- Lorenz Esch <lorenz.esch@tu-ilmenau.de>
- Juan GPC <jgarciaprieto@mgh.harvard.edu>
- Gabriel Motta <gabrielbenmotta@gmail.com>