Slicer 4.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends
vtkMRMLScene Class Reference

A set of MRML Nodes that supports serialization and undo/redo. More...

#include <Libs/MRML/Core/vtkMRMLScene.h>

Collaboration diagram for vtkMRMLScene:
Collaboration graph
[legend]

List of all members.

Public Types

enum  SceneEventType {
  NodeAboutToBeAddedEvent = 0x2000, NodeAddedEvent, NodeAboutToBeRemovedEvent, NodeRemovedEvent,
  NewSceneEvent = 66030, SceneEditedEvent, MetadataAddedEvent, ImportProgressFeedbackEvent,
  SaveProgressFeedbackEvent, StateEvent = 0x2000, StartEvent = 0x0100, EndEvent = 0x0200,
  ProgressEvent = 0x0400, StartBatchProcessEvent = StateEvent | StartEvent | BatchProcessState, EndBatchProcessEvent = StateEvent | EndEvent | BatchProcessState, ProgressBatchProcessEvent = StateEvent | ProgressEvent | BatchProcessState,
  StartCloseEvent = StateEvent | StartEvent | CloseState, EndCloseEvent = StateEvent | EndEvent | CloseState, ProgressCloseEvent = StateEvent | ProgressEvent | CloseState, StartImportEvent = StateEvent | StartEvent | ImportState,
  EndImportEvent = StateEvent | EndEvent | ImportState, ProgressImportEvent = StateEvent | EndEvent | ImportState, StartRestoreEvent = StateEvent | StartEvent | RestoreState, EndRestoreEvent = StateEvent | EndEvent | RestoreState,
  ProgressRestoreEvent = StateEvent | ProgressEvent | RestoreState, StartSaveEvent = StateEvent | StartEvent | SaveState, EndSaveEvent = StateEvent | EndEvent | SaveState, ProgressSaveEvent = StateEvent | ProgressEvent | SaveState
}
enum  StateType {
  BatchProcessState = 0x0001, CloseState = 0x0002 | BatchProcessState, ImportState = 0x0004 | BatchProcessState, RestoreState = 0x0008 | BatchProcessState,
  SaveState = 0x0010
}
typedef vtkObject Superclass

Public Member Functions

vtkMRMLNodeAddNode (vtkMRMLNode *nodeToAdd)
void AddReferencedNodeID (const char *id, vtkMRMLNode *refrencingNode)
void AddReservedID (const char *id)
void AddURIHandler (vtkURIHandler *handler)
 Add a uri handler to the collection.
void Clear (int removeSingletons)
 Remove nodes and clear undo/redo stacks.
void ClearRedoStack ()
 clear Redo stack, delete redo history
void ClearReferencedNodeID ()
void ClearUndoStack ()
 clear Undo stack, delete undo history
int Commit (const char *url=NULL)
 Save scene into URL.
int Connect ()
 Create new scene from URL.
vtkMRMLNodeCopyNode (vtkMRMLNode *n)
 Add a copy of a node to the scene.
void CopyNodeReferences (vtkMRMLScene *scene)
void CopyRegisteredNodesToScene (vtkMRMLScene *scene)
 Copies all registered nodes into the parameter scene.
void CopySingletonNodesToScene (vtkMRMLScene *scene)
 Copies all singleton nodes into the parameter scene.
vtkMRMLNodeCreateNodeByClass (const char *className)
 Create node with a given class.
void Edited ()
void EndState (unsigned long state)
vtkURIHandlerFindURIHandler (const char *URI)
vtkURIHandlerFindURIHandlerByName (const char *name)
 Returns a URIhandler of a specific type if its name is known.
std::string GenerateUniqueName (const std::string &baseName)
virtual vtkCacheManagerGetCacheManager ()
const char * GetChangedID (const char *id)
virtual const char * GetClassName ()
const char * GetClassNameByTag (const char *tagName)
 Add a path to the list.
virtual vtkDataIOManagerGetDataIOManager ()
virtual unsigned long GetErrorCode ()
std::string GetErrorMessage ()
const char * GetErrorMessagePointer ()
vtkMRMLNodeGetFirstNode (const char *byName=0, const char *byClass=0, const int *byHideFromEditors=0)
vtkMRMLNodeGetFirstNodeByName (const char *name)
virtual char * GetLastLoadedVersion ()
 the version of the last loaded scene file
virtual int GetLoadFromXMLString ()
bool GetModifiedSinceRead ()
vtkMRMLNodeGetNextNode ()
 Get next node in the scene.
vtkMRMLNodeGetNextNodeByClass (const char *className)
 Get next node of the class in the scene.
vtkMRMLNodeGetNodeByID (std::string name)
vtkMRMLNodeGetNodeByID (const char *name)
 Get node given a unique ID.
const char * GetNodeClasses ()
 returns list of names
std::list< std::string > GetNodeClassesList ()
vtkCollection * GetNodes ()
 return collection of nodes
int GetNodesByClass (const char *className, std::vector< vtkMRMLNode * > &nodes)
 Get vector of nodes of a specified class in the scene.
vtkCollection * GetNodesByClass (const char *className)
 You are responsible for deleting the returned collection.
vtkCollection * GetNodesByClassByName (const char *className, const char *name)
vtkCollection * GetNodesByName (const char *name)
 Get nodes having the specified name.
vtkMRMLNodeGetNthNode (int n)
 Get n-th node in the scene.
vtkMRMLNodeGetNthNodeByClass (int n, const char *className)
 Get n-th node of a specified class in the scene.
vtkMRMLNodeGetNthRegisteredNodeClass (int n)
int GetNumberOfNodes ()
 Get number of nodes in the scene.
int GetNumberOfNodesByClass (const char *className)
 Get number of nodes of a specified class in the scene.
int GetNumberOfRedoLevels ()
 returns number of redo steps in the history buffer
int GetNumberOfRegisteredNodeClasses ()
int GetNumberOfUndoLevels ()
 returns number of undo steps in the history buffer
virtual int GetReadDataOnLoad ()
const std::vector< std::string > & GetReferencedIDs ()
vtkCollection * GetReferencedNodes (vtkMRMLNode *node)
void GetReferencedSubScene (vtkMRMLNode *node, vtkMRMLScene *newScene)
void GetReferencingNodes (vtkMRMLNode *referencedNode, std::vector< vtkMRMLNode * > &referencingNodes)
 Get vector of nodes containing references to an input node.
const std::vector
< vtkSmartPointer< vtkMRMLNode > > & 
GetReferencingNodes ()
const char * GetRootDirectory ()
 Get Root directory, where URL is pointing.
virtual int GetSaveToXMLString ()
unsigned long GetSceneModifiedTime ()
const std::string & GetSceneXMLString ()
vtkMRMLNodeGetSingletonNode (const char *singletonTag, const char *className)
int GetStates () const
bool GetStorableNodesModifiedSinceRead (vtkCollection *modifiedStorableNodes=0)
const char * GetTagByClassName (const char *className)
 Add a path to the list.
int GetTransformBetweenNodes (vtkMRMLNode *node1, vtkMRMLNode *node2, vtkGeneralTransform *xform)
 Ger transformation between two nodes.
bool GetUndoFlag ()
const char * GetUniqueNameByString (const char *baseName)
virtual vtkCollection * GetURIHandlerCollection ()
const char * GetURL ()
 Get URL (file name) of the scene.
virtual vtkTagTableGetUserTagTable ()
virtual char * GetVersion ()
 the current software version
int Import ()
void IncrementSceneModifiedTime ()
void InitTraversal ()
 Initialize a traversal (not reentrant!)
vtkMRMLNodeInsertAfterNode (vtkMRMLNode *item, vtkMRMLNode *newItem)
 insert a node in the scene after a specified node
vtkMRMLNodeInsertBeforeNode (vtkMRMLNode *item, vtkMRMLNode *newItem)
 insert a node in the scene before a specified node
virtual int IsA (const char *type)
bool IsBatchProcessing () const
 Return true if the scene is in BatchProcess state, false otherwise.
bool IsClosing () const
 Return true if the scene is in Close state, false otherwise.
int IsFilePathRelative (const char *filepath)
bool IsImporting () const
 Return true if the scene is in Import state, false otherwise.
int IsNodePresent (vtkMRMLNode *n)
bool IsNodeReferencingNodeID (vtkMRMLNode *referencingNode, const char *id)
bool IsRestoring () const
 Return true if the scene is in Restore state, false otherwise.
void NodeAdded (vtkMRMLNode *n)
 Invoke a NodeAddedEvent (used, for instnace, after adding a bunch of nodes with AddNodeNoNotify.
void NodeAdded ()
void PrintSelf (ostream &os, vtkIndent indent)
void ProgressState (unsigned long state, int progress=0)
 TODO: Report progress of the current state.
void Redo ()
 redo, set the scene to previously undone
void RegisterNodeClass (vtkMRMLNode *node, const char *tagName)
 Register a node class to the scene so that the scene can later create the same node type from a tag or a class name.
void RegisterNodeClass (vtkMRMLNode *node)
void RemoveNode (vtkMRMLNode *n)
 Remove a path from the list.
void RemoveNodeReferences (vtkMRMLNode *node)
void RemoveReferencedNodeID (const char *id, vtkMRMLNode *refrencingNode)
void RemoveReferencesToNode (vtkMRMLNode *node)
void RemoveReservedIDs ()
void RemoveUnusedNodeReferences ()
void ResetNodes ()
 Reset all nodes to their constructor's state.
void SaveStateForUndo (vtkCollection *nodes)
 Save current state of the nodes in the undo buffer.
void SaveStateForUndo (std::vector< vtkMRMLNode * > nodes)
void SaveStateForUndo (vtkMRMLNode *node)
 Save current state of the node in the undo buffer.
void SaveStateForUndo ()
 Save current state in the undo buffer.
virtual void SetCacheManager (vtkCacheManager *)
virtual void SetDataIOManager (vtkDataIOManager *)
virtual void SetErrorCode (unsigned long)
void SetErrorMessage (const std::string &error)
void SetErrorMessage (const char *message)
virtual void SetLastLoadedVersion (const char *)
virtual void SetLoadFromXMLString (int)
virtual void SetReadDataOnLoad (int)
void SetRootDirectory (const char *dir)
 Set Root directory, where URL is pointing.
virtual void SetSaveToXMLString (int)
void SetSceneXMLString (const std::string &xmlString)
void SetUndoFlag (bool flag)
void SetUndoOff ()
void SetUndoOn ()
 Set undo on/off.
virtual void SetURIHandlerCollection (vtkCollection *)
void SetURL (const char *url)
 Set URL (file name) of the scene.
virtual void SetUserTagTable (vtkTagTable *)
virtual void SetVersion (const char *)
void StartState (unsigned long state, int anticipatedMaxProgress=0)
void Undo ()
 undo, set the scene to previous state
void UpdateNodeChangedIDs ()
void UpdateNodeReferences (vtkCollection *chekNodes)
void UpdateNodeReferences ()

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkMRMLSceneNew ()
static vtkMRMLSceneSafeDownCast (vtkObject *o)

Protected Member Functions

void AddNodeID (vtkMRMLNode *node)
 Add node to NodeIDs map used to speedup GetByID() method.
vtkMRMLNodeAddNodeNoNotify (vtkMRMLNode *n)
void AddReferencedNodes (vtkMRMLNode *node, vtkCollection *refNodes)
std::string BuildID (const std::string &baseID, int idIndex) const
std::string BuildName (const std::string &baseName, int nameIndex) const
 Combine a basename and an index to produce a full name.
void ClearNodeIDs ()
 Clear NodeIDs map used to speedup GetByID() method.
void CopyNodeInRedoStack (vtkMRMLNode *node)
void CopyNodeInUndoStack (vtkMRMLNode *node)
std::string GenerateUniqueID (vtkMRMLNode *node)
std::string GenerateUniqueID (const std::string &baseID)
std::string GenerateUniqueName (vtkMRMLNode *node)
 Return a unique name for a MRML node. It uses the node tag as the base.
virtual char * GetClassNameList ()
int GetUniqueIDIndex (const std::string &baseID)
int GetUniqueNameIndex (const std::string &baseName)
void PushIntoRedoStack ()
void PushIntoUndoStack ()
void RemoveAllNodesExceptSingletons ()
void RemoveNodeID (char *nodeID)
 Remove node from NodeIDs map used to speedup GetByID() method.
virtual void SetClassNameList (const char *)
void UpdateNodeIDs ()
 Syncronize NodeIDs map used to speedup GetByID() method with the Nodes collection.
 vtkMRMLScene ()
virtual ~vtkMRMLScene ()

Static Protected Member Functions

static void SceneCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData)
 Handle vtkMRMLScene::DeleteEvent: clear the scene.

Protected Attributes

vtkCacheManagerCacheManager
 data i/o handling members
vtkDataIOManagerDataIOManager
vtkCallbackCommand * DeleteEventCallback
std::string ErrorMessage
bool InUndo
char * LastLoadedVersion
int LoadFromXMLString
std::map< std::string,
vtkSmartPointer< vtkMRMLNode > > 
NodeIDs
unsigned long NodeIDsMTime
vtkCollection * Nodes
int ReadDataOnLoad
std::list< vtkCollection * > RedoStack
std::map< std::string,
std::string > 
ReferencedIDChanges
std::vector< std::string > ReferencedIDs
std::vector< vtkSmartPointer
< vtkMRMLNode > > 
ReferencingNodes
std::vector< vtkMRMLNode * > RegisteredNodeClasses
std::vector< std::string > RegisteredNodeTags
std::vector< std::string > ReservedIDs
std::string RootDirectory
int SaveToXMLString
unsigned long SceneModifiedTime
std::string SceneXMLString
std::vector< unsigned long > States
bool UndoFlag
std::list< vtkCollection * > UndoStack
int UndoStackSize
std::map< std::string, int > UniqueIDs
std::map< std::string, int > UniqueNames
vtkCollection * URIHandlerCollection
std::string URL
vtkTagTableUserTagTable
char * Version

Friends

class vtkMRMLSceneViewNode

Detailed Description

A set of MRML Nodes that supports serialization and undo/redo.

vtkMRMLScene represents and provides methods to manipulate a list of MRML objects. The list is core and duplicate entries are not prevented.

See also:
vtkMRMLNode
vtkCollection

Definition at line 49 of file vtkMRMLScene.h.


Member Typedef Documentation

typedef vtkObject vtkMRMLScene::Superclass

Definition at line 59 of file vtkMRMLScene.h.


Member Enumeration Documentation

Enumerator:
NodeAboutToBeAddedEvent 
NodeAddedEvent 
NodeAboutToBeRemovedEvent 
NodeRemovedEvent 
NewSceneEvent 
SceneEditedEvent 
MetadataAddedEvent 
ImportProgressFeedbackEvent 
SaveProgressFeedbackEvent 
StateEvent 

1024 (decimal)

StartEvent 
EndEvent 
ProgressEvent 
StartBatchProcessEvent 
EndBatchProcessEvent 
ProgressBatchProcessEvent 
StartCloseEvent 
EndCloseEvent 
ProgressCloseEvent 
StartImportEvent 
EndImportEvent 
ProgressImportEvent 
StartRestoreEvent 
EndRestoreEvent 
ProgressRestoreEvent 
StartSaveEvent 
EndSaveEvent 
ProgressSaveEvent 

Definition at line 535 of file vtkMRMLScene.h.

The state of the scene reflects what the scene is doing. The scene is in BatchProcessState when nodes are either inserted or removed contiguously. The methods Connect, Import and Clear automatically set the scene in specific states. It is possible to manually set the scene in a specific state using StartState and EndState. When the scene is in BatchProcessState mode, observers can ignore the events NodeAddedEvent and NodeRemovedEvent to only synchronize with the scene when the scene is no longer in BatchProcessState (EndBatchProcessEvent being fired).

The call scene->Connect("myScene.mrml"); that closes and import a scene will fire the events: vtkMRMLScene::StartBatchProcessEvent, vtkMRMLScene::StartCloseEvent,

vtkMRMLScene::NodeAboutToBeRemovedEvent, vtkMRMLScene::NodeRemovedEvent, vtkMRMLScene::ProgressCloseEvent, vtkMRMLScene::ProgressBatchProcessEvent, ... vtkMRMLScene::EndCloseEvent, vtkMRMLScene::StartImportEvent,

vtkMRMLScene::NodeAboutToBeAddedEvent, vtkMRMLScene::NodeAddedEvent, vtkMRMLScene::ProgressImportEvent, vtkMRMLScene::ProgressBatchProcessEvent, ... vtkMRMLScene::EndImportEvent, vtkMRMLScene::EndBatchProcessEvent

Enumerator:
BatchProcessState 
CloseState 
ImportState 
RestoreState 
SaveState 

Definition at line 471 of file vtkMRMLScene.h.


Constructor & Destructor Documentation

vtkMRMLScene::vtkMRMLScene ( ) [protected]
virtual vtkMRMLScene::~vtkMRMLScene ( ) [protected, virtual]

Member Function Documentation

vtkMRMLNode* vtkMRMLScene::AddNode ( vtkMRMLNode nodeToAdd)

Add a node to the scene and send NodeAboutToBeAddedEvent, NodeAddedEvent and SceneModified events. A unique ID (e.g. "vtkMRMLModeNode1", "vtkMRMLScalarVolumeNode4") is generated and set to the node. If the node has no name (i.e. vtkMRMLNode::GetName() == 0), a unique name is given to the node (e.g. "Model" if it's the first model node added into the scene, "Model_1" if it's the second, etc. If node is a singleton, and a node of the same class with the same singleton tag already exists in the scene, nodeToAdd is NOT added but its properties are copied (c.f. vtkMRMLNode::CopyWithScene()) into the already existing singleton node. That node is then returned.

void vtkMRMLScene::AddNodeID ( vtkMRMLNode node) [protected]

Add node to NodeIDs map used to speedup GetByID() method.

vtkMRMLNode* vtkMRMLScene::AddNodeNoNotify ( vtkMRMLNode n) [protected]

Add a node to the scene without invoking a NodeAddedEvent event Use with extreme caution as it might unsynchronize observer.

void vtkMRMLScene::AddReferencedNodeID ( const char *  id,
vtkMRMLNode refrencingNode 
)

The Scene maintains two lists that keep track of the relationship between node IDs and the nodes referencing those IDs. Each node can use the call AddReferencedNodeID to tell the scene that is 'has an interest' in the given ID so that the scene can notify that node when the ID has been remapped. It does this notification through the UpdateNodeReferences call. The two lists (std::vectors) are ReferencingNodes and ReferencedIDs, which (usually) contain the same number of elements and the entries should correspond; they can be different during update. The ReferencingNodes is a vector of smart pointers, so that the nodes are not freed until they are no longer used by these lists.

void vtkMRMLScene::AddReferencedNodes ( vtkMRMLNode node,
vtkCollection *  refNodes 
) [protected]
void vtkMRMLScene::AddReservedID ( const char *  id)
void vtkMRMLScene::AddURIHandler ( vtkURIHandler handler)

Add a uri handler to the collection.

std::string vtkMRMLScene::BuildID ( const std::string &  baseID,
int  idIndex 
) const [protected]
std::string vtkMRMLScene::BuildName ( const std::string &  baseName,
int  nameIndex 
) const [protected]

Combine a basename and an index to produce a full name.

void vtkMRMLScene::Clear ( int  removeSingletons)

Remove nodes and clear undo/redo stacks.

void vtkMRMLScene::ClearNodeIDs ( ) [protected]

Clear NodeIDs map used to speedup GetByID() method.

void vtkMRMLScene::ClearRedoStack ( )

clear Redo stack, delete redo history

void vtkMRMLScene::ClearReferencedNodeID ( ) [inline]

Definition at line 296 of file vtkMRMLScene.h.

void vtkMRMLScene::ClearUndoStack ( )

clear Undo stack, delete undo history

int vtkMRMLScene::Commit ( const char *  url = NULL)

Save scene into URL.

int vtkMRMLScene::Connect ( )

Create new scene from URL.

vtkMRMLNode* vtkMRMLScene::CopyNode ( vtkMRMLNode n)

Add a copy of a node to the scene.

void vtkMRMLScene::CopyNodeInRedoStack ( vtkMRMLNode node) [protected]
void vtkMRMLScene::CopyNodeInUndoStack ( vtkMRMLNode node) [protected]
void vtkMRMLScene::CopyNodeReferences ( vtkMRMLScene scene)
void vtkMRMLScene::CopyRegisteredNodesToScene ( vtkMRMLScene scene)

Copies all registered nodes into the parameter scene.

void vtkMRMLScene::CopySingletonNodesToScene ( vtkMRMLScene scene)

Copies all singleton nodes into the parameter scene.

vtkMRMLNode* vtkMRMLScene::CreateNodeByClass ( const char *  className)

Create node with a given class.

void vtkMRMLScene::Edited ( ) [inline]

Definition at line 417 of file vtkMRMLScene.h.

void vtkMRMLScene::EndState ( unsigned long  state)

Unflag the scene as being in a mode. EndState() fires the state end event if the scene is no longer in the state mode. A matching StartState(state) must be called prior. e.g. EndImportEvent if state is ImportState. EndState internally pops the state out of the stack

vtkURIHandler* vtkMRMLScene::FindURIHandler ( const char *  URI)

find a URI handler in the collection that can work on the passed URI returns NULL on failure

vtkURIHandler* vtkMRMLScene::FindURIHandlerByName ( const char *  name)

Returns a URIhandler of a specific type if its name is known.

std::string vtkMRMLScene::GenerateUniqueID ( vtkMRMLNode node) [protected]
std::string vtkMRMLScene::GenerateUniqueID ( const std::string &  baseID) [protected]
std::string vtkMRMLScene::GenerateUniqueName ( vtkMRMLNode node) [protected]

Return a unique name for a MRML node. It uses the node tag as the base.

std::string vtkMRMLScene::GenerateUniqueName ( const std::string &  baseName)

Generate a node name that is unique in the scene. Calling this function successively with the same baseName returns a different name: e.g. baseName1, baseName2, baseName3

virtual vtkCacheManager* vtkMRMLScene::GetCacheManager ( ) [virtual]
const char* vtkMRMLScene::GetChangedID ( const char *  id)

get the new id of the node that is different from one in the mrml file or NULL if id has not changed

virtual const char* vtkMRMLScene::GetClassName ( ) [virtual]
const char* vtkMRMLScene::GetClassNameByTag ( const char *  tagName)

Add a path to the list.

virtual char* vtkMRMLScene::GetClassNameList ( ) [protected, virtual]
virtual vtkDataIOManager* vtkMRMLScene::GetDataIOManager ( ) [virtual]
virtual unsigned long vtkMRMLScene::GetErrorCode ( ) [virtual]
std::string vtkMRMLScene::GetErrorMessage ( ) [inline]

Definition at line 382 of file vtkMRMLScene.h.

const char* vtkMRMLScene::GetErrorMessagePointer ( ) [inline]

Definition at line 405 of file vtkMRMLScene.h.

vtkMRMLNode* vtkMRMLScene::GetFirstNode ( const char *  byName = 0,
const char *  byClass = 0,
const int *  byHideFromEditors = 0 
)

Return the first node in the scene that matches the filtering criterias if specified.

vtkMRMLNode* vtkMRMLScene::GetFirstNodeByName ( const char *  name)
virtual char* vtkMRMLScene::GetLastLoadedVersion ( ) [virtual]

the version of the last loaded scene file

virtual int vtkMRMLScene::GetLoadFromXMLString ( ) [virtual]
bool vtkMRMLScene::GetModifiedSinceRead ( )

Returns true if the scene has been "significantly" modified since the last time it was read or written

vtkMRMLNode* vtkMRMLScene::GetNextNode ( )

Get next node in the scene.

vtkMRMLNode* vtkMRMLScene::GetNextNodeByClass ( const char *  className)

Get next node of the class in the scene.

vtkMRMLNode* vtkMRMLScene::GetNodeByID ( const char *  name)

Get node given a unique ID.

vtkMRMLNode* vtkMRMLScene::GetNodeByID ( std::string  name)
const char* vtkMRMLScene::GetNodeClasses ( )

returns list of names

std::list<std::string> vtkMRMLScene::GetNodeClassesList ( )
vtkCollection* vtkMRMLScene::GetNodes ( ) [inline]

return collection of nodes

Definition at line 137 of file vtkMRMLScene.h.

int vtkMRMLScene::GetNodesByClass ( const char *  className,
std::vector< vtkMRMLNode * > &  nodes 
)

Get vector of nodes of a specified class in the scene.

vtkCollection* vtkMRMLScene::GetNodesByClass ( const char *  className)

You are responsible for deleting the returned collection.

vtkCollection* vtkMRMLScene::GetNodesByClassByName ( const char *  className,
const char *  name 
)

Get nodes of a specified class having the specified name You are responsible for deleting the collection.

vtkCollection* vtkMRMLScene::GetNodesByName ( const char *  name)

Get nodes having the specified name.

vtkMRMLNode* vtkMRMLScene::GetNthNode ( int  n)

Get n-th node in the scene.

vtkMRMLNode* vtkMRMLScene::GetNthNodeByClass ( int  n,
const char *  className 
)

Get n-th node of a specified class in the scene.

vtkMRMLNode* vtkMRMLScene::GetNthRegisteredNodeClass ( int  n)

Get the nth registered node class, returns NULL if n is out of the range 0-GetNumberOfRegisteredNodeClasses Useful for iterating through nodes to find all the possible storage nodes.

int vtkMRMLScene::GetNumberOfNodes ( )

Get number of nodes in the scene.

int vtkMRMLScene::GetNumberOfNodesByClass ( const char *  className)

Get number of nodes of a specified class in the scene.

int vtkMRMLScene::GetNumberOfRedoLevels ( ) [inline]

returns number of redo steps in the history buffer

Definition at line 271 of file vtkMRMLScene.h.

int vtkMRMLScene::GetNumberOfRegisteredNodeClasses ( )

Get the number of registered node classes (is probably greater than the current number of nodes instantiated in the scene)

int vtkMRMLScene::GetNumberOfUndoLevels ( ) [inline]

returns number of undo steps in the history buffer

Definition at line 268 of file vtkMRMLScene.h.

virtual int vtkMRMLScene::GetReadDataOnLoad ( ) [virtual]
const std::vector< std::string >& vtkMRMLScene::GetReferencedIDs ( )

Return the list of referenced ids. Only used for debugging

vtkCollection* vtkMRMLScene::GetReferencedNodes ( vtkMRMLNode node)

Return collection of all nodes referenced directly or indirectly by node. The node itself is in first place in the collection. No doublon in the list. For a node to be referenced by another node, the latter must call AddReferencedNodeID(). Note that you are responsible for deleting the returned collection.

See also:
GetReferencedSubScene()
void vtkMRMLScene::GetReferencedSubScene ( vtkMRMLNode node,
vtkMRMLScene newScene 
)

Get a sub-scene containing all nodes directly or indirectly referenced by the input node. GetReferencedNodes() is internally called.

See also:
AddReferencedNodeID(), GetReferencedNodes()
void vtkMRMLScene::GetReferencingNodes ( vtkMRMLNode referencedNode,
std::vector< vtkMRMLNode * > &  referencingNodes 
)

Get vector of nodes containing references to an input node.

const std::vector< vtkSmartPointer<vtkMRMLNode> >& vtkMRMLScene::GetReferencingNodes ( )

Return the list of referencing nodes. Only used for debugging

const char* vtkMRMLScene::GetRootDirectory ( ) [inline]

Get Root directory, where URL is pointing.

Definition at line 78 of file vtkMRMLScene.h.

virtual int vtkMRMLScene::GetSaveToXMLString ( ) [virtual]
unsigned long vtkMRMLScene::GetSceneModifiedTime ( )
const std::string& vtkMRMLScene::GetSceneXMLString ( ) [inline]

Returns the saved scene with an XML format if SaveToXMLString is true and Commit() was called prior.

See also:
Commit(), SetSaveToXMLString()

Definition at line 396 of file vtkMRMLScene.h.

vtkMRMLNode* vtkMRMLScene::GetSingletonNode ( const char *  singletonTag,
const char *  className 
)

Search and return the singleton of type className with a singletonTag tag. Return 0 if such node can't be found in the scene.

int vtkMRMLScene::GetStates ( ) const

Returns the current state of the scene. It is a combination of all current states. Returns 0 if the scene has no current state flag.

See also:
IsBatchProcessing, IsClosing, IsImporting, IsRestoring
StartState, EndState
bool vtkMRMLScene::GetStorableNodesModifiedSinceRead ( vtkCollection *  modifiedStorableNodes = 0)

Search the scene for storable nodes that are "ModifiedSinceRead". Returns true if at least 1 matching node is found. If modifiedStorableNodes is passed the modified nodes are appended. Note that the nodes see their reference count being incremented while being in the list. Don't forget to clear it as soon as you don't need it.

const char* vtkMRMLScene::GetTagByClassName ( const char *  className)

Add a path to the list.

int vtkMRMLScene::GetTransformBetweenNodes ( vtkMRMLNode node1,
vtkMRMLNode node2,
vtkGeneralTransform *  xform 
)

Ger transformation between two nodes.

bool vtkMRMLScene::GetUndoFlag ( ) [inline]

Definition at line 252 of file vtkMRMLScene.h.

int vtkMRMLScene::GetUniqueIDIndex ( const std::string &  baseID) [protected]
const char* vtkMRMLScene::GetUniqueNameByString ( const char *  baseName)
Deprecated:
GetUniqueNameByString Obsolete utility function that provides an unsafe API for GenerateUniqueName()
See also:
GenerateUniqueName, GenerateUniqueID
int vtkMRMLScene::GetUniqueNameIndex ( const std::string &  baseName) [protected]

Returns a unique index for a given baseName. Calling this function succesively with the same baseName returns an incremented index: 1, 2, 3...

See also:
GenerateUniqueName
virtual vtkCollection* vtkMRMLScene::GetURIHandlerCollection ( ) [virtual]
const char* vtkMRMLScene::GetURL ( ) [inline]

Get URL (file name) of the scene.

Definition at line 68 of file vtkMRMLScene.h.

virtual vtkTagTable* vtkMRMLScene::GetUserTagTable ( ) [virtual]
virtual char* vtkMRMLScene::GetVersion ( ) [virtual]

the current software version

int vtkMRMLScene::Import ( )

Add the scene into the existing scene (no clear) from URL file or from

See also:
SceneXMLString XML string.
SetURL(), GetLoadFromXMLString(), SetSceneXMLString()
void vtkMRMLScene::IncrementSceneModifiedTime ( ) [inline]

Definition at line 412 of file vtkMRMLScene.h.

void vtkMRMLScene::InitTraversal ( )

Initialize a traversal (not reentrant!)

vtkMRMLNode* vtkMRMLScene::InsertAfterNode ( vtkMRMLNode item,
vtkMRMLNode newItem 
)

insert a node in the scene after a specified node

vtkMRMLNode* vtkMRMLScene::InsertBeforeNode ( vtkMRMLNode item,
vtkMRMLNode newItem 
)

insert a node in the scene before a specified node

virtual int vtkMRMLScene::IsA ( const char *  type) [virtual]
bool vtkMRMLScene::IsBatchProcessing ( ) const [inline]

Return true if the scene is in BatchProcess state, false otherwise.

Definition at line 725 of file vtkMRMLScene.h.

bool vtkMRMLScene::IsClosing ( ) const [inline]

Return true if the scene is in Close state, false otherwise.

Definition at line 732 of file vtkMRMLScene.h.

int vtkMRMLScene::IsFilePathRelative ( const char *  filepath)
bool vtkMRMLScene::IsImporting ( ) const [inline]

Return true if the scene is in Import state, false otherwise.

Definition at line 739 of file vtkMRMLScene.h.

int vtkMRMLScene::IsNodePresent ( vtkMRMLNode n)

Determine whether a particular node is present. Returns its position in the list.

bool vtkMRMLScene::IsNodeReferencingNodeID ( vtkMRMLNode referencingNode,
const char *  id 
)
bool vtkMRMLScene::IsRestoring ( ) const [inline]

Return true if the scene is in Restore state, false otherwise.

Definition at line 746 of file vtkMRMLScene.h.

static int vtkMRMLScene::IsTypeOf ( const char *  type) [static]
static vtkMRMLScene* vtkMRMLScene::New ( ) [static]
void vtkMRMLScene::NodeAdded ( ) [inline]

Definition at line 160 of file vtkMRMLScene.h.

void vtkMRMLScene::NodeAdded ( vtkMRMLNode n)

Invoke a NodeAddedEvent (used, for instnace, after adding a bunch of nodes with AddNodeNoNotify.

void vtkMRMLScene::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
void vtkMRMLScene::ProgressState ( unsigned long  state,
int  progress = 0 
)

TODO: Report progress of the current state.

void vtkMRMLScene::PushIntoRedoStack ( ) [protected]
void vtkMRMLScene::PushIntoUndoStack ( ) [protected]
void vtkMRMLScene::Redo ( )

redo, set the scene to previously undone

void vtkMRMLScene::RegisterNodeClass ( vtkMRMLNode node)

Utility function to RegisterNodeClass(), the node tag name is used when registering the node.

See also:
RegisterNodeClass()
void vtkMRMLScene::RegisterNodeClass ( vtkMRMLNode node,
const char *  tagName 
)

Register a node class to the scene so that the scene can later create the same node type from a tag or a class name.

This is mainly used during scene loading. The XML element names are used to instantiate the nodes.

node is an instance of the class to instantiate when CreateNodeByClass() is called with a corresponding className retrieved using GetClassNameByTag(). tagName can be 0 or an XML tag a custom tagName. If tagName is 0 (default), the node GetNodeTagName() is used. Otherwise, tagName is used.

The signature with tagName != 0 is useful to add support for scene backward compatibility. Calls with an obsolete tag should be wrapped with: "#if MRML_SUPPORT_VERSION < 0x0X0Y0Z"/"#endif where X is the major version of Slicer scene to support, Y the minor and Z the patch version.

See also:
CreateNodeByClass(), GetClassNameByTag()
void vtkMRMLScene::RemoveAllNodesExceptSingletons ( ) [protected]
void vtkMRMLScene::RemoveNode ( vtkMRMLNode n)

Remove a path from the list.

void vtkMRMLScene::RemoveNodeID ( char *  nodeID) [protected]

Remove node from NodeIDs map used to speedup GetByID() method.

void vtkMRMLScene::RemoveNodeReferences ( vtkMRMLNode node)
void vtkMRMLScene::RemoveReferencedNodeID ( const char *  id,
vtkMRMLNode refrencingNode 
)
void vtkMRMLScene::RemoveReferencesToNode ( vtkMRMLNode node)
void vtkMRMLScene::RemoveReservedIDs ( )
void vtkMRMLScene::RemoveUnusedNodeReferences ( )
void vtkMRMLScene::ResetNodes ( )

Reset all nodes to their constructor's state.

static vtkMRMLScene* vtkMRMLScene::SafeDownCast ( vtkObject *  o) [static]
void vtkMRMLScene::SaveStateForUndo ( vtkMRMLNode node)

Save current state of the node in the undo buffer.

void vtkMRMLScene::SaveStateForUndo ( vtkCollection *  nodes)

Save current state of the nodes in the undo buffer.

void vtkMRMLScene::SaveStateForUndo ( )

Save current state in the undo buffer.

void vtkMRMLScene::SaveStateForUndo ( std::vector< vtkMRMLNode * >  nodes)
static void vtkMRMLScene::SceneCallback ( vtkObject *  caller,
unsigned long  eid,
void *  clientData,
void *  callData 
) [static, protected]

Handle vtkMRMLScene::DeleteEvent: clear the scene.

virtual void vtkMRMLScene::SetCacheManager ( vtkCacheManager ) [virtual]
virtual void vtkMRMLScene::SetClassNameList ( const char *  ) [protected, virtual]
virtual void vtkMRMLScene::SetDataIOManager ( vtkDataIOManager ) [virtual]
virtual void vtkMRMLScene::SetErrorCode ( unsigned  long) [virtual]
void vtkMRMLScene::SetErrorMessage ( const std::string &  error) [inline]

Definition at line 378 of file vtkMRMLScene.h.

void vtkMRMLScene::SetErrorMessage ( const char *  message) [inline]

Definition at line 400 of file vtkMRMLScene.h.

virtual void vtkMRMLScene::SetLastLoadedVersion ( const char *  ) [virtual]
virtual void vtkMRMLScene::SetLoadFromXMLString ( int  ) [virtual]

This property controls whether Import() loads a scene from an XML string or from an XML file If true, contents is loaded from SceneXMLString. If false, contents is loaded from the URL file.

See also:
Import(), SetSceneXMLString(), SetURL(), SetSaveToXMLString()
virtual void vtkMRMLScene::SetReadDataOnLoad ( int  ) [virtual]
void vtkMRMLScene::SetRootDirectory ( const char *  dir) [inline]

Set Root directory, where URL is pointing.

Definition at line 73 of file vtkMRMLScene.h.

virtual void vtkMRMLScene::SetSaveToXMLString ( int  ) [virtual]

This property controls whether Commit() should save the scene as an XML string or an XML file. If true, the contents generated by Commit() will be in SceneXMLString. If false, the contents will be saved into the URL file.

See also:
Commit(), GetSceneXMLString(), SetURL(), SetLoadFromXMLString()
void vtkMRMLScene::SetSceneXMLString ( const std::string &  xmlString) [inline]

Set the XML string to read from by Import() if GetLoadFromXMLString() is true.

See also:
Import(), GetLoadFromXMLString(), GetSceneXMLString()

Definition at line 389 of file vtkMRMLScene.h.

void vtkMRMLScene::SetUndoFlag ( bool  flag) [inline]

Definition at line 253 of file vtkMRMLScene.h.

void vtkMRMLScene::SetUndoOff ( ) [inline]

Definition at line 251 of file vtkMRMLScene.h.

void vtkMRMLScene::SetUndoOn ( ) [inline]

Set undo on/off.

Definition at line 250 of file vtkMRMLScene.h.

virtual void vtkMRMLScene::SetURIHandlerCollection ( vtkCollection *  ) [virtual]
void vtkMRMLScene::SetURL ( const char *  url) [inline]

Set URL (file name) of the scene.

Definition at line 63 of file vtkMRMLScene.h.

virtual void vtkMRMLScene::SetUserTagTable ( vtkTagTable ) [virtual]
virtual void vtkMRMLScene::SetVersion ( const char *  ) [virtual]
void vtkMRMLScene::StartState ( unsigned long  state,
int  anticipatedMaxProgress = 0 
)

Flag the scene as being in a state mode. A matching EndState(state) must be called later. Nested states are supported as long as they all have their own EndState calls. StartState() fires the state start event if it isn't already in that state, e.g. StartImportEvent if state is ImportState. If the state is BatchProcessState, CloseState, ImportState or RestoreState and if the scene is not already in a BatchProcessState state, it also fires the event StartBatchProcessEvent. Example:

 scene->StartState(vtkMRMLScene::ImportState);
 // fires: StartBatchProcessEvent, StartImportEvent
 scene->StartState(vtkMRMLScene::ImportState);
 // doesn't fire anything
 scene->StartState(vtkMRMLScene::RestoreState);
 // fires: StartRestoreEvent
 scene->EndState(vtkMRMLScene::RestoreState);
 // fires: EndRestoreEvent
 scene->EndState(vtkMRMLScene::ImportState);
 // doesn't fire anything
 scene->EndState(vtkMRMLScene::ImportState);
 // fires: EndImportEvent, StartBatchProcessEvent

StartState internally pushes the state into a stack.

See also:
EndState, GetStates
void vtkMRMLScene::Undo ( )

undo, set the scene to previous state

void vtkMRMLScene::UpdateNodeChangedIDs ( )
void vtkMRMLScene::UpdateNodeIDs ( ) [protected]

Syncronize NodeIDs map used to speedup GetByID() method with the Nodes collection.

void vtkMRMLScene::UpdateNodeReferences ( vtkCollection *  chekNodes)
void vtkMRMLScene::UpdateNodeReferences ( )

Friends And Related Function Documentation

friend class vtkMRMLSceneViewNode [friend]

make the vtkMRMLSceneViewNode a friend since it has internal vtkMRMLScene so that it can call protected methods, for example UpdateNodeIDs() but that's the only class that is allowed to do so

Definition at line 55 of file vtkMRMLScene.h.


Member Data Documentation

data i/o handling members

Definition at line 655 of file vtkMRMLScene.h.

Definition at line 656 of file vtkMRMLScene.h.

vtkCallbackCommand* vtkMRMLScene::DeleteEventCallback [protected]

Definition at line 705 of file vtkMRMLScene.h.

std::string vtkMRMLScene::ErrorMessage [protected]

Definition at line 685 of file vtkMRMLScene.h.

bool vtkMRMLScene::InUndo [protected]

Definition at line 664 of file vtkMRMLScene.h.

Definition at line 703 of file vtkMRMLScene.h.

Definition at line 689 of file vtkMRMLScene.h.

std::map< std::string, vtkSmartPointer<vtkMRMLNode> > vtkMRMLScene::NodeIDs [protected]

Definition at line 683 of file vtkMRMLScene.h.

unsigned long vtkMRMLScene::NodeIDsMTime [protected]

Definition at line 695 of file vtkMRMLScene.h.

vtkCollection* vtkMRMLScene::Nodes [protected]

Definition at line 651 of file vtkMRMLScene.h.

Definition at line 693 of file vtkMRMLScene.h.

std::list< vtkCollection* > vtkMRMLScene::RedoStack [protected]

Definition at line 667 of file vtkMRMLScene.h.

std::map< std::string, std::string > vtkMRMLScene::ReferencedIDChanges [protected]

Definition at line 682 of file vtkMRMLScene.h.

std::vector< std::string > vtkMRMLScene::ReferencedIDs [protected]

Definition at line 680 of file vtkMRMLScene.h.

std::vector< vtkSmartPointer<vtkMRMLNode> > vtkMRMLScene::ReferencingNodes [protected]

Definition at line 681 of file vtkMRMLScene.h.

std::vector< vtkMRMLNode* > vtkMRMLScene::RegisteredNodeClasses [protected]

Definition at line 677 of file vtkMRMLScene.h.

std::vector< std::string > vtkMRMLScene::RegisteredNodeTags [protected]

Definition at line 678 of file vtkMRMLScene.h.

std::vector<std::string> vtkMRMLScene::ReservedIDs [protected]

Definition at line 675 of file vtkMRMLScene.h.

std::string vtkMRMLScene::RootDirectory [protected]

Definition at line 671 of file vtkMRMLScene.h.

Definition at line 691 of file vtkMRMLScene.h.

unsigned long vtkMRMLScene::SceneModifiedTime [protected]

Definition at line 652 of file vtkMRMLScene.h.

std::string vtkMRMLScene::SceneXMLString [protected]

Definition at line 687 of file vtkMRMLScene.h.

std::vector<unsigned long> vtkMRMLScene::States [protected]

Definition at line 660 of file vtkMRMLScene.h.

bool vtkMRMLScene::UndoFlag [protected]

Definition at line 663 of file vtkMRMLScene.h.

std::list< vtkCollection* > vtkMRMLScene::UndoStack [protected]

Definition at line 666 of file vtkMRMLScene.h.

int vtkMRMLScene::UndoStackSize [protected]

Definition at line 662 of file vtkMRMLScene.h.

std::map<std::string, int> vtkMRMLScene::UniqueIDs [protected]

Definition at line 673 of file vtkMRMLScene.h.

std::map<std::string, int> vtkMRMLScene::UniqueNames [protected]

Definition at line 674 of file vtkMRMLScene.h.

vtkCollection* vtkMRMLScene::URIHandlerCollection [protected]

Definition at line 657 of file vtkMRMLScene.h.

std::string vtkMRMLScene::URL [protected]

Definition at line 670 of file vtkMRMLScene.h.

Definition at line 658 of file vtkMRMLScene.h.

char* vtkMRMLScene::Version [protected]

Definition at line 700 of file vtkMRMLScene.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines