Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkSlicerAnnotationModuleLogic.h
Go to the documentation of this file.
1 #ifndef __vtkSlicerAnnotationModuleLogic_h
2 #define __vtkSlicerAnnotationModuleLogic_h
3 
4 // Slicer Logic includes
5 #include "vtkSlicerAnnotationsModuleLogicExport.h"
6 #include "vtkSlicerModuleLogic.h"
7 
8 // MRML includes
14 
15 // STD includes
16 #include <string>
17 
19 class VTK_SLICER_ANNOTATIONS_MODULE_LOGIC_EXPORT vtkSlicerAnnotationModuleLogic
20  :public vtkSlicerModuleLogic
21 {
22 public:
23  enum Events{
24  RefreshRequestEvent = vtkCommand::UserEvent,
25  HierarchyNodeAddedEvent
26  };
29  virtual void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
30 
33  void StartPlaceMode(bool persistent=false, vtkMRMLInteractionNode* interactionNode = NULL);
34 
37  void StopPlaceMode(bool persistent=false, vtkMRMLInteractionNode* interactionNode = NULL);
38 
39  // Start adding a new annotation Node
40  void AddAnnotationNode(const char * nodeDescriptor, bool persistent=false);
41 
42  // After a node was added, propagate to widget
43  void AddNodeCompleted(vtkMRMLAnnotationNode* annotationNode);
44 
47  void CancelCurrentOrRemoveLastAddedAnnotationNode(vtkMRMLInteractionNode* interactionNode = NULL);
48 
50  void RemoveAnnotationNode(vtkMRMLAnnotationNode* annotationNode);
51 
52  //
53  // Annotation Properties (interface to MRML)
54  //
56  virtual void RegisterNodes() VTK_OVERRIDE;
57 
59  bool IsAnnotationNode(const char* id);
60 
61  bool IsAnnotationHierarchyNode(const char* id);
62 
66  vtkMRMLAnnotationTextDisplayNode *GetTextDisplayNode(const char *id);
70  vtkMRMLAnnotationPointDisplayNode *GetPointDisplayNode(const char *id);
74  vtkMRMLAnnotationLineDisplayNode *GetLineDisplayNode(const char *id);
75 
77  const char * GetAnnotationName(const char * id);
78 
80  vtkStdString GetAnnotationText(const char* id);
82  void SetAnnotationText(const char* id, const char * newtext);
83 
85  double GetAnnotationTextScale(const char* id);
87  void SetAnnotationTextScale(const char* id, double textScale);
88 
90  double * GetAnnotationTextSelectedColor(const char* id);
92  void SetAnnotationTextSelectedColor(const char* id, double * color);
93 
95  double * GetAnnotationTextUnselectedColor(const char* id);
97  void SetAnnotationTextUnselectedColor(const char* id, double * color);
98 
100  double * GetAnnotationColor(const char *id);
102  void SetAnnotationColor(const char *id, double *color);
103 
105  double * GetAnnotationUnselectedColor(const char *id);
107  void SetAnnotationUnselectedColor(const char *id, double *color);
108 
110  double * GetAnnotationPointColor(const char *id);
112  void SetAnnotationPointColor(const char *id, double *color);
113 
115  double * GetAnnotationPointUnselectedColor(const char *id);
117  void SetAnnotationPointUnselectedColor(const char *id, double *color);
118 
121  const char * GetAnnotationPointGlyphTypeAsString(const char *id);
123  int GetAnnotationPointGlyphType(const char *id);
125  void SetAnnotationPointGlyphTypeFromString(const char *id, const char *glyphType);
127  void SetAnnotationPointGlyphType(const char *id, int glyphType);
128 
130  double * GetAnnotationLineColor(const char *id);
132  void SetAnnotationLineColor(const char *id, double *color);
133 
135  double * GetAnnotationLineUnselectedColor(const char *id);
137  void SetAnnotationLineUnselectedColor(const char *id, double *color);
138 
139 
141  const char * GetAnnotationMeasurement(const char * id, bool showUnits);
142 
144  const char * GetAnnotationIcon(const char * id);
145  const char * GetAnnotationIcon(vtkMRMLNode* mrmlNode);
146 
148  int GetAnnotationLockedUnlocked(const char * id);
150  void SetAnnotationLockedUnlocked(const char * id);
151 
153  int GetAnnotationVisibility(const char * id);
155  void SetAnnotationVisibility(const char * id);
156 
158  void SetAnnotationSelected(const char * id, bool selected);
160  void SetAllAnnotationsSelected(bool selected);
161 
163  void BackupAnnotationNode(const char * id);
165  void RestoreAnnotationNode(const char * id);
167  void DeleteBackupNodes(const char * id);
168 
170  void JumpSlicesToAnnotationCoordinate(const char* id);
171 
172  const char * MoveAnnotationUp(const char* id);
173  const char * MoveAnnotationDown(const char* id);
174 
175  //
176  // SnapShot functionality
177  //
179  void CreateSnapShot(const char* name, const char* description, int screenshotType, double scaleFactor, vtkImageData* screenshot);
180 
182  void ModifySnapShot(vtkStdString id, const char* name, const char* description, int screenshotType, double scaleFactor, vtkImageData* screenshot);
183 
185  vtkStdString GetSnapShotName(const char* id);
186 
188  vtkStdString GetSnapShotDescription(const char* id);
189 
191  int GetSnapShotScreenshotType(const char* id);
192 
194  double GetSnapShotScaleFactor(const char* id);
195 
197  vtkImageData* GetSnapShotScreenshot(const char* id);
198 
200  bool IsSnapshotNode(const char* id);
201 
202  //
203  // Hierarchy functionality
204  //
211  bool AddHierarchy();
212 
216  char * GetTopLevelHierarchyNodeID(vtkMRMLNode* node=0);
217 
219  char * GetTopLevelHierarchyNodeIDForNodeClass(vtkMRMLAnnotationNode *annotationNode);
220 
222  vtkMRMLAnnotationHierarchyNode *GetActiveHierarchyNode();
223 
225  vtkGetStringMacro(ActiveHierarchyNodeID);
226  vtkSetStringMacro(ActiveHierarchyNodeID);
227 
229  void SetHierarchyAnnotationsVisibleFlag(vtkMRMLAnnotationHierarchyNode* hierarchyNode, bool flag);
231  void SetHierarchyAnnotationsLockFlag(vtkMRMLAnnotationHierarchyNode* hierarchyNode, bool flag);
232 
233  //
234  // Place Annotations programmatically
235  //
236 
237  //
238  // Report functionality
239  //
241  const char* GetHTMLRepresentation(vtkMRMLAnnotationNode* annotationNode, int level);
243  const char* GetHTMLRepresentation(vtkMRMLAnnotationHierarchyNode* hierarchyNode, int level);
244 
245 
248  const char* AddDisplayNodeForHierarchyNode(vtkMRMLAnnotationHierarchyNode *hnode);
249 
252  char *LoadFiducialList(const char *filename);
253 
257  char *LoadAnnotation(const char *filename, const char *name, int fileType);
259  enum
260  {
261  None = 0,
265  };
266 
271  char *AddFiducial(double r=0.0, double a=0.0, double s=0.0, const char *label=NULL);
272 
273 protected:
274 
276 
278 
279  // Initialize listening to MRML events
280  virtual void SetMRMLSceneInternal(vtkMRMLScene * newScene) VTK_OVERRIDE;
281  virtual void ObserveMRMLScene() VTK_OVERRIDE;
282 
283  // MRML events
284  virtual void OnMRMLSceneNodeAdded(vtkMRMLNode* node) VTK_OVERRIDE;
285  virtual void OnMRMLSceneEndClose() VTK_OVERRIDE;
286  virtual void ProcessMRMLNodesEvents(vtkObject *caller,
287  unsigned long event,
288  void *callData ) VTK_OVERRIDE;
289  virtual void OnMRMLAnnotationNodeModifiedEvent(vtkMRMLNode* node);
290 
291 private:
292 
293  vtkMRMLAnnotationNode* m_LastAddedAnnotationNode;
294 
295  std::string m_StringHolder;
296 
297  char* m_MeasurementFormat;
298  char* m_CoordinateFormat;
299 
300  // id of the currently active hierarchy node
301  char *ActiveHierarchyNodeID;
302 
303  //
304  // Private hierarchy functionality.
305  //
312  bool AddHierarchyNodeForAnnotation(vtkMRMLAnnotationNode* annotationNode=0);
313 
314 
315 };
316 
317 #endif
static vtkSlicerModuleLogic * New()
The Usual vtk class functions.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
LRU Cache.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
virtual void ObserveMRMLScene()
virtual void SetMRMLSceneInternal(vtkMRMLScene *newScene)
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:138