Slicer  4.8
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 
32 class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkMRMLMarkupsDisplayNode : public vtkMRMLDisplayNode
33 {
34 public:
35  static vtkMRMLMarkupsDisplayNode *New();
37  void PrintSelf ( ostream& os, vtkIndent indent ) VTK_OVERRIDE;
38 
39  //--------------------------------------------------------------------------
40  // MRMLNode methods
41  //--------------------------------------------------------------------------
42 
43  virtual vtkMRMLNode* CreateNodeInstance ( ) VTK_OVERRIDE;
44 
45  // Read node attributes from XML (MRML) file
46  virtual void ReadXMLAttributes ( const char** atts ) VTK_OVERRIDE;
47 
48  // Write this node's information to a MRML file in XML format.
49  virtual void WriteXML ( ostream& of, int indent ) VTK_OVERRIDE;
50 
51 
52  // Copy the node's attributes to this object
53  virtual void Copy ( vtkMRMLNode *node ) VTK_OVERRIDE;
54 
55  // Get node XML tag name (like Volume, Markups)
56  virtual const char* GetNodeTagName() VTK_OVERRIDE {return "MarkupsDisplay";};
57 
58  // Finds the storage node and read the data
59  virtual void UpdateScene(vtkMRMLScene *scene) VTK_OVERRIDE;
60 
61  // Alternative method to propagate events generated in Display nodes
62  virtual void ProcessMRMLEvents ( vtkObject * /*caller*/,
63  unsigned long /*event*/,
64  void * /*callData*/ ) VTK_OVERRIDE;
65 
67  vtkGetMacro(TextScale,double);
68  vtkSetMacro(TextScale,double);
69 
73  {
74  GlyphMin = 1,
75  Vertex2D = GlyphMin,
89  GlyphMax = Sphere3D,
90  };
94 
96  void SetGlyphType(int type);
97  vtkGetMacro(GlyphType, int);
99  int GlyphTypeIs3D(int glyphType);
100  int GlyphTypeIs3D() { return this->GlyphTypeIs3D(this->GlyphType); };
101 
103  const char* GetGlyphTypeAsString();
104  const char* GetGlyphTypeAsString(int g);
105  void SetGlyphTypeFromString(const char *glyphString);
106 
108  void SetGlyphScale(double scale);
109  vtkGetMacro(GlyphScale,double);
110 
113  enum
114  {
115  ResetToDefaultsEvent = 19001,
116  };
117 
123  vtkSetMacro(SliceProjection, int);
124  vtkGetMacro(SliceProjection, int);
125 
127  inline void SliceProjectionOn();
128 
130  inline void SliceProjectionOff();
131 
134  vtkSetVector3Macro(SliceProjectionColor, double);
135  vtkGetVector3Macro(SliceProjectionColor, double);
136 
139  vtkSetClampMacro(SliceProjectionOpacity, double, 0.0, 1.0);
140  vtkGetMacro(SliceProjectionOpacity, double);
141 
144  inline void SliceProjectionUseFiducialColorOn();
145 
148  inline void SliceProjectionUseFiducialColorOff();
149 
152  inline bool GetSliceProjectionUseFiducialColor();
153 
156  inline void SliceProjectionOutlinedBehindSlicePlaneOn();
157 
160  inline void SliceProjectionOutlinedBehindSlicePlaneOff();
161 
164  inline bool GetSliceProjectionOutlinedBehindSlicePlane();
165 
173  {
174  ProjectionOff = 0x00,
175  ProjectionOn = 0x01,
176  ProjectionUseFiducialColor = 0x02,
177  ProjectionOutlinedBehindSlicePlane = 0x04
178  };
179 
180 protected:
184  void operator= ( const vtkMRMLMarkupsDisplayNode& );
185 
186  double TextScale;
188  double GlyphScale;
189  static const char* GlyphTypesNames[GlyphMax+2];
190 
192  double SliceProjectionColor[3];
194 };
195 
196 //----------------------------------------------------------------------------
198 {
199  this->SetSliceProjection( this->GetSliceProjection() |
201 }
202 
203 //----------------------------------------------------------------------------
205 {
206  this->SetSliceProjection( this->GetSliceProjection() &
208 }
209 
210 //----------------------------------------------------------------------------
212 {
213  this->SetSliceProjection( this->GetSliceProjection() |
215 }
216 
217 //----------------------------------------------------------------------------
219 {
220  this->SetSliceProjection( this->GetSliceProjection() &
222 }
223 
224 //----------------------------------------------------------------------------
226 {
227  if (this->GetSliceProjection() &
228  this->ProjectionUseFiducialColor)
229  {
230  return true;
231  }
232  else
233  {
234  return false;
235  }
236 }
237 
238 //----------------------------------------------------------------------------
240 {
241  this->SetSliceProjection( this->GetSliceProjection() |
243 }
244 
245 //----------------------------------------------------------------------------
247 {
248  this->SetSliceProjection( this->GetSliceProjection() &
250 }
251 
252 //----------------------------------------------------------------------------
254 {
255  if (this->GetSliceProjection() &
256  this->ProjectionOutlinedBehindSlicePlane)
257  {
258  return true;
259  }
260  else
261  {
262  return false;
263  }
264 }
265 
266 #endif
virtual void ProcessMRMLEvents(vtkObject *caller, unsigned long event, void *callData) VTK_OVERRIDE
virtual vtkMRMLNode * CreateNodeInstance()=0
Create instance of the default node. Like New only virtual.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
void operator=(const vtkMRMLDisplayNode &)
int GetMinimumGlyphType()
Return the min/max glyph types, for iterating over them in tcl.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
void SliceProjectionOn()
Set SliceProjection to On.
Abstract class that contains graphical display properties for displayable nodes.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
virtual void UpdateScene(vtkMRMLScene *scene) VTK_OVERRIDE
Finds the storage node and read the data.
void SliceProjectionOff()
Set SliceProjection to Off.