Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | 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>

Inheritance diagram for vtkMRMLScene:
Inheritance graph
[legend]
Collaboration diagram for vtkMRMLScene:
Collaboration graph
[legend]

Public Types

enum  SceneEventType {
  NodeAboutToBeAddedEvent = 0x2000, NodeAddedEvent, NodeAboutToBeRemovedEvent, NodeRemovedEvent,
  NewSceneEvent = 66030, MetadataAddedEvent = 66032, 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

void AddDefaultNode (vtkMRMLNode *node)
 
vtkMRMLNodeAddNewNodeByClass (std::string className, std::string nodeBaseName="")
 Instantiate and add a node to the scene. More...
 
vtkMRMLNodeAddNode (vtkMRMLNode *nodeToAdd)
 Add a node to the scene and send vtkMRMLScene::NodeAboutToBeAddedEvent, vtkMRMLScene::NodeAddedEvent and vtkMRMLScene::SceneModified events. More...
 
void AddReferencedNodeID (const char *id, vtkMRMLNode *refrencingNode)
 
void AddReservedID (const char *id)
 
void AddURIHandler (vtkURIHandler *handler)
 Add a uri handler to the collection. More...
 
void Clear (int removeSingletons=0)
 
void ClearRedoStack ()
 clear Redo stack, delete redo history More...
 
void ClearUndoStack ()
 clear Undo stack, delete undo history More...
 
int Commit (const char *url=NULL)
 
int Connect ()
 Create new scene from URL. More...
 
void CopyDefaultNodesToScene (vtkMRMLScene *scene)
 Copies all default nodes into the parameter scene. Does not remove existing default nodes. More...
 
vtkMRMLNodeCopyNode (vtkMRMLNode *n)
 Add a copy of a node to the scene. More...
 
void CopyNodeChangedIDs (vtkMRMLScene *scene)
 
void CopyNodeReferences (vtkMRMLScene *scene)
 
void CopyRegisteredNodesToScene (vtkMRMLScene *scene)
 Copies all registered nodes into the parameter scene. More...
 
void CopySingletonNodesToScene (vtkMRMLScene *scene)
 Copies all singleton nodes into the parameter scene. More...
 
vtkMRMLNodeCreateNodeByClass (const char *className)
 Create node with a given class. More...
 
void EndState (unsigned long state)
 Unflag the scene as being in a state mode. More...
 
vtkURIHandlerFindURIHandler (const char *URI)
 Find a URI handler in the collection that can work on the passed URI. More...
 
vtkURIHandlerFindURIHandlerByName (const char *name)
 Returns a URIhandler of a specific type if its name is known. More...
 
std::string 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. More...
 
virtual vtkCacheManagerGetCacheManager ()
 
const char * GetChangedID (const char *id)
 
virtual const char * GetClassName ()
 
const char * GetClassNameByTag (const char *tagName)
 Add a path to the list. More...
 
virtual vtkDataIOManagerGetDataIOManager ()
 
vtkMRMLNodeGetDefaultNodeByClass (const char *className)
 
virtual unsigned long GetErrorCode ()
 
std::string GetErrorMessage ()
 
const char * GetErrorMessagePointer ()
 
vtkMRMLNodeGetFirstNode (const char *byName=0, const char *byClass=0, const int *byHideFromEditors=0, bool exactNameMatch=true)
 Return the first node in the scene that matches the filtering criteria if specified. More...
 
vtkMRMLNodeGetFirstNodeByClass (const char *className)
 Convenience function for getting 0-th node of a specified class in the scene. More...
 
vtkMRMLNodeGetFirstNodeByName (const char *name)
 
virtual char * GetLastLoadedVersion ()
 The version of the last loaded scene file. More...
 
virtual int GetLoadFromXMLString ()
 
bool GetModifiedSinceRead ()
 Returns true if the scene has been "significantly" modified since the last time it was read or written. More...
 
vtkMRMLNodeGetNextNode ()
 
vtkMRMLNodeGetNextNodeByClass (const char *className)
 
vtkMRMLNodeGetNodeByID (const char *name)
 Get node given a unique ID. More...
 
vtkMRMLNodeGetNodeByID (std::string name)
 
std::list< std::string > GetNodeClassesList ()
 
vtkCollection * GetNodes ()
 Return collection of nodes. More...
 
int GetNodesByClass (const char *className, std::vector< vtkMRMLNode *> &nodes)
 Get vector of nodes of a specified class in the scene. More...
 
vtkCollection * GetNodesByClass (const char *className)
 
vtkCollection * GetNodesByClassByName (const char *className, const char *name)
 
vtkCollection * GetNodesByName (const char *name)
 Get nodes having the specified name. More...
 
vtkMRMLNodeGetNthNode (int n)
 Get n-th node in the scene. More...
 
vtkMRMLNodeGetNthNodeByClass (int n, const char *className)
 Get n-th node of a specified class in the scene. More...
 
const char * GetNthReferencedID (int n)
 
vtkMRMLNodeGetNthReferencingNode (int n)
 
vtkMRMLNodeGetNthRegisteredNodeClass (int n)
 
int GetNumberOfNodeReferences ()
 Get the total number of node references (number of ReferencedID-ReferencingNode pairs). More...
 
int GetNumberOfNodes ()
 Get number of nodes in the scene. More...
 
int GetNumberOfNodesByClass (const char *className)
 Get number of nodes of a specified class in the scene. More...
 
int GetNumberOfRedoLevels ()
 returns number of redo steps in the history buffer More...
 
int GetNumberOfRegisteredNodeClasses ()
 
int GetNumberOfUndoLevels ()
 returns number of undo steps in the history buffer More...
 
virtual int GetReadDataOnLoad ()
 
vtkCollection * GetReferencedNodes (vtkMRMLNode *node, bool recursive=true)
 Return collection of all nodes referenced directly or indirectly by node. More...
 
void GetReferencedSubScene (vtkMRMLNode *node, vtkMRMLScene *newScene)
 Get a sub-scene containing all nodes directly or indirectly referenced by the input node. More...
 
void GetReferencingNodes (vtkMRMLNode *referencedNode, std::vector< vtkMRMLNode *> &referencingNodes)
 Get vector of nodes containing references to an input node. More...
 
const char * GetRootDirectory ()
 Get Root directory, where URL is pointing. More...
 
virtual int GetSaveToXMLString ()
 
const std::string & GetSceneXMLString ()
 Returns the saved scene with an XML format if SaveToXMLString is true and Commit() was called prior. More...
 
vtkMRMLNodeGetSingletonNode (const char *singletonTag, const char *className)
 Search and return the singleton of type className with a singletonTag tag. More...
 
vtkMRMLNodeGetSingletonNode (vtkMRMLNode *n)
 Search and return a matching singleton in the scene that the input singleton node will overwrite if it is added to the scene. More...
 
int GetStates () const
 Returns the current state of the scene. More...
 
bool GetStorableNodesModifiedSinceRead (vtkCollection *modifiedStorableNodes=0)
 Search the scene for storable nodes that are "ModifiedSinceRead". More...
 
const char * GetTagByClassName (const char *className)
 Add a path to the list. More...
 
bool GetUndoFlag ()
 
const char * GetUniqueNameByString (const char *baseName)
 
virtual vtkCollection * GetURIHandlerCollection ()
 
const char * GetURL ()
 Get URL (file name) of the scene. More...
 
virtual vtkTagTableGetUserTagTable ()
 
virtual char * GetVersion ()
 The current software version. More...
 
int Import ()
 Add the scene into the existing scene (no clear) from URL file or from. More...
 
void InitTraversal ()
 
vtkMRMLNodeInsertAfterNode (vtkMRMLNode *item, vtkMRMLNode *newItem)
 insert a node in the scene after a specified node More...
 
vtkMRMLNodeInsertBeforeNode (vtkMRMLNode *item, vtkMRMLNode *newItem)
 insert a node in the scene before a specified node More...
 
virtual int IsA (const char *type)
 
bool IsBatchProcessing () const
 Return true if the scene is in BatchProcess state, false otherwise. More...
 
bool IsClosing () const
 Return true if the scene is in Close state, false otherwise. More...
 
int IsFilePathRelative (const char *filepath)
 
bool IsImporting () const
 Return true if the scene is in Import state, false otherwise. More...
 
bool IsNodeClassRegistered (const std::string &className)
 Return True if className is a registered node. More...
 
int IsNodePresent (vtkMRMLNode *n)
 Determine whether a particular node is present. More...
 
bool IsNodeReferencingNodeID (vtkMRMLNode *referencingNode, const char *id)
 
bool IsReservedID (const std::string &id)
 
bool IsRestoring () const
 Return true if the scene is in Restore state, false otherwise. More...
 
void NodeAdded (vtkMRMLNode *n)
 Invoke a vtkMRMLScene::NodeAddedEvent. More...
 
void NodeAdded ()
 
void PrintSelf (ostream &os, vtkIndent indent) VTK_OVERRIDE
 
void ProgressState (unsigned long state, int progress=0)
 TODO: Report progress of the current state. More...
 
void Redo ()
 redo, set the scene to previously undone More...
 
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. More...
 
void RegisterNodeClass (vtkMRMLNode *node)
 Utility function to RegisterNodeClass(), the node tag name is used when registering the node. More...
 
void RemoveAllDefaultNodes ()
 Deletes all default node values from the scene. More...
 
void RemoveNode (vtkMRMLNode *n)
 Remove a path from the list. More...
 
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. More...
 
void SaveStateForUndo ()
 Save current state in the undo buffer. More...
 
void SaveStateForUndo (vtkMRMLNode *node)
 Save current state of the node in the undo buffer. More...
 
void SaveStateForUndo (vtkCollection *nodes)
 Save current state of the nodes in the undo buffer. More...
 
void SaveStateForUndo (std::vector< vtkMRMLNode *> nodes)
 
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)
 This property controls whether Import() loads a scene from an XML string or from an XML file. More...
 
virtual void SetReadDataOnLoad (int)
 
void SetRootDirectory (const char *dir)
 Set Root directory, where URL is pointing. More...
 
virtual void SetSaveToXMLString (int)
 This property controls whether Commit() should save the scene as an XML string or an XML file. More...
 
void SetSceneXMLString (const std::string &xmlString)
 Set the XML string to read from by Import() if GetLoadFromXMLString() is true. More...
 
void SetStorableNodesModifiedSinceRead ()
 Search the scene for storable nodes that are not "ModifiedSinceRead". More...
 
void SetUndoFlag (bool flag)
 
void SetUndoOff ()
 
void SetUndoOn ()
 Set undo on/off. More...
 
virtual void SetURIHandlerCollection (vtkCollection *)
 
void SetURL (const char *url)
 Set URL (file name) of the scene. More...
 
virtual void SetUserTagTable (vtkTagTable *)
 
virtual void SetVersion (const char *)
 
void StartState (unsigned long state, int anticipatedMaxProgress=0)
 Flag the scene as being in a state mode. More...
 
void Undo ()
 undo, set the scene to previous state More...
 
void UpdateNodeChangedIDs ()
 Change node IDs based on the ReferencedIDChanges list. More...
 
void UpdateNodeReferences (vtkCollection *checkNodes=NULL)
 Notify nodes about node ID changes. More...
 

Static Public Member Functions

static int IsTypeOf (const char *type)
 
static vtkMRMLSceneNew ()
 
static vtkMRMLSceneSafeDownCast (vtkObject *o)
 
static void SetStorableNodesModifiedSinceRead (vtkCollection *storableNodes)
 Given a collection of storable nodes, iterate through and call StorableModified() on them. More...
 

Protected Types

typedef std::map< std::string, std::set< std::string > > NodeReferencesType
 

Protected Member Functions

void AddNodeID (vtkMRMLNode *node)
 Add node to NodeIDs map used to speedup GetByID() method. More...
 
vtkMRMLNodeAddNodeNoNotify (vtkMRMLNode *n)
 
void AddReferencedNodes (vtkMRMLNode *node, vtkCollection *refNodes, bool recursive=true)
 
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. More...
 
void ClearNodeIDs ()
 Clear NodeIDs map used to speedup GetByID() method. More...
 
void CopyNodeInRedoStack (vtkMRMLNode *node)
 
void CopyNodeInUndoStack (vtkMRMLNode *node)
 
NodeReferencesType::iterator FindNodeReference (const char *referencedId, vtkMRMLNode *referencingNode)
 Get a NodeReferences iterator for a node reference. More...
 
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. More...
 
int GetUniqueIDIndex (const std::string &baseID)
 
int GetUniqueNameIndex (const std::string &baseName)
 Returns a unique index for a given baseName. More...
 
void PushIntoRedoStack ()
 
void PushIntoUndoStack ()
 
void RemoveAllNodes (bool removeSingletons)
 
void RemoveNodeID (char *nodeID)
 Remove node from NodeIDs map used to speedup GetByID() method. More...
 
void UpdateNodeIDs ()
 Synchronize NodeIDs map used to speedup GetByID() method with the Nodes collection. More...
 
 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. More...
 

Protected Attributes

vtkCacheManagerCacheManager
 data i/o handling members More...
 
vtkDataIOManagerDataIOManager
 
std::map< std::string, vtkSmartPointer< vtkMRMLNode > > DefaultNodes
 
vtkCallbackCommand * DeleteEventCallback
 
std::string ErrorMessage
 
bool InUndo
 
char * LastLoadedVersion
 
int LoadFromXMLString
 
std::map< std::string, vtkSmartPointer< vtkMRMLNode > > NodeIDs
 
vtkMTimeType NodeIDsMTime
 
NodeReferencesType NodeReferences
 
vtkCollection * Nodes
 
int ReadDataOnLoad
 
std::list< vtkCollection *> RedoStack
 
std::map< std::string, std::string > ReferencedIDChanges
 
std::vector< vtkMRMLNode *> RegisteredNodeClasses
 
std::vector< std::string > RegisteredNodeTags
 
std::set< std::string > ReservedIDs
 
std::string RootDirectory
 
int SaveToXMLString
 
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 54 of file vtkMRMLScene.h.

Member Typedef Documentation

◆ NodeReferencesType

typedef std::map< std::string, std::set<std::string> > vtkMRMLScene::NodeReferencesType
protected

Definition at line 709 of file vtkMRMLScene.h.

◆ Superclass

typedef vtkObject vtkMRMLScene::Superclass

Definition at line 64 of file vtkMRMLScene.h.

Member Enumeration Documentation

◆ SceneEventType

Enumerator
NodeAboutToBeAddedEvent 
NodeAddedEvent 
NodeAboutToBeRemovedEvent 
NodeRemovedEvent 
NewSceneEvent 
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 626 of file vtkMRMLScene.h.

◆ StateType

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:

Enumerator
BatchProcessState 
CloseState 
ImportState 
RestoreState 
SaveState 

Definition at line 550 of file vtkMRMLScene.h.

Constructor & Destructor Documentation

◆ vtkMRMLScene()

vtkMRMLScene::vtkMRMLScene ( )
protected

◆ ~vtkMRMLScene()

virtual vtkMRMLScene::~vtkMRMLScene ( )
protectedvirtual

Member Function Documentation

◆ AddDefaultNode()

void vtkMRMLScene::AddDefaultNode ( vtkMRMLNode node)

Set a default node for node creation and reset. One default node can be specified for each node class. It is useful for overriding default values that are set in a node's constructor.

◆ AddNewNodeByClass()

vtkMRMLNode* vtkMRMLScene::AddNewNodeByClass ( std::string  className,
std::string  nodeBaseName = "" 
)

Instantiate and add a node to the scene.

This is the preferred way to create and add a new node to the scene. It ensures that the new node properties are initialized considering its default nodes.

The method calls CreateNodeByClass(), vtkMRMLNode::SetName() and AddNode().

Note
Instead of calling SetName() after creating the node, prefer passing nodeBaseName, indeed the method AddNode() ensures that the final node name is unique in the scene by appending a suffix if needed.
See also
CreateNodeByClass(), vtkMRMLNode::SetName(), AddNode()
AddDefaultNode()
GenerateUniqueName()

◆ AddNode()

vtkMRMLNode* vtkMRMLScene::AddNode ( vtkMRMLNode nodeToAdd)

Add a node to the scene and send vtkMRMLScene::NodeAboutToBeAddedEvent, vtkMRMLScene::NodeAddedEvent and vtkMRMLScene::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.

◆ AddNodeID()

void vtkMRMLScene::AddNodeID ( vtkMRMLNode node)
protected

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

◆ AddNodeNoNotify()

vtkMRMLNode* vtkMRMLScene::AddNodeNoNotify ( vtkMRMLNode n)
protected

Add a node to the scene without invoking a vtkMRMLScene::NodeAddedEvent event.

Warning
Use with extreme caution as it might unsynchronize observer.

◆ AddReferencedNodeID()

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

The Scene maintains a map (NodeReferences) to 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.

◆ AddReferencedNodes()

void vtkMRMLScene::AddReferencedNodes ( vtkMRMLNode node,
vtkCollection *  refNodes,
bool  recursive = true 
)
protected

Get referenced nodes

Parameters
recursiveAll referenced nodes recursively if true, only directly referenced nodes if false. Default is true.

◆ AddReservedID()

void vtkMRMLScene::AddReservedID ( const char *  id)

◆ AddURIHandler()

void vtkMRMLScene::AddURIHandler ( vtkURIHandler handler)

Add a uri handler to the collection.

◆ BuildID()

std::string vtkMRMLScene::BuildID ( const std::string &  baseID,
int  idIndex 
) const
protected

◆ BuildName()

std::string vtkMRMLScene::BuildName ( const std::string &  baseName,
int  nameIndex 
) const
protected

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

◆ Clear()

void vtkMRMLScene::Clear ( int  removeSingletons = 0)

Remove nodes and clear undo/redo stacks.

Parameters
removeSingletonsIf set to true then it removes all singleton nodes (interaction, color, view nodes etc.) from the scene. If it is set to false then it just resets singleton nodes to their default state.

◆ ClearNodeIDs()

void vtkMRMLScene::ClearNodeIDs ( )
protected

Clear NodeIDs map used to speedup GetByID() method.

◆ ClearRedoStack()

void vtkMRMLScene::ClearRedoStack ( )

clear Redo stack, delete redo history

◆ ClearUndoStack()

void vtkMRMLScene::ClearUndoStack ( )

clear Undo stack, delete undo history

◆ Commit()

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

Save scene into URL Returns nonzero on success

◆ Connect()

int vtkMRMLScene::Connect ( )

Create new scene from URL.

Returns nonzero on success.

◆ CopyDefaultNodesToScene()

void vtkMRMLScene::CopyDefaultNodesToScene ( vtkMRMLScene scene)

Copies all default nodes into the parameter scene. Does not remove existing default nodes.

◆ CopyNode()

vtkMRMLNode* vtkMRMLScene::CopyNode ( vtkMRMLNode n)

Add a copy of a node to the scene.

◆ CopyNodeChangedIDs()

void vtkMRMLScene::CopyNodeChangedIDs ( vtkMRMLScene scene)

◆ CopyNodeInRedoStack()

void vtkMRMLScene::CopyNodeInRedoStack ( vtkMRMLNode node)
protected

◆ CopyNodeInUndoStack()

void vtkMRMLScene::CopyNodeInUndoStack ( vtkMRMLNode node)
protected

◆ CopyNodeReferences()

void vtkMRMLScene::CopyNodeReferences ( vtkMRMLScene scene)

◆ CopyRegisteredNodesToScene()

void vtkMRMLScene::CopyRegisteredNodesToScene ( vtkMRMLScene scene)

Copies all registered nodes into the parameter scene.

◆ CopySingletonNodesToScene()

void vtkMRMLScene::CopySingletonNodesToScene ( vtkMRMLScene scene)

Copies all singleton nodes into the parameter scene.

◆ CreateNodeByClass()

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

Create node with a given class.

Result of this method may be different than creating a node directly (using its own constructor), as this method ensures the new node properties are initialized based on the associated default node. Default node may be specified in the scene, using AddDefaultNode() method.

Note
A default node is associated with an other node if it belongs to the class hierarchy of that node.
Warning
This method does NOT add the new node to the scene. To create a new node and add it to the scene in one step, use AddNewNodeByClass().
See also
AddDefaultNode(), AddNewNodeByClass()

◆ EndState()

void vtkMRMLScene::EndState ( unsigned long  state)

Unflag the scene as being in a state 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. vtkMRMLScene::EndImportEvent if state is ImportState .

EndState() internally pops the state out of the stack.

◆ FindNodeReference()

NodeReferencesType::iterator vtkMRMLScene::FindNodeReference ( const char *  referencedId,
vtkMRMLNode referencingNode 
)
protected

Get a NodeReferences iterator for a node reference.

◆ FindURIHandler()

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

Find a URI handler in the collection that can work on the passed URI.

Returns NULL on failure

◆ FindURIHandlerByName()

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

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

◆ GenerateUniqueID() [1/2]

std::string vtkMRMLScene::GenerateUniqueID ( vtkMRMLNode node)
protected

◆ GenerateUniqueID() [2/2]

std::string vtkMRMLScene::GenerateUniqueID ( const std::string &  baseID)
protected

◆ GenerateUniqueName() [1/2]

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.

◆ GenerateUniqueName() [2/2]

std::string vtkMRMLScene::GenerateUniqueName ( vtkMRMLNode node)
protected

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

◆ GetCacheManager()

virtual vtkCacheManager* vtkMRMLScene::GetCacheManager ( )
virtual

◆ GetChangedID()

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

◆ GetClassName()

virtual const char* vtkMRMLScene::GetClassName ( )
virtual

◆ GetClassNameByTag()

const char* vtkMRMLScene::GetClassNameByTag ( const char *  tagName)

Add a path to the list.

◆ GetDataIOManager()

virtual vtkDataIOManager* vtkMRMLScene::GetDataIOManager ( )
virtual

◆ GetDefaultNodeByClass()

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

◆ GetErrorCode()

virtual unsigned long vtkMRMLScene::GetErrorCode ( )
virtual

◆ GetErrorMessage()

std::string vtkMRMLScene::GetErrorMessage ( )

◆ GetErrorMessagePointer()

const char* vtkMRMLScene::GetErrorMessagePointer ( )

◆ GetFirstNode()

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

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

By default, byName will be compared using an exact match. If exactNameMatch is set to false, the node will be returned if its name starts with byName. If the pointer byHideFromEditors is not set, the function will return both the nodes hidden from editors as well as the nodes visible in editors. If the pointer byHideFromEditors is set, the function will only return the nodes that are either hidden from editors or the nodes that are visible in editors.

◆ GetFirstNodeByClass()

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

Convenience function for getting 0-th node of a specified class in the scene.

◆ GetFirstNodeByName()

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

◆ GetLastLoadedVersion()

virtual char* vtkMRMLScene::GetLastLoadedVersion ( )
virtual

The version of the last loaded scene file.

◆ GetLoadFromXMLString()

virtual int vtkMRMLScene::GetLoadFromXMLString ( )
virtual

◆ GetModifiedSinceRead()

bool vtkMRMLScene::GetModifiedSinceRead ( )

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

◆ GetNextNode()

vtkMRMLNode* vtkMRMLScene::GetNextNode ( )

This method is deprecated, kept for backward compatibility but it will be removed in the future. The problem is that it changes the node collection's internal iterator, which may cause unintended side effects in caller functions that also use the node collection's internal iterator. Use other methods instead (GetNodes(), GetNodesByClass(), etc.) or traverse collection returned by GetNodes() using a collection iterator.

◆ GetNextNodeByClass()

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

This method is deprecated, kept for backward compatibility but it will be removed in the future. The problem is that it changes the node collection's internal iterator, which may cause unintended side effects in caller functions that also use the node collection's internal iterator. Use other methods instead (GetNodes(), GetNodesByClass(), etc.) or traverse collection returned by GetNodes() using a collection iterator.

◆ GetNodeByID() [1/2]

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

Get node given a unique ID.

◆ GetNodeByID() [2/2]

vtkMRMLNode* vtkMRMLScene::GetNodeByID ( std::string  name)

◆ GetNodeClassesList()

std::list<std::string> vtkMRMLScene::GetNodeClassesList ( )

◆ GetNodes()

vtkCollection* vtkMRMLScene::GetNodes ( )

Return collection of nodes.

◆ GetNodesByClass() [1/2]

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

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

◆ GetNodesByClass() [2/2]

vtkCollection* vtkMRMLScene::GetNodesByClass ( const char *  className)
Warning
You are responsible for deleting the returned collection.

◆ GetNodesByClassByName()

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

Get nodes of a specified class having the specified name.

Warning
You are responsible for deleting the collection.

◆ GetNodesByName()

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

Get nodes having the specified name.

◆ GetNthNode()

vtkMRMLNode* vtkMRMLScene::GetNthNode ( int  n)

Get n-th node in the scene.

◆ GetNthNodeByClass()

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

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

◆ GetNthReferencedID()

const char* vtkMRMLScene::GetNthReferencedID ( int  n)

Get the ReferencedID component of the n-th ReferencedID-ReferencingNode pair. Only for testing and debugging.

◆ GetNthReferencingNode()

vtkMRMLNode* vtkMRMLScene::GetNthReferencingNode ( int  n)

Get the ReferencingNode component of the n-th ReferencedID-ReferencingNode pair. Only for testing and debugging.

◆ GetNthRegisteredNodeClass()

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.

◆ GetNumberOfNodeReferences()

int vtkMRMLScene::GetNumberOfNodeReferences ( )

Get the total number of node references (number of ReferencedID-ReferencingNode pairs).

Warning
Only for testing and debugging.

◆ GetNumberOfNodes()

int vtkMRMLScene::GetNumberOfNodes ( )

Get number of nodes in the scene.

◆ GetNumberOfNodesByClass()

int vtkMRMLScene::GetNumberOfNodesByClass ( const char *  className)

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

◆ GetNumberOfRedoLevels()

int vtkMRMLScene::GetNumberOfRedoLevels ( )
inline

returns number of redo steps in the history buffer

Definition at line 359 of file vtkMRMLScene.h.

◆ GetNumberOfRegisteredNodeClasses()

int vtkMRMLScene::GetNumberOfRegisteredNodeClasses ( )

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

◆ GetNumberOfUndoLevels()

int vtkMRMLScene::GetNumberOfUndoLevels ( )
inline

returns number of undo steps in the history buffer

Definition at line 356 of file vtkMRMLScene.h.

◆ GetReadDataOnLoad()

virtual int vtkMRMLScene::GetReadDataOnLoad ( )
virtual

◆ GetReferencedNodes()

vtkCollection* vtkMRMLScene::GetReferencedNodes ( vtkMRMLNode node,
bool  recursive = true 
)

Return collection of all nodes referenced directly or indirectly by node.

Parameters
recursiveAll referenced nodes recursively if true, only directly referenced nodes if false. Default is true.

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().

Warning
You are responsible for deleting the returned collection.
See also
GetReferencedSubScene()

◆ GetReferencedSubScene()

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

Get a sub-scene containing all nodes directly or indirectly referenced by the input node.

Note
GetReferencedNodes() is internally called.
See also
AddReferencedNodeID(), GetReferencedNodes()

◆ GetReferencingNodes()

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

Get vector of nodes containing references to an input node.

◆ GetRootDirectory()

const char* vtkMRMLScene::GetRootDirectory ( )

Get Root directory, where URL is pointing.

◆ GetSaveToXMLString()

virtual int vtkMRMLScene::GetSaveToXMLString ( )
virtual

◆ GetSceneXMLString()

const std::string& vtkMRMLScene::GetSceneXMLString ( )

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

See also
Commit(), SetSaveToXMLString()

◆ GetSingletonNode() [1/2]

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.

◆ GetSingletonNode() [2/2]

vtkMRMLNode* vtkMRMLScene::GetSingletonNode ( vtkMRMLNode n)

Search and return a matching singleton in the scene that the input singleton node will overwrite if it is added to the scene.

There is matching if the singleton tag and className are the same, or there is an existing node with the generated unique singleton node ID. Return 0 if such node can't be found in the scene.

◆ GetStates()

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

◆ GetStorableNodesModifiedSinceRead()

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.

◆ GetTagByClassName()

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

Add a path to the list.

◆ GetUndoFlag()

bool vtkMRMLScene::GetUndoFlag ( )
inline

Definition at line 340 of file vtkMRMLScene.h.

◆ GetUniqueIDIndex()

int vtkMRMLScene::GetUniqueIDIndex ( const std::string &  baseID)
protected

◆ GetUniqueNameByString()

const char* vtkMRMLScene::GetUniqueNameByString ( const char *  baseName)
Deprecated:
GetUniqueNameByString Obsolete utility function that provides an unsafe API for GenerateUniqueName()
See also
GenerateUniqueName, GenerateUniqueID

◆ GetUniqueNameIndex()

int vtkMRMLScene::GetUniqueNameIndex ( const std::string &  baseName)
protected

Returns a unique index for a given baseName.

Calling this function successively with the same baseName returns an incremented index: 1, 2, 3...

See also
GenerateUniqueName

◆ GetURIHandlerCollection()

virtual vtkCollection* vtkMRMLScene::GetURIHandlerCollection ( )
virtual

◆ GetURL()

const char* vtkMRMLScene::GetURL ( )

Get URL (file name) of the scene.

◆ GetUserTagTable()

virtual vtkTagTable* vtkMRMLScene::GetUserTagTable ( )
virtual

◆ GetVersion()

virtual char* vtkMRMLScene::GetVersion ( )
virtual

The current software version.

◆ Import()

int vtkMRMLScene::Import ( )

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

See also
SceneXMLString XML string.

Returns nonzero on success.

See also
SetURL(), GetLoadFromXMLString(), SetSceneXMLString()

◆ InitTraversal()

void vtkMRMLScene::InitTraversal ( )

This method is deprecated, kept for backward compatibility but it will be removed in the future. The problem is that it changes the node collection's internal iterator, which may cause unintended side effects in caller functions that also use the node collection's internal iterator. Use other methods instead (GetNodes(), GetNodesByClass(), etc.) or traverse collection returned by GetNodes() using a collection iterator.

◆ InsertAfterNode()

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

insert a node in the scene after a specified node

◆ InsertBeforeNode()

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

insert a node in the scene before a specified node

◆ IsA()

virtual int vtkMRMLScene::IsA ( const char *  type)
virtual

◆ IsBatchProcessing()

bool vtkMRMLScene::IsBatchProcessing ( ) const
inline

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

Definition at line 838 of file vtkMRMLScene.h.

◆ IsClosing()

bool vtkMRMLScene::IsClosing ( ) const
inline

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

Definition at line 845 of file vtkMRMLScene.h.

◆ IsFilePathRelative()

int vtkMRMLScene::IsFilePathRelative ( const char *  filepath)

◆ IsImporting()

bool vtkMRMLScene::IsImporting ( ) const
inline

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

Definition at line 852 of file vtkMRMLScene.h.

◆ IsNodeClassRegistered()

bool vtkMRMLScene::IsNodeClassRegistered ( const std::string &  className)

Return True if className is a registered node.

See also
RegisterNodeClass(vtkMRMLNode* node)

◆ IsNodePresent()

int vtkMRMLScene::IsNodePresent ( vtkMRMLNode n)

Determine whether a particular node is present.

Returns its position in the list.

◆ IsNodeReferencingNodeID()

bool vtkMRMLScene::IsNodeReferencingNodeID ( vtkMRMLNode referencingNode,
const char *  id 
)

◆ IsReservedID()

bool vtkMRMLScene::IsReservedID ( const std::string &  id)

◆ IsRestoring()

bool vtkMRMLScene::IsRestoring ( ) const
inline

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

Definition at line 859 of file vtkMRMLScene.h.

◆ IsTypeOf()

static int vtkMRMLScene::IsTypeOf ( const char *  type)
static

◆ New()

static vtkMRMLScene* vtkMRMLScene::New ( )
static

◆ NodeAdded() [1/2]

void vtkMRMLScene::NodeAdded ( vtkMRMLNode n)

Invoke a vtkMRMLScene::NodeAddedEvent.

This function is used after adding a bunch of nodes with AddNodeNoNotify()

◆ NodeAdded() [2/2]

void vtkMRMLScene::NodeAdded ( )
inline

Definition at line 209 of file vtkMRMLScene.h.

◆ PrintSelf()

void vtkMRMLScene::PrintSelf ( ostream &  os,
vtkIndent  indent 
)

◆ ProgressState()

void vtkMRMLScene::ProgressState ( unsigned long  state,
int  progress = 0 
)

TODO: Report progress of the current state.

◆ PushIntoRedoStack()

void vtkMRMLScene::PushIntoRedoStack ( )
protected

◆ PushIntoUndoStack()

void vtkMRMLScene::PushIntoUndoStack ( )
protected

◆ Redo()

void vtkMRMLScene::Redo ( )

redo, set the scene to previously undone

◆ RegisterNodeClass() [1/2]

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 and #endif where X is the major version of Slicer scene to support, Y the minor and Z the patch version.

See also
CreateNodeByClass(), GetClassNameByTag()

◆ RegisterNodeClass() [2/2]

void vtkMRMLScene::RegisterNodeClass ( vtkMRMLNode node)

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

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

◆ RemoveAllDefaultNodes()

void vtkMRMLScene::RemoveAllDefaultNodes ( )

Deletes all default node values from the scene.

◆ RemoveAllNodes()

void vtkMRMLScene::RemoveAllNodes ( bool  removeSingletons)
protected

◆ RemoveNode()

void vtkMRMLScene::RemoveNode ( vtkMRMLNode n)

Remove a path from the list.

◆ RemoveNodeID()

void vtkMRMLScene::RemoveNodeID ( char *  nodeID)
protected

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

◆ RemoveNodeReferences()

void vtkMRMLScene::RemoveNodeReferences ( vtkMRMLNode node)

◆ RemoveReferencedNodeID()

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

◆ RemoveReferencesToNode()

void vtkMRMLScene::RemoveReferencesToNode ( vtkMRMLNode node)

◆ RemoveReservedIDs()

void vtkMRMLScene::RemoveReservedIDs ( )

◆ RemoveUnusedNodeReferences()

void vtkMRMLScene::RemoveUnusedNodeReferences ( )

◆ ResetNodes()

void vtkMRMLScene::ResetNodes ( )

Reset all nodes to their constructor's state.

◆ SafeDownCast()

static vtkMRMLScene* vtkMRMLScene::SafeDownCast ( vtkObject *  o)
static

◆ SaveStateForUndo() [1/4]

void vtkMRMLScene::SaveStateForUndo ( )

Save current state in the undo buffer.

◆ SaveStateForUndo() [2/4]

void vtkMRMLScene::SaveStateForUndo ( vtkMRMLNode node)

Save current state of the node in the undo buffer.

◆ SaveStateForUndo() [3/4]

void vtkMRMLScene::SaveStateForUndo ( vtkCollection *  nodes)

Save current state of the nodes in the undo buffer.

◆ SaveStateForUndo() [4/4]

void vtkMRMLScene::SaveStateForUndo ( std::vector< vtkMRMLNode *>  nodes)

◆ SceneCallback()

static void vtkMRMLScene::SceneCallback ( vtkObject *  caller,
unsigned long  eid,
void *  clientData,
void *  callData 
)
staticprotected

Handle vtkMRMLScene::DeleteEvent: clear the scene.

◆ SetCacheManager()

virtual void vtkMRMLScene::SetCacheManager ( vtkCacheManager )
virtual

◆ SetDataIOManager()

virtual void vtkMRMLScene::SetDataIOManager ( vtkDataIOManager )
virtual

◆ SetErrorCode()

virtual void vtkMRMLScene::SetErrorCode ( unsigned  long)
virtual

◆ SetErrorMessage() [1/2]

void vtkMRMLScene::SetErrorMessage ( const std::string &  error)

◆ SetErrorMessage() [2/2]

void vtkMRMLScene::SetErrorMessage ( const char *  message)

◆ SetLastLoadedVersion()

virtual void vtkMRMLScene::SetLastLoadedVersion ( const char *  )
virtual

◆ SetLoadFromXMLString()

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()

◆ SetReadDataOnLoad()

virtual void vtkMRMLScene::SetReadDataOnLoad ( int  )
virtual

◆ SetRootDirectory()

void vtkMRMLScene::SetRootDirectory ( const char *  dir)

Set Root directory, where URL is pointing.

◆ SetSaveToXMLString()

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()

◆ SetSceneXMLString()

void vtkMRMLScene::SetSceneXMLString ( const std::string &  xmlString)

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

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

◆ SetStorableNodesModifiedSinceRead() [1/2]

void vtkMRMLScene::SetStorableNodesModifiedSinceRead ( )

Search the scene for storable nodes that are not "ModifiedSinceRead".

Useful after loading a scene from a temporary directory and deleting the files.

See also
SetStorableNodesModifiedSinceRead(vtkCollection*)

◆ SetStorableNodesModifiedSinceRead() [2/2]

static void vtkMRMLScene::SetStorableNodesModifiedSinceRead ( vtkCollection *  storableNodes)
static

Given a collection of storable nodes, iterate through and call StorableModified() on them.

◆ SetUndoFlag()

void vtkMRMLScene::SetUndoFlag ( bool  flag)
inline

Definition at line 341 of file vtkMRMLScene.h.

◆ SetUndoOff()

void vtkMRMLScene::SetUndoOff ( )
inline

Definition at line 339 of file vtkMRMLScene.h.

◆ SetUndoOn()

void vtkMRMLScene::SetUndoOn ( )
inline

Set undo on/off.

Definition at line 338 of file vtkMRMLScene.h.

◆ SetURIHandlerCollection()

virtual void vtkMRMLScene::SetURIHandlerCollection ( vtkCollection *  )
virtual

◆ SetURL()

void vtkMRMLScene::SetURL ( const char *  url)

Set URL (file name) of the scene.

◆ SetUserTagTable()

virtual void vtkMRMLScene::SetUserTagTable ( vtkTagTable )
virtual

◆ SetVersion()

virtual void vtkMRMLScene::SetVersion ( const char *  )
virtual

◆ StartState()

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

◆ Undo()

void vtkMRMLScene::Undo ( )

undo, set the scene to previous state

◆ UpdateNodeChangedIDs()

void vtkMRMLScene::UpdateNodeChangedIDs ( )

Change node IDs based on the ReferencedIDChanges list.

◆ UpdateNodeIDs()

void vtkMRMLScene::UpdateNodeIDs ( )
protected

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

◆ UpdateNodeReferences()

void vtkMRMLScene::UpdateNodeReferences ( vtkCollection *  checkNodes = NULL)

Notify nodes about node ID changes.

vtkMRMLNode::UpdateReferenceID() is called for all the nodes that refer to a node with a changed ID.

If checkNodes is not NULL, then only those nodes are notified that are part of the checkNodes collection.

Friends And Related Function Documentation

◆ vtkMRMLSceneViewNode

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 60 of file vtkMRMLScene.h.

Member Data Documentation

◆ CacheManager

vtkCacheManager* vtkMRMLScene::CacheManager
protected

data i/o handling members

Definition at line 771 of file vtkMRMLScene.h.

◆ DataIOManager

vtkDataIOManager* vtkMRMLScene::DataIOManager
protected

Definition at line 772 of file vtkMRMLScene.h.

◆ DefaultNodes

std::map< std::string, vtkSmartPointer<vtkMRMLNode> > vtkMRMLScene::DefaultNodes
protected

Definition at line 802 of file vtkMRMLScene.h.

◆ DeleteEventCallback

vtkCallbackCommand* vtkMRMLScene::DeleteEventCallback
protected

Definition at line 821 of file vtkMRMLScene.h.

◆ ErrorMessage

std::string vtkMRMLScene::ErrorMessage
protected

Definition at line 804 of file vtkMRMLScene.h.

◆ InUndo

bool vtkMRMLScene::InUndo
protected

Definition at line 780 of file vtkMRMLScene.h.

◆ LastLoadedVersion

char* vtkMRMLScene::LastLoadedVersion
protected

Definition at line 819 of file vtkMRMLScene.h.

◆ LoadFromXMLString

int vtkMRMLScene::LoadFromXMLString
protected

Definition at line 808 of file vtkMRMLScene.h.

◆ NodeIDs

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

Definition at line 797 of file vtkMRMLScene.h.

◆ NodeIDsMTime

vtkMTimeType vtkMRMLScene::NodeIDsMTime
protected

Definition at line 814 of file vtkMRMLScene.h.

◆ NodeReferences

NodeReferencesType vtkMRMLScene::NodeReferences
protected

Definition at line 795 of file vtkMRMLScene.h.

◆ Nodes

vtkCollection* vtkMRMLScene::Nodes
protected

Definition at line 768 of file vtkMRMLScene.h.

◆ ReadDataOnLoad

int vtkMRMLScene::ReadDataOnLoad
protected

Definition at line 812 of file vtkMRMLScene.h.

◆ RedoStack

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

Definition at line 783 of file vtkMRMLScene.h.

◆ ReferencedIDChanges

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

Definition at line 796 of file vtkMRMLScene.h.

◆ RegisteredNodeClasses

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

Definition at line 792 of file vtkMRMLScene.h.

◆ RegisteredNodeTags

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

Definition at line 793 of file vtkMRMLScene.h.

◆ ReservedIDs

std::set<std::string> vtkMRMLScene::ReservedIDs
protected

Definition at line 790 of file vtkMRMLScene.h.

◆ RootDirectory

std::string vtkMRMLScene::RootDirectory
protected

Definition at line 786 of file vtkMRMLScene.h.

◆ SaveToXMLString

int vtkMRMLScene::SaveToXMLString
protected

Definition at line 810 of file vtkMRMLScene.h.

◆ SceneXMLString

std::string vtkMRMLScene::SceneXMLString
protected

Definition at line 806 of file vtkMRMLScene.h.

◆ States

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

Definition at line 776 of file vtkMRMLScene.h.

◆ UndoFlag

bool vtkMRMLScene::UndoFlag
protected

Definition at line 779 of file vtkMRMLScene.h.

◆ UndoStack

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

Definition at line 782 of file vtkMRMLScene.h.

◆ UndoStackSize

int vtkMRMLScene::UndoStackSize
protected

Definition at line 778 of file vtkMRMLScene.h.

◆ UniqueIDs

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

Definition at line 788 of file vtkMRMLScene.h.

◆ UniqueNames

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

Definition at line 789 of file vtkMRMLScene.h.

◆ URIHandlerCollection

vtkCollection* vtkMRMLScene::URIHandlerCollection
protected

Definition at line 773 of file vtkMRMLScene.h.

◆ URL

std::string vtkMRMLScene::URL
protected

Definition at line 785 of file vtkMRMLScene.h.

◆ UserTagTable

vtkTagTable* vtkMRMLScene::UserTagTable
protected

Definition at line 774 of file vtkMRMLScene.h.

◆ Version

char* vtkMRMLScene::Version
protected

Definition at line 818 of file vtkMRMLScene.h.


The documentation for this class was generated from the following file: