Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerMarkupsPlaceWidget.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
4  Queen's University, Kingston, ON, Canada. 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 Matthew Holden, PerkLab, Queen's University
16  and was supported through the Applied Cancer Research Unit program of Cancer Care
17  Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
18 
19 ==============================================================================*/
20 
21 #ifndef __qSlicerMarkupsPlaceWidget_h
22 #define __qSlicerMarkupsPlaceWidget_h
23 
24 // Qt includes
25 #include "qSlicerWidget.h"
26 
27 #include "qMRMLUtils.h"
28 
29 // Markups Widgets includes
30 #include "qSlicerMarkupsModuleWidgetsExport.h"
31 #include "ui_qSlicerMarkupsPlaceWidget.h"
32 
33 
34 class qSlicerMarkupsPlaceWidgetPrivate;
37 class vtkMRMLMarkupsNode;
38 
40 class Q_SLICER_MODULE_MARKUPS_WIDGETS_EXPORT
42 {
43  Q_OBJECT
45  Q_PROPERTY(bool buttonsVisible READ buttonsVisible WRITE setButtonsVisible)
46  Q_PROPERTY(bool deleteAllMarkupsOptionVisible READ deleteAllMarkupsOptionVisible WRITE setDeleteAllMarkupsOptionVisible)
47  Q_PROPERTY(PlaceMultipleMarkupsType placeMultipleMarkups READ placeMultipleMarkups WRITE setPlaceMultipleMarkups)
48  Q_PROPERTY(QColor nodeColor READ nodeColor WRITE setNodeColor)
49  Q_PROPERTY(QColor defaultNodeColor READ defaultNodeColor WRITE setDefaultNodeColor)
50  Q_PROPERTY(bool currentNodeActive READ currentNodeActive WRITE setCurrentNodeActive)
51  Q_PROPERTY(bool placeModeEnabled READ placeModeEnabled WRITE setPlaceModeEnabled)
52  Q_PROPERTY(bool placeModePersistency READ placeModePersistency WRITE setPlaceModePersistency)
53 
54 public:
56  qSlicerMarkupsPlaceWidget(QWidget *parent=nullptr);
57  ~qSlicerMarkupsPlaceWidget() override;
58 
60  {
61  ShowPlaceMultipleMarkupsOption, // show a menu on the place button to place multiple markup points
62  HidePlaceMultipleMarkupsOption, // don't allow to change persistency of place mode, just use current
63  ForcePlaceSingleMarkup, // always disable persistency when enabling place mode
64  ForcePlaceMultipleMarkups // always enable persistency when enabling place mode
65  };
66 
68  Q_INVOKABLE vtkMRMLNode* currentNode() const;
69  Q_INVOKABLE vtkMRMLMarkupsFiducialNode* currentMarkupsFiducialNode() const;
70  Q_INVOKABLE vtkMRMLMarkupsNode* currentMarkupsNode() const;
71 
74  Q_INVOKABLE vtkMRMLInteractionNode* interactionNode()const;
75 
77  bool currentNodeActive() const;
78 
80  bool placeModeEnabled() const;
81 
83  bool placeModePersistency() const;
84 
86  PlaceMultipleMarkupsType placeMultipleMarkups() const;
87 
89  bool buttonsVisible() const;
90 
92  bool deleteAllMarkupsOptionVisible() const;
93 
95  QColor nodeColor() const;
96 
98  QColor defaultNodeColor() const;
99 
100  Q_INVOKABLE QToolButton* placeButton() const;
101 
102  Q_INVOKABLE QToolButton* deleteButton() const;
103 
104 public slots:
105 
106  void setMRMLScene(vtkMRMLScene* scene) override;
107 
109  void setCurrentNode(vtkMRMLNode* currentNode);
110 
112  void setCurrentNodeActive(bool active);
113 
116  void setInteractionNode(vtkMRMLInteractionNode* interactionNode);
117 
118  void setDefaultNodeColor(QColor color);
119 
120  void setNodeColor(QColor color);
121 
123  void setPlaceModeEnabled(bool enable);
124 
126  void setPlaceMultipleMarkups(PlaceMultipleMarkupsType option);
127 
129  void setButtonsVisible(bool visible);
130 
132  void setDeleteAllMarkupsOptionVisible(bool visible);
133 
135  void setPlaceModePersistency(bool);
136 
138  void deleteLastPoint();
139 
141  void deleteAllPoints();
142 
144  void deleteLastMarkup();
145 
147  void deleteAllMarkups();
148 
149 protected slots:
150 
152  void updateWidget();
153 
155  void onColorButtonChanged(QColor);
157  void onVisibilityButtonClicked();
159  void onLockedButtonClicked();
160 
161  void onPlacePersistent(bool enable);
162 
163 signals:
164 
168  void activeMarkupsPlaceModeChanged(bool enabled);
169 
171  void activeMarkupsFiducialPlaceModeChanged(bool enabled);
172 
173 protected:
174  QScopedPointer<qSlicerMarkupsPlaceWidgetPrivate> d_ptr;
175 
176  virtual void setup();
177 
178 private:
179  Q_DECLARE_PRIVATE(qSlicerMarkupsPlaceWidget);
180  Q_DISABLE_COPY(qSlicerMarkupsPlaceWidget);
181 
182 };
183 
184 #endif
QScopedPointer< qSlicerMarkupsPlaceWidgetPrivate > d_ptr
MRML node to represent a fiducial markup Fiducial Markups nodes contain a list of control points...
void setMRMLScene(vtkMRMLScene *scene) override
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:61
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167