44#include <QSharedDataPointer>
45#include <QSharedPointer>
84 using SPtr = QSharedPointer<FiffCov>;
86 using UPtr = std::unique_ptr<FiffCov>;
88 using SDPtr = QSharedDataPointer<FiffCov>;
102 FiffCov(QIODevice& p_IODevice);
143 FiffCov pick_channels(
const QStringList& p_include = defaultQStringList,
const QStringList& p_exclude = defaultQStringList);
172 FiffCov regularize(
const FiffInfo& p_info,
double p_fMag = 0.1,
double p_fGrad = 0.1,
double p_fEeg = 0.1,
bool p_bProj =
true, QStringList p_exclude = defaultQStringList)
const;
195 const Eigen::MatrixXi& events,
196 const QList<int>& eventCodes,
201 bool doBaseline =
false,
202 bool removeMean =
true,
203 unsigned int ignoreMask = 0,
214 bool save(
const QString& fileName)
const;
267 return this->
dim <= -1;
274 bool t_bIsShort =
true;
275 out <<
"#### Fiff Covariance ####\n";
276 out <<
"\tKind: " << p_FiffCov.
kind << std::endl;
277 out <<
"\tdiag: " << p_FiffCov.
diag << std::endl;
278 out <<
"\tdim: " << p_FiffCov.
dim << std::endl;
279 out <<
"\tnames " << p_FiffCov.
names.size() <<
":\n\t";
282 qint32 nchan = p_FiffCov.
names.size() > 6 ? 6 : p_FiffCov.
names.size();
283 for (qint32 i = 0; i < nchan / 2; ++i)
284 out << p_FiffCov.
names[i].toUtf8().constData() <<
" ";
286 for (qint32 i = p_FiffCov.
names.size() - nchan / 2; i < p_FiffCov.
names.size(); ++i)
287 out << p_FiffCov.
names[i].toUtf8().constData() <<
" ";
291 out <<
"\tdata " << p_FiffCov.
data.rows() <<
" x " << p_FiffCov.
data.cols() <<
":\n\t";
293 qint32 nrows = p_FiffCov.
data.rows() > 6 ? 6 : p_FiffCov.
data.rows();
294 qint32 ncols = p_FiffCov.
data.cols() > 6 ? 6 : p_FiffCov.
data.cols();
295 for (qint32 i = 0; i < nrows / 2; ++i) {
296 for (qint32 j = 0; j < ncols / 2; ++j)
297 out << p_FiffCov.
data(i, j) <<
" ";
299 for (qint32 j = p_FiffCov.
data.cols() - ncols / 2; j < p_FiffCov.
data.cols(); ++j)
300 out << p_FiffCov.
data(i, j) <<
" ";
304 for (qint32 i = p_FiffCov.
data.rows() - nrows / 2; i < p_FiffCov.
data.rows(); ++i) {
305 for (qint32 j = 0; j < ncols / 2; ++j)
306 out << p_FiffCov.
data(i, j) <<
" ";
308 for (qint32 j = p_FiffCov.
data.cols() - ncols / 2; j < p_FiffCov.
data.cols(); ++j)
309 out << p_FiffCov.
data(i, j) <<
" ";
315 out <<
"\tprojectors " << p_FiffCov.
projs.size() <<
":\n";
316 for (qint32 i = 0; i < p_FiffCov.
projs.size(); ++i)
317 out <<
"\t" << p_FiffCov.
projs[i];
320 out <<
"\tbads " << p_FiffCov.
bads.size() <<
":\n\t";
321 for (qint32 i = 0; i < p_FiffCov.
bads.size(); ++i)
322 out << p_FiffCov.
bads[i].toUtf8().constData() <<
" ";
324 out <<
"\n\tfree: " << p_FiffCov.
nfree << std::endl;
326 out <<
"\teig " << p_FiffCov.
eig.size() <<
":\n\t";
328 qint32 nrows = p_FiffCov.
eig.size() > 6 ? 6 : p_FiffCov.
eig.size();
329 for (qint32 i = 0; i < nrows / 2; ++i)
330 out << p_FiffCov.
eig[i] <<
" ";
332 for (qint32 i = p_FiffCov.
eig.size() - nrows / 2; i < p_FiffCov.
eig.size(); ++i)
333 out << p_FiffCov.
eig[i] <<
" ";
337 out <<
"\n\teigvec " << p_FiffCov.
eigvec.rows() <<
" x " << p_FiffCov.
eigvec.cols() <<
":\n\t";
339 qint32 nrows = p_FiffCov.
eigvec.rows() > 6 ? 6 : p_FiffCov.
eigvec.rows();
340 qint32 ncols = p_FiffCov.
eigvec.cols() > 6 ? 6 : p_FiffCov.
eigvec.cols();
341 for (qint32 i = 0; i < nrows / 2; ++i) {
342 for (qint32 j = 0; j < ncols / 2; ++j)
343 out << p_FiffCov.
eigvec(i, j) <<
" ";
345 for (qint32 j = p_FiffCov.
eigvec.cols() - ncols / 2; j < p_FiffCov.
eigvec.cols(); ++j)
346 out << p_FiffCov.
eigvec(i, j) <<
" ";
350 for (qint32 i = p_FiffCov.
eigvec.rows() - nrows / 2; i < p_FiffCov.
eigvec.rows(); ++i) {
351 for (qint32 j = 0; j < ncols / 2; ++j)
352 out << p_FiffCov.
eigvec(i, j) <<
" ";
354 for (qint32 j = p_FiffCov.
eigvec.cols() - ncols / 2; j < p_FiffCov.
eigvec.cols(); ++j)
355 out << p_FiffCov.
eigvec(i, j) <<
" ";
364#ifndef metatype_fiffcovsptr
365#define metatype_fiffcovsptr
369#ifndef metatype_fiffcov
370#define metatype_fiffcov
Full FIFF measurement metadata: everything from FIFFB_MEAS / FIFFB_MEAS_INFO needed to interpret a re...
Export/import macros and build-info accessors for the FIFFLIB shared library.
#define FIFFSHARED_EXPORT
SSP projection item: a named projection vector set with active/desired flags, parsed from FIFFB_PROJ_...
Q_DECLARE_METATYPE(QSharedPointer< FIFFLIB::FiffCov >)
Primitive scalar typedefs and forward-compatible aliases backing the FIFF type system.
FIFF file I/O, in-memory data structures and high-level readers/writers.
std::ostream & operator<<(std::ostream &out, const FIFFLIB::FiffCov &p_FiffCov)
FIFF noise / data covariance: matrix, channel names, kind, applied projectors, bads,...
std::unique_ptr< FiffCov > UPtr
friend std::ostream & operator<<(std::ostream &out, const FIFFLIB::FiffCov &p_FiffCov)
FiffCov regularize(const FiffInfo &p_info, double p_fMag=0.1, double p_fGrad=0.1, double p_fEeg=0.1, bool p_bProj=true, QStringList p_exclude=defaultQStringList) const
QSharedDataPointer< FiffCov > SDPtr
std::unique_ptr< const FiffCov > ConstUPtr
FiffCov pick_channels(const QStringList &p_include=defaultQStringList, const QStringList &p_exclude=defaultQStringList)
QSharedPointer< FiffCov > SPtr
static FiffCov computeGrandAverage(const QList< FiffCov > &covs)
FiffCov & operator=(const FiffCov &rhs)
FiffCov prepare_noise_cov(const FiffInfo &p_info, const QStringList &p_chNames) const
bool save(const QString &fileName) const
QSharedPointer< const FiffCov > ConstSPtr
static FiffCov compute_from_epochs(const FiffRawData &raw, const Eigen::MatrixXi &events, const QList< int > &eventCodes, float tmin, float tmax, float bmin=0.0f, float bmax=0.0f, bool doBaseline=false, bool removeMean=true, unsigned int ignoreMask=0, float delay=0.0f, const RejectionParams *rej=nullptr)
Artifact-rejection thresholds for the MNE-C batch averaging pipeline (gradiometer / magnetometer / EE...
Full FIFF measurement info: per-channel descriptors, sampling and filter setup, projectors,...
Continuous FIFF raw recording: FiffInfo plus a random-access directory of FIFF_DATA_BUFFER tags.