Slicer
4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
A set of MRML Nodes that supports serialization and undo/redo. More...
#include <Libs/MRML/Core/vtkMRMLScene.h>
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) |
vtkMRMLNode * | AddNewNodeByClass (std::string className, std::string nodeBaseName="") |
Instantiate and add a node to the scene. More... | |
vtkMRMLNode * | AddNode (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) |
Remove nodes and clear undo/redo stacks. More... | |
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... | |
vtkMRMLNode * | CopyNode (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... | |
vtkMRMLNode * | CreateNodeByClass (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... | |
vtkURIHandler * | FindURIHandler (const char *URI) |
Find a URI handler in the collection that can work on the passed URI. More... | |
vtkURIHandler * | FindURIHandlerByName (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 vtkCacheManager * | GetCacheManager () |
const char * | GetChangedID (const char *id) |
virtual const char * | GetClassName () |
const char * | GetClassNameByTag (const char *tagName) |
Add a path to the list. More... | |
virtual vtkDataIOManager * | GetDataIOManager () |
vtkMRMLNode * | GetDefaultNodeByClass (const char *className) |
virtual unsigned long | GetErrorCode () |
std::string | GetErrorMessage () |
const char * | GetErrorMessagePointer () |
vtkMRMLNode * | 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 criterias if specified. More... | |
vtkMRMLNode * | GetFirstNodeByClass (const char *className) |
Convenience function for getting 0-th node of a specified class in the scene. More... | |
vtkMRMLNode * | GetFirstNodeByName (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... | |
vtkMRMLNode * | GetNextNode () |
vtkMRMLNode * | GetNextNodeByClass (const char *className) |
vtkMRMLNode * | GetNodeByID (const char *name) |
Get node given a unique ID. More... | |
vtkMRMLNode * | GetNodeByID (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... | |
vtkMRMLNode * | GetNthNode (int n) |
Get n-th node in the scene. More... | |
vtkMRMLNode * | GetNthNodeByClass (int n, const char *className) |
Get n-th node of a specified class in the scene. More... | |
const char * | GetNthReferencedID (int n) |
vtkMRMLNode * | GetNthReferencingNode (int n) |
vtkMRMLNode * | GetNthRegisteredNodeClass (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) |
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... | |
vtkMRMLNode * | GetSingletonNode (const char *singletonTag, const char *className) |
Search and return the singleton of type className with a singletonTag tag. More... | |
vtkMRMLNode * | 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. 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 vtkTagTable * | GetUserTagTable () |
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 () |
vtkMRMLNode * | InsertAfterNode (vtkMRMLNode *item, vtkMRMLNode *newItem) |
insert a node in the scene after a specified node More... | |
vtkMRMLNode * | InsertBeforeNode (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 vtkMRMLScene * | New () |
static vtkMRMLScene * | SafeDownCast (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... | |
vtkMRMLNode * | AddNodeNoNotify (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. 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 | |
vtkCacheManager * | CacheManager |
data i/o handling members More... | |
vtkDataIOManager * | DataIOManager |
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 |
vtkMTimeType | 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 |
vtkTagTable * | UserTagTable |
char * | Version |
Friends | |
class | vtkMRMLSceneViewNode |
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.
Definition at line 54 of file vtkMRMLScene.h.
|
protected |
Definition at line 696 of file vtkMRMLScene.h.
typedef vtkObject vtkMRMLScene::Superclass |
Definition at line 64 of file vtkMRMLScene.h.
Definition at line 613 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:
Enumerator | |
---|---|
BatchProcessState | |
CloseState | |
ImportState | |
RestoreState | |
SaveState |
Definition at line 537 of file vtkMRMLScene.h.
|
protected |
|
protectedvirtual |
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.
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().
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.
|
protected |
Add node to NodeIDs map used to speedup GetByID() method.
|
protected |
Add a node to the scene without invoking a vtkMRMLScene::NodeAddedEvent event.
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.
|
protected |
void vtkMRMLScene::AddReservedID | ( | const char * | id | ) |
void vtkMRMLScene::AddURIHandler | ( | vtkURIHandler * | handler | ) |
Add a uri handler to the collection.
|
protected |
|
protected |
Combine a basename and an index to produce a full name.
void vtkMRMLScene::Clear | ( | int | removeSingletons | ) |
Remove nodes and clear undo/redo stacks.
|
protected |
Clear NodeIDs map used to speedup GetByID() method.
void vtkMRMLScene::ClearRedoStack | ( | ) |
clear Redo stack, delete redo history
void vtkMRMLScene::ClearUndoStack | ( | ) |
clear Undo stack, delete undo history
int vtkMRMLScene::Commit | ( | const char * | url = NULL | ) |
Save scene into URL Returns nonzero on success
int vtkMRMLScene::Connect | ( | ) |
Create new scene from URL.
Returns nonzero on success.
void vtkMRMLScene::CopyDefaultNodesToScene | ( | vtkMRMLScene * | scene | ) |
Copies all default nodes into the parameter scene. Does not remove existing default nodes.
vtkMRMLNode* vtkMRMLScene::CopyNode | ( | vtkMRMLNode * | n | ) |
Add a copy of a node to the scene.
void vtkMRMLScene::CopyNodeChangedIDs | ( | vtkMRMLScene * | scene | ) |
|
protected |
|
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.
This method ensures the new node properties are initialized using the associated default node if any.
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.
|
protected |
Get a NodeReferences iterator for a node reference.
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.
|
protected |
|
protected |
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.
|
protected |
Return a unique name for a MRML node. It uses the node tag as the base.
|
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::GetClassNameByTag | ( | const char * | tagName | ) |
Add a path to the list.
|
virtual |
vtkMRMLNode* vtkMRMLScene::GetDefaultNodeByClass | ( | const char * | className | ) |
|
virtual |
std::string vtkMRMLScene::GetErrorMessage | ( | ) |
const char* vtkMRMLScene::GetErrorMessagePointer | ( | ) |
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 criterias 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.
vtkMRMLNode* vtkMRMLScene::GetFirstNodeByClass | ( | const char * | className | ) |
Convenience function for getting 0-th node of a specified class in the scene.
vtkMRMLNode* vtkMRMLScene::GetFirstNodeByName | ( | const char * | name | ) |
|
virtual |
The version of the last loaded scene file.
|
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 | ( | ) |
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.
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.
vtkMRMLNode* vtkMRMLScene::GetNodeByID | ( | const char * | name | ) |
Get node given a unique ID.
vtkMRMLNode* vtkMRMLScene::GetNodeByID | ( | std::string | name | ) |
std::list<std::string> vtkMRMLScene::GetNodeClassesList | ( | ) |
vtkCollection* vtkMRMLScene::GetNodes | ( | ) |
Return collection of nodes.
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 | ) |
vtkCollection* vtkMRMLScene::GetNodesByClassByName | ( | const char * | className, |
const char * | name | ||
) |
Get nodes of a specified class having the specified name.
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.
const char* vtkMRMLScene::GetNthReferencedID | ( | int | n | ) |
Get the ReferencedID component of the n-th ReferencedID-ReferencingNode pair. Only for testing and debugging.
vtkMRMLNode* vtkMRMLScene::GetNthReferencingNode | ( | int | n | ) |
Get the ReferencingNode component of the n-th ReferencedID-ReferencingNode pair. Only for testing and debugging.
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::GetNumberOfNodeReferences | ( | ) |
Get the total number of node references (number of ReferencedID-ReferencingNode pairs).
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.
|
inline |
returns number of redo steps in the history buffer
Definition at line 349 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)
|
inline |
returns number of undo steps in the history buffer
Definition at line 346 of file vtkMRMLScene.h.
|
virtual |
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().
void vtkMRMLScene::GetReferencedSubScene | ( | vtkMRMLNode * | node, |
vtkMRMLScene * | newScene | ||
) |
Get a sub-scene containing all nodes directly or indirectly referenced by the input node.
void vtkMRMLScene::GetReferencingNodes | ( | vtkMRMLNode * | referencedNode, |
std::vector< vtkMRMLNode *> & | referencingNodes | ||
) |
Get vector of nodes containing references to an input node.
const char* vtkMRMLScene::GetRootDirectory | ( | ) |
Get Root directory, where URL is pointing.
|
virtual |
const std::string& vtkMRMLScene::GetSceneXMLString | ( | ) |
Returns the saved scene with an XML format if SaveToXMLString is true and Commit() was called prior.
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.
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.
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.
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.
|
inline |
Definition at line 330 of file vtkMRMLScene.h.
|
protected |
const char* vtkMRMLScene::GetUniqueNameByString | ( | const char * | 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...
|
virtual |
const char* vtkMRMLScene::GetURL | ( | ) |
Get URL (file name) of the scene.
|
virtual |
|
virtual |
The current software version.
int vtkMRMLScene::Import | ( | ) |
Add the scene into the existing scene (no clear) from URL file or from.
Returns nonzero on success.
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.
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 |
|
inline |
Return true if the scene is in BatchProcess state, false otherwise.
Definition at line 823 of file vtkMRMLScene.h.
|
inline |
Return true if the scene is in Close state, false otherwise.
Definition at line 830 of file vtkMRMLScene.h.
int vtkMRMLScene::IsFilePathRelative | ( | const char * | filepath | ) |
|
inline |
Return true if the scene is in Import state, false otherwise.
Definition at line 837 of file vtkMRMLScene.h.
bool vtkMRMLScene::IsNodeClassRegistered | ( | const std::string & | className | ) |
Return True if className is a registered node.
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::IsReservedID | ( | const std::string & | id | ) |
|
inline |
Return true if the scene is in Restore state, false otherwise.
Definition at line 844 of file vtkMRMLScene.h.
|
static |
|
static |
void vtkMRMLScene::NodeAdded | ( | vtkMRMLNode * | n | ) |
Invoke a vtkMRMLScene::NodeAddedEvent.
This function is used after adding a bunch of nodes with AddNodeNoNotify()
|
inline |
Definition at line 199 of file vtkMRMLScene.h.
void vtkMRMLScene::PrintSelf | ( | ostream & | os, |
vtkIndent | indent | ||
) |
void vtkMRMLScene::ProgressState | ( | unsigned long | state, |
int | progress = 0 |
||
) |
TODO: Report progress of the current state.
|
protected |
|
protected |
void vtkMRMLScene::Redo | ( | ) |
redo, set the scene to previously undone
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.
void vtkMRMLScene::RegisterNodeClass | ( | vtkMRMLNode * | node | ) |
Utility function to RegisterNodeClass(), the node tag name is used when registering the node.
void vtkMRMLScene::RemoveAllDefaultNodes | ( | ) |
Deletes all default node values from the scene.
|
protected |
void vtkMRMLScene::RemoveNode | ( | vtkMRMLNode * | n | ) |
Remove a path from the list.
|
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 |
void vtkMRMLScene::SaveStateForUndo | ( | ) |
Save current state in the undo buffer.
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 | ( | std::vector< vtkMRMLNode *> | nodes | ) |
|
staticprotected |
Handle vtkMRMLScene::DeleteEvent: clear the scene.
|
virtual |
|
virtual |
|
virtual |
void vtkMRMLScene::SetErrorMessage | ( | const std::string & | error | ) |
void vtkMRMLScene::SetErrorMessage | ( | const char * | message | ) |
|
virtual |
|
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.
|
virtual |
void vtkMRMLScene::SetRootDirectory | ( | const char * | dir | ) |
Set Root directory, where URL is pointing.
|
virtual |
void vtkMRMLScene::SetSceneXMLString | ( | const std::string & | xmlString | ) |
Set the XML string to read from by Import() if GetLoadFromXMLString() is true.
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.
|
static |
Given a collection of storable nodes, iterate through and call StorableModified() on them.
|
inline |
Definition at line 331 of file vtkMRMLScene.h.
|
inline |
Definition at line 329 of file vtkMRMLScene.h.
|
inline |
Set undo on/off.
Definition at line 328 of file vtkMRMLScene.h.
|
virtual |
void vtkMRMLScene::SetURL | ( | const char * | url | ) |
Set URL (file name) of the scene.
|
virtual |
|
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:
StartState() internally pushes the state into a stack.
void vtkMRMLScene::Undo | ( | ) |
undo, set the scene to previous state
void vtkMRMLScene::UpdateNodeChangedIDs | ( | ) |
Change node IDs based on the ReferencedIDChanges list.
|
protected |
Synchronize NodeIDs map used to speedup GetByID() method with the Nodes collection.
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.
|
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.
|
protected |
data i/o handling members
Definition at line 756 of file vtkMRMLScene.h.
|
protected |
Definition at line 757 of file vtkMRMLScene.h.
|
protected |
Definition at line 787 of file vtkMRMLScene.h.
|
protected |
Definition at line 806 of file vtkMRMLScene.h.
|
protected |
Definition at line 789 of file vtkMRMLScene.h.
|
protected |
Definition at line 765 of file vtkMRMLScene.h.
|
protected |
Definition at line 804 of file vtkMRMLScene.h.
|
protected |
Definition at line 793 of file vtkMRMLScene.h.
|
protected |
Definition at line 782 of file vtkMRMLScene.h.
|
protected |
Definition at line 799 of file vtkMRMLScene.h.
|
protected |
Definition at line 780 of file vtkMRMLScene.h.
|
protected |
Definition at line 752 of file vtkMRMLScene.h.
|
protected |
Definition at line 797 of file vtkMRMLScene.h.
|
protected |
Definition at line 768 of file vtkMRMLScene.h.
|
protected |
Definition at line 781 of file vtkMRMLScene.h.
|
protected |
Definition at line 777 of file vtkMRMLScene.h.
|
protected |
Definition at line 778 of file vtkMRMLScene.h.
|
protected |
Definition at line 775 of file vtkMRMLScene.h.
|
protected |
Definition at line 771 of file vtkMRMLScene.h.
|
protected |
Definition at line 795 of file vtkMRMLScene.h.
|
protected |
Definition at line 753 of file vtkMRMLScene.h.
|
protected |
Definition at line 791 of file vtkMRMLScene.h.
|
protected |
Definition at line 761 of file vtkMRMLScene.h.
|
protected |
Definition at line 764 of file vtkMRMLScene.h.
|
protected |
Definition at line 767 of file vtkMRMLScene.h.
|
protected |
Definition at line 763 of file vtkMRMLScene.h.
|
protected |
Definition at line 773 of file vtkMRMLScene.h.
|
protected |
Definition at line 774 of file vtkMRMLScene.h.
|
protected |
Definition at line 758 of file vtkMRMLScene.h.
|
protected |
Definition at line 770 of file vtkMRMLScene.h.
|
protected |
Definition at line 759 of file vtkMRMLScene.h.
|
protected |
Definition at line 803 of file vtkMRMLScene.h.