MNE-CPP
0.1.9
A Framework for Electrophysiology
src
libraries
mne
mne_cluster_info.cpp
Go to the documentation of this file.
1
//=============================================================================================================
38
//=============================================================================================================
39
// INCLUDES
40
//=============================================================================================================
41
42
#include "
mne_cluster_info.h
"
43
44
//=============================================================================================================
45
// QT INCLUDES
46
//=============================================================================================================
47
48
#include <QFile>
49
#include <QTextStream>
50
51
//=============================================================================================================
52
// USED NAMESPACES
53
//=============================================================================================================
54
55
using namespace
MNELIB;
56
57
//=============================================================================================================
58
// DEFINE MEMBER METHODS
59
//=============================================================================================================
60
61
MNEClusterInfo::MNEClusterInfo
()
62
{
63
}
64
65
//=============================================================================================================
66
67
void
MNEClusterInfo::clear
()
68
{
69
clusterLabelNames
.clear();
70
clusterLabelIds
.clear();
71
centroidVertno
.clear();
72
centroidSource_rr
.clear();
73
clusterVertnos
.clear();
74
clusterSource_rr
.clear();
75
clusterDistances
.clear();
76
}
77
78
//=============================================================================================================
79
80
void
MNEClusterInfo::write
(QString p_sFileName)
const
81
{
82
QFile file(
"./"
+p_sFileName);
83
if
(!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
84
qDebug(
"Unable to open file."
);
85
return
;
86
}
87
QTextStream out(&file);
88
out <<
"MNE Cluster Info\n"
;
89
90
for
(qint32 i = 0; i <
clusterLabelIds
.size(); ++i)
91
{
92
out <<
"\nLabel : "
<<
clusterLabelNames
[i] <<
"\n"
;
93
out <<
"Label ID : "
<<
clusterLabelIds
[i] <<
"\n"
;
94
out <<
"Centroid Vertno : "
<<
centroidVertno
[i] <<
"\n"
;
95
out <<
"Centroid rr : "
<<
centroidSource_rr
[i](0) <<
", "
<<
clusterSource_rr
[i](1) <<
", "
<<
clusterSource_rr
[i](2) <<
"\n"
;
96
out <<
"Vertnos :\n"
;
97
for
(qint32 j = 0; j <
clusterVertnos
[i].size(); ++j)
98
out <<
clusterVertnos
[i][j] <<
", "
;
99
out <<
"\nDistances :\n"
;
100
for
(qint32 j = 0; j <
clusterDistances
[i].size(); ++j)
101
out <<
clusterDistances
[i][j] <<
", "
;
102
out <<
"\nrr :\n"
;
103
for
(qint32 j = 0; j <
clusterSource_rr
[i].rows(); ++j)
104
out <<
clusterSource_rr
[i](j,0) <<
", "
<<
clusterSource_rr
[i](j,1) <<
", "
<<
clusterSource_rr
[i](j,2) <<
"\n"
;
105
106
out <<
"\n"
;
107
}
108
109
// optional, as QFile destructor will already do it:
110
file.close();
111
112
QFile file_centroids(
"./centroids_"
+p_sFileName);
113
114
if
(file_centroids.open(QIODevice::WriteOnly | QIODevice::Text)) {
115
QTextStream out_centroids(&file_centroids);
116
117
for
(qint32 i = 0; i <
clusterLabelIds
.size(); ++i)
118
out_centroids <<
centroidVertno
[i] <<
", "
;
119
120
// optional, as QFile destructor will already do it:
121
file_centroids.close();
122
}
123
}
MNELIB::MNEClusterInfo::MNEClusterInfo
MNEClusterInfo()
Definition:
mne_cluster_info.cpp:61
MNELIB::MNEClusterInfo::centroidVertno
QList< qint32 > centroidVertno
Definition:
mne_cluster_info.h:126
MNELIB::MNEClusterInfo::centroidSource_rr
QList< Eigen::Vector3f > centroidSource_rr
Definition:
mne_cluster_info.h:127
mne_cluster_info.h
MNEClusterInfo class declaration, which provides cluster information.
MNELIB::MNEClusterInfo::clusterVertnos
QList< Eigen::VectorXi > clusterVertnos
Definition:
mne_cluster_info.h:128
MNELIB::MNEClusterInfo::clusterDistances
QList< Eigen::VectorXd > clusterDistances
Definition:
mne_cluster_info.h:130
MNELIB::MNEClusterInfo::clusterLabelIds
QList< qint32 > clusterLabelIds
Definition:
mne_cluster_info.h:125
MNELIB::MNEClusterInfo::clusterSource_rr
QList< Eigen::MatrixX3f > clusterSource_rr
Definition:
mne_cluster_info.h:129
MNELIB::MNEClusterInfo::clear
void clear()
Definition:
mne_cluster_info.cpp:67
MNELIB::MNEClusterInfo::write
void write(QString p_sFileName) const
Definition:
mne_cluster_info.cpp:80
MNELIB::MNEClusterInfo::clusterLabelNames
QList< QString > clusterLabelNames
Definition:
mne_cluster_info.h:124
Generated on Wed Aug 9 2023 17:55:42 for MNE-CPP by
1.8.17