Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLMarkupsAbstractOptionsWidget.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Copyright (c) The Intervention Centre
4  Oslo University Hospital, Oslo, Norway. All Rights Reserved.
5 
6  See COPYRIGHT.txt
7  or http://www.slicer.org/copyright/copyright.txt for details.
8 
9  Unless required by applicable law or agreed to in writing, software
10  distributed under the License is distributed on an "AS IS" BASIS,
11  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  See the License for the specific language governing permissions and
13  limitations under the License.
14 
15  This file was originally developed by Rafael Palomar (The Intervention Centre,
16  Oslo University Hospital) and was supported by The Research Council of Norway
17  through the ALive project (grant nr. 311393).
18 
19 ==============================================================================*/
20 
21 #ifndef __qMRMLMarkupsAbstractOptionsWidget_h_
22 #define __qMRMLMarkupsAbstractOptionsWidget_h_
23 
24 // Markups Widgets includes
25 #include "qSlicerMarkupsModuleWidgetsExport.h"
26 
27 //MRML includes
28 #include <vtkMRMLScene.h>
29 #include <vtkMRMLMarkupsNode.h>
30 
31 // Qt includes
32 #include <QWidget>
33 
34 //-------------------------------------------------------------------------------
35 class vtkMRMLMarkupsNode;
36 class vtkMRMLNode;
37 
38 //-------------------------------------------------------------------------------
43 class Q_SLICER_MODULE_MARKUPS_WIDGETS_EXPORT qMRMLMarkupsAbstractOptionsWidget
44  : public QWidget
45 {
46  Q_OBJECT
47 
48  Q_PROPERTY(QString className READ className CONSTANT);
49 
50 public:
51  typedef QWidget Superclass;
52  qMRMLMarkupsAbstractOptionsWidget(QWidget* parent=nullptr);
54 
56  virtual void updateWidgetFromMRML() = 0;
57 
59  virtual const QString className() const = 0;
60 
61  // Returns the associated markups node
63  {return this->MarkupsNode.GetPointer();}
64 
65  // Returns the associated markups node
67  {return this->MRMLScene.GetPointer();}
68 
72  virtual bool canManageMRMLMarkupsNode(vtkMRMLMarkupsNode *markupsNode) const = 0;
73 
75  virtual qMRMLMarkupsAbstractOptionsWidget* createInstance() const = 0;
76 
77 public slots:
79  void setMRMLMarkupsNode(vtkMRMLNode* markupsNode);
81  virtual void setMRMLMarkupsNode(vtkMRMLMarkupsNode* markupsNode) = 0;
83  virtual void setMRMLScene(vtkMRMLScene* mrmlScene)
84  {this->MRMLScene = mrmlScene;}
85 
86 protected:
87  vtkWeakPointer<vtkMRMLMarkupsNode> MarkupsNode;
88  vtkWeakPointer<vtkMRMLScene> MRMLScene;
89 
90 private:
91  Q_DISABLE_COPY(qMRMLMarkupsAbstractOptionsWidget);
92 };
93 
94 #endif // __qMRMLMarkupsAbstractOptionsWidget_h_
vtkWeakPointer< vtkMRMLMarkupsNode > MarkupsNode
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
virtual void setMRMLScene(vtkMRMLScene *mrmlScene)
Sets the vtkMRMLNode to operate on.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167