Slicer 5.8
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 "vtkSlicerMarkupsModuleMRMLExport.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_SLICER_MARKUPS_MODULE_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
148 vtkGetMacro(TextScale,double);
149 vtkSetMacro(TextScale,double);
150
152
155 vtkSetMacro(PointLabelsVisibility, bool);
156 vtkGetMacro(PointLabelsVisibility, bool);
157 vtkBooleanMacro(PointLabelsVisibility, bool);
159
161
164 vtkSetMacro(PropertiesLabelVisibility, bool);
165 vtkGetMacro(PropertiesLabelVisibility, bool);
166 vtkBooleanMacro(PropertiesLabelVisibility, bool);
168
170
173 vtkSetMacro(FillVisibility, bool);
174 vtkGetMacro(FillVisibility, bool);
175 vtkBooleanMacro(FillVisibility, bool);
176
178
181 vtkSetMacro(OutlineVisibility, bool);
182 vtkGetMacro(OutlineVisibility, bool);
183 vtkBooleanMacro(OutlineVisibility, bool);
184
186
189 vtkSetMacro(FillOpacity, double);
190 vtkGetMacro(FillOpacity, double);
191 vtkBooleanMacro(FillOpacity, double);
192
194
197 vtkSetMacro(OutlineOpacity, double);
198 vtkGetMacro(OutlineOpacity, double);
199 vtkBooleanMacro(OutlineOpacity, double);
200
203 {
204 SnapModeUnconstrained, //< point is moved independently from displayed objects in 3D views (e.g., in parallel with camera plane)
205 SnapModeToVisibleSurface, //< point is snapped to any visible surface in 3D views
206 //SnapModeToNode //< point is snapped to a specific node, not implemented yet
207 SnapMode_Last // insert new items above this line
208 };
209
232 static int GetMinimumGlyphType() { return 1; };
234
236 vtkSetMacro(GlyphType, int);
237 vtkGetMacro(GlyphType, int);
239 int GlyphTypeIs3D(int glyphType);
240 int GlyphTypeIs3D() { return this->GlyphTypeIs3D(this->GlyphType); };
241
243 const char* GetGlyphTypeAsString();
244 void SetGlyphTypeFromString(const char* glyphString);
245
246 static const char* GetGlyphTypeAsString(int g);
247 static int GetGlyphTypeFromString(const char*);
248
251 vtkSetMacro(SnapMode, int);
252 vtkGetMacro(SnapMode, int);
253
254 static const char* GetSnapModeAsString(int g);
255 static int GetSnapModeFromString(const char*);
256
262 vtkSetMacro(GlyphScale,double);
263 vtkGetMacro(GlyphScale,double);
264
268 vtkSetMacro(GlyphSize,double);
269 vtkGetMacro(GlyphSize,double);
270
275 vtkSetMacro(UseGlyphScale, bool);
276 vtkGetMacro(UseGlyphScale, bool);
277 vtkBooleanMacro(UseGlyphScale, bool);
278
279 enum
280 {
281 ResetToDefaultsEvent = 19001, //< reset this node to the default values, request completed by markups logic
282 JumpToPointEvent,
284 ActionEvent,
286 CustomActionEvent1,
289 CustomActionEvent2,
292 CustomActionEvent3,
295 CustomActionEvent4,
298 CustomActionEvent5,
301 CustomActionEvent6,
304 };
305
311 vtkSetMacro(SliceProjection, bool);
312 vtkGetMacro(SliceProjection, bool);
313 vtkBooleanMacro(SliceProjection, bool);
314
317 vtkSetMacro(SliceProjectionUseFiducialColor, bool);
318 vtkGetMacro(SliceProjectionUseFiducialColor, bool);
319 vtkBooleanMacro(SliceProjectionUseFiducialColor, bool);
320
323 vtkSetMacro(SliceProjectionOutlinedBehindSlicePlane, bool);
324 vtkGetMacro(SliceProjectionOutlinedBehindSlicePlane, bool);
325 vtkBooleanMacro(SliceProjectionOutlinedBehindSlicePlane, bool);
326
329 vtkSetVector3Macro(SliceProjectionColor, double);
330 vtkGetVector3Macro(SliceProjectionColor, double);
331
334 vtkSetClampMacro(SliceProjectionOpacity, double, 0.0, 1.0);
335 vtkGetMacro(SliceProjectionOpacity, double);
336
340 {
341 UseLineThickness = 0,
343 CurveLineSizeMode_Last // insert new types above this line
344 };
345
348 vtkSetMacro(CurveLineSizeMode, int);
349 vtkGetMacro(CurveLineSizeMode, int);
351 void SetCurveLineSizeModeFromString(const char* modeString);
352 static const char* GetCurveLineSizeModeAsString(int mode);
353 static int GetCurveLineSizeModeFromString(const char*);
354
360 vtkGetMacro(LineThickness, double);
361 vtkSetMacro(LineThickness, double);
362
367 vtkGetMacro(LineDiameter, double);
368 vtkSetMacro(LineDiameter, double);
369
372 vtkGetMacro(LineColorFadingStart, double);
373 vtkSetMacro(LineColorFadingStart, double);
374
377 vtkGetMacro(LineColorFadingEnd, double);
378 vtkSetMacro(LineColorFadingEnd, double);
379
382 vtkSetClampMacro(LineColorFadingSaturation, double, 0.0, 1.0);
383 vtkGetMacro(LineColorFadingSaturation, double);
384
387 vtkSetClampMacro(LineColorFadingHueOffset, double, 0.0, 1.0);
388 vtkGetMacro(LineColorFadingHueOffset, double);
389
394 virtual void SetLineColorNodeID(const char *lineColorNodeID);
395
397 const char* GetLineColorNodeID();
398
401 virtual const char* GetLineColorNodeReferenceRole();
402
406 vtkGetMacro(OccludedVisibility, bool);
407 vtkSetMacro(OccludedVisibility, bool);
408 vtkBooleanMacro(OccludedVisibility, bool);
409
413 vtkGetMacro(OccludedOpacity, double);
414 vtkSetMacro(OccludedOpacity, double);
415
419 vtkGetObjectMacro(TextProperty, vtkTextProperty);
420
422 vtkSetVector3Macro(ActiveColor, double);
424 vtkGetVector3Macro(ActiveColor, double);
425
427
428 vtkGetMacro(HandlesInteractive, bool);
429 vtkSetMacro(HandlesInteractive, bool);
430 vtkBooleanMacro(HandlesInteractive, bool);
431 vtkGetMacro(TranslationHandleVisibility, bool);
432 vtkSetMacro(TranslationHandleVisibility, bool);
433 vtkBooleanMacro(TranslationHandleVisibility, bool);
434 vtkGetMacro(RotationHandleVisibility, bool);
435 vtkSetMacro(RotationHandleVisibility, bool);
436 vtkBooleanMacro(RotationHandleVisibility, bool);
437 vtkGetMacro(ScaleHandleVisibility, bool);
438 vtkSetMacro(ScaleHandleVisibility, bool);
439 vtkBooleanMacro(ScaleHandleVisibility, bool);
440 void SetHandleVisibility(int handleType, bool visibility);
441 bool GetHandleVisibility(int handleType);
443
445
447 vtkSetMacro(InteractionHandleScale, double);
448 vtkGetMacro(InteractionHandleScale, double);
450
452
456 vtkSetVector4Macro(RotationHandleComponentVisibility, bool);
457 vtkGetVector4Macro(RotationHandleComponentVisibility, bool);
458 vtkSetVector4Macro(ScaleHandleComponentVisibility, bool);
459 vtkGetVector4Macro(ScaleHandleComponentVisibility, bool);
460 vtkSetVector4Macro(TranslationHandleComponentVisibility, bool);
461 vtkGetVector4Macro(TranslationHandleComponentVisibility, bool);
463
466 virtual vtkDataSet* GetScalarDataSet() override;
468 virtual vtkDataArray* GetActiveScalarArray() override;
469
471 virtual void UpdateAssignedAttribute() override;
472
473 virtual void SetScalarVisibility(int visibility) override;
474
476 vtkGetMacro(CanDisplayScaleHandles, bool);
477
478protected:
482 void operator= ( const vtkMRMLMarkupsDisplayNode& );
483
484 // Set the text style from a string
485 // String format follows html-style conventions
486 void SetTextPropertyFromString(std::string textPropertyString);
487
488 // Return a string representing the text style
489 // String format follows html-style conventions
491
494 std::map<std::string, ComponentInfo> ActiveComponents;
495
497
504 double TextScale;
507 double GlyphSize;
509
513 double SliceProjectionColor[3];
515
517
518 static const char* LineColorNodeReferenceRole;
520
524
529
532
533 vtkTextProperty* TextProperty;
534
535 double ActiveColor[3];
536
542
543 bool RotationHandleComponentVisibility[4];
544 bool ScaleHandleComponentVisibility[4];
545 bool TranslationHandleComponentVisibility[4];
546
548};
549#endif
Abstract class that contains graphical display properties for displayable nodes.
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)
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)
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()
Abstract Superclass for all specific types of MRML nodes.
MRML node to represent procedurally defined color information.
A set of MRML Nodes that supports serialization and undo/redo.