Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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,
120
123
126 std::vector<std::string> GetActiveComponentInteractionContexts();
127
129 void SetActiveControlPoint(int controlPointIndex);
130
135 int UpdateActiveControlPointWorld(int controlPointIndex, vtkMRMLInteractionEventData* eventData,
136 double accurateWorldOrientationMatrix[9], const char* viewNodeID,
137 const char* associatedNodeID, int positionStatus);
138
141 void GetActiveControlPoints(std::vector<int>& controlPointIndices);
146
154 static const char* GetMovingInSliceViewAttributeName() { return "Markups.MovingInSliceView"; }
155 static const char* GetMovingMarkupIndexAttributeName() { return "Markups.MovingMarkupIndex"; }
157
159 vtkGetMacro(TextScale,double);
160 vtkSetMacro(TextScale,double);
161
163
166 vtkSetMacro(PointLabelsVisibility, bool);
167 vtkGetMacro(PointLabelsVisibility, bool);
168 vtkBooleanMacro(PointLabelsVisibility, bool);
170
172
175 vtkSetMacro(PropertiesLabelVisibility, bool);
176 vtkGetMacro(PropertiesLabelVisibility, bool);
177 vtkBooleanMacro(PropertiesLabelVisibility, bool);
179
181
184 vtkSetMacro(FillVisibility, bool);
185 vtkGetMacro(FillVisibility, bool);
186 vtkBooleanMacro(FillVisibility, bool);
187
189
192 vtkSetMacro(OutlineVisibility, bool);
193 vtkGetMacro(OutlineVisibility, bool);
194 vtkBooleanMacro(OutlineVisibility, bool);
195
197
200 vtkSetMacro(FillOpacity, double);
201 vtkGetMacro(FillOpacity, double);
202 vtkBooleanMacro(FillOpacity, double);
203
205
208 vtkSetMacro(OutlineOpacity, double);
209 vtkGetMacro(OutlineOpacity, double);
210 vtkBooleanMacro(OutlineOpacity, double);
211
214 {
215 SnapModeUnconstrained, //< point is moved independently from displayed objects in 3D views (e.g., in parallel with camera plane)
216 SnapModeToVisibleSurface, //< point is snapped to any visible surface in 3D views
217 //SnapModeToNode //< point is snapped to a specific node, not implemented yet
218 SnapMode_Last // insert new items above this line
219 };
220
242
243 static int GetMinimumGlyphType() { return 1; };
245
247 vtkSetMacro(GlyphType, int);
248 vtkGetMacro(GlyphType, int);
250 int GlyphTypeIs3D(int glyphType);
251 int GlyphTypeIs3D() { return this->GlyphTypeIs3D(this->GlyphType); };
252
254 const char* GetGlyphTypeAsString();
255 void SetGlyphTypeFromString(const char* glyphString);
256
257 static const char* GetGlyphTypeAsString(int g);
258 static int GetGlyphTypeFromString(const char*);
259
262 vtkSetMacro(SnapMode, int);
263 vtkGetMacro(SnapMode, int);
264
265 static const char* GetSnapModeAsString(int g);
266 static int GetSnapModeFromString(const char*);
267
273 vtkSetMacro(GlyphScale,double);
274 vtkGetMacro(GlyphScale,double);
275
279 vtkSetMacro(GlyphSize,double);
280 vtkGetMacro(GlyphSize,double);
281
286 vtkSetMacro(UseGlyphScale, bool);
287 vtkGetMacro(UseGlyphScale, bool);
288 vtkBooleanMacro(UseGlyphScale, bool);
289
290 enum
291 {
292 ResetToDefaultsEvent = 19001, //< reset this node to the default values, request completed by markups logic
315 };
316
322 vtkSetMacro(SliceProjection, bool);
323 vtkGetMacro(SliceProjection, bool);
324 vtkBooleanMacro(SliceProjection, bool);
325
330 vtkBooleanMacro(SliceProjectionUseFiducialColor, bool);
331
337
340 vtkSetVector3Macro(SliceProjectionColor, double);
341 vtkGetVector3Macro(SliceProjectionColor, double);
342
345 vtkSetClampMacro(SliceProjectionOpacity, double, 0.0, 1.0);
346 vtkGetMacro(SliceProjectionOpacity, double);
347
351 {
354 CurveLineSizeMode_Last // insert new types above this line
355 };
356
359 vtkSetMacro(CurveLineSizeMode, int);
360 vtkGetMacro(CurveLineSizeMode, int);
362 void SetCurveLineSizeModeFromString(const char* modeString);
363 static const char* GetCurveLineSizeModeAsString(int mode);
364 static int GetCurveLineSizeModeFromString(const char*);
365
371 vtkGetMacro(LineThickness, double);
372 vtkSetMacro(LineThickness, double);
373
378 vtkGetMacro(LineDiameter, double);
379 vtkSetMacro(LineDiameter, double);
380
383 vtkGetMacro(LineColorFadingStart, double);
384 vtkSetMacro(LineColorFadingStart, double);
385
388 vtkGetMacro(LineColorFadingEnd, double);
389 vtkSetMacro(LineColorFadingEnd, double);
390
393 vtkSetClampMacro(LineColorFadingSaturation, double, 0.0, 1.0);
394 vtkGetMacro(LineColorFadingSaturation, double);
395
398 vtkSetClampMacro(LineColorFadingHueOffset, double, 0.0, 1.0);
399 vtkGetMacro(LineColorFadingHueOffset, double);
400
405 virtual void SetLineColorNodeID(const char *lineColorNodeID);
406
408 const char* GetLineColorNodeID();
409
412 virtual const char* GetLineColorNodeReferenceRole();
413
417 vtkGetMacro(OccludedVisibility, bool);
418 vtkSetMacro(OccludedVisibility, bool);
419 vtkBooleanMacro(OccludedVisibility, bool);
420
424 vtkGetMacro(OccludedOpacity, double);
425 vtkSetMacro(OccludedOpacity, double);
426
430 vtkGetObjectMacro(TextProperty, vtkTextProperty);
431
433 vtkSetVector3Macro(ActiveColor, double);
435 vtkGetVector3Macro(ActiveColor, double);
436
438
439 vtkGetMacro(HandlesInteractive, bool);
440 vtkSetMacro(HandlesInteractive, bool);
441 vtkBooleanMacro(HandlesInteractive, bool);
442 vtkGetMacro(TranslationHandleVisibility, bool);
443 vtkSetMacro(TranslationHandleVisibility, bool);
444 vtkBooleanMacro(TranslationHandleVisibility, bool);
445 vtkGetMacro(RotationHandleVisibility, bool);
446 vtkSetMacro(RotationHandleVisibility, bool);
447 vtkBooleanMacro(RotationHandleVisibility, bool);
448 vtkGetMacro(ScaleHandleVisibility, bool);
449 vtkSetMacro(ScaleHandleVisibility, bool);
450 vtkBooleanMacro(ScaleHandleVisibility, bool);
451 void SetHandleVisibility(int handleType, bool visibility);
452 bool GetHandleVisibility(int handleType);
454
456
458 vtkSetMacro(InteractionHandleScale, double);
459 vtkGetMacro(InteractionHandleScale, double);
461
463
467 vtkSetVector4Macro(RotationHandleComponentVisibility, bool);
468 vtkGetVector4Macro(RotationHandleComponentVisibility, bool);
469 vtkSetVector4Macro(ScaleHandleComponentVisibility, bool);
470 vtkGetVector4Macro(ScaleHandleComponentVisibility, bool);
471 vtkSetVector4Macro(TranslationHandleComponentVisibility, bool);
472 vtkGetVector4Macro(TranslationHandleComponentVisibility, bool);
474
477 virtual vtkDataSet* GetScalarDataSet() override;
479 virtual vtkDataArray* GetActiveScalarArray() override;
480
482 virtual void UpdateAssignedAttribute() override;
483
484 virtual void SetScalarVisibility(int visibility) override;
485
487 vtkGetMacro(CanDisplayScaleHandles, bool);
488
489protected:
494
495 // Set the text style from a string
496 // String format follows html-style conventions
497 void SetTextPropertyFromString(std::string textPropertyString);
498
499 // Return a string representing the text style
500 // String format follows html-style conventions
502
505 std::map<std::string, ComponentInfo> ActiveComponents;
506
508
515 double TextScale;
518 double GlyphSize;
520
526
528
529 static const char* LineColorNodeReferenceRole;
531
535
540
543
544 vtkTextProperty* TextProperty;
545
546 double ActiveColor[3];
547
553
557
559};
560#endif
void operator=(const vtkMRMLDisplayNode &)
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML (MRML) file.
static const char * LineColorNodeReferenceRole
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.