Slicer  4.8
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 <vtkAbstractWidget.h>
38 #include <vtkHandleWidget.h>
39 #include <vtkSeedWidget.h>
40 #include <vtkSmartPointer.h>
41 
42 // MRML includes
43 #include <vtkMRMLSliceNode.h>
44 #include <vtkMRMLInteractionNode.h>
46 
48 class VTK_SLICER_MARKUPS_MODULE_MRMLDISPLAYABLEMANAGER_EXPORT vtkMRMLMarkupsDisplayableManagerHelper :
49  public vtkObject
50 {
51 public:
52 
54  vtkTypeMacro(vtkMRMLMarkupsDisplayableManagerHelper, vtkObject);
55  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
56 
58  void UpdateLockedAllWidgetsFromNodes();
60  void UpdateLockedAllWidgetsFromInteractionNode(vtkMRMLInteractionNode* interactionNode);
62  void UpdateLockedAllWidgets(bool locked);
66  void UpdateLocked(vtkMRMLMarkupsNode* node, vtkMRMLInteractionNode *interactionNode = NULL);
67 
69  void RecordWidgetForNode(vtkAbstractWidget* widget, vtkMRMLMarkupsNode *node);
70 
72  vtkAbstractWidget * GetWidget(vtkMRMLMarkupsNode * node);
74  vtkAbstractWidget * GetIntersectionWidget(vtkMRMLMarkupsNode * node);
77  vtkAbstractWidget * GetPointProjectionWidget(std::string uniqueFiducialID);
78 
80  void RemoveAllWidgetsAndNodes();
82  void RemoveWidgetAndNode(vtkMRMLMarkupsNode *node);
83 
84 
86  vtkMRMLMarkupsNode * GetMarkupsNodeFromDisplayNode(vtkMRMLMarkupsDisplayNode *displayNode);
87 
89  std::vector<vtkMRMLMarkupsNode*> MarkupsNodeList;
90 
92  typedef std::vector<vtkMRMLMarkupsNode*>::iterator MarkupsNodeListIt;
93 
95  std::map<vtkMRMLMarkupsNode*, vtkAbstractWidget*> Widgets;
96 
98  typedef std::map<vtkMRMLMarkupsNode*, vtkAbstractWidget*>::iterator WidgetsIt;
99 
101  std::map<vtkMRMLMarkupsNode*, vtkAbstractWidget*> WidgetIntersections;
102 
104  typedef std::map<vtkMRMLMarkupsNode*, vtkAbstractWidget*>::iterator WidgetIntersectionsIt;
105 
107  std::map<std::string, vtkAbstractWidget*> WidgetPointProjections;
108 
110  typedef std::map<std::string, vtkAbstractWidget*>::iterator WidgetPointProjectionsIt;
111 
112  //
113  // End of The Lists!!
114  //
115  //----------------------------------------------------------------------------------
116 
117 
119  void PlaceSeed(double x, double y, vtkRenderWindowInteractor * interactor, vtkRenderer * renderer);
120 
122  vtkHandleWidget * GetSeed(int index);
123 
125  void RemoveSeeds();
126 
129  int GetNodeGlyphType(vtkMRMLNode *displayNode, int index);
132  void SetNodeGlyphType(vtkMRMLNode *displayNode, int glyphType, int index);
134  void RemoveNodeGlyphType(vtkMRMLNode *displayNode);
136  void ClearNodeGlyphTypes();
137 
138 protected:
139 
142 
144  void PrintNodeGlyphTypes();
145 
146 private:
147 
149  void operator=(const vtkMRMLMarkupsDisplayableManagerHelper&);
150 
152  vtkSmartPointer<vtkSeedWidget> SeedWidget;
154  std::vector<vtkSmartPointer<vtkHandleWidget> > HandleWidgetList;
156  typedef std::vector<vtkSmartPointer<vtkHandleWidget> >::iterator HandleWidgetListIt;
157 
160  std::map<vtkMRMLNode*, std::vector<int> > NodeGlyphTypes;
161 };
162 
163 #endif /* VTKMRMLMARKUPSDISPLAYABLEMANAGERHELPER_H_ */
std::map< vtkMRMLMarkupsNode *, vtkAbstractWidget * >::iterator WidgetIntersectionsIt
.. and its associated convenient typedef
std::map< vtkMRMLMarkupsNode *, vtkAbstractWidget * > WidgetIntersections
Map of vtkWidgets to reflect the Slice intersections indexed using associated node ID...
std::vector< vtkMRMLMarkupsNode * > MarkupsNodeList
List of nodes managed by the DisplayableManager.
std::vector< vtkMRMLMarkupsNode * >::iterator MarkupsNodeListIt
Typedef for iterator over the list of nodes managed by the DisplayableManager.
MRML node to represent a list of markups Markups nodes contains a list of markups that each contain a...
std::map< vtkMRMLMarkupsNode *, vtkAbstractWidget * > Widgets
Map of vtkWidget indexed using associated node ID.
std::map< vtkMRMLMarkupsNode *, vtkAbstractWidget * >::iterator WidgetsIt
.. and its associated convenient typedef
std::map< std::string, vtkAbstractWidget * > WidgetPointProjections
Map of vtkWidgets to reflect the Slice projection indexed using associated point IDs.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
std::map< std::string, vtkAbstractWidget * >::iterator WidgetPointProjectionsIt
.. and its associated convenient typedef