Skip to content

ENH: Let user turn ON/OFF collision detection #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RoomsEyeView/Logic/vtkMRMLRoomsEyeViewNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 10 additions & 3 deletions RoomsEyeView/Resources/UI/qSlicerRoomsEyeViewModule.ui
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
<item row="2" column="0" colspan="3">
<widget class="QLabel" name="CollisionDetectionStatusLabel">
<property name="text">
<string>No collisions detected.</string>
<string>Collision computation disabled</string>
</property>
</widget>
</item>
Expand All @@ -278,14 +278,21 @@
</property>
</spacer>
</item>
<item row="0" column="0">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="ActivateCollisionComputationCheckBox">
<property name="text">
<string>Enable computation</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Patient body:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="qMRMLSegmentSelectorWidget" name="SegmentSelectorWidget_PatientBody" native="true">
<property name="noneEnabled" stdset="0">
<bool>true</bool>
Expand Down
16 changes: 15 additions & 1 deletion RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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");
}
1 change: 1 addition & 0 deletions RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public slots:
void updateTreatmentOrientationMarker();

void setFixedReferenceCameraEnabled(bool);
void setCollisionComputationEnabled(bool);

protected slots:
void onLoadTreatmentMachineButtonClicked();
Expand Down