Slicer  4.8
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 Member Functions | Protected Attributes
vtkMRMLLayoutLogic Class Reference

MRML logic class for layout manipulation. More...

#include <Libs/MRML/Logic/vtkMRMLLayoutLogic.h>

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

Public Types

typedef vtkMRMLAbstractLogic Superclass
 
typedef std::map< std::string, std::string > ViewAttributes
 
typedef std::vector< ViewPropertyViewProperties
 
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)
 
vtkMRMLNodeCreateViewFromAttributes (const ViewAttributes &attributes)
 
virtual const char * GetClassName ()
 
virtual vtkMRMLLayoutNodeGetLayoutNode ()
 
vtkMRMLNodeGetViewFromAttributes (const ViewAttributes &attributes)
 This returns the best view node that matches the attributes. More...
 
vtkMRMLNodeGetViewFromElement (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)
 
virtual void PrintSelf (ostream &os, vtkIndent indent) VTK_OVERRIDE
 
- Public Member Functions inherited from vtkMRMLAbstractLogic
virtual vtkMRMLApplicationLogicGetMRMLApplicationLogic () const
 Get access to overall application state. More...
 
vtkMRMLSceneGetMRMLScene () const
 Return a reference to the current MRML scene. More...
 
void PrintSelf (ostream &os, vtkIndent indent) VTK_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 vtkMRMLLayoutLogicNew ()
 The Usual vtk class functions. More...
 
static vtkMRMLLayoutLogicSafeDownCast (vtkObject *o)
 
- Static Public Member Functions inherited from vtkMRMLAbstractLogic
static int IsTypeOf (const char *type)
 
static vtkMRMLAbstractLogicNew ()
 
static vtkMRMLAbstractLogicSafeDownCast (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)
 
virtual void OnMRMLNodeModified (vtkMRMLNode *node) VTK_OVERRIDE
 
virtual void OnMRMLSceneEndRestore () VTK_OVERRIDE
 
virtual void OnMRMLSceneStartRestore () VTK_OVERRIDE
 
void operator= (const vtkMRMLLayoutLogic &)
 
void SetLayoutNode (vtkMRMLLayoutNode *layoutNode)
 Not public as we internally take care of chosing/updating the layout node. More...
 
virtual void SetMRMLSceneInternal (vtkMRMLScene *newScene) VTK_OVERRIDE
 Reimplemented to listen to specific scene events. More...
 
virtual void UnobserveMRMLScene () VTK_OVERRIDE
 
void UpdateCompareViewLayoutDefinitions ()
 
void UpdateFromLayoutNode ()
 Update the logic when the layout node is set or modified. More...
 
virtual void UpdateFromMRMLScene () VTK_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 &)
 
virtual ~vtkMRMLLayoutLogic ()
 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 ()
 
vtkObserverManagerGetMRMLLogicsObserverManager () const
 
vtkCallbackCommand * GetMRMLNodesCallbackCommand ()
 
vtkObserverManagerGetMRMLNodesObserverManager () const
 
vtkCallbackCommand * GetMRMLSceneCallbackCommand ()
 
vtkObserverManagerGetMRMLSceneObserverManager () const
 
int GetPendingModifiedEventCount () const
 
int GetProcessingMRMLSceneEvent () const
 Return the event id currently processed or 0 if any. More...
 
int InvokePendingModifiedEvent ()
 
virtual void Modified () VTK_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=0)
 
void SetDisableModifiedEvent (bool onOff)
 
void SetInMRMLLogicsCallbackFlag (int flag)
 
void SetInMRMLNodesCallbackFlag (int flag)
 
void SetInMRMLSceneCallbackFlag (int flag)
 
void SetProcessingMRMLSceneEvent (int event)
 
bool StartModify ()
 
 vtkMRMLAbstractLogic ()
 
virtual ~vtkMRMLAbstractLogic ()
 

Protected Attributes

vtkXMLDataElement * ConventionalLayoutRootElement
 
int LastValidViewArrangement
 
vtkMRMLLayoutNodeLayoutNode
 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)
 

Detailed Description

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.

Member Typedef Documentation

◆ Superclass

Definition at line 77 of file vtkMRMLLayoutLogic.h.

◆ ViewAttributes

typedef std::map<std::string, std::string> vtkMRMLLayoutLogic::ViewAttributes

Definition at line 80 of file vtkMRMLLayoutLogic.h.

◆ ViewProperties

Definition at line 82 of file vtkMRMLLayoutLogic.h.

◆ ViewProperty

Definition at line 81 of file vtkMRMLLayoutLogic.h.

Constructor & Destructor Documentation

◆ vtkMRMLLayoutLogic() [1/2]

vtkMRMLLayoutLogic::vtkMRMLLayoutLogic ( )
protected

Logic constructor.

◆ ~vtkMRMLLayoutLogic()

virtual vtkMRMLLayoutLogic::~vtkMRMLLayoutLogic ( )
protectedvirtual

Logic destructor.

◆ vtkMRMLLayoutLogic() [2/2]

vtkMRMLLayoutLogic::vtkMRMLLayoutLogic ( const vtkMRMLLayoutLogic )
protected

Member Function Documentation

◆ AddDefaultLayouts()

virtual void vtkMRMLLayoutLogic::AddDefaultLayouts ( )
virtual

Add all the layout descriptions of the known layouts TBD: could be done in vtkMRMLLayoutNode directly... not sure what's best.

◆ ApplyProperties()

void vtkMRMLLayoutLogic::ApplyProperties ( const ViewProperties properties,
vtkMRMLNode view,
const std::string &  action 
)

◆ ApplyProperty()

void vtkMRMLLayoutLogic::ApplyProperty ( const ViewProperty property,
vtkMRMLNode view 
)

◆ CreateMaximizedViewLayoutDescription()

void vtkMRMLLayoutLogic::CreateMaximizedViewLayoutDescription ( int  layout,
vtkMRMLAbstractViewNode viewToMaximize 
)

Create a layout description that maximizes a view. Note that the view node must be a singleton.

See also
MaximizeView()

◆ CreateMissingViews() [1/2]

void vtkMRMLLayoutLogic::CreateMissingViews ( )
protected

◆ CreateMissingViews() [2/2]

void vtkMRMLLayoutLogic::CreateMissingViews ( vtkXMLDataElement *  layoutRootElement)
protected

◆ CreateViewFromAttributes()

vtkMRMLNode* vtkMRMLLayoutLogic::CreateViewFromAttributes ( const ViewAttributes attributes)

◆ GetClassName()

virtual const char* vtkMRMLLayoutLogic::GetClassName ( )
virtual

Reimplemented from vtkMRMLAbstractLogic.

◆ GetLayoutNode()

virtual vtkMRMLLayoutNode* vtkMRMLLayoutLogic::GetLayoutNode ( )
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.

◆ GetNextElement()

vtkXMLDataElement* vtkMRMLLayoutLogic::GetNextElement ( vtkXMLDataElement *  element)
protected

◆ GetNextViewElement()

vtkXMLDataElement* vtkMRMLLayoutLogic::GetNextViewElement ( vtkXMLDataElement *  viewElement)
protected

Utility functions to browse XML data elements.

◆ GetViewElementAttributes()

ViewAttributes vtkMRMLLayoutLogic::GetViewElementAttributes ( vtkXMLDataElement *  viewElement) const
protected

◆ GetViewElementProperties()

ViewProperties vtkMRMLLayoutLogic::GetViewElementProperties ( vtkXMLDataElement *  viewElement) const
protected

◆ GetViewElementProperty()

ViewProperty vtkMRMLLayoutLogic::GetViewElementProperty ( vtkXMLDataElement *  viewProperty) const
protected

◆ GetViewFromAttributes()

vtkMRMLNode* vtkMRMLLayoutLogic::GetViewFromAttributes ( const ViewAttributes attributes)

This returns the best view node that matches the attributes.

◆ GetViewFromElement()

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.

◆ GetViewNodes()

virtual vtkCollection* vtkMRMLLayoutLogic::GetViewNodes ( )
virtual

Returns the up-to-date list of all the nodes that are mapped in the current layout.

◆ GetViewsFromAttributes()

vtkCollection* vtkMRMLLayoutLogic::GetViewsFromAttributes ( const ViewAttributes attributes)

This returns the best view node that matches the attributes.

◆ GetViewsFromLayout()

vtkCollection* vtkMRMLLayoutLogic::GetViewsFromLayout ( vtkXMLDataElement *  root)
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.

◆ IsA()

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

Reimplemented from vtkMRMLAbstractLogic.

◆ IsTypeOf()

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

◆ MaximizeView()

void vtkMRMLLayoutLogic::MaximizeView ( vtkMRMLAbstractViewNode viewToMaximize)

◆ New()

static vtkMRMLLayoutLogic* vtkMRMLLayoutLogic::New ( )
static

The Usual vtk class functions.

◆ OnMRMLNodeModified()

virtual void vtkMRMLLayoutLogic::OnMRMLNodeModified ( vtkMRMLNode )
protectedvirtual

Called after the corresponding MRML event is triggered.

See also
ProcessMRMLNodesEvents

Reimplemented from vtkMRMLAbstractLogic.

◆ OnMRMLSceneEndRestore()

virtual void vtkMRMLLayoutLogic::OnMRMLSceneEndRestore ( )
protectedvirtual

If vtkMRMLScene::EndRestoreEvent has been set to be observed in SetMRMLSceneInternal, it is called when the scene fires the event

See also
ProcessMRMLSceneEvents, SetMRMLSceneInternal
OnMRMLSceneStartRestore

Reimplemented from vtkMRMLAbstractLogic.

◆ OnMRMLSceneStartRestore()

virtual void vtkMRMLLayoutLogic::OnMRMLSceneStartRestore ( )
protectedvirtual

If vtkMRMLScene::StartRestoreEvent has been set to be observed in SetMRMLSceneInternal, it is called when the scene fires the event

See also
ProcessMRMLSceneEvents, SetMRMLSceneInternal
OnMRMLSceneEndRestore

Reimplemented from vtkMRMLAbstractLogic.

◆ operator=()

void vtkMRMLLayoutLogic::operator= ( const vtkMRMLLayoutLogic )
protected

◆ PrintSelf()

virtual void vtkMRMLLayoutLogic::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
virtual

◆ SafeDownCast()

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

◆ SetLayoutNode()

void vtkMRMLLayoutLogic::SetLayoutNode ( vtkMRMLLayoutNode layoutNode)
protected

Not public as we internally take care of chosing/updating the layout node.

◆ SetMRMLSceneInternal()

virtual void vtkMRMLLayoutLogic::SetMRMLSceneInternal ( vtkMRMLScene newScene)
protectedvirtual

Reimplemented to listen to specific scene events.

Reimplemented from vtkMRMLAbstractLogic.

◆ UnobserveMRMLScene()

virtual void vtkMRMLLayoutLogic::UnobserveMRMLScene ( )
protectedvirtual

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

See also
SetMRMLSceneInternal, ObserveMRMLScene, UpdateFromMRMLScene

Reimplemented from vtkMRMLAbstractLogic.

◆ UpdateCompareViewLayoutDefinitions()

void vtkMRMLLayoutLogic::UpdateCompareViewLayoutDefinitions ( )
protected

Define the compare view layouts available based on settings in the layout node

◆ UpdateFromLayoutNode()

void vtkMRMLLayoutLogic::UpdateFromLayoutNode ( )
protected

Update the logic when the layout node is set or modified.

◆ UpdateFromMRMLScene()

virtual void vtkMRMLLayoutLogic::UpdateFromMRMLScene ( )
protectedvirtual

Called everytime 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).

See also
SetMRMLSceneInternal, UnobserveMRMLScene, ObserveMRMLScene

Reimplemented from vtkMRMLAbstractLogic.

◆ UpdateLayoutNode()

void vtkMRMLLayoutLogic::UpdateLayoutNode ( )
protected

Call SetLayoutNode with the unique layout node in the mrml scene Create a vtkMRMLLayoutNode if there is no layout node in the scene

◆ UpdateViewCollectionsFromLayout()

void vtkMRMLLayoutLogic::UpdateViewCollectionsFromLayout ( )
protected

Make sure the view node list mapped in the current layout is up-to-date.

◆ UpdateViewNodes()

void vtkMRMLLayoutLogic::UpdateViewNodes ( )
protected

Makes sure there is at least one 3D view node and three slice nodes (red, yellow and green)

Member Data Documentation

◆ ConventionalLayoutRootElement

vtkXMLDataElement* vtkMRMLLayoutLogic::ConventionalLayoutRootElement
protected

Definition at line 180 of file vtkMRMLLayoutLogic.h.

◆ LastValidViewArrangement

int vtkMRMLLayoutLogic::LastValidViewArrangement
protected

Definition at line 177 of file vtkMRMLLayoutLogic.h.

◆ LayoutNode

vtkMRMLLayoutNode* vtkMRMLLayoutLogic::LayoutNode
protected

Pointer on the unique Layout node of the mrml node.

Definition at line 176 of file vtkMRMLLayoutLogic.h.

◆ ViewNodes

vtkCollection* vtkMRMLLayoutLogic::ViewNodes
protected

Up-to-date list of the nodes that are mapped into the scene.

Definition at line 179 of file vtkMRMLLayoutLogic.h.


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