Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLHierarchyNode.h
Go to the documentation of this file.
1/*=auto=========================================================================
2
3 Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
4
5 See COPYRIGHT.txt
6 or http://www.slicer.org/copyright/copyright.txt for details.
7
8 Program: 3D Slicer
9 Module: $RCSfile: vtkMRMLHierarchyNode.h,v $
10 Date: $Date: 2006/03/19 17:12:29 $
11 Version: $Revision: 1.13 $
12
13=========================================================================auto=*/
14
15#ifndef __vtkMRMLHierarchyNode_h
16#define __vtkMRMLHierarchyNode_h
17
18// MRML includes
19#include "vtkMRMLNode.h"
20
21// VTK includes
22class vtkCollection;
23
24// STD includes
25#include <vector>
26
28class VTK_MRML_EXPORT vtkMRMLHierarchyNode : public vtkMRMLNode
29{
30public:
33 void PrintSelf(ostream& os, vtkIndent indent) override;
34
36
39 void ReadXMLAttributes(const char** atts) override;
40
43 void WriteXML(ostream& of, int indent) override;
44
47 void Copy(vtkMRMLNode* node) override;
48
51 const char* GetNodeTagName() override { return "Hierarchy"; }
52
54 void SetSceneReferences() override;
55
59 void UpdateReferences() override;
60
63 void UpdateScene(vtkMRMLScene* scene) override;
64
67 void UpdateReferenceID(const char* oldID, const char* newID) override;
68
72
76
79 virtual char* GetParentNodeID() { return GetParentNodeIDReference(); }
80
81 virtual void SetParentNodeID(const char* ref);
82
85 void GetAllChildrenNodes(std::vector<vtkMRMLHierarchyNode*>& childrenNodes);
86
91 std::vector<vtkMRMLHierarchyNode*> GetChildrenNodes();
92
94 int GetNumberOfChildrenNodes() { return static_cast<int>(this->GetChildrenNodes().size()); }
95
98
101
103 void SetIndexInParent(int index);
104
107 void MoveInParent(int increment);
108
111
114
116 enum
117 {
120 };
121
123
127
128 virtual void SetAssociatedNodeID(const char* ref);
129
132
135 virtual void GetAssociatedChildrenNodes(vtkCollection* children, const char* childClass = nullptr);
136
139 static vtkMRMLHierarchyNode* GetAssociatedHierarchyNode(vtkMRMLScene* scene, const char* associatedNodeID);
142 // vtkSetMacro(SortingValue, double);
144 // nodes (since the order of that associated node could have changed as well)
145 void SetSortingValue(double value);
146 vtkGetMacro(SortingValue, double);
147
151 vtkGetMacro(AllowMultipleChildren, int);
152 vtkSetMacro(AllowMultipleChildren, int);
153 vtkBooleanMacro(AllowMultipleChildren, int);
154
155protected:
160
163 void SetParentNodeIDReference(const char* id);
164 vtkGetStringMacro(ParentNodeIDReference);
165
167
170
172
178
180 vtkGetStringMacro(AssociatedNodeIDReference);
181
182 typedef std::map<std::string, std::vector<vtkMRMLHierarchyNode*>> HierarchyChildrenNodesType;
183
184 static std::map<vtkMRMLScene*, HierarchyChildrenNodesType> SceneHierarchyChildrenNodes;
185 static std::map<vtkMRMLScene*, vtkMTimeType> SceneHierarchyChildrenNodesMTime;
186
192
193 typedef std::map<std::string, vtkMRMLHierarchyNode*> AssociatedHierarchyNodesType;
194
195 static std::map<vtkMRMLScene*, AssociatedHierarchyNodesType> SceneAssociatedHierarchyNodes;
196
197 static std::map<vtkMRMLScene*, vtkMTimeType> SceneAssociatedHierarchyNodesMTime;
198
200
201 static double MaximumSortingValue;
202
204
207
214};
215
216#endif
void InvokeHierarchyModifiedEvent(vtkMRMLNode *node=nullptr)
void UpdateReferenceID(const char *oldID, const char *newID) override
Update the stored reference to another node in the scene.
virtual char * GetParentNodeIDReference()
virtual vtkMRMLNode * GetAssociatedNode()
Get node associated with this hierarchy node.
virtual void GetAssociatedChildrenNodes(vtkCollection *children, const char *childClass=nullptr)
void SetAssociatedNodeIDReference(const char *)
void SetIndexInParent(int index)
Set index of this node in it's parent based on the value of their SortingValue.
int GetNumberOfChildrenNodes()
Returns the number of immediate children in the hierarchy.
vtkMRMLHierarchyNode * GetTopParentNode()
Get the top parent node in the hierarchy.
void SetParentNodeIDReference(const char *id)
String ID of the parent hierarchy MRML node.
virtual void SetAssociatedNodeID(const char *ref)
virtual char * GetParentNodeID()
String ID of the parent hierarchy MRML node.
vtkMRMLHierarchyNode * GetParentNode()
Associated parent MRML node.
static vtkMRMLHierarchyNode * GetAssociatedHierarchyNode(vtkMRMLScene *scene, const char *associatedNodeID)
Get Hierarchy node for a given associated node.
virtual void SetParentNodeID(const char *ref)
static std::map< vtkMRMLScene *, HierarchyChildrenNodesType > SceneHierarchyChildrenNodes
std::vector< vtkMRMLHierarchyNode * > GetChildrenNodes()
int AllowMultipleChildren
is this a node that's only supposed to have one child?
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
std::map< std::string, vtkMRMLHierarchyNode * > AssociatedHierarchyNodesType
void RemoveHierarchyChildrenNodes()
Removes immediate children nodes, their children are reparented to this parent node.
char * AssociatedNodeIDReference
String ID of the associated MRML node.
void Copy(vtkMRMLNode *node) override
Copy the node's attributes to this object.
void MoveInParent(int increment)
static std::map< vtkMRMLScene *, AssociatedHierarchyNodesType > SceneAssociatedHierarchyNodes
virtual char * GetAssociatedNodeID()
String ID of the corresponding displayable MRML node.
~vtkMRMLHierarchyNode() override
static std::map< vtkMRMLScene *, vtkMTimeType > SceneHierarchyChildrenNodesMTime
void PrintSelf(ostream &os, vtkIndent indent) override
int GetIndexInParent()
Get index of this node in it's parent based on the value of their SortingValue.
void operator=(const vtkMRMLHierarchyNode &)
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file.
void SetSortingValue(double value)
Node's Sorting Value.
vtkMRMLHierarchyNode(const vtkMRMLHierarchyNode &)
vtkMRMLNode * CreateNodeInstance() override
Create instance of the default node. Like New only virtual.
vtkMRMLHierarchyNode * GetNthChildNode(int index)
Get n-th child node sorted in the order of their SortingValue.
static void AssociatedHierarchyIsModified(vtkMRMLScene *scene)
Mark hierarchy as modified.
void GetAllChildrenNodes(std::vector< vtkMRMLHierarchyNode * > &childrenNodes)
Given this hierarchy node returns all it's children recursively.
virtual char * GetAssociatedNodeIDReference()
static void HierarchyIsModified(vtkMRMLScene *scene)
Mark hierarchy as modified when you.
void UpdateReferences() override
std::map< std::string, std::vector< vtkMRMLHierarchyNode * > > HierarchyChildrenNodesType
static int UpdateAssociatedToHierarchyMap(vtkMRMLScene *scene)
static std::map< vtkMRMLScene *, vtkMTimeType > SceneAssociatedHierarchyNodesMTime
void SetSceneReferences() override
Set the reference node to current scene.
void UpdateScene(vtkMRMLScene *scene) override
Observe the reference transform node.
void RemoveAllHierarchyChildrenNodes()
Removes all children hierarchy nodes including children of children, etc.
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
static vtkMRMLHierarchyNode * New()
friend class vtkMRMLScene