Slicer  5.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLAnnotationDisplayableManagerHelper.h
Go to the documentation of this file.
1 /*=auto=========================================================================
2 
3  Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
4 
5  See COPYRIGHT.txt
6  or http://www.slicer.org/copyright/copyright.txt for details.
7 
8  Program: 3D Slicer
9  Module: $RCSfile: vtkMRMLAnnotationDisplayableManagerHelper,v $
10  Date: $Date: Aug 4, 2010 10:44:52 AM $
11  Version: $Revision: 1.0 $
12 
13  =========================================================================auto=*/
14 
15 #ifndef VTKMRMLANNOTATIONDISPLAYABLEMANAGERHELPER_H_
16 #define VTKMRMLANNOTATIONDISPLAYABLEMANAGERHELPER_H_
17 
18 // Annotations includes
19 #include "vtkSlicerAnnotationsModuleMRMLDisplayableManagerExport.h"
20 
21 // Annotations MRML includes
24 
25 // MRML includes
27 
28 // VTK includes
29 #include <vtkHandleWidget.h>
30 #include <vtkLineWidget2.h>
31 #include <vtkSeedWidget.h>
32 #include <vtkSmartPointer.h>
33 
34 // STD includes
35 #include <map>
36 #include <vector>
37 
39 class VTK_SLICER_ANNOTATIONS_MODULE_MRMLDISPLAYABLEMANAGER_EXPORT
41  : public vtkObject
42 {
43 public:
44 
47  void PrintSelf(ostream& os, vtkIndent indent) override;
48 
50  void UpdateLockedAllWidgetsFromNodes();
52  void UpdateLockedAllWidgetsFromInteractionNode(vtkMRMLInteractionNode* interactionNode);
54  void UpdateLockedAllWidgets(bool locked);
56  void UpdateLocked(vtkMRMLAnnotationNode* node);
59  void UpdateVisible(vtkMRMLAnnotationNode* node, bool displayableInViewer = true);
61  void UpdateWidget(vtkMRMLAnnotationNode* node);
62 
64  vtkAbstractWidget * GetWidget(vtkMRMLAnnotationNode * node);
66  vtkAbstractWidget * GetIntersectionWidget(vtkMRMLAnnotationNode * node);
68  vtkAbstractWidget * GetOverLineProjectionWidget(vtkMRMLAnnotationNode * node);
70  vtkAbstractWidget * GetUnderLineProjectionWidget(vtkMRMLAnnotationNode * node);
72  vtkAbstractWidget * GetPointProjectionWidget(vtkMRMLAnnotationNode * node);
74  void RemoveAllWidgetsAndNodes();
76  void RemoveWidgetAndNode(vtkMRMLAnnotationNode *node);
77 
78 
80  vtkMRMLAnnotationNode * GetAnnotationNodeFromDisplayNode(vtkMRMLAnnotationDisplayNode *displayNode);
81 
82  //----------------------------------------------------------------------------------
83  // The Lists!!
84  //
85  // An annotation which is managed by a displayableManager consists of
86  // a) the Annotation MRML Node (AnnotationNodeList)
87  // b) the vtkWidget to show this annotation (Widgets)
88  // c) a vtkWidget to represent sliceIntersections in the slice viewers (WidgetIntersections)
89  //
90 
92  std::vector<vtkMRMLAnnotationNode*> AnnotationNodeList;
93 
95  typedef std::vector<vtkMRMLAnnotationNode*>::iterator AnnotationNodeListIt;
96 
98  std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> Widgets;
99 
101  typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetsIt;
102 
104  std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> WidgetIntersections;
105 
107  typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetIntersectionsIt;
108 
110  std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> WidgetOverLineProjections;
111 
113  typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetOverLineProjectionsIt;
114 
116  std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> WidgetUnderLineProjections;
117 
119  typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetUnderLineProjectionsIt;
120 
122  std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> WidgetPointProjections;
123 
125  typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetPointProjectionsIt;
126 
127  //
128  // End of The Lists!!
129  //
130  //----------------------------------------------------------------------------------
131 
132 
134  void PlaceSeed(double x, double y, vtkRenderWindowInteractor * interactor, vtkRenderer * renderer);
135 
137  vtkHandleWidget * GetSeed(int index);
138 
140  void RemoveSeeds();
141 
142 
143 protected:
144 
147 
148 private:
149 
151  void operator=(const vtkMRMLAnnotationDisplayableManagerHelper&) = delete;
152 
154  vtkSmartPointer<vtkSeedWidget> SeedWidget;
156  std::vector<vtkSmartPointer<vtkHandleWidget> > HandleWidgetList;
158  typedef std::vector<vtkSmartPointer<vtkHandleWidget> >::iterator HandleWidgetListIt;
159 };
160 
161 #endif /* VTKMRMLANNOTATIONDISPLAYABLEMANAGERHELPER_H_ */
std::map< vtkMRMLAnnotationNode *, vtkAbstractWidget * > WidgetPointProjections
Map of vtkWidgets to reflect the Slice projection indexed using associated node ID.
std::map< vtkMRMLAnnotationNode *, vtkAbstractWidget * > WidgetIntersections
Map of vtkWidgets to reflect the Slice intersections indexed using associated node ID...
std::map< vtkMRMLAnnotationNode *, vtkAbstractWidget * >::iterator WidgetOverLineProjectionsIt
.. and its associated convenient typedef
std::map< vtkMRMLAnnotationNode *, vtkAbstractWidget * >::iterator WidgetIntersectionsIt
.. and its associated convenient typedef
std::vector< vtkMRMLAnnotationNode * > AnnotationNodeList
List of Nodes managed by the DisplayableManager.
std::map< vtkMRMLAnnotationNode *, vtkAbstractWidget * >::iterator WidgetPointProjectionsIt
.. and its associated convenient typedef
std::vector< vtkMRMLAnnotationNode * >::iterator AnnotationNodeListIt
.. and its associated convenient typedef
std::map< vtkMRMLAnnotationNode *, vtkAbstractWidget * > Widgets
Map of vtkWidget indexed using associated node ID.
std::map< vtkMRMLAnnotationNode *, vtkAbstractWidget * > WidgetUnderLineProjections
Map of vtkWidgets to reflect the Slice projection indexed using associated node ID.
std::map< vtkMRMLAnnotationNode *, vtkAbstractWidget * > WidgetOverLineProjections
Map of vtkWidgets to reflect the Slice projection indexed using associated node ID.
std::map< vtkMRMLAnnotationNode *, vtkAbstractWidget * >::iterator WidgetUnderLineProjectionsIt
.. and its associated convenient typedef
std::map< vtkMRMLAnnotationNode *, vtkAbstractWidget * >::iterator WidgetsIt
.. and its associated convenient typedef