Slicer  5.1
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 
38 class VTK_SLICER_ANNOTATIONS_MODULE_MRMLDISPLAYABLEMANAGER_EXPORT
40  : public vtkObject
41 {
42 public:
43 
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
49  void UpdateLockedAllWidgetsFromNodes();
51  void UpdateLockedAllWidgetsFromInteractionNode(vtkMRMLInteractionNode* interactionNode);
53  void UpdateLockedAllWidgets(bool locked);
55  void UpdateLocked(vtkMRMLAnnotationNode* node);
58  void UpdateVisible(vtkMRMLAnnotationNode* node, bool displayableInViewer = true);
60  void UpdateWidget(vtkMRMLAnnotationNode* node);
61 
63  vtkAbstractWidget * GetWidget(vtkMRMLAnnotationNode * node);
65  vtkAbstractWidget * GetIntersectionWidget(vtkMRMLAnnotationNode * node);
67  vtkAbstractWidget * GetOverLineProjectionWidget(vtkMRMLAnnotationNode * node);
69  vtkAbstractWidget * GetUnderLineProjectionWidget(vtkMRMLAnnotationNode * node);
71  vtkAbstractWidget * GetPointProjectionWidget(vtkMRMLAnnotationNode * node);
73  void RemoveAllWidgetsAndNodes();
75  void RemoveWidgetAndNode(vtkMRMLAnnotationNode *node);
76 
77 
79  vtkMRMLAnnotationNode * GetAnnotationNodeFromDisplayNode(vtkMRMLAnnotationDisplayNode *displayNode);
80 
81  //----------------------------------------------------------------------------------
82  // The Lists!!
83  //
84  // An annotation which is managed by a displayableManager consists of
85  // a) the Annotation MRML Node (AnnotationNodeList)
86  // b) the vtkWidget to show this annotation (Widgets)
87  // c) a vtkWidget to represent sliceIntersections in the slice viewers (WidgetIntersections)
88  //
89 
91  std::vector<vtkMRMLAnnotationNode*> AnnotationNodeList;
92 
94  typedef std::vector<vtkMRMLAnnotationNode*>::iterator AnnotationNodeListIt;
95 
97  std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> Widgets;
98 
100  typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetsIt;
101 
103  std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> WidgetIntersections;
104 
106  typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetIntersectionsIt;
107 
109  std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> WidgetOverLineProjections;
110 
112  typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetOverLineProjectionsIt;
113 
115  std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> WidgetUnderLineProjections;
116 
118  typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetUnderLineProjectionsIt;
119 
121  std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> WidgetPointProjections;
122 
124  typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetPointProjectionsIt;
125 
126  //
127  // End of The Lists!!
128  //
129  //----------------------------------------------------------------------------------
130 
131 
133  void PlaceSeed(double x, double y, vtkRenderWindowInteractor * interactor, vtkRenderer * renderer);
134 
136  vtkHandleWidget * GetSeed(int index);
137 
139  void RemoveSeeds();
140 
141 
142 protected:
143 
146 
147 private:
148 
150  void operator=(const vtkMRMLAnnotationDisplayableManagerHelper&) = delete;
151 
153  vtkSmartPointer<vtkSeedWidget> SeedWidget;
155  std::vector<vtkSmartPointer<vtkHandleWidget> > HandleWidgetList;
157  typedef std::vector<vtkSmartPointer<vtkHandleWidget> >::iterator HandleWidgetListIt;
158 };
159 
160 #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