Slicer 5.4
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
45class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkMRMLMarkupsDisplayNode : public vtkMRMLDisplayNode
46{
47public:
50 void PrintSelf(ostream& os, vtkIndent indent) override;
51
52 //--------------------------------------------------------------------------
53 // MRMLNode methods
54 //--------------------------------------------------------------------------
55
57
59 void ReadXMLAttributes(const char** atts) override;
60
62 void WriteXML(ostream& of, int indent) override;
63
67
69 const char* GetNodeTagName() override { return "MarkupsDisplay"; };
70
72 void UpdateScene(vtkMRMLScene* scene) override;
73
75 void ProcessMRMLEvents(vtkObject* /*caller*/, unsigned long /*event*/, void* /*callData*/ ) override;
76
79
81 static const std::string GetDefaultContextName() { return ""; };
82
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,
121
124
127 std::vector<std::string> GetActiveComponentInteractionContexts();
128
130 void SetActiveControlPoint(int controlPointIndex);
131
136 int UpdateActiveControlPointWorld(int controlPointIndex, vtkMRMLInteractionEventData* eventData,
137 double accurateWorldOrientationMatrix[9], const char* viewNodeID,
138 const char* associatedNodeID, int positionStatus);
139
142 void GetActiveControlPoints(std::vector<int>& controlPointIndices);
147
149 vtkGetMacro(TextScale,double);
150 vtkSetMacro(TextScale,double);
151
153
156 vtkSetMacro(PointLabelsVisibility, bool);
157 vtkGetMacro(PointLabelsVisibility, bool);
158 vtkBooleanMacro(PointLabelsVisibility, bool);
160
162
165 vtkSetMacro(PropertiesLabelVisibility, bool);
166 vtkGetMacro(PropertiesLabelVisibility, bool);
167 vtkBooleanMacro(PropertiesLabelVisibility, bool);
169
171
174 vtkSetMacro(FillVisibility, bool);
175 vtkGetMacro(FillVisibility, bool);
176 vtkBooleanMacro(FillVisibility, bool);
177
179
182 vtkSetMacro(OutlineVisibility, bool);
183 vtkGetMacro(OutlineVisibility, bool);
184 vtkBooleanMacro(OutlineVisibility, bool);
185
187
190 vtkSetMacro(FillOpacity, double);
191 vtkGetMacro(FillOpacity, double);
192 vtkBooleanMacro(FillOpacity, double);
193
195
198 vtkSetMacro(OutlineOpacity, double);
199 vtkGetMacro(OutlineOpacity, double);
200 vtkBooleanMacro(OutlineOpacity, double);
201
204 {
205 SnapModeUnconstrained, //< point is moved independently from displayed objects in 3D views (e.g., in parallel with camera plane)
206 SnapModeToVisibleSurface, //< point is snapped to any visible surface in 3D views
207 //SnapModeToNode //< point is snapped to a specific node, not implemented yet
208 SnapMode_Last // insert new items above this line
209 };
210
233 static int GetMinimumGlyphType() { return 1; };
235
237 vtkSetMacro(GlyphType, int);
238 vtkGetMacro(GlyphType, int);
240 int GlyphTypeIs3D(int glyphType);
241 int GlyphTypeIs3D() { return this->GlyphTypeIs3D(this->GlyphType); };
242
244 const char* GetGlyphTypeAsString();
245 void SetGlyphTypeFromString(const char* glyphString);
246
247 static const char* GetGlyphTypeAsString(int g);
248 static int GetGlyphTypeFromString(const char*);
249
252 vtkSetMacro(SnapMode, int);
253 vtkGetMacro(SnapMode, int);
254
255 static const char* GetSnapModeAsString(int g);
256 static int GetSnapModeFromString(const char*);
257
265 vtkSetMacro(GlyphScale,double);
266 vtkGetMacro(GlyphScale,double);
267
271 vtkSetMacro(GlyphSize,double);
272 vtkGetMacro(GlyphSize,double);
273
278 vtkSetMacro(UseGlyphScale, bool);
279 vtkGetMacro(UseGlyphScale, bool);
280 vtkBooleanMacro(UseGlyphScale, bool);
281
282 enum
283 {
284 ResetToDefaultsEvent = 19001, //< reset this node to the default values, request completed by markups logic
285 JumpToPointEvent,
287 ActionEvent,
289 CustomActionEvent1,
292 CustomActionEvent2,
295 CustomActionEvent3,
298 CustomActionEvent4,
301 CustomActionEvent5,
304 CustomActionEvent6,
307 };
308
314 vtkSetMacro(SliceProjection, bool);
315 vtkGetMacro(SliceProjection, bool);
316 vtkBooleanMacro(SliceProjection, bool);
317
320 vtkSetMacro(SliceProjectionUseFiducialColor, bool);
321 vtkGetMacro(SliceProjectionUseFiducialColor, bool);
322 vtkBooleanMacro(SliceProjectionUseFiducialColor, bool);
323
326 vtkSetMacro(SliceProjectionOutlinedBehindSlicePlane, bool);
327 vtkGetMacro(SliceProjectionOutlinedBehindSlicePlane, bool);
328 vtkBooleanMacro(SliceProjectionOutlinedBehindSlicePlane, bool);
329
332 vtkSetVector3Macro(SliceProjectionColor, double);
333 vtkGetVector3Macro(SliceProjectionColor, double);
334
337 vtkSetClampMacro(SliceProjectionOpacity, double, 0.0, 1.0);
338 vtkGetMacro(SliceProjectionOpacity, double);
339
343 {
344 UseLineThickness = 0,
346 CurveLineSizeMode_Last // insert new types above this line
347 };
348
351 vtkSetMacro(CurveLineSizeMode, int);
352 vtkGetMacro(CurveLineSizeMode, int);
354 void SetCurveLineSizeModeFromString(const char* modeString);
355 static const char* GetCurveLineSizeModeAsString(int mode);
356 static int GetCurveLineSizeModeFromString(const char*);
357
363 vtkGetMacro(LineThickness, double);
364 vtkSetMacro(LineThickness, double);
365
370 vtkGetMacro(LineDiameter, double);
371 vtkSetMacro(LineDiameter, double);
372
375 vtkGetMacro(LineColorFadingStart, double);
376 vtkSetMacro(LineColorFadingStart, double);
377
380 vtkGetMacro(LineColorFadingEnd, double);
381 vtkSetMacro(LineColorFadingEnd, double);
382
385 vtkSetClampMacro(LineColorFadingSaturation, double, 0.0, 1.0);
386 vtkGetMacro(LineColorFadingSaturation, double);
387
390 vtkSetClampMacro(LineColorFadingHueOffset, double, 0.0, 1.0);
391 vtkGetMacro(LineColorFadingHueOffset, double);
392
397 virtual void SetLineColorNodeID(const char *lineColorNodeID);
398
400 const char* GetLineColorNodeID();
401
404 virtual const char* GetLineColorNodeReferenceRole();
405
409 vtkGetMacro(OccludedVisibility, bool);
410 vtkSetMacro(OccludedVisibility, bool);
411 vtkBooleanMacro(OccludedVisibility, bool);
412
416 vtkGetMacro(OccludedOpacity, double);
417 vtkSetMacro(OccludedOpacity, double);
418
422 vtkGetObjectMacro(TextProperty, vtkTextProperty);
423
425 vtkSetVector3Macro(ActiveColor, double);
427 vtkGetVector3Macro(ActiveColor, double);
428
430
431 vtkGetMacro(HandlesInteractive, bool);
432 vtkSetMacro(HandlesInteractive, bool);
433 vtkBooleanMacro(HandlesInteractive, bool);
434 vtkGetMacro(TranslationHandleVisibility, bool);
435 vtkSetMacro(TranslationHandleVisibility, bool);
436 vtkBooleanMacro(TranslationHandleVisibility, bool);
437 vtkGetMacro(RotationHandleVisibility, bool);
438 vtkSetMacro(RotationHandleVisibility, bool);
439 vtkBooleanMacro(RotationHandleVisibility, bool);
440 vtkGetMacro(ScaleHandleVisibility, bool);
441 vtkSetMacro(ScaleHandleVisibility, bool);
442 vtkBooleanMacro(ScaleHandleVisibility, bool);
443 void SetHandleVisibility(int handleType, bool visibility);
444 bool GetHandleVisibility(int handleType);
446
448
450 vtkSetMacro(InteractionHandleScale, double);
451 vtkGetMacro(InteractionHandleScale, double);
453
455
459 vtkSetVector4Macro(RotationHandleComponentVisibility, bool);
460 vtkGetVector4Macro(RotationHandleComponentVisibility, bool);
461 vtkSetVector4Macro(ScaleHandleComponentVisibility, bool);
462 vtkGetVector4Macro(ScaleHandleComponentVisibility, bool);
463 vtkSetVector4Macro(TranslationHandleComponentVisibility, bool);
464 vtkGetVector4Macro(TranslationHandleComponentVisibility, bool);
466
469 virtual vtkDataSet* GetScalarDataSet() override;
471 virtual vtkDataArray* GetActiveScalarArray() override;
472
474 virtual void UpdateAssignedAttribute() override;
475
476 virtual void SetScalarVisibility(int visibility) override;
477
479 vtkGetMacro(CanDisplayScaleHandles, bool);
480
481protected:
485 void operator= ( const vtkMRMLMarkupsDisplayNode& );
486
487 // Set the text style from a string
488 // String format follows html-style conventions
489 void SetTextPropertyFromString(std::string textPropertyString);
490
491 // Return a string representing the text style
492 // String format follows html-style conventions
494
497 std::map<std::string, ComponentInfo> ActiveComponents;
498
500
507 double TextScale;
510 double GlyphSize;
512
516 double SliceProjectionColor[3];
518
520
521 static const char* LineColorNodeReferenceRole;
523
527
532
535
536 vtkTextProperty* TextProperty;
537
538 double ActiveColor[3];
539
545
546 bool RotationHandleComponentVisibility[4];
547 bool ScaleHandleComponentVisibility[4];
548 bool TranslationHandleComponentVisibility[4];
549
551};
552#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.