ATLAS Offline Software
Classes | Public Member Functions | Protected Member Functions | Private Slots | Private Attributes | List of all members
VP1CustomStereoEditor Class Reference

#include <VP1CustomStereoEditor.h>

Inheritance diagram for VP1CustomStereoEditor:
Collaboration diagram for VP1CustomStereoEditor:

Classes

class  Imp
 

Public Member Functions

 VP1CustomStereoEditor (VP1ExaminerViewer *)
 
void setState (QByteArray)
 
QByteArray state () const
 
virtual ~VP1CustomStereoEditor ()
 

Protected Member Functions

void closeEvent (QCloseEvent *)
 

Private Slots

void buttonClicked ()
 
void changedView (bool checked)
 
void changedView_viewer (bool checked)
 
void showEvent (QShowEvent *ev)
 
void updateFocal ()
 
void setToFocal30 ()
 
void perform3DCalculations (double value)
 

Private Attributes

Impm_d
 
SbBool m_leftEyeFilter [3]
 
SbBool m_rightEyeFilter [3]
 
SbBool m_leftEyeFilter_def [3]
 
SbBool m_rightEyeFilter_def [3]
 

Detailed Description

Definition at line 30 of file VP1CustomStereoEditor.h.

Constructor & Destructor Documentation

◆ VP1CustomStereoEditor()

VP1CustomStereoEditor::VP1CustomStereoEditor ( VP1ExaminerViewer viewer)

WARNING!!!!!!

we hide the viewer section for the tag, because it is still under development.

Comment out the line below to develop and debug, and then for the final release.

Definition at line 103 of file VP1CustomSteroEditor.cxx.

104 : QWidget(0,Qt::WindowStaysOnTopHint), m_d(new Imp)
105 {
106  VP1Msg::messageDebug("VP1CustomStereoEditor::VP1CustomStereoEditor()");
107 
108  // set the default anaglyph masks
109  m_leftEyeFilter_def[0] = true; m_leftEyeFilter_def[1] = false; m_leftEyeFilter_def[2] = false;
110  m_rightEyeFilter_def[0] = false; m_rightEyeFilter_def[1] = true; m_rightEyeFilter_def[2] = true;
111 
112  m_d->theclass = this;
113  m_d->ui.setupUi(this);
114  m_d->ui.groupBox_camera->setChecked(true);
115  m_d->ui.groupBox_viewer->setChecked(false);
116  // m_d->ui.widget_utilityZoomContents->setVisible(false);
117 
118  // a handle on the main viewer widget
119  m_d->viewer = viewer;
120 
121  setWindowIcon(QIcon(QString(":/vp1/icons/icons/3d_32x32.png")));
122 
123  // set default values
124  m_d->ui.label_focal->setText( QString::number(m_d->viewer->getCamera()->focalDistance.getValue()) );
125  m_d->ui.doubleSpinBox_offset->setValue(m_d->viewer->stereo_offset_camera);
126  m_d->ui.doubleSpinBox_parallax->setValue(m_d->viewer->stereo_parallax_camera);
127  m_d->ui.doubleSpinBox_offset_viewer->setValue(m_d->viewer->stereo_offset_viewer);
128 
129 
130  connect(m_d->ui.pushButton_focal,SIGNAL(clicked()),this,SLOT(updateFocal()));
131 
132  connect(m_d->ui.pushButton_setToFocal30,SIGNAL(clicked()),this,SLOT(setToFocal30()));
133 
134 
135  connect(m_d->ui.pushButton_defCamera,SIGNAL(clicked()),this,SLOT(buttonClicked()));
136  connect(m_d->ui.pushButton_defViewer,SIGNAL(clicked()),this,SLOT(buttonClicked()));
137 
138  connect(m_d->ui.pushButton_refresh,SIGNAL(clicked()),this,SLOT(buttonClicked()));
139  connect(m_d->ui.pushButton_refreshViewer,SIGNAL(clicked()),this,SLOT(buttonClicked()));
140 
141  connect(m_d->ui.radioButton_standard,SIGNAL(toggled(bool)),this,SLOT(changedView(bool)));
142  connect(m_d->ui.radioButton_left,SIGNAL(toggled(bool)),this,SLOT(changedView(bool)));
143  connect(m_d->ui.radioButton_right,SIGNAL(toggled(bool)),this,SLOT(changedView(bool)));
144 
145  connect(m_d->ui.radioButton_left_viewer,SIGNAL(toggled(bool)),this,SLOT(changedView_viewer(bool)));
146  connect(m_d->ui.radioButton_right_viewer,SIGNAL(toggled(bool)),this,SLOT(changedView_viewer(bool)));
147  connect(m_d->ui.radioButton_standard_viewer,SIGNAL(toggled(bool)),this,SLOT(changedView_viewer(bool)));
148 
149  connect(m_d->ui.radioButton_noStereo,SIGNAL(toggled(bool)),this,SLOT(changedView_viewer(bool)));
150  connect(m_d->ui.radioButton_anaglyph,SIGNAL(toggled(bool)),this,SLOT(changedView_viewer(bool)));
151  connect(m_d->ui.radioButton_quadbuffer,SIGNAL(toggled(bool)),this,SLOT(changedView_viewer(bool)));
152  connect(m_d->ui.radioButton_int_rows,SIGNAL(toggled(bool)),this,SLOT(changedView_viewer(bool)));
153  connect(m_d->ui.radioButton_int_cols,SIGNAL(toggled(bool)),this,SLOT(changedView_viewer(bool)));
154 
155  connect(m_d->ui.doubleSpinBox_imageWidth_meter,SIGNAL(valueChanged(double)),this,SLOT(perform3DCalculations(double)));
156  connect(m_d->ui.doubleSpinBox_imageWidth_inch,SIGNAL(valueChanged(double)),this,SLOT(perform3DCalculations(double)));
157  connect(m_d->ui.doubleSpinBox_offset,SIGNAL(valueChanged(double)),this,SLOT(perform3DCalculations(double)));
158 
159 
169  m_d->ui.groupBox_viewer->hide();
170 
171 }

◆ ~VP1CustomStereoEditor()

VP1CustomStereoEditor::~VP1CustomStereoEditor ( )
virtual

Definition at line 174 of file VP1CustomSteroEditor.cxx.

175 {
176  // m_d->frameHolderWidget->deleteLater();
177  // for(VP1CustomTourFrameWidget*frame : m_d->frames)
178  // frame->deleteLater();
179  delete m_d;
180 }

Member Function Documentation

◆ buttonClicked

void VP1CustomStereoEditor::buttonClicked ( )
privateslot

Definition at line 343 of file VP1CustomSteroEditor.cxx.

344 {
345  VP1Msg::messageDebug("VP1CustomStereoEditor::buttonClicked() - updating STEREO settings...");
346 
348  if (m_d->ui.pushButton_refresh==sender())
349  {
350  // get user's values
351  double offset(m_d->ui.doubleSpinBox_offset->value());
352  double parallax(m_d->ui.doubleSpinBox_parallax->value());
353  // get current values
354  float old_offset = m_d->viewer->stereo_offset_camera;
355  float old_parallax = m_d->viewer->stereo_parallax_camera;
356 
357  SoCamera *camera = m_d->viewer->getCamera();
358 
359  if (old_offset != offset) {
360  camera->setStereoAdjustment(offset);
362  VP1Msg::messageDebug("Changed CAMERA STEREO offset to: "+QString::number(offset));
363  }
364  if (old_parallax != parallax) {
365  camera->setBalanceAdjustment(parallax);
366  m_d->viewer->stereo_parallax_camera = parallax;
367  VP1Msg::messageDebug("Changed CAMERA STEREO balance/parallax to : "+QString::number(parallax));
368  }
369 
370  }
371 
372 
374  else if (m_d->ui.pushButton_refreshViewer==sender())
375  {
376  // get user's value
377  double offset(m_d->ui.doubleSpinBox_offset_viewer->value());
378  // get current value
379  float old_offset = m_d->viewer->stereo_offset_viewer;
380 
381  if (old_offset != offset) {
384  VP1Msg::messageDebug("Changed VIEWER STEREO offset to: "+QString::number(offset));
385  }
386  }
387 
389  else if (m_d->ui.pushButton_defCamera==sender())
390  {
391  // set default values
392 
393  /*
394  * Default Interaxial (aka Stereo Base) distance.
395  *
396  * The value is chosen because it's the approximate distance between the human eyes.
397  * See:
398  * - http://doc.coin3d.org/Coin/classSoCamera.html#a6ed2d2527604e86cc8be234b1e429991
399  * - http://www.sky.com/shop/export/sites/www.sky.com/shop/__PDF/3D/Basic_Principles_of_Stereoscopic_3D_v1.pdf
400  * - http://www.dashwood3d.com/blog/beginners-guide-to-shooting-stereoscopic-3d/
401  */
402  double defOff = 0.1;
403 
404  /*
405  * Default Zero Parallax Plane
406  *
407  * The value 1.0 for the Balance/Parallax, puts the Zero Parallax Plane at the Focal Legth.
408  *
409  * See:
410  * - http://www.dashwood3d.com/blog/beginners-guide-to-shooting-stereoscopic-3d/
411  * - http://www.cafedownloads.com/reviews/r13/3dstereo.html
412  */
413  double defParall = 1.0;
414 
415  m_d->ui.doubleSpinBox_offset->setValue(defOff);
416  m_d->ui.doubleSpinBox_parallax->setValue(defParall);
417 
418  }
419 
420 
422  else if (m_d->ui.pushButton_defViewer==sender())
423  {
424  // set default values
425 
426  /* Default Interaxial (aka Stereo Base) distance.
427  * The value is chosen because it's the approximate distance between the human eyes.
428  * See:
429  * - http://doc.coin3d.org/Coin/classSoCamera.html#a6ed2d2527604e86cc8be234b1e429991
430  * - http://www.sky.com/shop/export/sites/www.sky.com/shop/__PDF/3D/Basic_Principles_of_Stereoscopic_3D_v1.pdf
431  * - http://www.dashwood3d.com/blog/beginners-guide-to-shooting-stereoscopic-3d/
432  */
433  double defOff = 0.1;
434 
435  m_d->ui.doubleSpinBox_offset_viewer->setValue(defOff);
436 
437  }
438 
439 
440 }

◆ changedView

void VP1CustomStereoEditor::changedView ( bool  checked)
privateslot

Definition at line 267 of file VP1CustomSteroEditor.cxx.

268 {
269  if (checked) {
270  SoCamera *camera = m_d->viewer->getCamera();
271  if (m_d->ui.radioButton_standard->isChecked() ) {
272  camera->setStereoMode(SoCamera::MONOSCOPIC);
273  VP1Msg::messageDebug("Changed camera STEREO view to STANDARD.");
274  }
275  else if (m_d->ui.radioButton_left->isChecked() ) {
276  camera->setStereoMode(SoCamera::LEFT_VIEW);
277  VP1Msg::messageDebug("Changed camera STEREO view to LEFT EYE.");
278  }
279  else if (m_d->ui.radioButton_right->isChecked() ) {
280  camera->setStereoMode(SoCamera::RIGHT_VIEW);
281  VP1Msg::messageDebug("Changed camera STEREO view to RIGHT EYE.");
282  }
283  m_d->viewer->show(); // update the view
284  }
285 }

◆ changedView_viewer

void VP1CustomStereoEditor::changedView_viewer ( bool  checked)
privateslot

Definition at line 287 of file VP1CustomSteroEditor.cxx.

288 {
289  if (checked) {
290  // we only show the LEFT view in REAL color
291  if (m_d->ui.radioButton_left_viewer->isChecked())
292  {
293  m_leftEyeFilter[0] = true; m_leftEyeFilter[1] = true; m_leftEyeFilter[2] = true;
294  m_rightEyeFilter[0] = false; m_rightEyeFilter[1] = false; m_rightEyeFilter[2] = false;
296  }
297  // we only show the RIGHT view in REAL color
298  if (m_d->ui.radioButton_right_viewer->isChecked())
299  {
300  m_leftEyeFilter[0] = false; m_leftEyeFilter[1] = false; m_leftEyeFilter[2] = false;
301  m_rightEyeFilter[0] = true; m_rightEyeFilter[1] = true; m_rightEyeFilter[2] = true;
303  }
304  // we set the standard Red/Cyan anaglyph view
305  if (m_d->ui.radioButton_standard_viewer->isChecked())
306  {
308  }
309  if (m_d->ui.radioButton_noStereo->isChecked())
310  {
311  m_d->viewer->setStereoTypeSlot(SoQtViewer::STEREO_NONE);
312  m_d->ui.groupBox_2->setEnabled(false);
313  }
314  if (m_d->ui.radioButton_anaglyph->isChecked())
315  {
316  m_d->viewer->setStereoTypeSlot(SoQtViewer::STEREO_ANAGLYPH);
317  m_d->ui.groupBox_2->setEnabled(true);
318  }
319  if (m_d->ui.radioButton_quadbuffer->isChecked())
320  {
321  m_d->viewer->setStereoTypeSlot(SoQtViewer::STEREO_QUADBUFFER);
322  m_d->ui.groupBox_2->setEnabled(true);
323  }
324  if (m_d->ui.radioButton_int_rows->isChecked())
325  {
326  m_d->viewer->setStereoTypeSlot(SoQtViewer::STEREO_INTERLEAVED_ROWS);
327  m_d->ui.groupBox_2->setEnabled(true);
328  }
329  if (m_d->ui.radioButton_int_cols->isChecked())
330  {
331  m_d->viewer->setStereoTypeSlot(SoQtViewer::STEREO_INTERLEAVED_COLUMNS);
332  m_d->ui.groupBox_2->setEnabled(true);
333  }
334 
335 
336  m_d->viewer->show(); // update the view
337  }
338 }

◆ closeEvent()

void VP1CustomStereoEditor::closeEvent ( QCloseEvent *  ev)
protected

Definition at line 211 of file VP1CustomSteroEditor.cxx.

212 {
213  ev->ignore();
214  hide();
215 }

◆ perform3DCalculations

void VP1CustomStereoEditor::perform3DCalculations ( double  value)
privateslot

Definition at line 235 of file VP1CustomSteroEditor.cxx.

236 {
237  double value_meters = 0.;
238 
239  if (m_d->ui.doubleSpinBox_imageWidth_meter==sender()) {
240  // converting meters to inches, and set the new value on the screen
241  m_d->ui.doubleSpinBox_imageWidth_inch->setValue( value * 39.370);
242  value_meters = value;
243  }
244  else if (m_d->ui.doubleSpinBox_imageWidth_inch==sender()) {
245  // converting inches to meters, and set the new value on the screen
246  m_d->ui.doubleSpinBox_imageWidth_meter->setValue( value / 39.370);
247  value_meters = value / 39.370;
248  }
249  else {
250  value_meters = m_d->ui.doubleSpinBox_imageWidth_meter->value();
251  }
252 
253  // perform S3D calculations
254  // --> see: http://www.dashwood3d.com/blog/beginners-guide-to-shooting-stereoscopic-3d/
255  double nativeParallax = m_d->ui.doubleSpinBox_offset->value() / value_meters;
256  double minimumObjDistance = m_d->ui.doubleSpinBox_offset->value() / 30.;
257 
258  // update the S3D values
259  m_d->ui.label_nativeParalValue->setText( QString::number(nativeParallax) );
260  m_d->ui.label_minObjDistValue->setText( QString::number(minimumObjDistance) );
261 
262 }

◆ setState()

void VP1CustomStereoEditor::setState ( QByteArray  )

◆ setToFocal30

void VP1CustomStereoEditor::setToFocal30 ( )
privateslot

Definition at line 227 of file VP1CustomSteroEditor.cxx.

228 {
229  m_d->ui.doubleSpinBox_offset->setValue( (m_d->viewer->getCamera()->focalDistance.getValue() / 30.0) );
230  m_d->ui.doubleSpinBox_offset_viewer->setValue( (m_d->viewer->getCamera()->focalDistance.getValue() / 30.0) );
231 }

◆ showEvent

void VP1CustomStereoEditor::showEvent ( QShowEvent *  ev)
privateslot

Definition at line 189 of file VP1CustomSteroEditor.cxx.

190 {
191  // set default values
192 
193  m_d->ui.label_focal->setText( QString::number(m_d->viewer->getCamera()->focalDistance.getValue()) );
194 
195  m_d->ui.doubleSpinBox_offset->setValue(m_d->viewer->stereo_offset_camera);
196  m_d->ui.doubleSpinBox_parallax->setValue(m_d->viewer->stereo_parallax_camera);
197  m_d->ui.doubleSpinBox_offset_viewer->setValue(m_d->viewer->stereo_offset_viewer);
198 
199  m_d->ui.radioButton_standard->setChecked(true);
200  m_d->ui.radioButton_noStereo->setChecked(true);
201  m_d->ui.radioButton_standard_viewer->setChecked(true);
202 
203  m_d->ui.groupBox_2->setEnabled(false);
204 
205  // go on with the default QWidget behavior
206  QWidget::showEvent(ev);
207 }

◆ state()

QByteArray VP1CustomStereoEditor::state ( ) const

◆ updateFocal

void VP1CustomStereoEditor::updateFocal ( )
privateslot

Definition at line 220 of file VP1CustomSteroEditor.cxx.

221 {
222  m_d->ui.label_focal->setText( QString::number(m_d->viewer->getCamera()->focalDistance.getValue()) );
223 }

Member Data Documentation

◆ m_d

Imp* VP1CustomStereoEditor::m_d
private

Definition at line 71 of file VP1CustomStereoEditor.h.

◆ m_leftEyeFilter

SbBool VP1CustomStereoEditor::m_leftEyeFilter[3]
private

Definition at line 74 of file VP1CustomStereoEditor.h.

◆ m_leftEyeFilter_def

SbBool VP1CustomStereoEditor::m_leftEyeFilter_def[3]
private

Definition at line 80 of file VP1CustomStereoEditor.h.

◆ m_rightEyeFilter

SbBool VP1CustomStereoEditor::m_rightEyeFilter[3]
private

Definition at line 75 of file VP1CustomStereoEditor.h.

◆ m_rightEyeFilter_def

SbBool VP1CustomStereoEditor::m_rightEyeFilter_def[3]
private

Definition at line 81 of file VP1CustomStereoEditor.h.


The documentation for this class was generated from the following files:
VP1CustomStereoEditor::changedView_viewer
void changedView_viewer(bool checked)
Definition: VP1CustomSteroEditor.cxx:287
VP1CustomStereoEditor::updateFocal
void updateFocal()
Definition: VP1CustomSteroEditor.cxx:220
VP1ExaminerViewer::stereo_offset_viewer
float stereo_offset_viewer
Definition: VP1ExaminerViewer.h:93
VP1CustomStereoEditor::setToFocal30
void setToFocal30()
Definition: VP1CustomSteroEditor.cxx:227
fillPileUpNoiseLumi.connect
string connect
Definition: fillPileUpNoiseLumi.py:70
VP1CustomStereoEditor::m_rightEyeFilter_def
SbBool m_rightEyeFilter_def[3]
Definition: VP1CustomStereoEditor.h:81
athena.value
value
Definition: athena.py:124
VP1CustomStereoEditor::m_leftEyeFilter
SbBool m_leftEyeFilter[3]
Definition: VP1CustomStereoEditor.h:74
ev
int ev
Definition: globals.cxx:25
VP1ExaminerViewer::stereo_parallax_camera
float stereo_parallax_camera
Definition: VP1ExaminerViewer.h:92
VP1CustomStereoEditor::perform3DCalculations
void perform3DCalculations(double value)
Definition: VP1CustomSteroEditor.cxx:235
VP1ExaminerViewer::setAnaglyphStereoColorMasksSlot
void setAnaglyphStereoColorMasksSlot(const SbBool left[3], const SbBool right[3])
Definition: VP1ExaminerViewer.cxx:587
VP1ExaminerViewer::setStereoTypeSlot
SbBool setStereoTypeSlot(SoQtViewer::StereoType type)
Definition: VP1ExaminerViewer.cxx:580
python.selection.number
number
Definition: selection.py:20
VP1CustomStereoEditor::m_d
Imp * m_d
Definition: VP1CustomStereoEditor.h:70
VP1CustomStereoEditor::Imp::theclass
VP1CustomStereoEditor * theclass
Definition: VP1CustomSteroEditor.cxx:38
VP1CustomStereoEditor::Imp::ui
Ui::VP1CustomStereoEditorForm ui
Definition: VP1CustomSteroEditor.cxx:39
VP1ExaminerViewer::stereo_offset_camera
float stereo_offset_camera
Definition: VP1ExaminerViewer.h:91
VP1Msg::messageDebug
static void messageDebug(const QString &)
Definition: VP1Msg.cxx:39
VP1CustomStereoEditor::buttonClicked
void buttonClicked()
Definition: VP1CustomSteroEditor.cxx:343
VP1ExaminerViewer::setStereoOffsetSlot
void setStereoOffsetSlot(float offset)
Definition: VP1ExaminerViewer.cxx:573
VP1CustomStereoEditor::m_leftEyeFilter_def
SbBool m_leftEyeFilter_def[3]
Definition: VP1CustomStereoEditor.h:80
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
VP1CustomStereoEditor::Imp::viewer
VP1ExaminerViewer * viewer
Definition: VP1CustomSteroEditor.cxx:40
VP1CustomStereoEditor::changedView
void changedView(bool checked)
Definition: VP1CustomSteroEditor.cxx:267
VP1CustomStereoEditor::m_rightEyeFilter
SbBool m_rightEyeFilter[3]
Definition: VP1CustomStereoEditor.h:75