Slicer
5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
MRML logic class for layout manipulation. More...
#include <Libs/MRML/Logic/vtkMRMLLayoutLogic.h>
Public Types | |
typedef vtkMRMLAbstractLogic | Superclass |
typedef std::map< std::string, std::string > | ViewAttributes |
typedef std::vector< ViewProperty > | ViewProperties |
typedef ViewAttributes | ViewProperty |
Public Types inherited from vtkMRMLAbstractLogic | |
typedef vtkObject | Superclass |
typedef void(vtkMRMLAbstractLogic::* | TaskFunctionPointer) (void *clientdata) |
Public Member Functions | |
virtual void | AddDefaultLayouts () |
void | ApplyProperties (const ViewProperties &properties, vtkMRMLNode *view, const std::string &action) |
void | ApplyProperty (const ViewProperty &property, vtkMRMLNode *view) |
void | CreateMaximizedViewLayoutDescription (int layout, vtkMRMLAbstractViewNode *viewToMaximize) |
vtkMRMLNode * | CreateViewFromAttributes (const ViewAttributes &attributes) |
virtual const char * | GetClassName () |
virtual vtkMRMLLayoutNode * | GetLayoutNode () |
std::string | GetMaximizedViewLayoutDescription (vtkMRMLAbstractViewNode *viewToMaximize) |
Returns layout description that shows the specified view maximized. More... | |
vtkMRMLNode * | GetViewFromAttributes (const ViewAttributes &attributes) |
This returns the best view node that matches the attributes. More... | |
vtkMRMLNode * | GetViewFromElement (vtkXMLDataElement *element) |
virtual vtkCollection * | GetViewNodes () |
vtkCollection * | GetViewsFromAttributes (const ViewAttributes &attributes) |
This returns the best view node that matches the attributes. More... | |
virtual int | IsA (const char *type) |
void | MaximizeView (vtkMRMLAbstractViewNode *viewToMaximize) |
void | PrintSelf (ostream &os, vtkIndent indent) override |
Public Member Functions inherited from vtkMRMLAbstractLogic | |
virtual vtkMRMLApplicationLogic * | GetMRMLApplicationLogic () const |
Get access to overall application state. More... | |
vtkMRMLScene * | GetMRMLScene () const |
Return a reference to the current MRML scene. More... | |
void | PrintSelf (ostream &os, vtkIndent indent) override |
virtual void | SetMRMLApplicationLogic (vtkMRMLApplicationLogic *logic) |
void | SetMRMLScene (vtkMRMLScene *newScene) |
Set and observe the MRMLScene. More... | |
Static Public Member Functions | |
static int | IsTypeOf (const char *type) |
static vtkMRMLLayoutLogic * | New () |
The Usual vtk class functions. More... | |
static vtkMRMLLayoutLogic * | SafeDownCast (vtkObject *o) |
Static Public Member Functions inherited from vtkMRMLAbstractLogic | |
static int | IsTypeOf (const char *type) |
static vtkMRMLAbstractLogic * | New () |
static vtkMRMLAbstractLogic * | SafeDownCast (vtkObject *o) |
Protected Member Functions | |
void | CreateMissingViews () |
void | CreateMissingViews (vtkXMLDataElement *layoutRootElement) |
vtkXMLDataElement * | GetNextElement (vtkXMLDataElement *element) |
vtkXMLDataElement * | GetNextViewElement (vtkXMLDataElement *viewElement) |
Utility functions to browse XML data elements. More... | |
ViewAttributes | GetViewElementAttributes (vtkXMLDataElement *viewElement) const |
ViewProperties | GetViewElementProperties (vtkXMLDataElement *viewElement) const |
ViewProperty | GetViewElementProperty (vtkXMLDataElement *viewProperty) const |
vtkCollection * | GetViewsFromLayout (vtkXMLDataElement *root) |
void | OnMRMLNodeModified (vtkMRMLNode *node) override |
void | OnMRMLSceneEndRestore () override |
void | OnMRMLSceneStartRestore () override |
void | operator= (const vtkMRMLLayoutLogic &) |
void | SetLayoutNode (vtkMRMLLayoutNode *layoutNode) |
Not public as we internally take care of choosing/updating the layout node. More... | |
void | SetMRMLSceneInternal (vtkMRMLScene *newScene) override |
Reimplemented to listen to specific scene events. More... | |
void | UnobserveMRMLScene () override |
void | UpdateCompareViewLayoutDefinitions () |
void | UpdateFromLayoutNode () |
Update the logic when the layout node is set or modified. More... | |
void | UpdateFromMRMLScene () override |
void | UpdateLayoutNode () |
void | UpdateViewCollectionsFromLayout () |
Make sure the view node list mapped in the current layout is up-to-date. More... | |
void | UpdateViewNodes () |
vtkMRMLLayoutLogic () | |
Logic constructor. More... | |
vtkMRMLLayoutLogic (const vtkMRMLLayoutLogic &) | |
~vtkMRMLLayoutLogic () override | |
Logic destructor. More... | |
Protected Member Functions inherited from vtkMRMLAbstractLogic | |
int | EndModify (bool wasModifying) |
virtual bool | EnterMRMLLogicsCallback () const |
virtual bool | EnterMRMLNodesCallback () const |
virtual bool | EnterMRMLSceneCallback () const |
bool | GetDisableModifiedEvent () const |
int | GetInMRMLLogicsCallbackFlag () const |
int | GetInMRMLNodesCallbackFlag () const |
int | GetInMRMLSceneCallbackFlag () const |
vtkCallbackCommand * | GetMRMLLogicsCallbackCommand () |
vtkObserverManager * | GetMRMLLogicsObserverManager () const |
vtkCallbackCommand * | GetMRMLNodesCallbackCommand () |
vtkObserverManager * | GetMRMLNodesObserverManager () const |
vtkCallbackCommand * | GetMRMLSceneCallbackCommand () |
vtkObserverManager * | GetMRMLSceneObserverManager () const |
int | GetPendingModifiedEventCount () const |
int | GetProcessingMRMLSceneEvent () const |
Return the event id currently processed or 0 if any. More... | |
int | InvokePendingModifiedEvent () |
void | Modified () override |
virtual void | ObserveMRMLScene () |
virtual void | OnMRMLSceneEndBatchProcess () |
virtual void | OnMRMLSceneEndClose () |
virtual void | OnMRMLSceneEndImport () |
virtual void | OnMRMLSceneNew () |
virtual void | OnMRMLSceneNodeAdded (vtkMRMLNode *) |
virtual void | OnMRMLSceneNodeRemoved (vtkMRMLNode *) |
virtual void | OnMRMLSceneStartBatchProcess () |
virtual void | OnMRMLSceneStartClose () |
virtual void | OnMRMLSceneStartImport () |
virtual void | ProcessMRMLLogicsEvents (vtkObject *caller, unsigned long event, void *callData) |
virtual void | ProcessMRMLNodesEvents (vtkObject *caller, unsigned long event, void *callData) |
virtual void | ProcessMRMLSceneEvents (vtkObject *caller, unsigned long event, void *callData) |
virtual void | RegisterNodes () |
void | SetAndObserveMRMLSceneEventsInternal (vtkMRMLScene *newScene, vtkIntArray *events, vtkFloatArray *priorities=nullptr) |
void | SetDisableModifiedEvent (bool onOff) |
void | SetInMRMLLogicsCallbackFlag (int flag) |
void | SetInMRMLNodesCallbackFlag (int flag) |
void | SetInMRMLSceneCallbackFlag (int flag) |
void | SetProcessingMRMLSceneEvent (int event) |
bool | StartModify () |
vtkMRMLAbstractLogic () | |
~vtkMRMLAbstractLogic () override | |
Protected Attributes | |
vtkXMLDataElement * | ConventionalLayoutRootElement |
int | LastValidViewArrangement |
vtkMRMLLayoutNode * | LayoutNode |
Pointer on the unique Layout node of the mrml node. More... | |
vtkCollection * | ViewNodes |
Up-to-date list of the nodes that are mapped into the scene. More... | |
Additional Inherited Members | |
Static Protected Member Functions inherited from vtkMRMLAbstractLogic | |
static void | MRMLLogicsCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData) |
MRMLLogicCallback is a static function to relay modified events from the logics. More... | |
static void | MRMLNodesCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData) |
MRMLNodesCallback is a static function to relay modified events from the nodes. More... | |
static void | MRMLSceneCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData) |
MRML logic class for layout manipulation.
This class manages the logic associated with reading, saving, and changing propertied of the colors
vtkMRMLLayoutLogic is a logic that controls the layout node and the view nodes in a MRML scene. It ensures that at least one 3D view and three slice views are always in the MRML scene (after a scene is closed or imported). The logic keeps an up-to-date list of the different MRML view nodes (3D, slice ...) that are mapped into the layout. A typical use case would be: vtkMRMLScene* scene = vtkMRMLScene::New(); vtkMRMLLayoutLogic* layoutLogic = vtkMRMLLayoutLogic::New(); layoutLogic->SetMRMLScene(scene); layoutLogic->GetLayoutNode()->SetViewArrangement( vtkMRMLLayoutNode::SlicerLayoutConventionalView); vtkCollection* views = layoutLogic->GetViewNodes(); vtkMRMLViewNode* viewNode = vtkMRMLViewNode::SafeDownCast( views->GetItemAsObject(0)); vtkMRMLSliceNode* redNode = vtkMRMLSliceNode::SafeDownCast( views->GetItemAsObject(1)); vtkMRMLSliceNode* yellowNode = vtkMRMLSliceNode::SafeDownCast( views->GetItemAsObject(2)); vtkMRMLSliceNode* greenNode = vtkMRMLSliceNode::SafeDownCast( views->GetItemAsObject(3));
When vtkMRMLScene::Clear() is called, vtkMRMLLayoutNode::Copy() is called with an empty layout node, it sets the view arrangement to None. So when the scene is created/closed/imported, the view arrangement is restored to its previous valid layout.
Definition at line 72 of file vtkMRMLLayoutLogic.h.
Definition at line 77 of file vtkMRMLLayoutLogic.h.
typedef std::map<std::string, std::string> vtkMRMLLayoutLogic::ViewAttributes |
Definition at line 80 of file vtkMRMLLayoutLogic.h.
typedef std::vector<ViewProperty> vtkMRMLLayoutLogic::ViewProperties |
Definition at line 82 of file vtkMRMLLayoutLogic.h.
Definition at line 81 of file vtkMRMLLayoutLogic.h.
|
protected |
Logic constructor.
|
overrideprotected |
Logic destructor.
|
protected |
|
virtual |
Add all the layout descriptions of the known layouts TBD: could be done in vtkMRMLLayoutNode directly... not sure what's best.
void vtkMRMLLayoutLogic::ApplyProperties | ( | const ViewProperties & | properties, |
vtkMRMLNode * | view, | ||
const std::string & | action | ||
) |
void vtkMRMLLayoutLogic::ApplyProperty | ( | const ViewProperty & | property, |
vtkMRMLNode * | view | ||
) |
void vtkMRMLLayoutLogic::CreateMaximizedViewLayoutDescription | ( | int | layout, |
vtkMRMLAbstractViewNode * | viewToMaximize | ||
) |
Create a layout description that maximizes a view. Note that the view node must be a singleton.
|
protected |
|
protected |
vtkMRMLNode* vtkMRMLLayoutLogic::CreateViewFromAttributes | ( | const ViewAttributes & | attributes | ) |
|
virtual |
Reimplemented from vtkMRMLAbstractLogic.
|
virtual |
Returns the unique layout node of the scene. The logic scan the scene at first and if it can't find a layout node, it creates one.
std::string vtkMRMLLayoutLogic::GetMaximizedViewLayoutDescription | ( | vtkMRMLAbstractViewNode * | viewToMaximize | ) |
Returns layout description that shows the specified view maximized.
|
protected |
|
protected |
Utility functions to browse XML data elements.
|
protected |
|
protected |
|
protected |
vtkMRMLNode* vtkMRMLLayoutLogic::GetViewFromAttributes | ( | const ViewAttributes & | attributes | ) |
This returns the best view node that matches the attributes.
vtkMRMLNode* vtkMRMLLayoutLogic::GetViewFromElement | ( | vtkXMLDataElement * | element | ) |
Returns the best node that fits the description given in the XML attributes in the element. The attributes should be precise enough to match a unique node in the scene. Returns 0 if no node can be found.
|
virtual |
Returns the up-to-date list of all the nodes that are mapped in the current layout.
vtkCollection* vtkMRMLLayoutLogic::GetViewsFromAttributes | ( | const ViewAttributes & | attributes | ) |
This returns the best view node that matches the attributes.
|
protected |
As we pass the root element of the entire layout, it returns a list of all the nodes that are found in the layout.
|
virtual |
Reimplemented from vtkMRMLAbstractLogic.
|
static |
void vtkMRMLLayoutLogic::MaximizeView | ( | vtkMRMLAbstractViewNode * | viewToMaximize | ) |
Convenient function that creates and set a layout made of only 1 view.
|
static |
The Usual vtk class functions.
|
overrideprotectedvirtual |
Called after the corresponding MRML event is triggered.
Reimplemented from vtkMRMLAbstractLogic.
|
overrideprotectedvirtual |
If vtkMRMLScene::EndRestoreEvent has been set to be observed in SetMRMLSceneInternal, it is called when the scene fires the event
Reimplemented from vtkMRMLAbstractLogic.
|
overrideprotectedvirtual |
If vtkMRMLScene::StartRestoreEvent has been set to be observed in SetMRMLSceneInternal, it is called when the scene fires the event
Reimplemented from vtkMRMLAbstractLogic.
|
protected |
|
override |
|
static |
|
protected |
Not public as we internally take care of choosing/updating the layout node.
|
overrideprotectedvirtual |
Reimplemented to listen to specific scene events.
Reimplemented from vtkMRMLAbstractLogic.
|
overrideprotectedvirtual |
Called anytime a scene is not set to the logic anymore (e.g. a new or no scene is set) Reimplement the method to delete all the scene specific information such as a node IDs, pointers...
Reimplemented from vtkMRMLAbstractLogic.
|
protected |
Define the compare view layouts available based on settings in the layout node
|
protected |
Update the logic when the layout node is set or modified.
|
overrideprotectedvirtual |
Called every time the scene has been significantly changed. If the scene BatchProcessState events are observed (in SetMRMLSceneInternal() ), UpdateFromMRMLScene is called after each batch process (Close, Import, Restore...). It is also being called by default when a new scene is set (SetMRMLScene).
Reimplemented from vtkMRMLAbstractLogic.
|
protected |
Call SetLayoutNode with the unique layout node in the mrml scene Create a vtkMRMLLayoutNode if there is no layout node in the scene
|
protected |
Make sure the view node list mapped in the current layout is up-to-date.
|
protected |
Makes sure there is at least one 3D view node and three slice nodes (red, yellow and green)
|
protected |
Definition at line 183 of file vtkMRMLLayoutLogic.h.
|
protected |
Definition at line 180 of file vtkMRMLLayoutLogic.h.
|
protected |
Pointer on the unique Layout node of the mrml node.
Definition at line 179 of file vtkMRMLLayoutLogic.h.
|
protected |
Up-to-date list of the nodes that are mapped into the scene.
Definition at line 182 of file vtkMRMLLayoutLogic.h.