Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLMarkupsDisplayNode.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 ==============================================================================*/
17 
18 // .NAME vtkMRMLMarkupsDisplayNode - MRML node to represent display properties for markups
19 // .SECTION Description
20 // vtkMRMLMarkupsDisplayNode nodes store display properties of markups,
21 // keeping elements that are applicable to all parts of the markups in this superclass
22 //
23 
24 #ifndef __vtkMRMLMarkupsDisplayNode_h
25 #define __vtkMRMLMarkupsDisplayNode_h
26 
27 #include "vtkSlicerMarkupsModuleMRMLExport.h"
28 
29 #include "vtkMRMLDisplayNode.h"
30 #include "vtkMRMLMarkupsNode.h"
31 
32 // vtkAddon includes
33 #include <vtkAddonSetGet.h>
34 
35 // STD includes
36 #include <map>
37 
38 // VTK include
39 #include <vtkTextProperty.h>
40 
43 
45 class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkMRMLMarkupsDisplayNode : public vtkMRMLDisplayNode
46 {
47 public:
48  static vtkMRMLMarkupsDisplayNode *New();
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
52  //--------------------------------------------------------------------------
53  // MRMLNode methods
54  //--------------------------------------------------------------------------
55 
56  vtkMRMLNode* CreateNodeInstance() override;
57 
59  void ReadXMLAttributes(const char** atts) override;
60 
62  void WriteXML(ostream& of, int indent) override;
63 
67 
69  const char* GetNodeTagName() override { return "MarkupsDisplay"; };
70 
72  void UpdateScene(vtkMRMLScene* scene) override;
73 
75  void ProcessMRMLEvents(vtkObject* /*caller*/, unsigned long /*event*/, void* /*callData*/ ) override;
76 
78  vtkMRMLMarkupsNode* GetMarkupsNode();
79 
81  static const std::string GetDefaultContextName() { return ""; };
82 
89  int GetActiveComponentType(std::string context=vtkMRMLMarkupsDisplayNode::GetDefaultContextName());
91  {
92  ComponentNone = 0,
100  Component_Last
101  };
103  {
105  {
106  this->Type = ComponentNone;
107  this->Index = -1;
108  }
109  int Type;
110  int Index;
111  };
112 
116  int GetActiveComponentIndex(std::string context=vtkMRMLMarkupsDisplayNode::GetDefaultContextName());
117 
119  void SetActiveComponent(int componentType, int componentIndex,
121 
123  bool HasActiveComponent();
124 
127  std::vector<std::string> GetActiveComponentInteractionContexts();
128 
130  void SetActiveControlPoint(int controlPointIndex);
131 
136  int UpdateActiveControlPointWorld(int controlPointIndex, vtkMRMLInteractionEventData* eventData,
137  double accurateWorldOrientationMatrix[9], const char* viewNodeID,
138  const char* associatedNodeID, int positionStatus);
139 
142  void GetActiveControlPoints(std::vector<int>& controlPointIndices);
146  int GetActiveControlPoint(std::string context=vtkMRMLMarkupsDisplayNode::GetDefaultContextName());
147 
149  vtkGetMacro(TextScale,double);
150  vtkSetMacro(TextScale,double);
151 
153 
156  vtkSetMacro(PointLabelsVisibility, bool);
157  vtkGetMacro(PointLabelsVisibility, bool);
158  vtkBooleanMacro(PointLabelsVisibility, bool);
160 
162 
165  vtkSetMacro(PropertiesLabelVisibility, bool);
166  vtkGetMacro(PropertiesLabelVisibility, bool);
167  vtkBooleanMacro(PropertiesLabelVisibility, bool);
169 
171 
174  vtkSetMacro(FillVisibility, bool);
175  vtkGetMacro(FillVisibility, bool);
176  vtkBooleanMacro(FillVisibility, bool);
177 
179 
182  vtkSetMacro(OutlineVisibility, bool);
183  vtkGetMacro(OutlineVisibility, bool);
184  vtkBooleanMacro(OutlineVisibility, bool);
185 
187 
190  vtkSetMacro(FillOpacity, double);
191  vtkGetMacro(FillOpacity, double);
192  vtkBooleanMacro(FillOpacity, double);
193 
195 
198  vtkSetMacro(OutlineOpacity, double);
199  vtkGetMacro(OutlineOpacity, double);
200  vtkBooleanMacro(OutlineOpacity, double);
201 
204  {
205  SnapModeUnconstrained, //< point is moved independently from displayed objects in 3D views (e.g., in parallel with camera plane)
206  SnapModeToVisibleSurface, //< point is snapped to any visible surface in 3D views
207  //SnapModeToNode //< point is snapped to a specific node, not implemented yet
208  SnapMode_Last // insert new items above this line
209  };
210 
214  {
215  GlyphTypeInvalid = 0,
230  GlyphType_Last // insert new types above this line
231  };
233  static int GetMinimumGlyphType() { return 1; };
235 
237  vtkSetMacro(GlyphType, int);
238  vtkGetMacro(GlyphType, int);
240  int GlyphTypeIs3D(int glyphType);
241  int GlyphTypeIs3D() { return this->GlyphTypeIs3D(this->GlyphType); };
242 
244  const char* GetGlyphTypeAsString();
245  void SetGlyphTypeFromString(const char* glyphString);
246 
247  static const char* GetGlyphTypeAsString(int g);
248  static int GetGlyphTypeFromString(const char*);
249 
252  vtkSetMacro(SnapMode, int);
253  vtkGetMacro(SnapMode, int);
254 
255  static const char* GetSnapModeAsString(int g);
256  static int GetSnapModeFromString(const char*);
257 
265  vtkSetMacro(GlyphScale,double);
266  vtkGetMacro(GlyphScale,double);
267 
271  vtkSetMacro(GlyphSize,double);
272  vtkGetMacro(GlyphSize,double);
273 
278  vtkSetMacro(UseGlyphScale, bool);
279  vtkGetMacro(UseGlyphScale, bool);
280  vtkBooleanMacro(UseGlyphScale, bool);
281 
282  enum
283  {
284  ResetToDefaultsEvent = 19001, //< reset this node to the default values, request completed by markups logic
285  JumpToPointEvent,
287  ActionEvent,
289  CustomActionEvent1,
292  CustomActionEvent2,
295  CustomActionEvent3,
298  CustomActionEvent4,
301  CustomActionEvent5,
304  CustomActionEvent6,
307  };
308 
314  vtkSetMacro(SliceProjection, bool);
315  vtkGetMacro(SliceProjection, bool);
316  vtkBooleanMacro(SliceProjection, bool);
317 
320  vtkSetMacro(SliceProjectionUseFiducialColor, bool);
321  vtkGetMacro(SliceProjectionUseFiducialColor, bool);
322  vtkBooleanMacro(SliceProjectionUseFiducialColor, bool);
323 
326  vtkSetMacro(SliceProjectionOutlinedBehindSlicePlane, bool);
327  vtkGetMacro(SliceProjectionOutlinedBehindSlicePlane, bool);
328  vtkBooleanMacro(SliceProjectionOutlinedBehindSlicePlane, bool);
329 
332  vtkSetVector3Macro(SliceProjectionColor, double);
333  vtkGetVector3Macro(SliceProjectionColor, double);
334 
337  vtkSetClampMacro(SliceProjectionOpacity, double, 0.0, 1.0);
338  vtkGetMacro(SliceProjectionOpacity, double);
339 
343  {
344  UseLineThickness = 0,
346  CurveLineSizeMode_Last // insert new types above this line
347  };
348 
351  vtkSetMacro(CurveLineSizeMode, int);
352  vtkGetMacro(CurveLineSizeMode, int);
353  const char* GetCurveLineSizeModeAsString();
354  void SetCurveLineSizeModeFromString(const char* modeString);
355  static const char* GetCurveLineSizeModeAsString(int mode);
356  static int GetCurveLineSizeModeFromString(const char*);
357 
363  vtkGetMacro(LineThickness, double);
364  vtkSetMacro(LineThickness, double);
365 
370  vtkGetMacro(LineDiameter, double);
371  vtkSetMacro(LineDiameter, double);
372 
375  vtkGetMacro(LineColorFadingStart, double);
376  vtkSetMacro(LineColorFadingStart, double);
377 
380  vtkGetMacro(LineColorFadingEnd, double);
381  vtkSetMacro(LineColorFadingEnd, double);
382 
385  vtkSetClampMacro(LineColorFadingSaturation, double, 0.0, 1.0);
386  vtkGetMacro(LineColorFadingSaturation, double);
387 
390  vtkSetClampMacro(LineColorFadingHueOffset, double, 0.0, 1.0);
391  vtkGetMacro(LineColorFadingHueOffset, double);
392 
397  virtual void SetLineColorNodeID(const char *lineColorNodeID);
398 
400  const char* GetLineColorNodeID();
401 
403  vtkMRMLProceduralColorNode* GetLineColorNode();
404  virtual const char* GetLineColorNodeReferenceRole();
405 
409  vtkGetMacro(OccludedVisibility, bool);
410  vtkSetMacro(OccludedVisibility, bool);
411  vtkBooleanMacro(OccludedVisibility, bool);
412 
416  vtkGetMacro(OccludedOpacity, double);
417  vtkSetMacro(OccludedOpacity, double);
418 
422  vtkGetObjectMacro(TextProperty, vtkTextProperty);
423 
425  vtkSetVector3Macro(ActiveColor, double);
427  vtkGetVector3Macro(ActiveColor, double);
428 
430  vtkGetMacro(HandlesInteractive, bool);
432  vtkSetMacro(HandlesInteractive, bool);
433  vtkBooleanMacro(HandlesInteractive, bool);
434  vtkGetMacro(TranslationHandleVisibility, bool);
435  vtkSetMacro(TranslationHandleVisibility, bool);
436  vtkBooleanMacro(TranslationHandleVisibility, bool);
437  vtkGetMacro(RotationHandleVisibility, bool);
438  vtkSetMacro(RotationHandleVisibility, bool);
439  vtkBooleanMacro(RotationHandleVisibility, bool);
440  vtkGetMacro(ScaleHandleVisibility, bool);
441  vtkSetMacro(ScaleHandleVisibility, bool);
442  vtkBooleanMacro(ScaleHandleVisibility, bool);
443  void SetHandleVisibility(int handleType, bool visibility);
444  bool GetHandleVisibility(int handleType);
446 
448  vtkSetMacro(InteractionHandleScale, double);
451  vtkGetMacro(InteractionHandleScale, double);
453 
455  vtkSetVector4Macro(RotationHandleComponentVisibility, bool);
460  vtkGetVector4Macro(RotationHandleComponentVisibility, bool);
461  vtkSetVector4Macro(ScaleHandleComponentVisibility, bool);
462  vtkGetVector4Macro(ScaleHandleComponentVisibility, bool);
463  vtkSetVector4Macro(TranslationHandleComponentVisibility, bool);
464  vtkGetVector4Macro(TranslationHandleComponentVisibility, bool);
466 
469  virtual vtkDataSet* GetScalarDataSet() override;
471  virtual vtkDataArray* GetActiveScalarArray() override;
472 
474  virtual void UpdateAssignedAttribute() override;
475 
476  virtual void SetScalarVisibility(int visibility) override;
477 
479  vtkGetMacro(CanDisplayScaleHandles, bool);
480 
481 protected:
483  ~vtkMRMLMarkupsDisplayNode() override;
485  void operator= ( const vtkMRMLMarkupsDisplayNode& );
486 
487  // Set the text style from a string
488  // String format follows html-style conventions
489  void SetTextPropertyFromString(std::string textPropertyString);
490 
491  // Return a string representing the text style
492  // String format follows html-style conventions
493  std::string GetTextPropertyAsString();
494 
497  std::map<std::string, ComponentInfo> ActiveComponents;
498 
499  int SnapMode;
500 
505  double FillOpacity;
507  double TextScale;
509  double GlyphScale;
510  double GlyphSize;
512 
516  double SliceProjectionColor[3];
518 
519  virtual const char* GetLineColorNodeReferenceMRMLAttributeName();
520 
521  static const char* LineColorNodeReferenceRole;
523 
526  double LineDiameter;
527 
532 
535 
536  vtkTextProperty* TextProperty;
537 
538  double ActiveColor[3];
539 
545 
546  bool RotationHandleComponentVisibility[4];
547  bool ScaleHandleComponentVisibility[4];
548  bool TranslationHandleComponentVisibility[4];
549 
551 };
552 #endif
std::map< std::string, ComponentInfo > ActiveComponents
void PrintSelf(ostream &os, vtkIndent indent) override
virtual vtkDataArray * GetActiveScalarArray()
static const std::string GetDefaultContextName()
Get name of the default interaction context (typically the mouse)
void ReadXMLAttributes(const char **atts) override
void UpdateScene(vtkMRMLScene *scene) override
Finds the storage node and read the data.
virtual vtkMRMLNode * CreateNodeInstance()=0
Create instance of the default node. Like New only virtual.
vtkMRMLCopyContentMacro(vtkMRMLDisplayNode)
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
SnapModes
Define how points are placed and moved in views.
void WriteXML(ostream &of, int indent) override
static std::string GetTextPropertyAsString(vtkTextProperty *property)
void operator=(const vtkMRMLDisplayNode &)
virtual vtkDataSet * GetScalarDataSet()
void ProcessMRMLEvents(vtkObject *caller, unsigned long event, void *callData) override
MRML node to represent procedurally defined color information.
virtual void SetScalarVisibility(int)
static int GetMinimumGlyphType()
Return the min/max glyph types, for iterating over them in tcl.
static const char * LineColorNodeReferenceRole
Abstract class that contains graphical display properties for displayable nodes.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Markups)
static const char * LineColorNodeReferenceMRMLAttributeName
virtual void UpdateAssignedAttribute()