Slicer 5.13
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
103 {
105 {
106 this->Type = ComponentNone;
107 this->Index = -1;
108 }
109 int Type;
110 int Index;
111 };
112
117
119 void SetActiveComponent(int componentType, int componentIndex, std::string context = vtkMRMLMarkupsDisplayNode::GetDefaultContextName());
120
123
126 std::vector<std::string> GetActiveComponentInteractionContexts();
127
129 void SetActiveControlPoint(int controlPointIndex);
130
135 int UpdateActiveControlPointWorld(int controlPointIndex,
137 double accurateWorldOrientationMatrix[9],
138 const char* viewNodeID,
139 const char* associatedNodeID,
140 int positionStatus);
141
144 void GetActiveControlPoints(std::vector<int>& controlPointIndices);
149
157 static const char* GetMovingInSliceViewAttributeName() { return "Markups.MovingInSliceView"; }
158 static const char* GetMovingMarkupIndexAttributeName() { return "Markups.MovingMarkupIndex"; }
160
162 vtkGetMacro(TextScale, double);
163 vtkSetMacro(TextScale, double);
164
166
169 vtkSetMacro(PointLabelsVisibility, bool);
170 vtkGetMacro(PointLabelsVisibility, bool);
171 vtkBooleanMacro(PointLabelsVisibility, bool);
173
175
178 vtkSetMacro(PropertiesLabelVisibility, bool);
179 vtkGetMacro(PropertiesLabelVisibility, bool);
180 vtkBooleanMacro(PropertiesLabelVisibility, bool);
182
184
196 vtkSetMacro(PropertiesLabelFormat, std::string);
197 vtkGetMacro(PropertiesLabelFormat, std::string);
199
201 static std::string GetDefaultPropertiesLabelFormat() { return "%N:%M"; }
202
204
207 vtkSetMacro(FillVisibility, bool);
208 vtkGetMacro(FillVisibility, bool);
209 vtkBooleanMacro(FillVisibility, bool);
210
212
215 vtkSetMacro(OutlineVisibility, bool);
216 vtkGetMacro(OutlineVisibility, bool);
217 vtkBooleanMacro(OutlineVisibility, bool);
218
220
223 vtkSetMacro(FillOpacity, double);
224 vtkGetMacro(FillOpacity, double);
225 vtkBooleanMacro(FillOpacity, double);
226
228
231 vtkSetMacro(OutlineOpacity, double);
232 vtkGetMacro(OutlineOpacity, double);
233 vtkBooleanMacro(OutlineOpacity, double);
234
237 {
238 SnapModeUnconstrained, //< point is moved independently from displayed objects in 3D views (e.g., in parallel with camera plane)
239 SnapModeToVisibleSurface, //< point is snapped to any visible surface in 3D views
240 // SnapModeToNode //< point is snapped to a specific node, not implemented yet
241 SnapMode_Last // insert new items above this line
242 };
243
265
266 static int GetMinimumGlyphType() { return 1; };
268
270 vtkSetMacro(GlyphType, int);
271 vtkGetMacro(GlyphType, int);
273 int GlyphTypeIs3D(int glyphType);
274 int GlyphTypeIs3D() { return this->GlyphTypeIs3D(this->GlyphType); };
275
277 const char* GetGlyphTypeAsString();
278 void SetGlyphTypeFromString(const char* glyphString);
279
280 static const char* GetGlyphTypeAsString(int g);
281 static int GetGlyphTypeFromString(const char*);
282
285 vtkSetMacro(SnapMode, int);
286 vtkGetMacro(SnapMode, int);
287
288 static const char* GetSnapModeAsString(int g);
289 static int GetSnapModeFromString(const char*);
290
296 vtkSetMacro(GlyphScale, double);
297 vtkGetMacro(GlyphScale, double);
298
302 vtkSetMacro(GlyphSize, double);
303 vtkGetMacro(GlyphSize, double);
304
309 vtkSetMacro(UseGlyphScale, bool);
310 vtkGetMacro(UseGlyphScale, bool);
311 vtkBooleanMacro(UseGlyphScale, bool);
312
313 enum
314 {
315 ResetToDefaultsEvent = 19001, //< reset this node to the default values, request completed by markups logic
338 };
339
345 vtkSetMacro(SliceProjection, bool);
346 vtkGetMacro(SliceProjection, bool);
347 vtkBooleanMacro(SliceProjection, bool);
348
353 vtkBooleanMacro(SliceProjectionUseFiducialColor, bool);
354
360
363 vtkSetVector3Macro(SliceProjectionColor, double);
364 vtkGetVector3Macro(SliceProjectionColor, double);
365
368 vtkSetClampMacro(SliceProjectionOpacity, double, 0.0, 1.0);
369 vtkGetMacro(SliceProjectionOpacity, double);
370
374 {
377 CurveLineSizeMode_Last // insert new types above this line
378 };
379
382 vtkSetMacro(CurveLineSizeMode, int);
383 vtkGetMacro(CurveLineSizeMode, int);
385 void SetCurveLineSizeModeFromString(const char* modeString);
386 static const char* GetCurveLineSizeModeAsString(int mode);
387 static int GetCurveLineSizeModeFromString(const char*);
388
394 vtkGetMacro(LineThickness, double);
395 vtkSetMacro(LineThickness, double);
396
401 vtkGetMacro(LineDiameter, double);
402 vtkSetMacro(LineDiameter, double);
403
406 vtkGetMacro(LineColorFadingStart, double);
407 vtkSetMacro(LineColorFadingStart, double);
408
411 vtkGetMacro(LineColorFadingEnd, double);
412 vtkSetMacro(LineColorFadingEnd, double);
413
416 vtkSetClampMacro(LineColorFadingSaturation, double, 0.0, 1.0);
417 vtkGetMacro(LineColorFadingSaturation, double);
418
421 vtkSetClampMacro(LineColorFadingHueOffset, double, 0.0, 1.0);
422 vtkGetMacro(LineColorFadingHueOffset, double);
423
426 vtkSetMacro(LineDirectionVisibility, bool);
427 vtkGetMacro(LineDirectionVisibility, bool);
428 vtkBooleanMacro(LineDirectionVisibility, bool);
429
432 vtkSetMacro(LineDirectionVisibility3D, bool);
433 vtkGetMacro(LineDirectionVisibility3D, bool);
434 vtkBooleanMacro(LineDirectionVisibility3D, bool);
435
438 vtkSetMacro(LineDirectionVisibility2D, bool);
439 vtkGetMacro(LineDirectionVisibility2D, bool);
440 vtkBooleanMacro(LineDirectionVisibility2D, bool);
441
444 static constexpr double LineDirectionMarkerBaseScaleFactor = 3.0;
445
449 vtkSetMacro(LineDirectionMarkerScale, double);
450 vtkGetMacro(LineDirectionMarkerScale, double);
451
457
464
471
476 virtual void SetLineColorNodeID(const char* lineColorNodeID);
477
479 const char* GetLineColorNodeID();
480
483 virtual const char* GetLineColorNodeReferenceRole();
484
488 vtkGetMacro(OccludedVisibility, bool);
489 vtkSetMacro(OccludedVisibility, bool);
490 vtkBooleanMacro(OccludedVisibility, bool);
491
495 vtkGetMacro(OccludedOpacity, double);
496 vtkSetMacro(OccludedOpacity, double);
497
501 vtkGetObjectMacro(TextProperty, vtkTextProperty);
502
504 vtkSetVector3Macro(ActiveColor, double);
506 vtkGetVector3Macro(ActiveColor, double);
507
509
510 vtkGetMacro(HandlesInteractive, bool);
511 vtkSetMacro(HandlesInteractive, bool);
512 vtkBooleanMacro(HandlesInteractive, bool);
513 vtkGetMacro(TranslationHandleVisibility, bool);
514 vtkSetMacro(TranslationHandleVisibility, bool);
515 vtkBooleanMacro(TranslationHandleVisibility, bool);
516 vtkGetMacro(RotationHandleVisibility, bool);
517 vtkSetMacro(RotationHandleVisibility, bool);
518 vtkBooleanMacro(RotationHandleVisibility, bool);
519 vtkGetMacro(ScaleHandleVisibility, bool);
520 vtkSetMacro(ScaleHandleVisibility, bool);
521 vtkBooleanMacro(ScaleHandleVisibility, bool);
522 void SetHandleVisibility(int handleType, bool visibility);
523 bool GetHandleVisibility(int handleType);
525
527
529 vtkSetMacro(InteractionHandleScale, double);
530 vtkGetMacro(InteractionHandleScale, double);
532
534
536 vtkSetClampMacro(InteractionHandleOpacity, double, 0.0, 1.0);
537 vtkGetMacro(InteractionHandleOpacity, double);
539
541
545 vtkSetVector4Macro(RotationHandleComponentVisibility, bool);
546 vtkGetVector4Macro(RotationHandleComponentVisibility, bool);
547 vtkSetVector4Macro(ScaleHandleComponentVisibility, bool);
548 vtkGetVector4Macro(ScaleHandleComponentVisibility, bool);
549 vtkSetVector4Macro(TranslationHandleComponentVisibility, bool);
550 vtkGetVector4Macro(TranslationHandleComponentVisibility, bool);
552
555 virtual vtkDataSet* GetScalarDataSet() override;
557 virtual vtkDataArray* GetActiveScalarArray() override;
558
560 virtual void UpdateAssignedAttribute() override;
561
562 virtual void SetScalarVisibility(int visibility) override;
563
565 vtkGetMacro(CanDisplayScaleHandles, bool);
566
567protected:
572
573 // Set the text style from a string
574 // String format follows html-style conventions
575 void SetTextPropertyFromString(std::string textPropertyString);
576
577 // Return a string representing the text style
578 // String format follows html-style conventions
580
583 std::map<std::string, ComponentInfo> ActiveComponents;
584
586
594 double TextScale;
597 double GlyphSize;
599
605
607
608 static const char* LineColorNodeReferenceRole;
610
614
619
627
630
631 vtkTextProperty* TextProperty;
632
633 double ActiveColor[3];
634
641
645
647};
648#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 std::string GetDefaultPropertiesLabelFormat()
Default format of the properties label text.
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.