Slicer 5.6
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
264 vtkSetMacro(GlyphScale,double);
265 vtkGetMacro(GlyphScale,double);
266
270 vtkSetMacro(GlyphSize,double);
271 vtkGetMacro(GlyphSize,double);
272
277 vtkSetMacro(UseGlyphScale, bool);
278 vtkGetMacro(UseGlyphScale, bool);
279 vtkBooleanMacro(UseGlyphScale, bool);
280
281 enum
282 {
283 ResetToDefaultsEvent = 19001, //< reset this node to the default values, request completed by markups logic
284 JumpToPointEvent,
286 ActionEvent,
288 CustomActionEvent1,
291 CustomActionEvent2,
294 CustomActionEvent3,
297 CustomActionEvent4,
300 CustomActionEvent5,
303 CustomActionEvent6,
306 };
307
313 vtkSetMacro(SliceProjection, bool);
314 vtkGetMacro(SliceProjection, bool);
315 vtkBooleanMacro(SliceProjection, bool);
316
319 vtkSetMacro(SliceProjectionUseFiducialColor, bool);
320 vtkGetMacro(SliceProjectionUseFiducialColor, bool);
321 vtkBooleanMacro(SliceProjectionUseFiducialColor, bool);
322
325 vtkSetMacro(SliceProjectionOutlinedBehindSlicePlane, bool);
326 vtkGetMacro(SliceProjectionOutlinedBehindSlicePlane, bool);
327 vtkBooleanMacro(SliceProjectionOutlinedBehindSlicePlane, bool);
328
331 vtkSetVector3Macro(SliceProjectionColor, double);
332 vtkGetVector3Macro(SliceProjectionColor, double);
333
336 vtkSetClampMacro(SliceProjectionOpacity, double, 0.0, 1.0);
337 vtkGetMacro(SliceProjectionOpacity, double);
338
342 {
343 UseLineThickness = 0,
345 CurveLineSizeMode_Last // insert new types above this line
346 };
347
350 vtkSetMacro(CurveLineSizeMode, int);
351 vtkGetMacro(CurveLineSizeMode, int);
353 void SetCurveLineSizeModeFromString(const char* modeString);
354 static const char* GetCurveLineSizeModeAsString(int mode);
355 static int GetCurveLineSizeModeFromString(const char*);
356
362 vtkGetMacro(LineThickness, double);
363 vtkSetMacro(LineThickness, double);
364
369 vtkGetMacro(LineDiameter, double);
370 vtkSetMacro(LineDiameter, double);
371
374 vtkGetMacro(LineColorFadingStart, double);
375 vtkSetMacro(LineColorFadingStart, double);
376
379 vtkGetMacro(LineColorFadingEnd, double);
380 vtkSetMacro(LineColorFadingEnd, double);
381
384 vtkSetClampMacro(LineColorFadingSaturation, double, 0.0, 1.0);
385 vtkGetMacro(LineColorFadingSaturation, double);
386
389 vtkSetClampMacro(LineColorFadingHueOffset, double, 0.0, 1.0);
390 vtkGetMacro(LineColorFadingHueOffset, double);
391
396 virtual void SetLineColorNodeID(const char *lineColorNodeID);
397
399 const char* GetLineColorNodeID();
400
403 virtual const char* GetLineColorNodeReferenceRole();
404
408 vtkGetMacro(OccludedVisibility, bool);
409 vtkSetMacro(OccludedVisibility, bool);
410 vtkBooleanMacro(OccludedVisibility, bool);
411
415 vtkGetMacro(OccludedOpacity, double);
416 vtkSetMacro(OccludedOpacity, double);
417
421 vtkGetObjectMacro(TextProperty, vtkTextProperty);
422
424 vtkSetVector3Macro(ActiveColor, double);
426 vtkGetVector3Macro(ActiveColor, double);
427
429
430 vtkGetMacro(HandlesInteractive, bool);
431 vtkSetMacro(HandlesInteractive, bool);
432 vtkBooleanMacro(HandlesInteractive, bool);
433 vtkGetMacro(TranslationHandleVisibility, bool);
434 vtkSetMacro(TranslationHandleVisibility, bool);
435 vtkBooleanMacro(TranslationHandleVisibility, bool);
436 vtkGetMacro(RotationHandleVisibility, bool);
437 vtkSetMacro(RotationHandleVisibility, bool);
438 vtkBooleanMacro(RotationHandleVisibility, bool);
439 vtkGetMacro(ScaleHandleVisibility, bool);
440 vtkSetMacro(ScaleHandleVisibility, bool);
441 vtkBooleanMacro(ScaleHandleVisibility, bool);
442 void SetHandleVisibility(int handleType, bool visibility);
443 bool GetHandleVisibility(int handleType);
445
447
449 vtkSetMacro(InteractionHandleScale, double);
450 vtkGetMacro(InteractionHandleScale, double);
452
454
458 vtkSetVector4Macro(RotationHandleComponentVisibility, bool);
459 vtkGetVector4Macro(RotationHandleComponentVisibility, bool);
460 vtkSetVector4Macro(ScaleHandleComponentVisibility, bool);
461 vtkGetVector4Macro(ScaleHandleComponentVisibility, bool);
462 vtkSetVector4Macro(TranslationHandleComponentVisibility, bool);
463 vtkGetVector4Macro(TranslationHandleComponentVisibility, bool);
465
468 virtual vtkDataSet* GetScalarDataSet() override;
470 virtual vtkDataArray* GetActiveScalarArray() override;
471
473 virtual void UpdateAssignedAttribute() override;
474
475 virtual void SetScalarVisibility(int visibility) override;
476
478 vtkGetMacro(CanDisplayScaleHandles, bool);
479
480protected:
484 void operator= ( const vtkMRMLMarkupsDisplayNode& );
485
486 // Set the text style from a string
487 // String format follows html-style conventions
488 void SetTextPropertyFromString(std::string textPropertyString);
489
490 // Return a string representing the text style
491 // String format follows html-style conventions
493
496 std::map<std::string, ComponentInfo> ActiveComponents;
497
499
506 double TextScale;
509 double GlyphSize;
511
515 double SliceProjectionColor[3];
517
519
520 static const char* LineColorNodeReferenceRole;
522
526
531
534
535 vtkTextProperty* TextProperty;
536
537 double ActiveColor[3];
538
544
545 bool RotationHandleComponentVisibility[4];
546 bool ScaleHandleComponentVisibility[4];
547 bool TranslationHandleComponentVisibility[4];
548
550};
551#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.