Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLNode.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: vtkMRMLNode.h,v $
10  Date: $Date: 2006/03/19 17:12:29 $
11  Version: $Revision: 1.18 $
12 
13 =========================================================================auto=*/
14 
15 #ifndef __vtkMRMLNode_h
16 #define __vtkMRMLNode_h
17 
18 // MRML includes
19 #include "vtkMRML.h"
20 #include "vtkObserverManager.h"
21 #include "vtkIdTypeArray.h"
22 #include "vtkIntArray.h"
23 
24 class vtkMRMLScene;
25 class vtkStringArray;
26 
27 // VTK includes
28 #include <vtkObject.h>
29 #include <vtkSmartPointer.h>
30 #include <vtkWeakPointer.h>
31 class vtkCallbackCommand;
32 
33 // Slicer VTK add-on includes
34 #include <vtkLoggingMacros.h>
35 
36 // STD includes
37 #include <map>
38 #include <string>
39 #include <vector>
40 
41 #ifndef vtkSetMRMLObjectMacro
42 #define vtkSetMRMLObjectMacro(node,value) {this->MRMLObserverManager->SetObject ( vtkObjectPointer( &(node)), (value) );};
43 #endif
44 
46 #ifndef vtkSetAndObserveMRMLObjectMacro
47 #define vtkSetAndObserveMRMLObjectMacro(node,value) {this->MRMLObserverManager->SetAndObserveObject ( vtkObjectPointer( &(node)), (value) );};
48 #endif
49 
50 #ifndef vtkSetAndObserveMRMLObjectMacroNoWarning
51 #define vtkSetAndObserveMRMLObjectMacroNoWarning(node,value) {this->MRMLObserverManager->SetAndObserveObject ( vtkObjectPointer( &(node)), (value), 0.0, false /* no warning */ );};
52 #endif
53 
54 #ifndef vtkSetAndObserveMRMLObjectEventsMacro
55 #define vtkSetAndObserveMRMLObjectEventsMacro(node,value,events) {this->MRMLObserverManager->SetAndObserveObjectEvents ( vtkObjectPointer( &(node)), (value), (events));};
56 #endif
57 
58 #ifndef vtkSetAndObserveMRMLObjectEventsMacroNoWarning
59 #define vtkSetAndObserveMRMLObjectEventsMacroNoWarning(node,value,events) {this->MRMLObserverManager->SetAndObserveObjectEvents ( vtkObjectPointer( &(node)), (value), (events), NULL /* priorities */, false /* no warning */);};
60 #endif
61 
62 #ifndef vtkObserveMRMLObjectMacro
63 #define vtkObserveMRMLObjectMacro(node) {this->MRMLObserverManager->ObserveObject ( (node) );};
64 #endif
65 
66 #ifndef vtkObserveMRMLObjectEventsMacro
67 #define vtkObserveMRMLObjectEventsMacro(node, events) {this->MRMLObserverManager->AddObjectEvents ( (node), (events) );};
68 #endif
69 
70 #ifndef vtkUnObserveMRMLObjectMacro
71 #define vtkUnObserveMRMLObjectMacro(node) {this->MRMLObserverManager->RemoveObjectEvents ( (node) );};
72 #endif
73 
74 #ifndef vtkSetReferenceStringBodyMacro
75 #define vtkSetReferenceStringBodyMacro(name) \
76  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to " << (_arg?_arg:"(null)") ); \
77  if ( this->name == NULL && _arg == NULL) { return;} \
78  if ( this->name && _arg && (!strcmp(this->name,_arg))) { return;} \
79  std::string oldValue; \
80  if (this->name) { oldValue = this->name; delete [] this->name; } \
81  if (_arg) \
82  { \
83  size_t n = strlen(_arg) + 1; \
84  char *cp1 = new char[n]; \
85  const char *cp2 = (_arg); \
86  this->name = cp1; \
87  do { *cp1++ = *cp2++; } while ( --n ); \
88  } \
89  else \
90  { \
91  this->name = NULL; \
92  } \
93  this->Modified(); \
94  if (this->Scene && this->name) \
95  { \
96  if (oldValue.size() > 0) \
97  { \
98  this->Scene->RemoveReferencedNodeID(oldValue.c_str(), this); \
99  } \
100  this->Scene->AddReferencedNodeID(this->name, this); \
101  }
102 #endif
103 
104 #ifndef vtkSetReferenceStringMacro
105 #define vtkSetReferenceStringMacro(name) \
106 virtual void Set##name (const char* _arg) \
107  { \
108  vtkSetReferenceStringBodyMacro(name)\
109  }
110 #endif
111 
112 #ifndef vtkCxxSetReferenceStringMacro
113 #define vtkCxxSetReferenceStringMacro(class,name) \
114 void class::Set##name (const char* _arg) \
115  { \
116  vtkSetReferenceStringBodyMacro(name); \
117  }
118 #endif
119 
120 #ifndef vtkMRMLNodeNewMacro
121 #define vtkMRMLNodeNewMacro(newClass) \
122  vtkStandardNewMacro(newClass); \
123  vtkMRMLNode* newClass::CreateNodeInstance() \
124  { \
125  return newClass::New(); \
126  }
127 #endif
128 
129 
135 class VTK_MRML_EXPORT vtkMRMLNode : public vtkObject
136 {
139  friend class vtkMRMLScene;
140  friend class vtkMRMLSceneViewNode;
141 
142 public:
143  vtkTypeMacro(vtkMRMLNode,vtkObject);
144  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
145 
149  virtual vtkMRMLNode* CreateNodeInstance() = 0;
150 
156  virtual void ReadXMLAttributes(const char** atts);
157 
162  virtual void UpdateReferences();
163 
166  virtual void ProcessChildNode(vtkMRMLNode *){};
167 
171  virtual void UpdateScene(vtkMRMLScene *)
172  {
173  this->UpdateNodeReferences();
174  };
175 
178  virtual void OnNodeAddedToScene()
179  {
180  this->UpdateNodeReferences();
181  };
182 
189  virtual void WriteXML(ostream& of, int indent);
190 
192  virtual void WriteNodeBodyXML(ostream& of, int indent);
193 
200  virtual void Copy(vtkMRMLNode *node);
201 
206  virtual void CopyReferences(vtkMRMLNode* node);
207 
221  void CopyWithScene(vtkMRMLNode *node);
222 
243  virtual void Reset(vtkMRMLNode* defaultNode);
244 
251  virtual int StartModify()
252  {
253  int disabledModify = this->GetDisableModifiedEvent();
254  this->DisableModifiedEventOn();
255  return disabledModify;
256  };
257 
265  virtual int EndModify(int previousDisableModifiedEventState)
266  {
267  this->SetDisableModifiedEvent(previousDisableModifiedEventState);
268  if (!previousDisableModifiedEventState)
269  {
270  return this->InvokePendingModifiedEvent();
271  }
272  return this->ModifiedEventPending;
273  };
274 
275 
279  virtual const char* GetNodeTagName() = 0;
280 
292  void SetAttribute(const char* name, const char* value);
293 
295  void RemoveAttribute(const char* name);
296 
300  const char* GetAttribute(const char* name);
301 
303  std::vector< std::string > GetAttributeNames();
304 
306  void GetAttributeNames(vtkStringArray* attributeNames);
307 
309  vtkGetMacro(HideFromEditors, int);
310  vtkSetMacro(HideFromEditors, int);
311  vtkBooleanMacro(HideFromEditors, int);
312 
314  vtkGetMacro(Selectable, int);
315  vtkSetMacro(Selectable, int);
316  vtkBooleanMacro(Selectable, int);
317 
318 
320  virtual void ProcessMRMLEvents ( vtkObject *caller, unsigned long event, void *callData );
321 
326  vtkGetMacro(InMRMLCallbackFlag, int);
327  void SetInMRMLCallbackFlag (int flag) {
328  this->InMRMLCallbackFlag = flag;
329  }
330 
332  vtkSetStringMacro(Description);
333  vtkGetStringMacro(Description);
334 
336  vtkSetStringMacro(Name);
337  vtkGetStringMacro(Name);
338 
340  //vtkSetStringMacro(ID);
341  vtkGetStringMacro(ID);
342 
369  vtkSetStringMacro(SingletonTag);
370  vtkGetStringMacro(SingletonTag);
372  {
373  this->SetSingletonTag("Singleton");
374  }
376  {
377  this->SetSingletonTag(NULL);
378  }
379  bool IsSingleton()
380  {
381  return (this->GetSingletonTag() != NULL);
382  }
383 
385  vtkGetMacro(SaveWithScene, int);
386  vtkSetMacro(SaveWithScene, int);
387  vtkBooleanMacro(SaveWithScene, int);
388 
390  vtkGetMacro(AddToScene, int);
391  vtkSetMacro(AddToScene, int);
392  vtkBooleanMacro(AddToScene, int);
393  void SetAddToSceneNoModify(int value);
394 
396  vtkGetMacro(DisableModifiedEvent, int);
397  void SetDisableModifiedEvent(int onOff)
398  {
399  this->DisableModifiedEvent = onOff;
400  }
402  {
403  this->SetDisableModifiedEvent(1);
404  }
406  {
407  this->SetDisableModifiedEvent(0);
408  }
409 
415  vtkGetMacro(ModifiedEventPending, int);
416 
430  virtual void Modified() VTK_OVERRIDE
431  {
432  if (!this->GetDisableModifiedEvent())
433  {
435  }
436  else
437  {
438  ++this->ModifiedEventPending;
439  }
440  }
441 
450  {
451  int oldModifiedEventPending = 0;
452  // Invoke pending standard Modified event
453  if ( this->ModifiedEventPending )
454  {
455  oldModifiedEventPending += this->ModifiedEventPending;
456  this->ModifiedEventPending = 0;
458  }
459  // Invoke pending custom modified events
460  if (!this->CustomModifiedEventPending.empty())
461  {
462  // Need to make a copy of the event IDs stored in this->CustomModifiedEventPending,
463  // because event invocation may add more events to this->CustomModifiedEventPending,
464  // which would then make the iterator invalid.
465  std::vector<int> customEventsToInvoke;
466  for (std::map< int, int >::iterator it=this->CustomModifiedEventPending.begin(); it!=this->CustomModifiedEventPending.end(); ++it)
467  {
468  oldModifiedEventPending += it->second;
469  customEventsToInvoke.push_back(it->first);
470  }
471  this->CustomModifiedEventPending.clear();
472  for (std::vector<int>::iterator it=customEventsToInvoke.begin(); it!=customEventsToInvoke.end(); ++it)
473  {
474  this->InvokeEvent(*it);
475  }
476  }
477  return oldModifiedEventPending;
478  }
479 
492  virtual void InvokeCustomModifiedEvent(int eventId, void *callData=NULL)
493  {
494  if (!this->GetDisableModifiedEvent())
495  {
496  // DisableModify is inactive, we immediately invoke the event
497  this->InvokeEvent(eventId, callData);
498  }
499  else
500  {
501  // just remember the custom modified event and invoke it once,
502  // when DisableModify is deactivated
503  ++this->CustomModifiedEventPending[eventId];
504  }
505  }
506 
508  {
509  int oldMode = this->GetDisableModifiedEvent();
510  this->DisableModifiedEventOn();
511  this->Copy(node);
513  this->SetDisableModifiedEvent(oldMode);
514  }
515 
517  {
518  int oldMode = this->GetDisableModifiedEvent();
519  this->DisableModifiedEventOn();
520  this->Copy(node);
521  this->SetDisableModifiedEvent(oldMode);
522  }
523 
533  {
534  int oldMode = this->StartModify();
535  this->CopyWithScene(node);
536  this->EndModify(oldMode);
537  }
538 
543  virtual vtkMRMLScene* GetScene();
544  virtual void SetScene(vtkMRMLScene* scene);
545 
550  virtual void SetSceneReferences();
551 
553  virtual void UpdateReferenceID(const char *oldID, const char *newID);
554 
561  const char *URLEncodeString(const char *inString);
562 
569  const char *URLDecodeString(const char *inString);
570 
572  vtkGetMacro(Selected, int);
573  vtkSetMacro(Selected, int);
574  vtkBooleanMacro(Selected, int);
575 
589  void AddNodeReferenceRole(const char *referenceRole, const char *mrmlAttributeName=0, vtkIntArray *events=0);
590 
592  vtkMRMLNode* SetNodeReferenceID(const char* referenceRole, const char* referencedNodeID);
593 
595  vtkMRMLNode* AddNodeReferenceID(const char* referenceRole , const char* referencedNodeID);
596 
599  vtkMRMLNode* SetNthNodeReferenceID(const char* referenceRole, int n, const char* referencedNodeID);
600 
605  vtkMRMLNode* SetAndObserveNodeReferenceID(const char* referenceRole , const char* referencedNodeID, vtkIntArray *events=0);
606 
611  vtkMRMLNode* AddAndObserveNodeReferenceID(const char* referenceRole , const char* referencedNodeID, vtkIntArray *events=0);
612 
628  vtkMRMLNode* SetAndObserveNthNodeReferenceID(const char* referenceRole, int n, const char *referencedNodeID, vtkIntArray *events=0);
629 
631  void RemoveNthNodeReferenceID(const char* referenceRole, int n);
632 
636  void RemoveNodeReferenceIDs(const char* referenceRole);
637 
642  bool HasNodeReferenceID(const char* referenceRole, const char* referencedNodeID);
643 
646  int GetNumberOfNodeReferences(const char* referenceRole);
647 
654  const char *GetNthNodeReferenceID(const char* referenceRole, int n);
655 
660  const char *GetNodeReferenceID(const char* referenceRole);
661 
672  vtkMRMLNode* GetNthNodeReference(const char* referenceRole, int n);
673 
676  vtkMRMLNode* GetNodeReference(const char* referenceRole);
677 
685  void GetNodeReferences(const char* referenceRole, std::vector<vtkMRMLNode*> &nodes);
686 
692  void GetNodeReferenceIDs(const char* referenceRole,
693  std::vector<const char*> &referencedNodeIDs);
694 
697  void GetNodeReferenceRoles(std::vector<std::string> &roles);
698 
702 
705  const char* GetNthNodeReferenceRole(int n);
706 
709  enum
710  {
712  IDChangedEvent = 16001,
717  };
718 
719 
720 protected:
721 
723  class VTK_MRML_EXPORT vtkMRMLNodeReference : public vtkObject
724  {
725  public:
726  vtkTypeMacro(vtkMRMLNodeReference,vtkObject);
727  static vtkMRMLNodeReference *New();
728  void PrintSelf(ostream& vtkNotUsed(os), vtkIndent vtkNotUsed(indent)) VTK_OVERRIDE {};
729 
730  public:
731  vtkSetStringMacro(ReferenceRole);
732  vtkGetStringMacro(ReferenceRole);
733 
734  vtkSetStringMacro(ReferencedNodeID);
735  vtkGetStringMacro(ReferencedNodeID);
736 
742  void SetEvents(vtkIntArray* events);
743  vtkIntArray* GetEvents() const;
744 
745  void SetReferencingNode(vtkMRMLNode* node);
746  vtkMRMLNode* GetReferencingNode() const;
747 
748  void SetReferencedNode(vtkMRMLNode* node);
749  vtkMRMLNode* GetReferencedNode() const;
750 
751  protected:
753  virtual ~vtkMRMLNodeReference();
754 
756  void operator=(const vtkMRMLNodeReference&);
757 
760 
762  vtkWeakPointer<vtkMRMLNode> ReferencingNode;
764  vtkSmartPointer<vtkMRMLNode> ReferencedNode;
765 
771  vtkSmartPointer<vtkIntArray> Events;
772  };
773 
774  vtkMRMLNode();
776  virtual ~vtkMRMLNode();
777  vtkMRMLNode(const vtkMRMLNode&);
778  void operator=(const vtkMRMLNode&);
779 
782  static void MRMLCallback( vtkObject *caller,
783  unsigned long eid, void *clientData, void *callData );
784 
787  vtkSetStringMacro( TempURLString );
788  vtkGetStringMacro( TempURLString );
789 
797  virtual const char* GetReferenceRoleFromMRMLAttributeName(const char* attName);
798 
806  virtual const char* GetMRMLAttributeNameFromReferenceRole(const char* refRole);
807 
811  virtual bool IsReferenceRoleGeneric(const char* refRole);
812 
816  virtual void UpdateNodeReferences(const char* referenceRole = NULL);
817 
822  virtual void UpdateNthNodeReference(const char* referenceRole, int n);
823 
827  vtkMRMLNode* UpdateNodeReferenceEventObserver(vtkMRMLNode *oldReferencedNode, vtkMRMLNode *newReferencedNode,
828  vtkIntArray *newEvents, vtkMRMLNodeReference* referenceToIgnore);
829 
835  void GetUpdatedReferencedNodeEventList(int& oldReferencedNodeUseCount, int& newReferencedNodeUseCount,
836  vtkIntArray* oldConsolidatedEventList, vtkIntArray* newConsolidatedEventList,
837  vtkMRMLNode* oldReferencedNode, vtkMRMLNode* newReferencedNode,
838  vtkMRMLNodeReference* referenceToIgnore, vtkIntArray* newEvents);
839 
842  virtual void InvalidateNodeReferences();
843 
848  {
849  this->InvokeEvent(vtkMRMLNode::ReferenceAddedEvent, reference);
850  }
851 
854  {
855  this->InvokeEvent(vtkMRMLNode::ReferenceModifiedEvent, reference);
856  }
857 
860  {
861  this->InvokeEvent(vtkMRMLNode::ReferenceRemovedEvent, reference);
862  }
863 
866  void ParseReferencesAttribute(const char *attValue, std::map<std::string, std::string> &references);
867 
869  vtkCallbackCommand *MRMLCallbackCommand;
870 
874 
875  char *Description;
876  char *Name;
877  char *ID;
880  int Selected;
882 
884 
885  // We don't increase the reference count of Scene when store its pointer
886  // therefore we must use a weak pointer to prevent pointer dangling when
887  // the scene is deleted.
888  vtkWeakPointer<vtkMRMLScene> Scene;
889 
890  typedef std::map< std::string, std::string > AttributesType;
891  AttributesType Attributes;
892 
894 
897  typedef std::vector< vtkSmartPointer<vtkMRMLNodeReference> > NodeReferenceListType;
898  typedef std::map< std::string, NodeReferenceListType > NodeReferencesType;
899  NodeReferencesType NodeReferences;
900 
901  std::map< std::string, std::string> NodeReferenceMRMLAttributeNames;
902 
903  typedef std::map< std::string, vtkSmartPointer<vtkIntArray> > NodeReferenceEventsType;
904  NodeReferenceEventsType NodeReferenceEvents; // for each role it specifies which referenced node emitted events this node should observe
905 
906 private:
907 
910  void SetID(const char* newID);
911 
913  char *TempURLString;
914 
915  char *SingletonTag;
916 
917  int DisableModifiedEvent;
918  int ModifiedEventPending;
919  std::map<int, int> CustomModifiedEventPending; // event id, pending value (number of events grouped together)
920 };
921 
922 #endif
vtkMRMLNode * SetNthNodeReferenceID(const char *referenceRole, int n, const char *referencedNodeID)
Set a N-th reference from this node with specified referencedNodeID for a specific referenceRole...
const char * GetNthNodeReferenceID(const char *referenceRole, int n)
Return the string of the Nth node ID for a specific reference role.
vtkMRMLNode * GetNodeReference(const char *referenceRole)
bool IsSingleton()
Definition: vtkMRMLNode.h:379
virtual void Copy(vtkMRMLNode *node) VTK_OVERRIDE
Copy the node&#39;s attributes to this object.
void DisableModifiedEventOff()
Definition: vtkMRMLNode.h:405
std::vector< vtkSmartPointer< vtkMRMLNodeReference > > NodeReferenceListType
Definition: vtkMRMLNode.h:897
virtual int InvokePendingModifiedEvent()
Invokes any modified events that are pending.
Definition: vtkMRMLNode.h:449
void SetSingletonOn()
Definition: vtkMRMLNode.h:371
void AddNodeReferenceRole(const char *referenceRole, const char *mrmlAttributeName=0, vtkIntArray *events=0)
Add a referenceRole.
vtkMRMLNode * SetAndObserveNodeReferenceID(const char *referenceRole, const char *referencedNodeID, vtkIntArray *events=0)
Set and observe a reference node from this node for a specific referenceRole.
std::map< std::string, NodeReferenceListType > NodeReferencesType
Definition: vtkMRMLNode.h:898
std::vector< std::string > GetAttributeNames()
Get all attribute names.
virtual void WriteNodeBodyXML(ostream &of, int indent) VTK_OVERRIDE
Write this node&#39;s body to a MRML file in XML format.
vtkWeakPointer< vtkMRMLNode > ReferencingNode
Points to this MRML node (that added the reference)
Definition: vtkMRMLNode.h:762
virtual vtkMRMLScene * GetScene()
Only the scene can set itself to the node.
virtual void Reset(vtkMRMLNode *defaultNode)
Reset node attributes to the initial state as defined in the constructor or the passed default node...
Manages adding and deleting of obserevers with events.
void CopyWithSceneWithSingleModifiedEvent(vtkMRMLNode *node)
Copy everything (including Scene and ID) from another node of the same type.
Definition: vtkMRMLNode.h:532
const char * GetNodeReferenceID(const char *referenceRole)
Utility function that returns the first node id for a specific referenceRole.
void GetNodeReferenceRoles(std::vector< std::string > &roles)
void SetAttribute(const char *name, const char *value)
Set a name value pair attribute.
int InMRMLCallbackFlag
Flag to avoid event loops.
Definition: vtkMRMLNode.h:873
vtkObserverManager * MRMLObserverManager
Definition: vtkMRMLNode.h:893
virtual void OnNodeAddedToScene()
Definition: vtkMRMLNode.h:178
const char * GetNthNodeReferenceRole(int n)
virtual int StartModify()
Start modifying the node. Disable Modify events.
Definition: vtkMRMLNode.h:251
virtual void ProcessMRMLEvents(vtkObject *, unsigned long, void *) VTK_OVERRIDE
alternative method to propagate events generated in Storage nodes
virtual void UpdateReferences()
The method should remove all pointers and observations to all nodes that are not in the scene anymore...
virtual void CopyReferences(vtkMRMLNode *node)
Copy the references of the node into this.
std::map< std::string, vtkSmartPointer< vtkIntArray > > NodeReferenceEventsType
Definition: vtkMRMLNode.h:903
void SetDisableModifiedEvent(int onOff)
Definition: vtkMRMLNode.h:397
virtual int GetDisableModifiedEvent()
Turn on/off generating InvokeEvent for set macros.
virtual void UpdateReferenceID(const char *oldID, const char *newID)
Update the stored reference to another node in the scene.
std::map< std::string, std::string > NodeReferenceMRMLAttributeNames
Definition: vtkMRMLNode.h:901
const char * GetAttribute(const char *name)
Get value of a name value pair attribute.
bool HasNodeReferenceID(const char *referenceRole, const char *referencedNodeID)
Return true if referencedNodeID is in the node ID list for a specific referenceRole.
virtual void OnNodeReferenceModified(vtkMRMLNodeReference *reference)
Called when a referenced node pointer is modified.
Definition: vtkMRMLNode.h:853
char * Name
Definition: vtkMRMLNode.h:876
virtual char * GetSingletonTag()
NodeReferenceEventsType NodeReferenceEvents
Definition: vtkMRMLNode.h:904
void GetNodeReferenceIDs(const char *referenceRole, std::vector< const char *> &referencedNodeIDs)
Return a list of the referenced node IDs.
vtkSmartPointer< vtkMRMLNode > ReferencedNode
The referenced node that is actually observed now.
Definition: vtkMRMLNode.h:764
void SetSingletonOff()
Definition: vtkMRMLNode.h:375
void SetAddToSceneNoModify(int value)
virtual void SetSceneReferences()
Update the references of the node to the scene.
void RemoveAttribute(const char *name)
Remove attribute with the specified name.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
virtual const char * GetNodeTagName() VTK_OVERRIDE
Get node XML tag name (like Volume, Model)
vtkSmartPointer< vtkIntArray > Events
Definition: vtkMRMLNode.h:771
char * Description
Definition: vtkMRMLNode.h:875
vtkMRMLNode * AddNodeReferenceID(const char *referenceRole, const char *referencedNodeID)
Convenience method that adds a referencedNodeID at the end of the list.
virtual int EndModify(int previousDisableModifiedEventState)
End modifying the node.
Definition: vtkMRMLNode.h:265
void RemoveNthNodeReferenceID(const char *referenceRole, int n)
Convenience method that removes the Nth node ID from the list.
virtual void OnNodeReferenceRemoved(vtkMRMLNodeReference *reference)
Called when a referenced node pointer is removed (set to NULL).
Definition: vtkMRMLNode.h:859
vtkMRMLNode * AddAndObserveNodeReferenceID(const char *referenceRole, const char *referencedNodeID, vtkIntArray *events=0)
Add and observe a reference node from this node for a specific referenceRole.
int GetNumberOfNodeReferences(const char *referenceRole)
Return the number of node IDs for a specific reference role (and nodes as they always have the same s...
virtual void ProcessChildNode(vtkMRMLNode *)
Set dependencies between this node and a child node when parsing XML file.
Definition: vtkMRMLNode.h:166
virtual void SetScene(vtkMRMLScene *scene)
void PrintSelf(ostream &vtkNotUsed(os), vtkIndent vtkNotUsed(indent)) VTK_OVERRIDE
Definition: vtkMRMLNode.h:728
const char * URLDecodeString(const char *inString)
Decode a URL string.
char * ReferenceRole
Name of the reference role.
Definition: vtkMRMLNode.h:759
AttributesType Attributes
Definition: vtkMRMLNode.h:891
vtkMRMLNode * SetAndObserveNthNodeReferenceID(const char *referenceRole, int n, const char *referencedNodeID, vtkIntArray *events=0)
Set and observe the Nth node ID for a specific reference role.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual void WriteXML(ostream &of, int indent) VTK_OVERRIDE
Write this node&#39;s information to a MRML file in XML format.
vtkMRMLNode * GetNthNodeReference(const char *referenceRole, int n)
Get referenced MRML node for a specific referenceRole.
std::map< std::string, std::string > AttributesType
Definition: vtkMRMLNode.h:890
void CopyWithSingleModifiedEvent(vtkMRMLNode *node)
Definition: vtkMRMLNode.h:507
void RemoveNodeReferenceIDs(const char *referenceRole)
Remove all node IDs and associated nodes for a specific referenceRole.
void CopyWithoutModifiedEvent(vtkMRMLNode *node)
Definition: vtkMRMLNode.h:516
vtkCallbackCommand * MRMLCallbackCommand
Holders for MRML callbacks.
Definition: vtkMRMLNode.h:869
vtkWeakPointer< vtkMRMLScene > Scene
Definition: vtkMRMLNode.h:888
int SaveWithScene
Definition: vtkMRMLNode.h:883
virtual void InvokeCustomModifiedEvent(int eventId, void *callData=NULL)
This method allows the node to compress events.
Definition: vtkMRMLNode.h:492
virtual vtkMRMLNode * CreateNodeInstance() VTK_OVERRIDE
MRMLNode methods.
vtkMRMLNode * SetNodeReferenceID(const char *referenceRole, const char *referencedNodeID)
Set a reference to a node with specified nodeID from this node for a specific referenceRole.
virtual void OnNodeReferenceAdded(vtkMRMLNodeReference *reference)
Definition: vtkMRMLNode.h:847
virtual void UpdateNodeReferences(const char *referenceRole=NULL)
void GetNodeReferences(const char *referenceRole, std::vector< vtkMRMLNode *> &nodes)
Return a list of the referenced nodes.
void SetInMRMLCallbackFlag(int flag)
Definition: vtkMRMLNode.h:327
virtual void Modified() VTK_OVERRIDE
Customized version of Modified() allowing to compress vtkCommand::ModifiedEvent.
Definition: vtkMRMLNode.h:430
void CopyWithScene(vtkMRMLNode *node)
Copy everything (including Scene and ID) from another node of the same type.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
Class to hold information about a node reference.
Definition: vtkMRMLNode.h:723
const char * URLEncodeString(const char *inString)
Encode a URL string.
NodeReferencesType NodeReferences
Definition: vtkMRMLNode.h:899
virtual void SetSingletonTag(const char *)
Tag that make this node a singleton in the scene.
void DisableModifiedEventOn()
Definition: vtkMRMLNode.h:401
int GetNumberOfNodeReferenceRoles()
int HideFromEditors
Definition: vtkMRMLNode.h:878
virtual void UpdateScene(vtkMRMLScene *)
Definition: vtkMRMLNode.h:171
virtual void ReadXMLAttributes(const char **atts) VTK_OVERRIDE
Read node attributes from XML file.