Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLMarkupsDisplayableManagerHelper.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16 ==============================================================================*/
25 
26 
27 #ifndef VTKMRMLMARKUPSDISPLAYABLEMANAGERHELPER_H_
28 #define VTKMRMLMARKUPSDISPLAYABLEMANAGERHELPER_H_
29 
30 // MarkupsModule includes
31 #include "vtkSlicerMarkupsModuleMRMLDisplayableManagerExport.h"
32 
33 // MarkupsModule/MRML includes
34 #include <vtkMRMLMarkupsNode.h>
35 
36 // VTK includes
37 #include <vtkSlicerMarkupsWidget.h>
38 #include <vtkSmartPointer.h>
39 
40 // MRML includes
41 #include <vtkMRMLSliceNode.h>
42 
43 // STL includes
44 #include <set>
45 
49 
51 class VTK_SLICER_MARKUPS_MODULE_MRMLDISPLAYABLEMANAGER_EXPORT vtkMRMLMarkupsDisplayableManagerHelper :
52  public vtkObject
53 {
54 public:
55 
57  vtkTypeMacro(vtkMRMLMarkupsDisplayableManagerHelper, vtkObject);
58  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
60  vtkGetObjectMacro(DisplayableManager, vtkMRMLMarkupsDisplayableManager);
61  void SetDisplayableManager(vtkMRMLMarkupsDisplayableManager*);
62 
64  //void SetAllWidgetsToManipulate();
65 
67  vtkSlicerMarkupsWidget * GetWidget(vtkMRMLMarkupsDisplayNode * markupsDisplayNode);
69  vtkSlicerMarkupsWidget * GetWidget(vtkMRMLMarkupsNode * markupsNode);
70 
72  void RemoveAllWidgetsAndNodes();
73 
75  typedef std::map < vtkSmartPointer<vtkMRMLMarkupsDisplayNode>, vtkSlicerMarkupsWidget* > DisplayNodeToWidgetType;
76  typedef std::map < vtkSmartPointer<vtkMRMLMarkupsDisplayNode>, vtkSlicerMarkupsWidget* >::iterator DisplayNodeToWidgetIt;
77  DisplayNodeToWidgetType MarkupsDisplayNodesToWidgets; // display nodes with widgets assigned
78 
79  typedef std::set < vtkSmartPointer<vtkMRMLMarkupsNode> > MarkupsNodesType;
80  typedef std::set < vtkSmartPointer<vtkMRMLMarkupsNode> >::iterator MarkupsNodesIt;
81  MarkupsNodesType MarkupsNodes; // observed markups nodes
82 
83  void AddMarkupsNode(vtkMRMLMarkupsNode* node);
84  void RemoveMarkupsNode(vtkMRMLMarkupsNode* node);
85  void AddDisplayNode(vtkMRMLMarkupsDisplayNode* displayNode);
86  void RemoveDisplayNode(vtkMRMLMarkupsDisplayNode* displayNode);
87 
88  void DeleteWidget(vtkSlicerMarkupsWidget* widget);
89 
90  void AddObservations(vtkMRMLMarkupsNode* node);
91  void RemoveObservations(vtkMRMLMarkupsNode* node);
92 
93 protected:
94 
97 
98 private:
99 
101  void operator=(const vtkMRMLMarkupsDisplayableManagerHelper&) = delete;
102 
105  std::map<vtkMRMLNode*, std::vector<int> > NodeGlyphTypes;
106 
107  bool AddingMarkupsNode;
108 
109  std::vector<unsigned long> ObservedMarkupNodeEvents;
110 
111  vtkMRMLMarkupsDisplayableManager* DisplayableManager;
112 };
113 
114 #endif /* VTKMRMLMARKUPSDISPLAYABLEMANAGERHELPER_H_ */
std::map< vtkSmartPointer< vtkMRMLMarkupsDisplayNode >, vtkSlicerMarkupsWidget *> DisplayNodeToWidgetType
Map of vtkWidget indexed using associated node ID.
std::set< vtkSmartPointer< vtkMRMLMarkupsNode > > MarkupsNodesType
std::map< vtkSmartPointer< vtkMRMLMarkupsDisplayNode >, vtkSlicerMarkupsWidget *>::iterator DisplayNodeToWidgetIt
Process interaction events to update state of markup widget nodes.
std::set< vtkSmartPointer< vtkMRMLMarkupsNode > >::iterator MarkupsNodesIt