diff --git a/RoomsEyeView/Logic/vtkMRMLRoomsEyeViewNode.cxx b/RoomsEyeView/Logic/vtkMRMLRoomsEyeViewNode.cxx index d630ec78..fda9268a 100644 --- a/RoomsEyeView/Logic/vtkMRMLRoomsEyeViewNode.cxx +++ b/RoomsEyeView/Logic/vtkMRMLRoomsEyeViewNode.cxx @@ -72,7 +72,7 @@ vtkMRMLNodeNewMacro(vtkMRMLRoomsEyeViewNode); vtkMRMLRoomsEyeViewNode::vtkMRMLRoomsEyeViewNode() : PatientBodySegmentID(nullptr) , TreatmentMachineDescriptorFilePath(nullptr) - , CollisionDetectionEnabled(true) + , CollisionDetectionEnabled(false) , GantryRotationAngle(0.0) , CollimatorRotationAngle(0.0) , ImagingPanelMovement(-68.50) diff --git a/RoomsEyeView/Resources/UI/qSlicerRoomsEyeViewModule.ui b/RoomsEyeView/Resources/UI/qSlicerRoomsEyeViewModule.ui index ab22c3ac..09c061c3 100644 --- a/RoomsEyeView/Resources/UI/qSlicerRoomsEyeViewModule.ui +++ b/RoomsEyeView/Resources/UI/qSlicerRoomsEyeViewModule.ui @@ -258,7 +258,7 @@ - No collisions detected. + Collision computation disabled @@ -278,14 +278,21 @@ - + + + + Enable computation + + + + Patient body: - + true diff --git a/RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.cxx b/RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.cxx index e1376fc0..3ea99d6b 100644 --- a/RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.cxx +++ b/RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.cxx @@ -392,6 +392,9 @@ void qSlicerRoomsEyeViewModuleWidget::setup() // 3D camera control connect(d->FixedCameraCheckBox, SIGNAL(toggled(bool)), this, SLOT(setFixedReferenceCameraEnabled(bool))); + // Collision detection control + connect(d->ActivateCollisionComputationCheckBox, SIGNAL(toggled(bool)), this, SLOT(setCollisionComputationEnabled(bool))); + // Disable treatment machine geometry controls until a machine is loaded d->GantryRotationSlider->setEnabled(false); d->CollimatorRotationSlider->setEnabled(false); @@ -1004,7 +1007,7 @@ void qSlicerRoomsEyeViewModuleWidget::checkForCollisions() Q_D(qSlicerRoomsEyeViewModuleWidget); vtkMRMLRoomsEyeViewNode* paramNode = vtkMRMLRoomsEyeViewNode::SafeDownCast(d->MRMLNodeComboBox_ParameterSet->currentNode()); - if (!paramNode || !d->ModuleWindowInitialized) + if (!paramNode || !d->ModuleWindowInitialized|| !paramNode->GetCollisionDetectionEnabled()) { return; } @@ -1093,3 +1096,14 @@ void qSlicerRoomsEyeViewModuleWidget::setFixedReferenceCameraEnabled(bool toggle } cameraNode->SetAndObserveTransformNodeID(nullptr); } + +//----------------------------------------------------------------------------- +void qSlicerRoomsEyeViewModuleWidget::setCollisionComputationEnabled(bool toggled) +{ + Q_D(qSlicerRoomsEyeViewModuleWidget); + vtkMRMLRoomsEyeViewNode* paramNode = vtkMRMLRoomsEyeViewNode::SafeDownCast(d->MRMLNodeComboBox_ParameterSet->currentNode()); + paramNode->SetCollisionDetectionEnabled(toggled); + QString collisionsMessage(toggled ? tr("Collision computation enabled") : tr("Collision computation disabled")); + d->CollisionDetectionStatusLabel->setText(collisionsMessage); + d->CollisionDetectionStatusLabel->setStyleSheet("color: black"); +} diff --git a/RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.h b/RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.h index 70e80595..8ba71d9a 100644 --- a/RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.h +++ b/RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.h @@ -68,6 +68,7 @@ public slots: void updateTreatmentOrientationMarker(); void setFixedReferenceCameraEnabled(bool); + void setCollisionComputationEnabled(bool); protected slots: void onLoadTreatmentMachineButtonClicked();