Skip to content

Commit

Permalink
BUG: Fix pointer simulator module
Browse files Browse the repository at this point in the history
Some widgets were missing from the UI

Re KitwareMedical#43
  • Loading branch information
cpinter committed Jun 15, 2023
1 parent 7cbf223 commit a07d849
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 37 deletions.
20 changes: 7 additions & 13 deletions GUIWidgets/qSlicerGUIWidgetsModuleWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ void qSlicerGUIWidgetsModuleWidget::setWidgetToGUIWidgetMarkupsNode(vtkMRMLGUIWi
QWidget* qSlicerGUIWidgetsModuleWidget::onAddHelloWorldNodeClicked()
{
qSlicerApplication* app = qSlicerApplication::application();
vtkMRMLGUIWidgetNode* widgetNode = vtkMRMLGUIWidgetNode::SafeDownCast(
app->mrmlScene()->AddNewNodeByClass("vtkMRMLGUIWidgetNode") );
vtkMRMLGUIWidgetNode* widgetNode = vtkMRMLGUIWidgetNode::SafeDownCast(app->mrmlScene()->AddNewNodeByClass("vtkMRMLGUIWidgetNode") );
widgetNode->SetName("TestButtonWidgetNode");

QPushButton* newButton = new QPushButton("Hello world!");
Expand Down Expand Up @@ -188,8 +187,7 @@ void qSlicerGUIWidgetsModuleWidget::onAddHomeWidgetButtonClicked()
Q_D(qSlicerGUIWidgetsModuleWidget);

qSlicerApplication* app = qSlicerApplication::application();
vtkMRMLGUIWidgetNode* widgetNode = vtkMRMLGUIWidgetNode::SafeDownCast(
app->mrmlScene()->AddNewNodeByClass("vtkMRMLGUIWidgetNode") );
vtkMRMLGUIWidgetNode* widgetNode = vtkMRMLGUIWidgetNode::SafeDownCast(app->mrmlScene()->AddNewNodeByClass("vtkMRMLGUIWidgetNode") );
widgetNode->SetName("HomeWidgetNode");

qMRMLVirtualRealityHomeWidget* widget = new qMRMLVirtualRealityHomeWidget();
Expand All @@ -203,8 +201,7 @@ void qSlicerGUIWidgetsModuleWidget::onAddDataModuleWidgetButtonClicked()
Q_D(qSlicerGUIWidgetsModuleWidget);

qSlicerApplication* app = qSlicerApplication::application();
vtkMRMLGUIWidgetNode* widgetNode = vtkMRMLGUIWidgetNode::SafeDownCast(
app->mrmlScene()->AddNewNodeByClass("vtkMRMLGUIWidgetNode") );
vtkMRMLGUIWidgetNode* widgetNode = vtkMRMLGUIWidgetNode::SafeDownCast(app->mrmlScene()->AddNewNodeByClass("vtkMRMLGUIWidgetNode") );
widgetNode->SetName("DataModuleWidgetNode");

qMRMLVirtualRealityDataModuleWidget* widget = new qMRMLVirtualRealityDataModuleWidget();
Expand All @@ -218,8 +215,7 @@ void qSlicerGUIWidgetsModuleWidget::onAddSegmentEditorWidgetButtonClicked()
Q_D(qSlicerGUIWidgetsModuleWidget);

qSlicerApplication* app = qSlicerApplication::application();
vtkMRMLGUIWidgetNode* widgetNode = vtkMRMLGUIWidgetNode::SafeDownCast(
app->mrmlScene()->AddNewNodeByClass("vtkMRMLGUIWidgetNode") );
vtkMRMLGUIWidgetNode* widgetNode = vtkMRMLGUIWidgetNode::SafeDownCast(app->mrmlScene()->AddNewNodeByClass("vtkMRMLGUIWidgetNode") );
widgetNode->SetName("SegmentEditorWidgetNode");

qMRMLVirtualRealitySegmentEditorWidget* widget = new qMRMLVirtualRealitySegmentEditorWidget();
Expand All @@ -233,12 +229,10 @@ void qSlicerGUIWidgetsModuleWidget::onAddTransformWidgetButtonClicked()
Q_D(qSlicerGUIWidgetsModuleWidget);

qSlicerApplication* app = qSlicerApplication::application();
vtkMRMLGUIWidgetNode* widgetNode = vtkMRMLGUIWidgetNode::SafeDownCast(
app->mrmlScene()->AddNewNodeByClass("vtkMRMLGUIWidgetNode") );
vtkMRMLGUIWidgetNode* widgetNode = vtkMRMLGUIWidgetNode::SafeDownCast(app->mrmlScene()->AddNewNodeByClass("vtkMRMLGUIWidgetNode") );
widgetNode->SetName("TransformWidgetNode");

vtkSlicerVirtualRealityLogic* vrLogic =
vtkSlicerVirtualRealityLogic::SafeDownCast(app->applicationLogic()->GetModuleLogic("VirtualReality"));
vtkSlicerVirtualRealityLogic* vrLogic = vtkSlicerVirtualRealityLogic::SafeDownCast(app->applicationLogic()->GetModuleLogic("VirtualReality"));
if (!vrLogic)
{
qCritical() << Q_FUNC_INFO << " : invalid VR logic";
Expand All @@ -253,7 +247,7 @@ void qSlicerGUIWidgetsModuleWidget::onAddTransformWidgetButtonClicked()
//-----------------------------------------------------------------------------
void qSlicerGUIWidgetsModuleWidget::onSetUpInteractionButtonClicked()
{
std::cout << "----- onSetUpInteractionButtonClicked ----- \n";
qCritical() << "----- onSetUpInteractionButtonClicked (no-op) ----- \n";
}

//-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion PointerSimulator/PointerSimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def updatePointerModel(self, origin, direction, length):
self.pointerModel.SetPolyDataConnection(tubeFilter.GetOutputPort())
slicer.mrmlScene.AddNode(self.pointerModel)
self.pointerModelDisplay = slicer.vtkMRMLModelDisplayNode()
self.pointerModelDisplay.SetSliceIntersectionVisibility(True)
self.pointerModelDisplay.SetVisibility2D(True)
self.pointerModelDisplay.SetColor(1,0,0)
self.pointerModelDisplay.SetOpacity(1.0)
slicer.mrmlScene.AddNode(self.pointerModelDisplay)
Expand Down
38 changes: 15 additions & 23 deletions PointerSimulator/Resources/UI/PointerSimulator.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>315</width>
<width>430</width>
<height>556</height>
</rect>
</property>
Expand All @@ -18,27 +18,25 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="qMRMLTransformSliders" name="translationSliders"/>
<widget class="QPushButton" name="setUpPointerButton">
<property name="text">
<string>Set up pointer</string>
</property>
</widget>
</item>
<item>
<widget class="ctkCollapsibleGroupBox" name="ClickGroupbox">
<property name="title">
<string>Click</string>
<widget class="qMRMLTransformSliders" name="rotationSliders">
<property name="Title">
<string>Rotation</string>
</property>
<property name="TypeOfTransform">
<enum>qMRMLTransformSliders::ROTATION</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QPushButton" name="clickButton">
<property name="text">
<string>Click</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="qMRMLTransformSliders" name="translationSliders"/>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -75,12 +73,6 @@
<header>ctkCollapsibleButton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ctkCollapsibleGroupBox</class>
<extends>QGroupBox</extends>
<header>ctkCollapsibleGroupBox.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
Expand Down

0 comments on commit a07d849

Please sign in to comment.