19 mVerticalLayout =
new QVBoxLayout(
this);
21 mVerticalLayout->setMargin(0);
23 mVerticalLayout->addWidget(
new QLabel(
"Define the operating table up direction. See the preferences help page for more information."));
25 QHBoxLayout* buttonLayout =
new QHBoxLayout;
26 mVerticalLayout->addLayout(buttonLayout);
28 QPushButton* toolDefineGravityButton =
new QPushButton(
"Tool direction is down");
29 connect(toolDefineGravityButton, &QPushButton::clicked,
this, &OperatingTableWidget::onDefineDownWithTool);
30 buttonLayout->addWidget(toolDefineGravityButton);
32 QPushButton* definePatientAnteriorUpButton =
new QPushButton(
"Patient Anterior Up");
33 connect(definePatientAnteriorUpButton, &QPushButton::clicked,
this, &OperatingTableWidget::onDefinePatientAnteriorUp);
34 buttonLayout->addWidget(definePatientAnteriorUpButton);
36 QPushButton* definePatientPosteriorUpButton =
new QPushButton(
"Patient Posterior Up");
37 connect(definePatientPosteriorUpButton, &QPushButton::clicked,
this, &OperatingTableWidget::onDefinePatientPosteriorUp);
38 buttonLayout->addWidget(definePatientPosteriorUpButton);
40 QPushButton* definePatientSuperiorUpButton =
new QPushButton(
"Patient Superior Up");
41 connect(definePatientSuperiorUpButton, &QPushButton::clicked,
this, &OperatingTableWidget::onDefinePatientSuperiorUp);
42 buttonLayout->addWidget(definePatientSuperiorUpButton);
44 mLabel =
new QLabel(
"Table transformation matrix, rMot:");
45 mVerticalLayout->addWidget(mLabel);
47 mVerticalLayout->addWidget(mMatrixWidget);
56 mVerticalLayout->addStretch();
59 this, &OperatingTableWidget::backendChanged);
64 this->backendChanged();
70 void OperatingTableWidget::backendChanged()
72 mMatrixWidget->blockSignals(
true);
76 mTableUp->setValue(table.getVectorUp());
78 mMatrixWidget->blockSignals(
false);
85 void OperatingTableWidget::matrixWidgetChanged()
87 OperatingTable table = mServices->patient()->getOperatingTable();
89 mServices->patient()->setOperatingTable(table);
92 void OperatingTableWidget::onDefineDownWithTool()
95 Vector3D toolUp = -Vector3D::UnitZ();
97 this->setNewUp(newUp);
99 void OperatingTableWidget::onDefinePatientAnteriorUp()
101 this->setNewUp(-Vector3D::UnitY());
103 void OperatingTableWidget::onDefinePatientPosteriorUp()
105 this->setNewUp(Vector3D::UnitY());
107 void OperatingTableWidget::onDefinePatientSuperiorUp()
109 this->setNewUp(Vector3D::UnitZ());
112 void OperatingTableWidget::setNewUp(
Vector3D newUp)
114 OperatingTable table = mServices->patient()->getOperatingTable();
117 table.rMot = R * table.rMot;
119 mServices->patient()->setOperatingTable(table);