diff --git a/VirtualReality/Widgets/CMakeLists.txt b/VirtualReality/Widgets/CMakeLists.txt
index 9b41860..4678eeb 100644
--- a/VirtualReality/Widgets/CMakeLists.txt
+++ b/VirtualReality/Widgets/CMakeLists.txt
@@ -8,6 +8,7 @@ set(${KIT}_EXPORT_DIRECTIVE "Q_SLICER_QTMODULES_${MODULE_NAME_UPPER}_WIDGETS_EXP
set(${KIT}_INCLUDE_DIRECTORIES
${vtkSlicerVirtualRealityModuleMRML_INCLUDE_DIRS}
${VTK_INCLUDE_DIRS}
+ ${qSlicerSubjectHierarchyModuleWidgets_INCLUDE_DIRS}
)
set(${KIT}_SRCS
@@ -18,6 +19,8 @@ set(${KIT}_SRCS
qMRML${MODULE_NAME}TransformWidget.h
qMRMLVirtualRealityHomeWidget.cxx
qMRMLVirtualRealityHomeWidget.h
+ qMRMLVirtualRealityDataModuleWidget.cxx
+ qMRMLVirtualRealityDataModuleWidget.h
)
set(${KIT}_MOC_SRCS
@@ -25,10 +28,12 @@ set(${KIT}_MOC_SRCS
qMRML${MODULE_NAME}TransformWidget.h
qMRML${MODULE_NAME}View_p.h
qMRMLVirtualRealityHomeWidget.h
+ qMRMLVirtualRealityDataModuleWidget.h
)
set(${KIT}_UI_SRCS
Resources/UI/qMRMLVirtualRealityHomeWidget.ui
+ Resources/UI/qMRMLVirtualRealityDataModuleWidget.ui
Resources/UI/qMRML${MODULE_NAME}TransformWidget.ui
)
@@ -41,6 +46,7 @@ set(${KIT}_TARGET_LIBRARIES
vtkSlicer${MODULE_NAME}ModuleMRML
vtkSlicerCamerasModuleLogic
${VTK_LIBRARIES}
+ qSlicerSubjectHierarchyModuleWidgets
)
#-----------------------------------------------------------------------------
diff --git a/VirtualReality/Widgets/Resources/UI/qMRMLVirtualRealityDataModuleWidget.ui b/VirtualReality/Widgets/Resources/UI/qMRMLVirtualRealityDataModuleWidget.ui
new file mode 100644
index 0000000..ba92916
--- /dev/null
+++ b/VirtualReality/Widgets/Resources/UI/qMRMLVirtualRealityDataModuleWidget.ui
@@ -0,0 +1,69 @@
+
+
+ qMRMLVirtualRealityDataModuleWidget
+
+
+
+ 0
+ 0
+ 530
+ 263
+
+
+
+ VR Data
+
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+ -
+
+
+
+
+
+
+ qMRMLWidget
+ QWidget
+
+ 1
+
+
+ qMRMLSubjectHierarchyTreeView
+ QTreeView
+ qMRMLSubjectHierarchyTreeView.h
+
+
+
+
+
+ qMRMLVirtualRealityDataModuleWidget
+ mrmlSceneChanged(vtkMRMLScene*)
+ SubjectHierarchyTreeView
+ setMRMLScene(vtkMRMLScene*)
+
+
+ 119
+ 1
+
+
+ 152
+ 37
+
+
+
+
+
diff --git a/VirtualReality/Widgets/qMRMLVirtualRealityDataModuleWidget.cxx b/VirtualReality/Widgets/qMRMLVirtualRealityDataModuleWidget.cxx
new file mode 100644
index 0000000..5addeb9
--- /dev/null
+++ b/VirtualReality/Widgets/qMRMLVirtualRealityDataModuleWidget.cxx
@@ -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
+
+//-----------------------------------------------------------------------------
+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 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;
+}
diff --git a/VirtualReality/Widgets/qMRMLVirtualRealityDataModuleWidget.h b/VirtualReality/Widgets/qMRMLVirtualRealityDataModuleWidget.h
new file mode 100644
index 0000000..d01ba7e
--- /dev/null
+++ b/VirtualReality/Widgets/qMRMLVirtualRealityDataModuleWidget.h
@@ -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
+#include
+
+// 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 d_ptr;
+
+private:
+ Q_DECLARE_PRIVATE(qMRMLVirtualRealityDataModuleWidget);
+ Q_DISABLE_COPY(qMRMLVirtualRealityDataModuleWidget);
+};
+
+#endif
diff --git a/VirtualReality/Widgets/qMRMLVirtualRealityHomeWidget.cxx b/VirtualReality/Widgets/qMRMLVirtualRealityHomeWidget.cxx
index bd35834..d623a5d 100644
--- a/VirtualReality/Widgets/qMRMLVirtualRealityHomeWidget.cxx
+++ b/VirtualReality/Widgets/qMRMLVirtualRealityHomeWidget.cxx
@@ -21,11 +21,11 @@
// VirtualReality Widgets includes
#include "qMRMLVirtualRealityHomeWidget.h"
-
#include "ui_qMRMLVirtualRealityHomeWidget.h"
// VirtualReality MRML includes
#include "vtkMRMLVirtualRealityViewNode.h"
+#include "qMRMLVirtualRealityDataModuleWidget.h"
// VTK includes
#include
@@ -53,6 +53,7 @@ class qMRMLVirtualRealityHomeWidgetPrivate : public Ui_qMRMLVirtualRealityHomeWi
public:
/// Virtual reality view MRML node
vtkWeakPointer VirtualRealityViewNode;
+ qMRMLVirtualRealityDataModuleWidget* DataModuleWidget;
};
//-----------------------------------------------------------------------------
@@ -60,6 +61,7 @@ qMRMLVirtualRealityHomeWidgetPrivate::qMRMLVirtualRealityHomeWidgetPrivate(qMRML
: q_ptr(&object)
{
this->VirtualRealityViewNode = nullptr;
+ this->DataModuleWidget = new qMRMLVirtualRealityDataModuleWidget;
}
//-----------------------------------------------------------------------------
@@ -92,6 +94,7 @@ void qMRMLVirtualRealityHomeWidgetPrivate::init()
// qMRMLVirtualRealityHomeWidget methods
//-----------------------------------------------------------------------------
+
qMRMLVirtualRealityHomeWidget::qMRMLVirtualRealityHomeWidget(QWidget* _parent)
: qMRMLWidget(_parent)
, d_ptr(new qMRMLVirtualRealityHomeWidgetPrivate(*this))
@@ -112,6 +115,13 @@ vtkMRMLVirtualRealityViewNode* qMRMLVirtualRealityHomeWidget::virtualRealityView
return d->VirtualRealityViewNode;
}
+//-----------------------------------------------------------------------------
+QString qMRMLVirtualRealityHomeWidget::virtualRealityViewNodeID()const
+{
+ Q_D(const qMRMLVirtualRealityHomeWidget);
+ return (d->VirtualRealityViewNode.GetPointer() ? d->VirtualRealityViewNode->GetID() : QString());
+}
+
//-----------------------------------------------------------------------------
void qMRMLVirtualRealityHomeWidget::addModuleButton(QWidget* moduleWidget, QIcon& icon)
{
@@ -174,10 +184,13 @@ void qMRMLVirtualRealityHomeWidget::onBackButtonPressed()
}
//-----------------------------------------------------------------------------
-QString qMRMLVirtualRealityHomeWidget::virtualRealityViewNodeID()const
+void qMRMLVirtualRealityHomeWidget::registerDataModule()
{
- Q_D(const qMRMLVirtualRealityHomeWidget);
- return (d->VirtualRealityViewNode.GetPointer() ? d->VirtualRealityViewNode->GetID() : QString());
+ Q_D(qMRMLVirtualRealityHomeWidget);
+ QIcon dataIcon(QPixmap(":/Icons/SubjectHierarchy.png"));
+ addModuleButton(d->DataModuleWidget, dataIcon);
+ d->DataModuleWidget->setMRMLScene(this->mrmlScene());
+ d->DataModuleWidget->treeView()->setColumnHidden(d->DataModuleWidget->treeView()->model()->idColumn(),true);
}
//-----------------------------------------------------------------------------
diff --git a/VirtualReality/Widgets/qMRMLVirtualRealityHomeWidget.h b/VirtualReality/Widgets/qMRMLVirtualRealityHomeWidget.h
index 470699f..a1387e2 100644
--- a/VirtualReality/Widgets/qMRMLVirtualRealityHomeWidget.h
+++ b/VirtualReality/Widgets/qMRMLVirtualRealityHomeWidget.h
@@ -73,7 +73,8 @@ public slots:
void addModuleButton(QWidget* moduleWidget, QIcon& icon);
void onModuleButtonPressed();
void onBackButtonPressed();
-
+ void registerDataModule();
+
protected slots:
/// Update widgets from the MRML node
void updateWidgetFromMRML();
diff --git a/VirtualReality/Widgets/qMRMLVirtualRealityView.cxx b/VirtualReality/Widgets/qMRMLVirtualRealityView.cxx
index 7e1d5b7..3a68085 100644
--- a/VirtualReality/Widgets/qMRMLVirtualRealityView.cxx
+++ b/VirtualReality/Widgets/qMRMLVirtualRealityView.cxx
@@ -111,6 +111,7 @@ qMRMLVirtualRealityViewPrivate::qMRMLVirtualRealityViewPrivate(qMRMLVirtualReali
{
this->MRMLVirtualRealityViewNode = nullptr;
this->HomeWidget = new qMRMLVirtualRealityHomeWidget(q_ptr);
+ this->DataModuleWidget = new qMRMLVirtualRealityDataModuleWidget;
}
//---------------------------------------------------------------------------
@@ -685,7 +686,8 @@ qMRMLVirtualRealityView::~qMRMLVirtualRealityView()
void qMRMLVirtualRealityView::registerModule(QWidget* widget, QIcon& icon)
{
Q_D(qMRMLVirtualRealityView);
- d->HomeWidget->addModuleButton(widget, icon);
+
+ d->HomeWidget->addModuleButton(widget, icon);
}
//------------------------------------------------------------------------------
diff --git a/VirtualReality/Widgets/qMRMLVirtualRealityView_p.h b/VirtualReality/Widgets/qMRMLVirtualRealityView_p.h
index 652015c..174cd9e 100644
--- a/VirtualReality/Widgets/qMRMLVirtualRealityView_p.h
+++ b/VirtualReality/Widgets/qMRMLVirtualRealityView_p.h
@@ -42,6 +42,7 @@
// VirtualReality Widgets includes
#include "qMRMLVirtualRealityHomeWidget.h"
+#include "qMRMLVirtualRealityDataModuleWidget.h"
// qMRML includes
#include "qMRMLVirtualRealityView.h"
@@ -122,6 +123,7 @@ public slots:
QTimer VirtualRealityLoopTimer;
qMRMLVirtualRealityHomeWidget* HomeWidget;
+ qMRMLVirtualRealityDataModuleWidget* DataModuleWidget;
};
#endif