MNE-CPP  beta 1.0
realtimecovwidget.cpp
Go to the documentation of this file.
1 //=============================================================================================================
36 //*************************************************************************************************************
37 //=============================================================================================================
38 // INCLUDES
39 //=============================================================================================================
40 
41 #include "realtimecovwidget.h"
42 
43 #include <xMeas/realtimecov.h>
44 
45 
46 //*************************************************************************************************************
47 //=============================================================================================================
48 // Eigen INCLUDES
49 //=============================================================================================================
50 
51 #include <Eigen/Core>
52 
53 
54 //*************************************************************************************************************
55 //=============================================================================================================
56 // STL INCLUDES
57 //=============================================================================================================
58 
59 
60 
61 //*************************************************************************************************************
62 //=============================================================================================================
63 // QT INCLUDES
64 //=============================================================================================================
65 
66 #include <QLabel>
67 #include <QFont>
68 #include <QDebug>
69 
70 
71 //*************************************************************************************************************
72 //=============================================================================================================
73 // USED NAMESPACES
74 //=============================================================================================================
75 
76 using namespace XDISPLIB;
77 using namespace XMEASLIB;
78 
79 
80 //=============================================================================================================
84 enum Tool
85 {
86  Freeze = 0,
88 };
89 
90 
91 //*************************************************************************************************************
92 //=============================================================================================================
93 // DEFINE MEMBER METHODS
94 //=============================================================================================================
95 
96 RealTimeCovWidget::RealTimeCovWidget(QSharedPointer<RealTimeCov> pRTC, QSharedPointer<QTime> &pTime, QWidget* parent)
97 : NewMeasurementWidget(parent)
98 , m_pRTC(pRTC)
99 , m_bInitialized(false)
100 {
101  Q_UNUSED(pTime)
102 
103  m_pActionSelectModality = new QAction(QIcon(":/images/covarianceSelection.png"), tr("Shows the covariance modality selection widget (F12)"),this);
104  m_pActionSelectModality->setShortcut(tr("F12"));
105  m_pActionSelectModality->setStatusTip(tr("Shows the covariance modality selection widget (F12)"));
106  connect(m_pActionSelectModality, &QAction::triggered, this, &RealTimeCovWidget::showModalitySelectionWidget);
107  addDisplayAction(m_pActionSelectModality);
108 
109  //set vertical layout
110  m_pRtcLayout = new QVBoxLayout(this);
111 
112  m_pLabelInit= new QLabel;
113  m_pLabelInit->setText("Acquiring Data");
114  m_pLabelInit->setAlignment(Qt::AlignCenter);
115  QFont font;font.setBold(true);font.setPointSize(20);
116  m_pLabelInit->setFont(font);
117  m_pRtcLayout->addWidget(m_pLabelInit);
118 
119  m_pImageSc = new ImageSc;
120  m_pRtcLayout->addWidget(m_pImageSc);
121 
122  //set layouts
123  this->setLayout(m_pRtcLayout);
124 
125  m_qListPickTypes << "EEG";// << "MEG";
126 
127  getData();
128 
129 }
130 
131 
132 //*************************************************************************************************************
133 
135 {
136 
137 }
138 
139 
140 //*************************************************************************************************************
141 
143 {
144  getData();
145 }
146 
147 
148 //*************************************************************************************************************
149 
151 {
152  if(!m_bInitialized || m_pRTC->getValue()->names.size() != m_qListChNames.size())
153  if(m_pRTC->isInitialized())
154  init();
155 
156  if(m_bInitialized)
157  {
158  MatrixXd data = (m_matSelectorT * m_pRTC->getValue()->data) * m_matSelector;
159  m_pImageSc->updateData(data);
160  }
161 }
162 
163 
164 //*************************************************************************************************************
165 
167 {
168  if(m_pRTC->getValue()->names.size() > 0)
169  {
170  m_pRtcLayout->removeWidget(m_pLabelInit);
171  m_pLabelInit->hide();
172 
173  m_pImageSc->setTitle(m_pRTC->getName());
174 
175  m_qListChNames = m_pRTC->getValue()->names;
176 
177  QList<qint32> qListSelChannel;
178  for(qint32 i = 0; i < m_qListChNames.size(); ++i)
179  {
180  foreach (const QString &type, m_qListPickTypes) {
181  if (m_qListChNames[i].contains(type))
182  qListSelChannel.append(i);
183  }
184  }
185 
186  m_matSelector = MatrixXd::Zero(m_pRTC->getValue()->data.cols(), qListSelChannel.size());
187 
188  for(qint32 i = 0; i < qListSelChannel.size(); ++i)
189  m_matSelector(qListSelChannel[i],i) = 1;
190 
191  m_matSelectorT = m_matSelector.transpose();
192 
193  m_bInitialized = true;
194  }
195 }
196 
197 
198 //*************************************************************************************************************
199 
201 {
202  if(!m_pModalitySelectionWidget)
203  {
204  m_pModalitySelectionWidget = QSharedPointer<CovModalityWidget>(new CovModalityWidget(this));
205 
206  m_pModalitySelectionWidget->setWindowTitle("Modality Selection");
207  }
208  m_pModalitySelectionWidget->show();
209 }
Free surfer annotation.
Definition: annotation.h:97
virtual void update(XMEASLIB::NewMeasurement::SPtr pMeasurement)
Eigen matrix visualization.
Definition: imagesc.h:96
void setTitle(const QString &p_sTitle)
Definition: graph.cpp:101
The CovModalityWidget class provides the sensor selection widget.
QSharedPointer< NewMeasurement > SPtr
void updateData(MatrixXd &p_dMat)
Definition: imagesc.cpp:146
The MeasurementWidget class is the base class of all measurement widgets.
Declaration of the RealTimeCovWidget Class.
RealTimeCovWidget(QSharedPointer< RealTimeCov > pRTC, QSharedPointer< QTime > &pTime, QWidget *parent=0)
Contains the declaration of the RealTimeCov class.
void addDisplayAction(QAction *pAction)