Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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 "vtkMRMLExport.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
44class VTK_MRML_EXPORT vtkMRMLMarkupsDisplayNode : public vtkMRMLDisplayNode
45{
46public:
49 void PrintSelf(ostream& os, vtkIndent indent) override;
50
51 //--------------------------------------------------------------------------
52 // MRMLNode methods
53 //--------------------------------------------------------------------------
54
56
58 void ReadXMLAttributes(const char** atts) override;
59
61 void WriteXML(ostream& of, int indent) override;
62
66
68 const char* GetNodeTagName() override { return "MarkupsDisplay"; };
69
71 void UpdateScene(vtkMRMLScene* scene) override;
72
74 void ProcessMRMLEvents(vtkObject* /*caller*/, unsigned long /*event*/, void* /*callData*/) override;
75
78
80 static const std::string GetDefaultContextName() { return ""; };
81
102 {
104 {
105 this->Type = ComponentNone;
106 this->Index = -1;
107 }
108 int Type;
109 int Index;
110 };
111
116
118 void SetActiveComponent(int componentType, int componentIndex, std::string context = vtkMRMLMarkupsDisplayNode::GetDefaultContextName());
119
122
125 std::vector<std::string> GetActiveComponentInteractionContexts();
126
128 void SetActiveControlPoint(int controlPointIndex);
129
134 int UpdateActiveControlPointWorld(int controlPointIndex,
136 double accurateWorldOrientationMatrix[9],
137 const char* viewNodeID,
138 const char* associatedNodeID,
139 int positionStatus);
140
143 void GetActiveControlPoints(std::vector<int>& controlPointIndices);
148
156 static const char* GetMovingInSliceViewAttributeName() { return "Markups.MovingInSliceView"; }
157 static const char* GetMovingMarkupIndexAttributeName() { return "Markups.MovingMarkupIndex"; }
159
161 vtkGetMacro(TextScale, double);
162 vtkSetMacro(TextScale, double);
163
165
168 vtkSetMacro(PointLabelsVisibility, bool);
169 vtkGetMacro(PointLabelsVisibility, bool);
170 vtkBooleanMacro(PointLabelsVisibility, bool);
172
174
177 vtkSetMacro(PropertiesLabelVisibility, bool);
178 vtkGetMacro(PropertiesLabelVisibility, bool);
179 vtkBooleanMacro(PropertiesLabelVisibility, bool);
181
183
186 vtkSetMacro(FillVisibility, bool);
187 vtkGetMacro(FillVisibility, bool);
188 vtkBooleanMacro(FillVisibility, bool);
189
191
194 vtkSetMacro(OutlineVisibility, bool);
195 vtkGetMacro(OutlineVisibility, bool);
196 vtkBooleanMacro(OutlineVisibility, bool);
197
199
202 vtkSetMacro(FillOpacity, double);
203 vtkGetMacro(FillOpacity, double);
204 vtkBooleanMacro(FillOpacity, double);
205
207
210 vtkSetMacro(OutlineOpacity, double);
211 vtkGetMacro(OutlineOpacity, double);
212 vtkBooleanMacro(OutlineOpacity, double);
213
216 {
217 SnapModeUnconstrained, //< point is moved independently from displayed objects in 3D views (e.g., in parallel with camera plane)
218 SnapModeToVisibleSurface, //< point is snapped to any visible surface in 3D views
219 // SnapModeToNode //< point is snapped to a specific node, not implemented yet
220 SnapMode_Last // insert new items above this line
221 };
222
244
245 static int GetMinimumGlyphType() { return 1; };
247
249 vtkSetMacro(GlyphType, int);
250 vtkGetMacro(GlyphType, int);
252 int GlyphTypeIs3D(int glyphType);
253 int GlyphTypeIs3D() { return this->GlyphTypeIs3D(this->GlyphType); };
254
256 const char* GetGlyphTypeAsString();
257 void SetGlyphTypeFromString(const char* glyphString);
258
259 static const char* GetGlyphTypeAsString(int g);
260 static int GetGlyphTypeFromString(const char*);
261
264 vtkSetMacro(SnapMode, int);
265 vtkGetMacro(SnapMode, int);
266
267 static const char* GetSnapModeAsString(int g);
268 static int GetSnapModeFromString(const char*);
269
275 vtkSetMacro(GlyphScale, double);
276 vtkGetMacro(GlyphScale, double);
277
281 vtkSetMacro(GlyphSize, double);
282 vtkGetMacro(GlyphSize, double);
283
288 vtkSetMacro(UseGlyphScale, bool);
289 vtkGetMacro(UseGlyphScale, bool);
290 vtkBooleanMacro(UseGlyphScale, bool);
291
292 enum
293 {
294 ResetToDefaultsEvent = 19001, //< reset this node to the default values, request completed by markups logic
317 };
318
324 vtkSetMacro(SliceProjection, bool);
325 vtkGetMacro(SliceProjection, bool);
326 vtkBooleanMacro(SliceProjection, bool);
327
332 vtkBooleanMacro(SliceProjectionUseFiducialColor, bool);
333
339
342 vtkSetVector3Macro(SliceProjectionColor, double);
343 vtkGetVector3Macro(SliceProjectionColor, double);
344
347 vtkSetClampMacro(SliceProjectionOpacity, double, 0.0, 1.0);
348 vtkGetMacro(SliceProjectionOpacity, double);
349
353 {
356 CurveLineSizeMode_Last // insert new types above this line
357 };
358
361 vtkSetMacro(CurveLineSizeMode, int);
362 vtkGetMacro(CurveLineSizeMode, int);
364 void SetCurveLineSizeModeFromString(const char* modeString);
365 static const char* GetCurveLineSizeModeAsString(int mode);
366 static int GetCurveLineSizeModeFromString(const char*);
367
373 vtkGetMacro(LineThickness, double);
374 vtkSetMacro(LineThickness, double);
375
380 vtkGetMacro(LineDiameter, double);
381 vtkSetMacro(LineDiameter, double);
382
385 vtkGetMacro(LineColorFadingStart, double);
386 vtkSetMacro(LineColorFadingStart, double);
387
390 vtkGetMacro(LineColorFadingEnd, double);
391 vtkSetMacro(LineColorFadingEnd, double);
392
395 vtkSetClampMacro(LineColorFadingSaturation, double, 0.0, 1.0);
396 vtkGetMacro(LineColorFadingSaturation, double);
397
400 vtkSetClampMacro(LineColorFadingHueOffset, double, 0.0, 1.0);
401 vtkGetMacro(LineColorFadingHueOffset, double);
402
407 virtual void SetLineColorNodeID(const char* lineColorNodeID);
408
410 const char* GetLineColorNodeID();
411
414 virtual const char* GetLineColorNodeReferenceRole();
415
419 vtkGetMacro(OccludedVisibility, bool);
420 vtkSetMacro(OccludedVisibility, bool);
421 vtkBooleanMacro(OccludedVisibility, bool);
422
426 vtkGetMacro(OccludedOpacity, double);
427 vtkSetMacro(OccludedOpacity, double);
428
432 vtkGetObjectMacro(TextProperty, vtkTextProperty);
433
435 vtkSetVector3Macro(ActiveColor, double);
437 vtkGetVector3Macro(ActiveColor, double);
438
440
441 vtkGetMacro(HandlesInteractive, bool);
442 vtkSetMacro(HandlesInteractive, bool);
443 vtkBooleanMacro(HandlesInteractive, bool);
444 vtkGetMacro(TranslationHandleVisibility, bool);
445 vtkSetMacro(TranslationHandleVisibility, bool);
446 vtkBooleanMacro(TranslationHandleVisibility, bool);
447 vtkGetMacro(RotationHandleVisibility, bool);
448 vtkSetMacro(RotationHandleVisibility, bool);
449 vtkBooleanMacro(RotationHandleVisibility, bool);
450 vtkGetMacro(ScaleHandleVisibility, bool);
451 vtkSetMacro(ScaleHandleVisibility, bool);
452 vtkBooleanMacro(ScaleHandleVisibility, bool);
453 void SetHandleVisibility(int handleType, bool visibility);
454 bool GetHandleVisibility(int handleType);
456
458
460 vtkSetMacro(InteractionHandleScale, double);
461 vtkGetMacro(InteractionHandleScale, double);
463
465
469 vtkSetVector4Macro(RotationHandleComponentVisibility, bool);
470 vtkGetVector4Macro(RotationHandleComponentVisibility, bool);
471 vtkSetVector4Macro(ScaleHandleComponentVisibility, bool);
472 vtkGetVector4Macro(ScaleHandleComponentVisibility, bool);
473 vtkSetVector4Macro(TranslationHandleComponentVisibility, bool);
474 vtkGetVector4Macro(TranslationHandleComponentVisibility, bool);
476
479 virtual vtkDataSet* GetScalarDataSet() override;
481 virtual vtkDataArray* GetActiveScalarArray() override;
482
484 virtual void UpdateAssignedAttribute() override;
485
486 virtual void SetScalarVisibility(int visibility) override;
487
489 vtkGetMacro(CanDisplayScaleHandles, bool);
490
491protected:
496
497 // Set the text style from a string
498 // String format follows html-style conventions
499 void SetTextPropertyFromString(std::string textPropertyString);
500
501 // Return a string representing the text style
502 // String format follows html-style conventions
504
507 std::map<std::string, ComponentInfo> ActiveComponents;
508
510
517 double TextScale;
520 double GlyphSize;
522
528
530
531 static const char* LineColorNodeReferenceRole;
533
537
542
545
546 vtkTextProperty* TextProperty;
547
548 double ActiveColor[3];
549
555
559
561};
562#endif
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML (MRML) file.
static const char * LineColorNodeReferenceRole
void operator=(const vtkMRMLMarkupsDisplayNode &)
vtkMRMLMarkupsDisplayNode(const vtkMRMLMarkupsDisplayNode &)
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
Alternative method to propagate events generated in Display nodes.
const char * GetCurveLineSizeModeAsString()
static int GetMinimumGlyphType()
Return the min/max glyph types, for iterating over them in tcl.
virtual void SetLineColorNodeID(const char *lineColorNodeID)
static const char * GetMovingInSliceViewAttributeName()
const char * GetGlyphTypeAsString()
Return a string representing the glyph type, set it from a string.
int GlyphTypeIs3D(int glyphType)
Returns 1 if the type is a 3d one, 0 else.
virtual vtkDataSet * GetScalarDataSet() override
vtkMRMLNode * CreateNodeInstance() override
Create instance of the default node. Like New only virtual.
static int GetCurveLineSizeModeFromString(const char *)
int GetActiveControlPoint(std::string context=vtkMRMLMarkupsDisplayNode::GetDefaultContextName())
SnapModes
Define how points are placed and moved in views.
void SetActiveControlPoint(int controlPointIndex)
Set active component index to the provided value and component type to ComponentControlPoint.
static vtkMRMLMarkupsDisplayNode * New()
virtual const char * GetLineColorNodeReferenceMRMLAttributeName()
virtual const char * GetLineColorNodeReferenceRole()
void SetCurveLineSizeModeFromString(const char *modeString)
static const char * GetGlyphTypeAsString(int g)
static int GetGlyphTypeFromString(const char *)
void SetTextPropertyFromString(std::string textPropertyString)
vtkMRMLProceduralColorNode * GetLineColorNode()
Get the line color node used for the projection on the line actors on the 2D viewers.
virtual void UpdateAssignedAttribute() override
Update scalar range and update markups pipeline when the active scalar array is changed.
const char * GetLineColorNodeID()
Get the line color node ID used for the projection on the line actors on the 2D viewers.
void UpdateScene(vtkMRMLScene *scene) override
Finds the storage node and read the data.
static const char * LineColorNodeReferenceMRMLAttributeName
static const char * GetSnapModeAsString(int g)
int UpdateActiveControlPointWorld(int controlPointIndex, vtkMRMLInteractionEventData *eventData, double accurateWorldOrientationMatrix[9], const char *viewNodeID, const char *associatedNodeID, int positionStatus)
static const std::string GetDefaultContextName()
Get name of the default interaction context (typically the mouse)
bool HasActiveComponent()
Query if there is an active component for any interaction context.
~vtkMRMLMarkupsDisplayNode() override
void PrintSelf(ostream &os, vtkIndent indent) override
int GetActiveComponentType(std::string context=vtkMRMLMarkupsDisplayNode::GetDefaultContextName())
std::string GetTextPropertyAsString()
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
void SetGlyphTypeFromString(const char *glyphString)
void SetHandleVisibility(int handleType, bool visibility)
static const char * GetMovingMarkupIndexAttributeName()
virtual void SetScalarVisibility(int visibility) override
virtual vtkDataArray * GetActiveScalarArray() override
Return the current active scalar array (based on active scalar name and location)
vtkMRMLMarkupsNode * GetMarkupsNode()
Convenience function for getting the displayable markups node.
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Markups)
bool GetHandleVisibility(int handleType)
int GetActiveComponentIndex(std::string context=vtkMRMLMarkupsDisplayNode::GetDefaultContextName())
vtkMRMLCopyContentMacro(vtkMRMLMarkupsDisplayNode)
std::map< std::string, ComponentInfo > ActiveComponents
void SetActiveComponent(int componentType, int componentIndex, std::string context=vtkMRMLMarkupsDisplayNode::GetDefaultContextName())
Set active component type and index for interaction context (empty by default, meaning mouse)
static int GetSnapModeFromString(const char *)
static const char * GetCurveLineSizeModeAsString(int mode)
void GetActiveControlPoints(std::vector< int > &controlPointIndices)
std::vector< std::string > GetActiveComponentInteractionContexts()
friend class vtkMRMLScene
MRML node to represent procedurally defined color information.