Slicer  4.8
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 
31  // Start the place mode for annotations
32  void StartPlaceMode(bool persistent=false);
33 
34  // Exit the place mode for annotations
35  void StopPlaceMode(bool persistent=false);
36 
37  // Start adding a new annotation Node
38  void AddAnnotationNode(const char * nodeDescriptor, bool persistent=false);
39 
40  // After a node was added, propagate to widget
41  void AddNodeCompleted(vtkMRMLAnnotationNode* annotationNode);
42 
43  // Cancel the current annotation placement or remove last annotation node
44  void CancelCurrentOrRemoveLastAddedAnnotationNode();
45 
47  void RemoveAnnotationNode(vtkMRMLAnnotationNode* annotationNode);
48 
49  //
50  // Annotation Properties (interface to MRML)
51  //
53  virtual void RegisterNodes() VTK_OVERRIDE;
54 
56  bool IsAnnotationNode(const char* id);
57 
58  bool IsAnnotationHierarchyNode(const char* id);
59 
63  vtkMRMLAnnotationTextDisplayNode *GetTextDisplayNode(const char *id);
67  vtkMRMLAnnotationPointDisplayNode *GetPointDisplayNode(const char *id);
71  vtkMRMLAnnotationLineDisplayNode *GetLineDisplayNode(const char *id);
72 
74  const char * GetAnnotationName(const char * id);
75 
77  vtkStdString GetAnnotationText(const char* id);
79  void SetAnnotationText(const char* id, const char * newtext);
80 
82  double GetAnnotationTextScale(const char* id);
84  void SetAnnotationTextScale(const char* id, double textScale);
85 
87  double * GetAnnotationTextSelectedColor(const char* id);
89  void SetAnnotationTextSelectedColor(const char* id, double * color);
90 
92  double * GetAnnotationTextUnselectedColor(const char* id);
94  void SetAnnotationTextUnselectedColor(const char* id, double * color);
95 
97  double * GetAnnotationColor(const char *id);
99  void SetAnnotationColor(const char *id, double *color);
100 
102  double * GetAnnotationUnselectedColor(const char *id);
104  void SetAnnotationUnselectedColor(const char *id, double *color);
105 
107  double * GetAnnotationPointColor(const char *id);
109  void SetAnnotationPointColor(const char *id, double *color);
110 
112  double * GetAnnotationPointUnselectedColor(const char *id);
114  void SetAnnotationPointUnselectedColor(const char *id, double *color);
115 
118  const char * GetAnnotationPointGlyphTypeAsString(const char *id);
120  int GetAnnotationPointGlyphType(const char *id);
122  void SetAnnotationPointGlyphTypeFromString(const char *id, const char *glyphType);
124  void SetAnnotationPointGlyphType(const char *id, int glyphType);
125 
127  double * GetAnnotationLineColor(const char *id);
129  void SetAnnotationLineColor(const char *id, double *color);
130 
132  double * GetAnnotationLineUnselectedColor(const char *id);
134  void SetAnnotationLineUnselectedColor(const char *id, double *color);
135 
136 
138  const char * GetAnnotationMeasurement(const char * id, bool showUnits);
139 
141  const char * GetAnnotationIcon(const char * id);
142  const char * GetAnnotationIcon(vtkMRMLNode* mrmlNode);
143 
145  int GetAnnotationLockedUnlocked(const char * id);
147  void SetAnnotationLockedUnlocked(const char * id);
148 
150  int GetAnnotationVisibility(const char * id);
152  void SetAnnotationVisibility(const char * id);
153 
155  void SetAnnotationSelected(const char * id, bool selected);
157  void SetAllAnnotationsSelected(bool selected);
158 
160  void BackupAnnotationNode(const char * id);
162  void RestoreAnnotationNode(const char * id);
164  void DeleteBackupNodes(const char * id);
165 
167  void JumpSlicesToAnnotationCoordinate(const char* id);
168 
169  const char * MoveAnnotationUp(const char* id);
170  const char * MoveAnnotationDown(const char* id);
171 
172  //
173  // SnapShot functionality
174  //
176  void CreateSnapShot(const char* name, const char* description, int screenshotType, double scaleFactor, vtkImageData* screenshot);
177 
179  void ModifySnapShot(vtkStdString id, const char* name, const char* description, int screenshotType, double scaleFactor, vtkImageData* screenshot);
180 
182  vtkStdString GetSnapShotName(const char* id);
183 
185  vtkStdString GetSnapShotDescription(const char* id);
186 
188  int GetSnapShotScreenshotType(const char* id);
189 
191  double GetSnapShotScaleFactor(const char* id);
192 
194  vtkImageData* GetSnapShotScreenshot(const char* id);
195 
197  bool IsSnapshotNode(const char* id);
198 
199  //
200  // Hierarchy functionality
201  //
208  bool AddHierarchy();
209 
213  char * GetTopLevelHierarchyNodeID(vtkMRMLNode* node=0);
214 
216  char * GetTopLevelHierarchyNodeIDForNodeClass(vtkMRMLAnnotationNode *annotationNode);
217 
219  vtkMRMLAnnotationHierarchyNode *GetActiveHierarchyNode();
220 
222  vtkGetStringMacro(ActiveHierarchyNodeID);
223  vtkSetStringMacro(ActiveHierarchyNodeID);
224 
226  void SetHierarchyAnnotationsVisibleFlag(vtkMRMLAnnotationHierarchyNode* hierarchyNode, bool flag);
228  void SetHierarchyAnnotationsLockFlag(vtkMRMLAnnotationHierarchyNode* hierarchyNode, bool flag);
229 
230  //
231  // Place Annotations programmatically
232  //
233 
234  //
235  // Report functionality
236  //
238  const char* GetHTMLRepresentation(vtkMRMLAnnotationNode* annotationNode, int level);
240  const char* GetHTMLRepresentation(vtkMRMLAnnotationHierarchyNode* hierarchyNode, int level);
241 
242 
245  const char* AddDisplayNodeForHierarchyNode(vtkMRMLAnnotationHierarchyNode *hnode);
246 
249  char *LoadFiducialList(const char *filename);
250 
254  char *LoadAnnotation(const char *filename, const char *name, int fileType);
256  enum
257  {
258  None = 0,
262  };
263 
268  char *AddFiducial(double r=0.0, double a=0.0, double s=0.0, const char *label=NULL);
269 
270 protected:
271 
273 
275 
276  // Initialize listening to MRML events
277  virtual void SetMRMLSceneInternal(vtkMRMLScene * newScene) VTK_OVERRIDE;
278  virtual void ObserveMRMLScene() VTK_OVERRIDE;
279 
280  // MRML events
281  virtual void OnMRMLSceneNodeAdded(vtkMRMLNode* node) VTK_OVERRIDE;
282  virtual void OnMRMLSceneEndClose() VTK_OVERRIDE;
283  virtual void ProcessMRMLNodesEvents(vtkObject *caller,
284  unsigned long event,
285  void *callData ) VTK_OVERRIDE;
286  virtual void OnMRMLAnnotationNodeModifiedEvent(vtkMRMLNode* node);
287  virtual void OnInteractionModeChangedEvent(vtkMRMLInteractionNode *interactionNode);
288  virtual void OnInteractionModePersistenceChangedEvent(vtkMRMLInteractionNode *interactionNode);
289 
290 private:
291 
292  vtkMRMLAnnotationNode* m_LastAddedAnnotationNode;
293 
294  std::string m_StringHolder;
295 
296  char* m_MeasurementFormat;
297  char* m_CoordinateFormat;
298 
299  // id of the currently active hierarchy node
300  char *ActiveHierarchyNodeID;
301 
302  //
303  // Private hierarchy functionality.
304  //
311  bool AddHierarchyNodeForAnnotation(vtkMRMLAnnotationNode* annotationNode=0);
312 
313 
314 };
315 
316 #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:135