44#include <QSharedDataPointer>
45#include <QSharedPointer>
81 using SPtr = QSharedPointer<FiffCov>;
83 using UPtr = std::unique_ptr<FiffCov>;
85 using SDPtr = QSharedDataPointer<FiffCov>;
140 FiffCov pick_channels(
const QStringList &p_include = defaultQStringList,
const QStringList &p_exclude = defaultQStringList);
169 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;
191 const Eigen::MatrixXi &events,
192 const QList<int> &eventCodes,
197 bool doBaseline =
false,
198 bool removeMean =
true,
199 unsigned int ignoreMask = 0,
209 bool save(
const QString &fileName)
const;
263 return this->
dim <= -1;
270 bool t_bIsShort =
true;
271 out <<
"#### Fiff Covariance ####\n";
272 out <<
"\tKind: " << p_FiffCov.
kind << std::endl;
273 out <<
"\tdiag: " << p_FiffCov.
diag << std::endl;
274 out <<
"\tdim: " << p_FiffCov.
dim << std::endl;
275 out <<
"\tnames " << p_FiffCov.
names.size() <<
":\n\t";
279 qint32 nchan = p_FiffCov.
names.size() > 6 ? 6 : p_FiffCov.
names.size();
280 for(qint32 i = 0; i < nchan/2; ++i)
281 out << p_FiffCov.
names[i].toUtf8().constData() <<
" ";
283 for(qint32 i = p_FiffCov.
names.size() - nchan/2; i < p_FiffCov.
names.size(); ++i)
284 out << p_FiffCov.
names[i].toUtf8().constData() <<
" ";
288 out <<
"\tdata " << p_FiffCov.
data.rows() <<
" x " << p_FiffCov.
data.cols() <<
":\n\t";
291 qint32 nrows = p_FiffCov.
data.rows() > 6 ? 6 : p_FiffCov.
data.rows();
292 qint32 ncols = p_FiffCov.
data.cols() > 6 ? 6 : p_FiffCov.
data.cols();
293 for(qint32 i = 0; i < nrows/2; ++i)
295 for(qint32 j = 0; j < ncols/2; ++j)
296 out << p_FiffCov.
data(i,j) <<
" ";
298 for(qint32 j = p_FiffCov.
data.cols() - ncols/2; j < p_FiffCov.
data.cols(); ++j)
299 out << p_FiffCov.
data(i,j) <<
" ";
303 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";
329 qint32 nrows = p_FiffCov.
eig.size() > 6 ? 6 : p_FiffCov.
eig.size();
330 for(qint32 i = 0; i < nrows/2; ++i)
331 out << p_FiffCov.
eig[i] <<
" ";
333 for(qint32 i = p_FiffCov.
eig.size() - nrows/2; i < p_FiffCov.
eig.size(); ++i)
334 out << p_FiffCov.
eig[i] <<
" ";
338 out <<
"\n\teigvec " << p_FiffCov.
eigvec.rows() <<
" x " << p_FiffCov.
eigvec.cols() <<
":\n\t";
341 qint32 nrows = p_FiffCov.
eigvec.rows() > 6 ? 6 : p_FiffCov.
eigvec.rows();
342 qint32 ncols = p_FiffCov.
eigvec.cols() > 6 ? 6 : p_FiffCov.
eigvec.cols();
343 for(qint32 i = 0; i < nrows/2; ++i)
345 for(qint32 j = 0; j < ncols/2; ++j)
346 out << p_FiffCov.
eigvec(i,j) <<
" ";
348 for(qint32 j = p_FiffCov.
eigvec.cols() - ncols/2; j < p_FiffCov.
eigvec.cols(); ++j)
349 out << p_FiffCov.
eigvec(i,j) <<
" ";
353 for(qint32 i = p_FiffCov.
eigvec.rows() - nrows/2; i < p_FiffCov.
eigvec.rows(); ++i)
355 for(qint32 j = 0; j < ncols/2; ++j)
356 out << p_FiffCov.
eigvec(i,j) <<
" ";
358 for(qint32 j = p_FiffCov.
eigvec.cols() - ncols/2; j < p_FiffCov.
eigvec.cols(); ++j)
359 out << p_FiffCov.
eigvec(i,j) <<
" ";
368#ifndef metatype_fiffcovsptr
369#define metatype_fiffcovsptr
373#ifndef metatype_fiffcov
374#define metatype_fiffcov
SSP projection item: a named projection vector set with active/desired flags, parsed from FIFFB_PROJ_...
Full FIFF measurement metadata: everything from FIFFB_MEAS / FIFFB_MEAS_INFO needed to interpret a re...
Q_DECLARE_METATYPE(QSharedPointer< FIFFLIB::FiffCov >)
Export/import macros and build-info accessors for the FIFFLIB shared library.
#define FIFFSHARED_EXPORT
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
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)
FiffCov pick_channels(const QStringList &p_include=defaultQStringList, const QStringList &p_exclude=defaultQStringList)
QSharedPointer< FiffCov > SPtr
static FiffCov computeGrandAverage(const QList< FiffCov > &covs)
FiffCov prepare_noise_cov(const FiffInfo &p_info, const QStringList &p_chNames) const
bool save(const QString &fileName) const
QSharedPointer< const FiffCov > ConstSPtr
Full FIFF measurement info: per-channel descriptors, sampling and filter setup, projectors,...