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 data module widget
Creates and registers the VR data module widget (which can be switched to from the VR home widget) KitwareMedical#43
- Loading branch information
1 parent
68b9774
commit 4f307a4
Showing
8 changed files
with
287 additions
and
6 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
69 changes: 69 additions & 0 deletions
69
VirtualReality/Widgets/Resources/UI/qMRMLVirtualRealityDataModuleWidget.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,69 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>qMRMLVirtualRealityDataModuleWidget</class> | ||
<widget class="qMRMLWidget" name="qMRMLVirtualRealityDataModuleWidget"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>530</width> | ||
<height>263</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>VR Data</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<property name="spacing"> | ||
<number>4</number> | ||
</property> | ||
<property name="leftMargin"> | ||
<number>4</number> | ||
</property> | ||
<property name="topMargin"> | ||
<number>4</number> | ||
</property> | ||
<property name="rightMargin"> | ||
<number>4</number> | ||
</property> | ||
<property name="bottomMargin"> | ||
<number>4</number> | ||
</property> | ||
<item> | ||
<widget class="qMRMLSubjectHierarchyTreeView" name="SubjectHierarchyTreeView"/> | ||
</item> | ||
</layout> | ||
</widget> | ||
<customwidgets> | ||
<customwidget> | ||
<class>qMRMLWidget</class> | ||
<extends>QWidget</extends> | ||
<header>qMRMLWidget.h</header> | ||
<container>1</container> | ||
</customwidget> | ||
<customwidget> | ||
<class>qMRMLSubjectHierarchyTreeView</class> | ||
<extends>QTreeView</extends> | ||
<header>qMRMLSubjectHierarchyTreeView.h</header> | ||
</customwidget> | ||
</customwidgets> | ||
<resources/> | ||
<connections> | ||
<connection> | ||
<sender>qMRMLVirtualRealityDataModuleWidget</sender> | ||
<signal>mrmlSceneChanged(vtkMRMLScene*)</signal> | ||
<receiver>SubjectHierarchyTreeView</receiver> | ||
<slot>setMRMLScene(vtkMRMLScene*)</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>119</x> | ||
<y>1</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>152</x> | ||
<y>37</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
</connections> | ||
</ui> |
112 changes: 112 additions & 0 deletions
112
VirtualReality/Widgets/qMRMLVirtualRealityDataModuleWidget.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,112 @@ | ||
/*============================================================================== | ||
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 "qMRMLVirtualRealityDataModuleWidget.h" | ||
#include "ui_qMRMLVirtualRealityDataModuleWidget.h" | ||
|
||
// VirtualReality MRML includes | ||
#include "vtkMRMLVirtualRealityViewNode.h" | ||
|
||
// Qt includes | ||
#include <QDebug> | ||
|
||
//----------------------------------------------------------------------------- | ||
class qMRMLVirtualRealityDataModuleWidgetPrivate : public Ui_qMRMLVirtualRealityDataModuleWidget | ||
{ | ||
Q_DECLARE_PUBLIC(qMRMLVirtualRealityDataModuleWidget); | ||
|
||
protected: | ||
qMRMLVirtualRealityDataModuleWidget* const q_ptr; | ||
|
||
public: | ||
qMRMLVirtualRealityDataModuleWidgetPrivate(qMRMLVirtualRealityDataModuleWidget& object); | ||
virtual ~qMRMLVirtualRealityDataModuleWidgetPrivate(); | ||
|
||
void init(); | ||
|
||
public: | ||
/// Virtual reality view MRML node | ||
vtkWeakPointer<vtkMRMLVirtualRealityViewNode> VirtualRealityViewNode; | ||
}; | ||
|
||
//----------------------------------------------------------------------------- | ||
qMRMLVirtualRealityDataModuleWidgetPrivate::qMRMLVirtualRealityDataModuleWidgetPrivate(qMRMLVirtualRealityDataModuleWidget& object) | ||
: q_ptr(&object) | ||
{ | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
qMRMLVirtualRealityDataModuleWidgetPrivate::~qMRMLVirtualRealityDataModuleWidgetPrivate() | ||
{ | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
void qMRMLVirtualRealityDataModuleWidgetPrivate::init() | ||
{ | ||
Q_Q(qMRMLVirtualRealityDataModuleWidget); | ||
this->setupUi(q); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
// qMRMLVirtualRealityDataModuleWidget methods | ||
|
||
//----------------------------------------------------------------------------- | ||
qMRMLVirtualRealityDataModuleWidget::qMRMLVirtualRealityDataModuleWidget(QWidget* _parent) | ||
: qMRMLWidget(_parent) | ||
, d_ptr(new qMRMLVirtualRealityDataModuleWidgetPrivate(*this)) | ||
{ | ||
Q_D(qMRMLVirtualRealityDataModuleWidget); | ||
d->init(); | ||
|
||
this->updateWidgetFromMRML(); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
qMRMLVirtualRealityDataModuleWidget::~qMRMLVirtualRealityDataModuleWidget() | ||
= default; | ||
|
||
//----------------------------------------------------------------------------- | ||
vtkMRMLVirtualRealityViewNode* qMRMLVirtualRealityDataModuleWidget::virtualRealityViewNode() const | ||
{ | ||
Q_D(const qMRMLVirtualRealityDataModuleWidget); | ||
return d->VirtualRealityViewNode; | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
QString qMRMLVirtualRealityDataModuleWidget::virtualRealityViewNodeID()const | ||
{ | ||
Q_D(const qMRMLVirtualRealityDataModuleWidget); | ||
return (d->VirtualRealityViewNode.GetPointer() ? d->VirtualRealityViewNode->GetID() : QString()); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
void qMRMLVirtualRealityDataModuleWidget::updateWidgetFromMRML() | ||
{ | ||
//Q_D(qMRMLVirtualRealityDataModuleWidget); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
qMRMLSubjectHierarchyTreeView* qMRMLVirtualRealityDataModuleWidget::treeView() | ||
{ | ||
Q_D(qMRMLVirtualRealityDataModuleWidget); | ||
return d->SubjectHierarchyTreeView; | ||
} |
76 changes: 76 additions & 0 deletions
76
VirtualReality/Widgets/qMRMLVirtualRealityDataModuleWidget.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,76 @@ | ||
/*============================================================================== | ||
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 __qMRMLVirtualRealityDataModuleWidget_h | ||
#define __qMRMLVirtualRealityDataModuleWidget_h | ||
|
||
// VirtualReality Widgets includes | ||
#include "qSlicerVirtualRealityModuleWidgetsExport.h" | ||
|
||
// MRMLWidgets includes | ||
#include "qMRMLWidget.h" | ||
|
||
// CTK includes | ||
#include <ctkPimpl.h> | ||
#include <ctkVTKObject.h> | ||
|
||
// MRML includes | ||
#include "qMRMLSubjectHierarchyTreeView.h" | ||
#include "qMRMLSubjectHierarchyModel.h" | ||
|
||
class vtkMRMLVirtualRealityViewNode; | ||
class qMRMLVirtualRealityDataModuleWidgetPrivate; | ||
|
||
/// \ingroup SlicerVirtualReality_Widgets | ||
class Q_SLICER_QTMODULES_VIRTUALREALITY_WIDGETS_EXPORT qMRMLVirtualRealityDataModuleWidget : public qMRMLWidget | ||
{ | ||
Q_OBJECT | ||
QVTK_OBJECT | ||
|
||
public: | ||
typedef qMRMLWidget Superclass; | ||
/// Constructor | ||
explicit qMRMLVirtualRealityDataModuleWidget(QWidget* parent = nullptr); | ||
/// Destructor | ||
~qMRMLVirtualRealityDataModuleWidget() override; | ||
|
||
/// Get virtual reality view MRML node | ||
Q_INVOKABLE vtkMRMLVirtualRealityViewNode* virtualRealityViewNode()const; | ||
Q_INVOKABLE QString virtualRealityViewNodeID()const; | ||
|
||
/// Get subject hierarchy tree view | ||
Q_INVOKABLE qMRMLSubjectHierarchyTreeView* treeView(); | ||
|
||
public slots: | ||
|
||
protected slots: | ||
/// Update widgets from the MRML node | ||
void updateWidgetFromMRML(); | ||
|
||
protected: | ||
QScopedPointer<qMRMLVirtualRealityDataModuleWidgetPrivate> d_ptr; | ||
|
||
private: | ||
Q_DECLARE_PRIVATE(qMRMLVirtualRealityDataModuleWidget); | ||
Q_DISABLE_COPY(qMRMLVirtualRealityDataModuleWidget); | ||
}; | ||
|
||
#endif |
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
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
Oops, something went wrong.