Slicer 5.11
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
405 vtkSetMacro(LineDirectionVisibility, bool);
406 vtkGetMacro(LineDirectionVisibility, bool);
407 vtkBooleanMacro(LineDirectionVisibility, bool);
408
411 vtkSetMacro(LineDirectionVisibility3D, bool);
412 vtkGetMacro(LineDirectionVisibility3D, bool);
413 vtkBooleanMacro(LineDirectionVisibility3D, bool);
414
417 vtkSetMacro(LineDirectionVisibility2D, bool);
418 vtkGetMacro(LineDirectionVisibility2D, bool);
419 vtkBooleanMacro(LineDirectionVisibility2D, bool);
420
423 static constexpr double LineDirectionMarkerBaseScaleFactor = 3.0;
424
428 vtkSetMacro(LineDirectionMarkerScale, double);
429 vtkGetMacro(LineDirectionMarkerScale, double);
430
436
443
450
455 virtual void SetLineColorNodeID(const char* lineColorNodeID);
456
458 const char* GetLineColorNodeID();
459
462 virtual const char* GetLineColorNodeReferenceRole();
463
467 vtkGetMacro(OccludedVisibility, bool);
468 vtkSetMacro(OccludedVisibility, bool);
469 vtkBooleanMacro(OccludedVisibility, bool);
470
474 vtkGetMacro(OccludedOpacity, double);
475 vtkSetMacro(OccludedOpacity, double);
476
480 vtkGetObjectMacro(TextProperty, vtkTextProperty);
481
483 vtkSetVector3Macro(ActiveColor, double);
485 vtkGetVector3Macro(ActiveColor, double);
486
488
489 vtkGetMacro(HandlesInteractive, bool);
490 vtkSetMacro(HandlesInteractive, bool);
491 vtkBooleanMacro(HandlesInteractive, bool);
492 vtkGetMacro(TranslationHandleVisibility, bool);
493 vtkSetMacro(TranslationHandleVisibility, bool);
494 vtkBooleanMacro(TranslationHandleVisibility, bool);
495 vtkGetMacro(RotationHandleVisibility, bool);
496 vtkSetMacro(RotationHandleVisibility, bool);
497 vtkBooleanMacro(RotationHandleVisibility, bool);
498 vtkGetMacro(ScaleHandleVisibility, bool);
499 vtkSetMacro(ScaleHandleVisibility, bool);
500 vtkBooleanMacro(ScaleHandleVisibility, bool);
501 void SetHandleVisibility(int handleType, bool visibility);
502 bool GetHandleVisibility(int handleType);
504
506
508 vtkSetMacro(InteractionHandleScale, double);
509 vtkGetMacro(InteractionHandleScale, double);
511
513
517 vtkSetVector4Macro(RotationHandleComponentVisibility, bool);
518 vtkGetVector4Macro(RotationHandleComponentVisibility, bool);
519 vtkSetVector4Macro(ScaleHandleComponentVisibility, bool);
520 vtkGetVector4Macro(ScaleHandleComponentVisibility, bool);
521 vtkSetVector4Macro(TranslationHandleComponentVisibility, bool);
522 vtkGetVector4Macro(TranslationHandleComponentVisibility, bool);
524
527 virtual vtkDataSet* GetScalarDataSet() override;
529 virtual vtkDataArray* GetActiveScalarArray() override;
530
532 virtual void UpdateAssignedAttribute() override;
533
534 virtual void SetScalarVisibility(int visibility) override;
535
537 vtkGetMacro(CanDisplayScaleHandles, bool);
538
539protected:
544
545 // Set the text style from a string
546 // String format follows html-style conventions
547 void SetTextPropertyFromString(std::string textPropertyString);
548
549 // Return a string representing the text style
550 // String format follows html-style conventions
552
555 std::map<std::string, ComponentInfo> ActiveComponents;
556
558
565 double TextScale;
568 double GlyphSize;
570
576
578
579 static const char* LineColorNodeReferenceRole;
581
585
590
598
601
602 vtkTextProperty* TextProperty;
603
604 double ActiveColor[3];
605
611
615
617};
618#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.
static constexpr double LineDirectionMarkerBaseScaleFactor
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.