MNE-CPP  beta 1.0
realtimemultisamplearrayscalingwidget.cpp
Go to the documentation of this file.
1 //=============================================================================================================
36 //*************************************************************************************************************
37 //=============================================================================================================
38 // INCLUDES
39 //=============================================================================================================
40 
42 #include "../realtimemultisamplearraywidget.h"
43 
44 
45 //*************************************************************************************************************
46 //=============================================================================================================
47 // Qt INCLUDES
48 //=============================================================================================================
49 
50 #include <QLabel>
51 #include <QGridLayout>
52 
53 #include <QDebug>
54 
55 
56 //*************************************************************************************************************
57 //=============================================================================================================
58 // USED NAMESPACES
59 //=============================================================================================================
60 
61 using namespace XDISPLIB;
62 
63 
64 //*************************************************************************************************************
65 //=============================================================================================================
66 // DEFINE MEMBER METHODS
67 //=============================================================================================================
68 
70 : m_pRTMSAW(toolbox)
71 {
72  this->setWindowTitle("Covariance Modality Settings");
73  this->setMinimumWidth(330);
74  this->setMaximumWidth(330);
75 
76  QGridLayout* t_pGridLayout = new QGridLayout;
77 
78  qint32 i = 0;
79  //MAG
80  if(m_pRTMSAW->m_qMapChScaling.contains(FIFF_UNIT_T))
81  {
82  QLabel* t_pLabelModality = new QLabel;
83  t_pLabelModality->setText("MAG (pT)");
84  t_pGridLayout->addWidget(t_pLabelModality,i,0,1,1);
85 
86  QDoubleSpinBox* t_pDoubleSpinBoxScale = new QDoubleSpinBox;
87  t_pDoubleSpinBoxScale->setMinimum(10e-11);
88  t_pDoubleSpinBoxScale->setMaximum(10e14);
89  t_pDoubleSpinBoxScale->setMaximumWidth(100);
90  t_pDoubleSpinBoxScale->setSingleStep(0.1);
91  t_pDoubleSpinBoxScale->setDecimals(4);
92  t_pDoubleSpinBoxScale->setValue(m_pRTMSAW->m_qMapChScaling[FIFF_UNIT_T]/(1e-12));
93  m_qMapScalingDoubleSpinBox.insert(FIFF_UNIT_T,t_pDoubleSpinBoxScale);
94  connect(t_pDoubleSpinBoxScale,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
95  this,&RealTimeMultiSampleArrayScalingWidget::updateDoubleSpinBox);
96  t_pGridLayout->addWidget(t_pDoubleSpinBoxScale,i,2,1,1);
97  ++i;
98  }
99 
100  //GRAD
101  if(m_pRTMSAW->m_qMapChScaling.contains(FIFF_UNIT_T_M))
102  {
103  QLabel* t_pLabelModality = new QLabel;
104  t_pLabelModality->setText("GRAD (fT/cm)");
105  t_pGridLayout->addWidget(t_pLabelModality,i,0,1,1);
106 
107  QDoubleSpinBox* t_pDoubleSpinBoxScale = new QDoubleSpinBox;
108  t_pDoubleSpinBoxScale->setMinimum(10e-11);
109  t_pDoubleSpinBoxScale->setMaximum(2000);
110  t_pDoubleSpinBoxScale->setMaximumWidth(100);
111  t_pDoubleSpinBoxScale->setSingleStep(20.0);
112  t_pDoubleSpinBoxScale->setDecimals(4);
113  t_pDoubleSpinBoxScale->setValue(m_pRTMSAW->m_qMapChScaling[FIFF_UNIT_T_M]/(1e-15 * 100)); //*100 because data in fiff files is stored as fT/m not fT/cm
114  m_qMapScalingDoubleSpinBox.insert(FIFF_UNIT_T_M,t_pDoubleSpinBoxScale);
115  connect(t_pDoubleSpinBoxScale,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
116  this,&RealTimeMultiSampleArrayScalingWidget::updateDoubleSpinBox);
117  t_pGridLayout->addWidget(t_pDoubleSpinBoxScale,i,2,1,1);
118  ++i;
119  }
120 
121  //EEG
122  if(m_pRTMSAW->m_qMapChScaling.contains(FIFFV_EEG_CH))
123  {
124  QLabel* t_pLabelModality = new QLabel;
125  t_pLabelModality->setText("EEG (uV)");
126  t_pGridLayout->addWidget(t_pLabelModality,i,0,1,1);
127 
128  QDoubleSpinBox* t_pDoubleSpinBoxScale = new QDoubleSpinBox;
129  t_pDoubleSpinBoxScale->setMinimum(10e-11);
130  t_pDoubleSpinBoxScale->setMaximum(2000);
131  t_pDoubleSpinBoxScale->setMaximumWidth(100);
132  t_pDoubleSpinBoxScale->setSingleStep(1.0);
133  t_pDoubleSpinBoxScale->setDecimals(4);
134  t_pDoubleSpinBoxScale->setValue(m_pRTMSAW->m_qMapChScaling[FIFFV_EEG_CH]/(1e-06));
135  m_qMapScalingDoubleSpinBox.insert(FIFFV_EEG_CH,t_pDoubleSpinBoxScale);
136  connect(t_pDoubleSpinBoxScale,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
137  this,&RealTimeMultiSampleArrayScalingWidget::updateDoubleSpinBox);
138  t_pGridLayout->addWidget(t_pDoubleSpinBoxScale,i,2,1,1);
139  ++i;
140  }
141 
142  //EOG
143  if(m_pRTMSAW->m_qMapChScaling.contains(FIFFV_EOG_CH))
144  {
145  QLabel* t_pLabelModality = new QLabel;
146  t_pLabelModality->setText("EOG (uV)");
147  t_pGridLayout->addWidget(t_pLabelModality,i,0,1,1);
148 
149  QDoubleSpinBox* t_pDoubleSpinBoxScale = new QDoubleSpinBox;
150  t_pDoubleSpinBoxScale->setMinimum(10e-11);
151  t_pDoubleSpinBoxScale->setMaximum(10000);
152  t_pDoubleSpinBoxScale->setMaximumWidth(100);
153  t_pDoubleSpinBoxScale->setSingleStep(10.0);
154  t_pDoubleSpinBoxScale->setDecimals(4);
155  t_pDoubleSpinBoxScale->setValue(m_pRTMSAW->m_qMapChScaling[FIFFV_EOG_CH]/(1e-06));
156  m_qMapScalingDoubleSpinBox.insert(FIFFV_EOG_CH,t_pDoubleSpinBoxScale);
157  connect(t_pDoubleSpinBoxScale,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
158  this,&RealTimeMultiSampleArrayScalingWidget::updateDoubleSpinBox);
159  t_pGridLayout->addWidget(t_pDoubleSpinBoxScale,i,2,1,1);
160  ++i;
161  }
162 
163  //STIM
164  if(m_pRTMSAW->m_qMapChScaling.contains(FIFFV_STIM_CH))
165  {
166  QLabel* t_pLabelModality = new QLabel;
167  t_pLabelModality->setText("STIM");
168  t_pGridLayout->addWidget(t_pLabelModality,i,0,1,1);
169 
170  QDoubleSpinBox* t_pDoubleSpinBoxScale = new QDoubleSpinBox;
171  t_pDoubleSpinBoxScale->setMinimum(10e-11);
172  t_pDoubleSpinBoxScale->setMaximum(1000);
173  t_pDoubleSpinBoxScale->setMaximumWidth(100);
174  t_pDoubleSpinBoxScale->setSingleStep(1.0);
175  t_pDoubleSpinBoxScale->setDecimals(4);
176  t_pDoubleSpinBoxScale->setValue(m_pRTMSAW->m_qMapChScaling[FIFFV_STIM_CH]);
177  m_qMapScalingDoubleSpinBox.insert(FIFFV_STIM_CH,t_pDoubleSpinBoxScale);
178  connect(t_pDoubleSpinBoxScale,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
179  this,&RealTimeMultiSampleArrayScalingWidget::updateDoubleSpinBox);
180  t_pGridLayout->addWidget(t_pDoubleSpinBoxScale,i,2,1,1);
181  ++i;
182  }
183 
184  //MISC
185  if(m_pRTMSAW->m_qMapChScaling.contains(FIFFV_MISC_CH))
186  {
187  QLabel* t_pLabelModality = new QLabel;
188  t_pLabelModality->setText("MISC");
189  t_pGridLayout->addWidget(t_pLabelModality,i,0,1,1);
190 
191  QDoubleSpinBox* t_pDoubleSpinBoxScale = new QDoubleSpinBox;
192  t_pDoubleSpinBoxScale->setMinimum(10e-11);
193  t_pDoubleSpinBoxScale->setMaximum(1000);
194  t_pDoubleSpinBoxScale->setMaximumWidth(100);
195  t_pDoubleSpinBoxScale->setSingleStep(1.0);
196  t_pDoubleSpinBoxScale->setDecimals(4);
197  t_pDoubleSpinBoxScale->setValue(m_pRTMSAW->m_qMapChScaling[FIFFV_MISC_CH]);
198  m_qMapScalingDoubleSpinBox.insert(FIFFV_MISC_CH,t_pDoubleSpinBoxScale);
199  connect(t_pDoubleSpinBoxScale,static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
200  this,&RealTimeMultiSampleArrayScalingWidget::updateDoubleSpinBox);
201  t_pGridLayout->addWidget(t_pDoubleSpinBoxScale,i,2,1,1);
202  ++i;
203  }
204 
205 
206  this->setLayout(t_pGridLayout);
207 }
208 
209 
210 
211 //*************************************************************************************************************
212 
213 void RealTimeMultiSampleArrayScalingWidget::updateDoubleSpinBox(const double val)
214 {
215  Q_UNUSED(val)
216 
217  QMap<qint32, QDoubleSpinBox*>::iterator it;
218  for (it = m_qMapScalingDoubleSpinBox.begin(); it != m_qMapScalingDoubleSpinBox.end(); ++it)
219  {
220  double scaleValue = 0;
221 
222  switch(it.key())
223  {
224  case FIFF_UNIT_T:
225  //MAG
226  scaleValue = 1e-12;
227  break;
228  case FIFF_UNIT_T_M:
229  //GRAD
230  scaleValue = 1e-15 * 100; //*100 because data in fiff files is stored as fT/m not fT/cm
231  break;
232  case FIFFV_EEG_CH:
233  //EEG
234  scaleValue = 1e-06;
235  break;
236  case FIFFV_EOG_CH:
237  //EOG
238  scaleValue = 1e-06;
239  break;
240  case FIFFV_EMG_CH:
241  //EMG
242  scaleValue = 1e-03;
243  break;
244  case FIFFV_ECG_CH:
245  //ECG
246  scaleValue = 1e-03;
247  break;
248  case FIFFV_MISC_CH:
249  //MISC
250  scaleValue = 1;
251  break;
252  case FIFFV_STIM_CH:
253  //STIM
254  scaleValue = 1;
255  break;
256  default:
257  scaleValue = 1.0;
258  }
259 
260  m_pRTMSAW->m_qMapChScaling[it.key()] = it.value()->value() * scaleValue;
261 
262 // qDebug()<<"m_pRTMSAW->m_qMapChScaling[it.key()]" << m_pRTMSAW->m_qMapChScaling[it.key()];
263  }
264 
265  emit scalingChanged();
266 }
Declaration of the RealTimeMultiSampleArrayScalingWidget Class.
RealTimeMultiSampleArrayScalingWidget(RealTimeMultiSampleArrayWidget *toolbox)
#define FIFF_UNIT_T_M
The RealTimeMultiSampleArrayNewWidget class provides a real-time curve display.