Slicer  4.10
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 // Helper macros for simplifying reading, writing, copying, and printing node properties.
38 
39 // STD includes
40 #include <map>
41 #include <string>
42 #include <vector>
43 
44 #ifndef vtkSetMRMLObjectMacro
45 #define vtkSetMRMLObjectMacro(node,value) {this->MRMLObserverManager->SetObject ( vtkObjectPointer( &(node)), (value) );};
46 #endif
47 
49 #ifndef vtkSetAndObserveMRMLObjectMacro
50 #define vtkSetAndObserveMRMLObjectMacro(node,value) {this->MRMLObserverManager->SetAndObserveObject ( vtkObjectPointer( &(node)), (value) );};
51 #endif
52 
53 #ifndef vtkSetAndObserveMRMLObjectMacroNoWarning
54 #define vtkSetAndObserveMRMLObjectMacroNoWarning(node,value) {this->MRMLObserverManager->SetAndObserveObject ( vtkObjectPointer( &(node)), (value), 0.0, false /* no warning */ );};
55 #endif
56 
57 #ifndef vtkSetAndObserveMRMLObjectEventsMacro
58 #define vtkSetAndObserveMRMLObjectEventsMacro(node,value,events) {this->MRMLObserverManager->SetAndObserveObjectEvents ( vtkObjectPointer( &(node)), (value), (events));};
59 #endif
60 
61 #ifndef vtkSetAndObserveMRMLObjectEventsMacroNoWarning
62 #define vtkSetAndObserveMRMLObjectEventsMacroNoWarning(node,value,events) {this->MRMLObserverManager->SetAndObserveObjectEvents ( vtkObjectPointer( &(node)), (value), (events), NULL /* priorities */, false /* no warning */);};
63 #endif
64 
65 #ifndef vtkObserveMRMLObjectMacro
66 #define vtkObserveMRMLObjectMacro(node) {this->MRMLObserverManager->ObserveObject ( (node) );};
67 #endif
68 
69 #ifndef vtkObserveMRMLObjectEventsMacro
70 #define vtkObserveMRMLObjectEventsMacro(node, events) {this->MRMLObserverManager->AddObjectEvents ( (node), (events) );};
71 #endif
72 
73 #ifndef vtkUnObserveMRMLObjectMacro
74 #define vtkUnObserveMRMLObjectMacro(node) {this->MRMLObserverManager->RemoveObjectEvents ( (node) );};
75 #endif
76 
77 #ifndef vtkSetReferenceStringBodyMacro
78 #define vtkSetReferenceStringBodyMacro(name) \
79  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to " << (_arg?_arg:"(null)") ); \
80  if ( this->name == NULL && _arg == NULL) { return;} \
81  if ( this->name && _arg && (!strcmp(this->name,_arg))) { return;} \
82  std::string oldValue; \
83  if (this->name) { oldValue = this->name; delete [] this->name; } \
84  if (_arg) \
85  { \
86  size_t n = strlen(_arg) + 1; \
87  char *cp1 = new char[n]; \
88  const char *cp2 = (_arg); \
89  this->name = cp1; \
90  do { *cp1++ = *cp2++; } while ( --n ); \
91  } \
92  else \
93  { \
94  this->name = NULL; \
95  } \
96  this->Modified(); \
97  if (this->Scene && this->name) \
98  { \
99  if (oldValue.size() > 0) \
100  { \
101  this->Scene->RemoveReferencedNodeID(oldValue.c_str(), this); \
102  } \
103  this->Scene->AddReferencedNodeID(this->name, this); \
104  }
105 #endif
106 
107 #ifndef vtkSetReferenceStringMacro
108 #define vtkSetReferenceStringMacro(name) \
109 virtual void Set##name (const char* _arg) \
110  { \
111  vtkSetReferenceStringBodyMacro(name)\
112  }
113 #endif
114 
115 #ifndef vtkCxxSetReferenceStringMacro
116 #define vtkCxxSetReferenceStringMacro(class,name) \
117 void class::Set##name (const char* _arg) \
118  { \
119  vtkSetReferenceStringBodyMacro(name); \
120  }
121 #endif
122 
123 #ifndef vtkMRMLNodeNewMacro
124 #define vtkMRMLNodeNewMacro(newClass) \
125  vtkStandardNewMacro(newClass); \
126  vtkMRMLNode* newClass::CreateNodeInstance() \
127  { \
128  return newClass::New(); \
129  }
130 #endif
131 
132 
138 class VTK_MRML_EXPORT vtkMRMLNode : public vtkObject
139 {
142  friend class vtkMRMLScene;
143  friend class vtkMRMLSceneViewNode;
144 
145 public:
146  vtkTypeMacro(vtkMRMLNode,vtkObject);
147  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
148 
152  virtual vtkMRMLNode* CreateNodeInstance() = 0;
153 
159  virtual void ReadXMLAttributes(const char** atts);
160 
165  virtual void UpdateReferences();
166 
169  virtual void ProcessChildNode(vtkMRMLNode *){};
170 
174  virtual void UpdateScene(vtkMRMLScene *)
175  {
176  this->UpdateNodeReferences();
177  };
178 
181  virtual void OnNodeAddedToScene()
182  {
183  this->UpdateNodeReferences();
184  };
185 
192  virtual void WriteXML(ostream& of, int indent);
193 
195  virtual void WriteNodeBodyXML(ostream& of, int indent);
196 
204  virtual void Copy(vtkMRMLNode *node);
205 
210  virtual void CopyReferences(vtkMRMLNode* node);
211 
225  void CopyWithScene(vtkMRMLNode *node);
226 
247  virtual void Reset(vtkMRMLNode* defaultNode);
248 
255  virtual int StartModify()
256  {
257  int disabledModify = this->GetDisableModifiedEvent();
258  this->DisableModifiedEventOn();
259  return disabledModify;
260  };
261 
269  virtual int EndModify(int previousDisableModifiedEventState)
270  {
271  this->SetDisableModifiedEvent(previousDisableModifiedEventState);
272  if (!previousDisableModifiedEventState)
273  {
274  return this->InvokePendingModifiedEvent();
275  }
276  return this->ModifiedEventPending;
277  };
278 
279 
283  virtual const char* GetNodeTagName() = 0;
284 
296  void SetAttribute(const char* name, const char* value);
297 
299  void RemoveAttribute(const char* name);
300 
304  const char* GetAttribute(const char* name);
305 
307  std::vector< std::string > GetAttributeNames();
308 
310  void GetAttributeNames(vtkStringArray* attributeNames);
311 
313  vtkGetMacro(HideFromEditors, int);
314  vtkSetMacro(HideFromEditors, int);
315  vtkBooleanMacro(HideFromEditors, int);
316 
318  vtkGetMacro(Selectable, int);
319  vtkSetMacro(Selectable, int);
320  vtkBooleanMacro(Selectable, int);
321 
322 
324  virtual void ProcessMRMLEvents ( vtkObject *caller, unsigned long event, void *callData );
325 
330  vtkGetMacro(InMRMLCallbackFlag, int);
331  void SetInMRMLCallbackFlag (int flag) {
332  this->InMRMLCallbackFlag = flag;
333  }
334 
336  vtkSetStringMacro(Description);
337  vtkGetStringMacro(Description);
338 
340  vtkSetStringMacro(Name);
341  vtkGetStringMacro(Name);
342 
344  //vtkSetStringMacro(ID);
345  vtkGetStringMacro(ID);
346 
373  vtkSetStringMacro(SingletonTag);
374  vtkGetStringMacro(SingletonTag);
376  {
377  this->SetSingletonTag("Singleton");
378  }
380  {
381  this->SetSingletonTag(NULL);
382  }
383  bool IsSingleton()
384  {
385  return (this->GetSingletonTag() != NULL);
386  }
387 
389  vtkGetMacro(SaveWithScene, int);
390  vtkSetMacro(SaveWithScene, int);
391  vtkBooleanMacro(SaveWithScene, int);
392 
394  vtkGetMacro(AddToScene, int);
395  vtkSetMacro(AddToScene, int);
396  vtkBooleanMacro(AddToScene, int);
397  void SetAddToSceneNoModify(int value);
398 
400  vtkGetMacro(DisableModifiedEvent, int);
401  void SetDisableModifiedEvent(int onOff)
402  {
403  this->DisableModifiedEvent = onOff;
404  }
406  {
407  this->SetDisableModifiedEvent(1);
408  }
410  {
411  this->SetDisableModifiedEvent(0);
412  }
413 
419  vtkGetMacro(ModifiedEventPending, int);
420 
434  virtual void Modified() VTK_OVERRIDE
435  {
436  if (!this->GetDisableModifiedEvent())
437  {
439  }
440  else
441  {
442  ++this->ModifiedEventPending;
443  }
444  }
445 
454  {
455  int oldModifiedEventPending = 0;
456  // Invoke pending standard Modified event
457  if ( this->ModifiedEventPending )
458  {
459  oldModifiedEventPending += this->ModifiedEventPending;
460  this->ModifiedEventPending = 0;
462  }
463  // Invoke pending custom modified events
464  if (!this->CustomModifiedEventPending.empty())
465  {
466  // Need to make a copy of the event IDs stored in this->CustomModifiedEventPending,
467  // because event invocation may add more events to this->CustomModifiedEventPending,
468  // which would then make the iterator invalid.
469  std::vector<int> customEventsToInvoke;
470  for (std::map< int, int >::iterator it=this->CustomModifiedEventPending.begin(); it!=this->CustomModifiedEventPending.end(); ++it)
471  {
472  oldModifiedEventPending += it->second;
473  customEventsToInvoke.push_back(it->first);
474  }
475  this->CustomModifiedEventPending.clear();
476  for (std::vector<int>::iterator it=customEventsToInvoke.begin(); it!=customEventsToInvoke.end(); ++it)
477  {
478  this->InvokeEvent(*it);
479  }
480  }
481  return oldModifiedEventPending;
482  }
483 
496  virtual void InvokeCustomModifiedEvent(int eventId, void *callData=NULL)
497  {
498  if (!this->GetDisableModifiedEvent())
499  {
500  // DisableModify is inactive, we immediately invoke the event
501  this->InvokeEvent(eventId, callData);
502  }
503  else
504  {
505  // just remember the custom modified event and invoke it once,
506  // when DisableModify is deactivated
507  ++this->CustomModifiedEventPending[eventId];
508  }
509  }
510 
512  {
513  int oldMode = this->GetDisableModifiedEvent();
514  this->DisableModifiedEventOn();
515  this->Copy(node);
517  this->SetDisableModifiedEvent(oldMode);
518  }
519 
521  {
522  int oldMode = this->GetDisableModifiedEvent();
523  this->DisableModifiedEventOn();
524  this->Copy(node);
525  this->SetDisableModifiedEvent(oldMode);
526  }
527 
537  {
538  int oldMode = this->StartModify();
539  this->CopyWithScene(node);
540  this->EndModify(oldMode);
541  }
542 
547  virtual vtkMRMLScene* GetScene();
548  virtual void SetScene(vtkMRMLScene* scene);
549 
554  virtual void SetSceneReferences();
555 
557  virtual void UpdateReferenceID(const char *oldID, const char *newID);
558 
565  const char *URLEncodeString(const char *inString);
566 
573  const char *URLDecodeString(const char *inString);
574 
578  std::string XMLAttributeEncodeString(const std::string& inString);
579 
587  std::string XMLAttributeDecodeString(const std::string& inString);
588 
590  vtkGetMacro(Selected, int);
591  vtkSetMacro(Selected, int);
592  vtkBooleanMacro(Selected, int);
593 
607  void AddNodeReferenceRole(const char *referenceRole, const char *mrmlAttributeName=0, vtkIntArray *events=0);
608 
610  vtkMRMLNode* SetNodeReferenceID(const char* referenceRole, const char* referencedNodeID);
611 
613  vtkMRMLNode* AddNodeReferenceID(const char* referenceRole , const char* referencedNodeID);
614 
617  vtkMRMLNode* SetNthNodeReferenceID(const char* referenceRole, int n, const char* referencedNodeID);
618 
623  vtkMRMLNode* SetAndObserveNodeReferenceID(const char* referenceRole , const char* referencedNodeID, vtkIntArray *events=0);
624 
629  vtkMRMLNode* AddAndObserveNodeReferenceID(const char* referenceRole , const char* referencedNodeID, vtkIntArray *events=0);
630 
646  vtkMRMLNode* SetAndObserveNthNodeReferenceID(const char* referenceRole, int n, const char *referencedNodeID, vtkIntArray *events=0);
647 
649  void RemoveNthNodeReferenceID(const char* referenceRole, int n);
650 
654  void RemoveNodeReferenceIDs(const char* referenceRole);
655 
660  bool HasNodeReferenceID(const char* referenceRole, const char* referencedNodeID);
661 
664  int GetNumberOfNodeReferences(const char* referenceRole);
665 
672  const char *GetNthNodeReferenceID(const char* referenceRole, int n);
673 
678  const char *GetNodeReferenceID(const char* referenceRole);
679 
690  vtkMRMLNode* GetNthNodeReference(const char* referenceRole, int n);
691 
694  vtkMRMLNode* GetNodeReference(const char* referenceRole);
695 
703  void GetNodeReferences(const char* referenceRole, std::vector<vtkMRMLNode*> &nodes);
704 
710  void GetNodeReferenceIDs(const char* referenceRole,
711  std::vector<const char*> &referencedNodeIDs);
712 
715  void GetNodeReferenceRoles(std::vector<std::string> &roles);
716 
720 
723  const char* GetNthNodeReferenceRole(int n);
724 
727  enum
728  {
730  IDChangedEvent = 16001,
735  };
736 
737 
738 protected:
739 
741  class VTK_MRML_EXPORT vtkMRMLNodeReference : public vtkObject
742  {
743  public:
744  vtkTypeMacro(vtkMRMLNodeReference,vtkObject);
745  static vtkMRMLNodeReference *New();
746  void PrintSelf(ostream& vtkNotUsed(os), vtkIndent vtkNotUsed(indent)) VTK_OVERRIDE {};
747 
748  public:
749  vtkSetStringMacro(ReferenceRole);
750  vtkGetStringMacro(ReferenceRole);
751 
752  vtkSetStringMacro(ReferencedNodeID);
753  vtkGetStringMacro(ReferencedNodeID);
754 
760  void SetEvents(vtkIntArray* events);
761  vtkIntArray* GetEvents() const;
762 
763  void SetReferencingNode(vtkMRMLNode* node);
764  vtkMRMLNode* GetReferencingNode() const;
765 
766  void SetReferencedNode(vtkMRMLNode* node);
767  vtkMRMLNode* GetReferencedNode() const;
768 
769  protected:
771  virtual ~vtkMRMLNodeReference();
772 
774  void operator=(const vtkMRMLNodeReference&);
775 
778 
780  vtkWeakPointer<vtkMRMLNode> ReferencingNode;
782  vtkSmartPointer<vtkMRMLNode> ReferencedNode;
783 
789  vtkSmartPointer<vtkIntArray> Events;
790  };
791 
792  vtkMRMLNode();
794  virtual ~vtkMRMLNode();
795  vtkMRMLNode(const vtkMRMLNode&);
796  void operator=(const vtkMRMLNode&);
797 
800  static void MRMLCallback( vtkObject *caller,
801  unsigned long eid, void *clientData, void *callData );
802 
805  vtkSetStringMacro( TempURLString );
806  vtkGetStringMacro( TempURLString );
807 
815  virtual const char* GetReferenceRoleFromMRMLAttributeName(const char* attName);
816 
824  virtual const char* GetMRMLAttributeNameFromReferenceRole(const char* refRole);
825 
829  virtual bool IsReferenceRoleGeneric(const char* refRole);
830 
834  virtual void UpdateNodeReferences(const char* referenceRole = NULL);
835 
840  virtual void UpdateNthNodeReference(const char* referenceRole, int n);
841 
845  vtkMRMLNode* UpdateNodeReferenceEventObserver(vtkMRMLNode *oldReferencedNode, vtkMRMLNode *newReferencedNode,
846  vtkIntArray *newEvents, vtkMRMLNodeReference* referenceToIgnore);
847 
853  void GetUpdatedReferencedNodeEventList(int& oldReferencedNodeUseCount, int& newReferencedNodeUseCount,
854  vtkIntArray* oldConsolidatedEventList, vtkIntArray* newConsolidatedEventList,
855  vtkMRMLNode* oldReferencedNode, vtkMRMLNode* newReferencedNode,
856  vtkMRMLNodeReference* referenceToIgnore, vtkIntArray* newEvents);
857 
860  virtual void InvalidateNodeReferences();
861 
866  {
867  this->InvokeEvent(vtkMRMLNode::ReferenceAddedEvent, reference);
868  }
869 
872  {
873  this->InvokeEvent(vtkMRMLNode::ReferenceModifiedEvent, reference);
874  }
875 
878  {
879  this->InvokeEvent(vtkMRMLNode::ReferenceRemovedEvent, reference);
880  }
881 
884  void ParseReferencesAttribute(const char *attValue, std::map<std::string, std::string> &references);
885 
887  vtkCallbackCommand *MRMLCallbackCommand;
888 
889  char *ID;
890  char *Name;
891  char *Description;
894  int Selected;
896 
898 
902 
903  // We don't increase the reference count of Scene when store its pointer
904  // therefore we must use a weak pointer to prevent pointer dangling when
905  // the scene is deleted.
906  vtkWeakPointer<vtkMRMLScene> Scene;
907 
908  typedef std::map< std::string, std::string > AttributesType;
910 
912 
915  typedef std::vector< vtkSmartPointer<vtkMRMLNodeReference> > NodeReferenceListType;
916  typedef std::map< std::string, NodeReferenceListType > NodeReferencesType;
918 
919  std::map< std::string, std::string> NodeReferenceMRMLAttributeNames;
920 
921  typedef std::map< std::string, vtkSmartPointer<vtkIntArray> > NodeReferenceEventsType;
922  NodeReferenceEventsType NodeReferenceEvents; // for each role it specifies which referenced node emitted events this node should observe
923 
924 private:
925 
928  void SetID(const char* newID);
929 
931  char *TempURLString;
932 
933  char *SingletonTag;
934 
935  int DisableModifiedEvent;
936  int ModifiedEventPending;
937  std::map<int, int> CustomModifiedEventPending; // event id, pending value (number of events grouped together)
938 };
939 
940 #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:383
virtual void Copy(vtkMRMLNode *node) VTK_OVERRIDE
Copy the node&#39;s attributes to this object
void DisableModifiedEventOff()
Definition: vtkMRMLNode.h:409
std::vector< vtkSmartPointer< vtkMRMLNodeReference > > NodeReferenceListType
Definition: vtkMRMLNode.h:915
virtual int InvokePendingModifiedEvent()
Invokes any modified events that are pending.
Definition: vtkMRMLNode.h:453
void SetSingletonOn()
Definition: vtkMRMLNode.h:375
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:916
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:780
std::string XMLAttributeDecodeString(const std::string &inString)
Decode an XML attribute string.
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:536
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:901
vtkObserverManager * MRMLObserverManager
Definition: vtkMRMLNode.h:911
virtual void OnNodeAddedToScene()
Definition: vtkMRMLNode.h:181
const char * GetNthNodeReferenceRole(int n)
virtual int StartModify()
Start modifying the node. Disable Modify events.
Definition: vtkMRMLNode.h:255
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:921
void SetDisableModifiedEvent(int onOff)
Definition: vtkMRMLNode.h:401
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:919
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:871
char * Name
Definition: vtkMRMLNode.h:890
virtual char * GetSingletonTag()
NodeReferenceEventsType NodeReferenceEvents
Definition: vtkMRMLNode.h:922
void GetNodeReferenceIDs(const char *referenceRole, std::vector< const char *> &referencedNodeIDs)
Return a list of the referenced node IDs.
std::string XMLAttributeEncodeString(const std::string &inString)
Encode an XML attribute string (replaces special characters by code sequences)
vtkSmartPointer< vtkMRMLNode > ReferencedNode
The referenced node that is actually observed now.
Definition: vtkMRMLNode.h:782
void SetSingletonOff()
Definition: vtkMRMLNode.h:379
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:789
char * Description
Definition: vtkMRMLNode.h:891
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:269
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:877
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:169
virtual void SetScene(vtkMRMLScene *scene)
void PrintSelf(ostream &vtkNotUsed(os), vtkIndent vtkNotUsed(indent)) VTK_OVERRIDE
Definition: vtkMRMLNode.h:746
const char * URLDecodeString(const char *inString)
Decode a URL string.
char * ReferenceRole
Name of the reference role.
Definition: vtkMRMLNode.h:777
AttributesType Attributes
Definition: vtkMRMLNode.h:909
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:908
void CopyWithSingleModifiedEvent(vtkMRMLNode *node)
Definition: vtkMRMLNode.h:511
void RemoveNodeReferenceIDs(const char *referenceRole)
Remove all node IDs and associated nodes for a specific referenceRole.
void CopyWithoutModifiedEvent(vtkMRMLNode *node)
Definition: vtkMRMLNode.h:520
vtkCallbackCommand * MRMLCallbackCommand
Holders for MRML callbacks.
Definition: vtkMRMLNode.h:887
vtkWeakPointer< vtkMRMLScene > Scene
Definition: vtkMRMLNode.h:906
int SaveWithScene
Definition: vtkMRMLNode.h:897
virtual void InvokeCustomModifiedEvent(int eventId, void *callData=NULL)
This method allows the node to compress events.
Definition: vtkMRMLNode.h:496
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:865
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:331
virtual void Modified() VTK_OVERRIDE
Customized version of Modified() allowing to compress vtkCommand::ModifiedEvent.
Definition: vtkMRMLNode.h:434
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:138
Class to hold information about a node reference.
Definition: vtkMRMLNode.h:741
const char * URLEncodeString(const char *inString)
Encode a URL string.
NodeReferencesType NodeReferences
Definition: vtkMRMLNode.h:917
virtual void SetSingletonTag(const char *)
Tag that make this node a singleton in the scene.
void DisableModifiedEventOn()
Definition: vtkMRMLNode.h:405
int GetNumberOfNodeReferenceRoles()
int HideFromEditors
Definition: vtkMRMLNode.h:892
virtual void UpdateScene(vtkMRMLScene *)
Definition: vtkMRMLNode.h:174
virtual void ReadXMLAttributes(const char **atts) VTK_OVERRIDE
Read node attributes from XML file