forked from KitwareMedical/SlicerVirtualReality
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Creating and registering VR segment editor widget
Creates and registers the VR segment editor widget (which can be switched to from the VR home widget) KitwareMedical#43
- Loading branch information
1 parent
0187b78
commit 3925264
Showing
6 changed files
with
294 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
VirtualReality/Widgets/Resources/UI/qMRMLVirtualRealitySegmentEditorWidget.ui
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>qMRMLVirtualRealitySegmentEditorWidget</class> | ||
<widget class="qMRMLWidget" name="qMRMLVirtualRealitySegmentEditorWidget"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>589</width> | ||
<height>590</height> | ||
</rect> | ||
</property> | ||
<property name="minimumSize"> | ||
<size> | ||
<width>100</width> | ||
<height>0</height> | ||
</size> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>qMRMLSegmentEditorWidget</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<property name="spacing"> | ||
<number>4</number> | ||
</property> | ||
<property name="leftMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="topMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="rightMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="bottomMargin"> | ||
<number>0</number> | ||
</property> | ||
<item> | ||
<widget class="qMRMLSegmentEditorWidget" name="SegmentEditorWidget" native="true"/> | ||
</item> | ||
</layout> | ||
</widget> | ||
<customwidgets> | ||
<customwidget> | ||
<class>qMRMLWidget</class> | ||
<extends>QWidget</extends> | ||
<header>qMRMLWidget.h</header> | ||
<container>1</container> | ||
</customwidget> | ||
<customwidget> | ||
<class>qMRMLSegmentEditorWidget</class> | ||
<extends>qMRMLWidget</extends> | ||
<header>qMRMLSegmentEditorWidget.h</header> | ||
<container>1</container> | ||
</customwidget> | ||
</customwidgets> | ||
<resources> | ||
<include location="../../../Resources/qSlicerSegmentationsModule.qrc"/> | ||
<include location="../../../../../../Base/QTGUI/Resources/qSlicerBaseQTGUI.qrc"/> | ||
</resources> | ||
<connections> | ||
<connection> | ||
<sender>qMRMLVirtualRealitySegmentEditorWidget</sender> | ||
<signal>mrmlSceneChanged(vtkMRMLScene*)</signal> | ||
<receiver>SegmentEditorWidget</receiver> | ||
<slot>setMRMLScene(vtkMRMLScene*)</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>189</x> | ||
<y>581</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>189</x> | ||
<y>533</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
</connections> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
VirtualReality/Widgets/qMRMLVirtualRealitySegmentEditorWidget.cxx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/*============================================================================== | ||
Copyright (c) Laboratory for Percutaneous Surgery (PerkLab) | ||
Queen's University, Kingston, ON, Canada. All Rights Reserved. | ||
See COPYRIGHT.txt | ||
or http://www.slicer.org/copyright/copyright.txt for details. | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
This file was originally developed by Csaba Pinter, PerkLab, Queen's University | ||
and was supported through the Applied Cancer Research Unit program of Cancer Care | ||
Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care | ||
and CANARIE. | ||
==============================================================================*/ | ||
|
||
// VirtualReality Widgets includes | ||
#include "qMRMLVirtualRealitySegmentEditorWidget.h" | ||
#include "ui_qMRMLVirtualRealitySegmentEditorWidget.h" | ||
|
||
// VirtualReality MRML includes | ||
#include "vtkMRMLVirtualRealityViewNode.h" | ||
|
||
// Segmentations includes | ||
#include "vtkMRMLSegmentEditorNode.h" | ||
|
||
// Qt includes | ||
#include <QDebug> | ||
#include "qpushbutton.h" | ||
#include "ctkMenuButton.h" | ||
#include "qtoolbutton.h" | ||
|
||
//----------------------------------------------------------------------------- | ||
class qMRMLVirtualRealitySegmentEditorWidgetPrivate : public Ui_qMRMLVirtualRealitySegmentEditorWidget | ||
{ | ||
Q_DECLARE_PUBLIC(qMRMLVirtualRealitySegmentEditorWidget); | ||
|
||
protected: | ||
qMRMLVirtualRealitySegmentEditorWidget* const q_ptr; | ||
|
||
public: | ||
qMRMLVirtualRealitySegmentEditorWidgetPrivate(qMRMLVirtualRealitySegmentEditorWidget& object); | ||
virtual ~qMRMLVirtualRealitySegmentEditorWidgetPrivate(); | ||
|
||
void init(); | ||
}; | ||
|
||
//----------------------------------------------------------------------------- | ||
qMRMLVirtualRealitySegmentEditorWidgetPrivate::qMRMLVirtualRealitySegmentEditorWidgetPrivate(qMRMLVirtualRealitySegmentEditorWidget& object) | ||
: q_ptr(&object) | ||
{ | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
qMRMLVirtualRealitySegmentEditorWidgetPrivate::~qMRMLVirtualRealitySegmentEditorWidgetPrivate() | ||
{ | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
void qMRMLVirtualRealitySegmentEditorWidgetPrivate::init() | ||
{ | ||
Q_Q(qMRMLVirtualRealitySegmentEditorWidget); | ||
this->setupUi(q); | ||
|
||
//List of effects to be used in VR; effects not listed here are not shown in the widget | ||
QStringList effectNameOrder; | ||
effectNameOrder.append("None"); | ||
effectNameOrder.append("Paint"); | ||
effectNameOrder.append("Erase"); | ||
effectNameOrder.append("Level tracing"); | ||
effectNameOrder.append("Grow from seeds"); | ||
effectNameOrder.append("Smoothing"); | ||
effectNameOrder.append("Scissors"); | ||
effectNameOrder.append("Logical Operators"); | ||
this->SegmentEditorWidget->setEffectNameOrder(effectNameOrder); | ||
|
||
//Hide unneeded effects and buttons | ||
this->SegmentEditorWidget->setUnorderedEffectsVisible(false); | ||
this->SegmentEditorWidget->setSwitchToSegmentationsButtonVisible(false); | ||
this->SegmentEditorWidget->findChild<QToolButton*>("SpecifyGeometryButton")->setVisible(false); | ||
this->SegmentEditorWidget->findChild<QToolButton*>("SliceRotateWarningButton")->setVisible(false); | ||
this->SegmentEditorWidget->findChild<ctkMenuButton*>("Show3DButton")->setVisible(false); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
// qMRMLVirtualRealitySegmentEditorWidget methods | ||
|
||
//----------------------------------------------------------------------------- | ||
qMRMLVirtualRealitySegmentEditorWidget::qMRMLVirtualRealitySegmentEditorWidget(QWidget* _parent) | ||
: qMRMLWidget(_parent) | ||
, d_ptr(new qMRMLVirtualRealitySegmentEditorWidgetPrivate(*this)) | ||
{ | ||
Q_D(qMRMLVirtualRealitySegmentEditorWidget); | ||
d->init(); | ||
|
||
this->updateWidgetFromMRML(); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
qMRMLVirtualRealitySegmentEditorWidget::~qMRMLVirtualRealitySegmentEditorWidget() | ||
= default; | ||
|
||
//----------------------------------------------------------------------------- | ||
void qMRMLVirtualRealitySegmentEditorWidget::updateWidgetFromMRML() | ||
{ | ||
//Q_D(qMRMLVirtualRealitySegmentEditorWidget); | ||
} | ||
|
||
void qMRMLVirtualRealitySegmentEditorWidget::setMRMLSegmentEditorNode(vtkMRMLSegmentEditorNode* newSegmentEditorNode) | ||
{ | ||
Q_D(qMRMLVirtualRealitySegmentEditorWidget); | ||
d->SegmentEditorWidget->setMRMLSegmentEditorNode(newSegmentEditorNode); | ||
} |
67 changes: 67 additions & 0 deletions
67
VirtualReality/Widgets/qMRMLVirtualRealitySegmentEditorWidget.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/*============================================================================== | ||
Copyright (c) Laboratory for Percutaneous Surgery (PerkLab) | ||
Queen's University, Kingston, ON, Canada. All Rights Reserved. | ||
See COPYRIGHT.txt | ||
or http://www.slicer.org/copyright/copyright.txt for details. | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
This file was originally developed by Csaba Pinter, PerkLab, Queen's University | ||
and was supported through the Applied Cancer Research Unit program of Cancer Care | ||
Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care | ||
and CANARIE. | ||
==============================================================================*/ | ||
|
||
#ifndef __qMRMLVirtualRealitySegmentEditorWidget_h | ||
#define __qMRMLVirtualRealitySegmentEditorWidget_h | ||
|
||
// VirtualReality Widgets includes | ||
#include "qSlicerVirtualRealityModuleWidgetsExport.h" | ||
|
||
// MRMLWidgets includes | ||
#include "qMRMLWidget.h" | ||
|
||
// CTK includes | ||
#include <ctkPimpl.h> | ||
#include <ctkVTKObject.h> | ||
|
||
class qMRMLVirtualRealitySegmentEditorWidgetPrivate; | ||
class vtkMRMLSegmentEditorNode; | ||
|
||
/// \ingroup SlicerVirtualReality_Widgets | ||
class Q_SLICER_QTMODULES_VIRTUALREALITY_WIDGETS_EXPORT qMRMLVirtualRealitySegmentEditorWidget : public qMRMLWidget | ||
{ | ||
Q_OBJECT | ||
QVTK_OBJECT | ||
|
||
public: | ||
typedef qMRMLWidget Superclass; | ||
/// Constructor | ||
explicit qMRMLVirtualRealitySegmentEditorWidget(QWidget* parent = nullptr); | ||
/// Destructor | ||
~qMRMLVirtualRealitySegmentEditorWidget() override; | ||
|
||
void setMRMLSegmentEditorNode(vtkMRMLSegmentEditorNode* newSegmentEditorNode); | ||
|
||
public slots: | ||
|
||
protected slots: | ||
/// Update widgets from the MRML node | ||
void updateWidgetFromMRML(); | ||
|
||
protected: | ||
QScopedPointer<qMRMLVirtualRealitySegmentEditorWidgetPrivate> d_ptr; | ||
|
||
private: | ||
Q_DECLARE_PRIVATE(qMRMLVirtualRealitySegmentEditorWidget); | ||
Q_DISABLE_COPY(qMRMLVirtualRealitySegmentEditorWidget); | ||
}; | ||
|
||
#endif |