NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Public Slots | Public Member Functions | Protected Member Functions | List of all members
niftk::MultiViewerVisibilityManager Class Reference

Maintains a list of SingleViewerWidgets and coordinates visibility properties by listening to AddNodeEvent, RemoveNodeEvent and listening directly to Modified events from the nodes "visible" property in DataStorage. More...

Inheritance diagram for niftk::MultiViewerVisibilityManager:
Inheritance graph
[legend]
Collaboration diagram for niftk::MultiViewerVisibilityManager:
Collaboration graph
[legend]

Public Slots

void OnNodesDropped (std::vector< mitk::DataNode * > nodes)
 When nodes are dropped, we set all the default properties, and renderer specific visibility flags etc. More...
 

Public Member Functions

 mitkClassMacro (MultiViewerVisibilityManager, DataNodePropertyListener) mitkNewMacro1Param(MultiViewerVisibilityManager
 
const mitk::DataStorage::Pointer MultiViewerVisibilityManager (mitk::DataStorage::Pointer dataStorage)
 This class must (checked with assert) have a non-NULL mitk::DataStorage so it is injected in the constructor, and we register to AddNodeEvent, RemoveNodeEvent. More...
 
virtual ~MultiViewerVisibilityManager ()
 Destructor, which unregisters all the listeners. More...
 
 MultiViewerVisibilityManager (const MultiViewerVisibilityManager &)
 
MultiViewerVisibilityManageroperator= (const MultiViewerVisibilityManager &)
 
void RegisterViewer (SingleViewerWidget *viewer)
 Each new viewer should first be registered with this class, so this class can manage renderer specific visibility properties. More...
 
void DeregisterViewers (std::vcl_size_t startIndex=0, std::vcl_size_t endIndex=-1)
 De-registers a range of viewers, which means actually removing them from m_DataNodes and m_Viewers. Start index inclusive, end index exclusive. More...
 
void ClearViewers (std::vcl_size_t startIndex=0, std::vcl_size_t endIndex=-1)
 Used to clear a range of windows, meaning to set renderer specific visibility properties to false for all the nodes registered in m_DataNodes. Start index inclusive, end index exclusive. More...
 
DnDDisplayDropType GetDropType () const
 Get the drop type, which controls the behaviour when multiple images are dropped into a single viewer. More...
 
void SetDropType (DnDDisplayDropType dropType)
 Set the drop type, which controls the behaviour when multiple images are dropped into a single viewer. More...
 
DnDDisplayInterpolationType GetInterpolationType () const
 Returns the default interpolation type, which takes effect when a new image is dropped. More...
 
void SetInterpolationType (DnDDisplayInterpolationType interpolationType)
 Sets the default interpolation type, which takes effect when a new image is dropped. More...
 
WindowLayout GetDefaultWindowLayout () const
 Returns the default render window layout for when images are dropped into a render window. More...
 
void SetDefaultWindowLayout (WindowLayout windowLayout)
 Sets the default render window layout for when images are dropped into a render window. More...
 
bool GetAutomaticallyAddChildren () const
 When we drop nodes onto a window, if true, we add all the children. More...
 
void SetAutomaticallyAddChildren (bool autoAdd)
 When we drop nodes onto a window, if true, we add all the children. More...
 
bool GetAccumulateWhenDropped () const
 Gets the flag deciding whether we accumulate images each time we drop. More...
 
void SetAccumulateWhenDropping (bool accumulate)
 Sets the flag deciding whether we prefer to accumulate images each time they are dropped. More...
 
void OnFocusChanged ()
 Called when one of the viewers receives the focus. More...
 
- Public Member Functions inherited from niftk::DataNodePropertyListener
 mitkClassMacro (DataNodePropertyListener, DataStorageListener) mitkNewMacro2Param(DataNodePropertyListener
 
const const std::stringmitkNewMacro3Param (DataNodePropertyListener, const mitk::DataStorage::Pointer, const std::string &, bool) mitkNewMacro3Param(DataNodePropertyListener
 
const const std::string const
const std::string int 
mitkNewMacro3Param (DataNodePropertyListener, const mitk::DataStorage::Pointer, const std::string &, float) mitkNewMacro3Param(DataNodePropertyListener
 
const const std::string const
const std::string int const
const std::string const
std::string &void 
SetRenderers (const std::vector< const mitk::BaseRenderer * > &renderers)
 Sets the list of renderers to check. More...
 
- Public Member Functions inherited from niftk::DataStorageListener
 mitkClassMacroItkParent (DataStorageListener, itk::LightObject) mitkNewMacro1Param(DataStorageListener
 
const
mitk::DataStorage::Pointer
mitk::DataStorage::Pointer 
GetDataStorage () const
 Gets the data storage. More...
 
void AddFilter (DataNodeFilter::Pointer filter)
 Adds a filter. More...
 
void ClearFilters ()
 Clears all filters. More...
 
bool IsBlocked () const
 Tells if the listener is blocked, i.e. the processing of signals is suppressed. More...
 
bool SetBlocked (bool blocked)
 Blocks the processing of signals. This can be used to avoid eventual infinite recursion. Returns true if the listener was already blocked, otherwise false. More...
 

Protected Member Functions

virtual void OnNodeAdded (mitk::DataNode *node) override
 Called when a node is added, and we set rendering window specific visibility to false for all registered windows, plus other default properties such as interpolation type. More...
 
virtual void OnNodeRemoved (mitk::DataNode *node) override
 Called when a node is added, and we set rendering window specific visibility. More...
 
virtual void OnPropertyChanged (mitk::DataNode *node, const mitk::BaseRenderer *renderer) override
 Called when the property value has changed globally or for the given renderer. If the global property has changed, renderer is NULL. More...
 
virtual void AddNodeToViewer (int windowIndex, mitk::DataNode *node, bool visibility=true)
 For a given window, effectively sets the rendering window specific visibility property for the given node to initialVisibility. More...
 
virtual void RemoveNodesFromViewer (int windowIndex)
 For a given window (denoted by its windowIndex, or index number in m_Viewers), effectively sets the rendering window specific visibility property of all nodes registered with that window to false. More...
 
- Protected Member Functions inherited from niftk::DataNodePropertyListener
 DataNodePropertyListener (const mitk::DataStorage::Pointer dataStorage, const std::string &propertyName)
 
 DataNodePropertyListener (const mitk::DataStorage::Pointer dataStorage, const std::string &propertyName, bool defaultValue)
 
 DataNodePropertyListener (const mitk::DataStorage::Pointer dataStorage, const std::string &propertyName, int defaultValue)
 
 DataNodePropertyListener (const mitk::DataStorage::Pointer dataStorage, const std::string &propertyName, float defaultValue)
 
 DataNodePropertyListener (const mitk::DataStorage::Pointer dataStorage, const std::string &propertyName, const std::string &defaultValue)
 
virtual ~DataNodePropertyListener ()
 
 DataNodePropertyListener (const DataNodePropertyListener &)
 
DataNodePropertyListeneroperator= (const DataNodePropertyListener &)
 
virtual void OnNodeDeleted (mitk::DataNode *node) override
 Called when a node is deleted. Notifies the observers for the node then removes them. More...
 
- Protected Member Functions inherited from niftk::DataStorageListener
 DataStorageListener (const mitk::DataStorage::Pointer)
 
virtual ~DataStorageListener ()
 
 DataStorageListener (const DataStorageListener &)
 
DataStorageListeneroperator= (const DataStorageListener &)
 
virtual void OnNodeChanged (mitk::DataNode *node)
 Called when the given node has been changed. Empty implementation, subclasses can redefine it. More...
 
bool Pass (const mitk::DataNode *node) const
 Checks the node against the list of filters. More...
 

Additional Inherited Members

- Public Attributes inherited from niftk::DataNodePropertyListener
mitk::Message2< mitk::DataNode
*, const mitk::BaseRenderer * > 
NodePropertyChanged
 GUI independent message callback. More...
 
- Public Attributes inherited from niftk::DataStorageListener
mitk::Message1< mitk::DataNode * > NodeAdded
 GUI independent message callback. More...
 
mitk::Message1< mitk::DataNode * > NodeChanged
 
mitk::Message1< mitk::DataNode * > NodeRemoved
 
mitk::Message1< mitk::DataNode * > NodeDeleted
 

Detailed Description

Maintains a list of SingleViewerWidgets and coordinates visibility properties by listening to AddNodeEvent, RemoveNodeEvent and listening directly to Modified events from the nodes "visible" property in DataStorage.

The strategy is the following:

If a new data node is added to the data storage, a renderer specific visibility property is created for the render windows of each registered viewer. The initial visibility is false. At the same time, an observer is registered to listen to the change of the global visibility of the node. When the global visibility of a node changes, its visibility specific to the renderer of th selected window is turned to the same as the global visibility. Similarly in the other around, when the selected window changes, the global visibility of the data nodes is set to the same as the visibility specific to the selected window.

Note: Since this class will change the global visibility, it cannot be used together with the MITK display that does not maintain renderer specific visibilities to its render windows.

Constructor & Destructor Documentation

niftk::MultiViewerVisibilityManager::MultiViewerVisibilityManager ( mitk::DataStorage::Pointer  dataStorage)

This class must (checked with assert) have a non-NULL mitk::DataStorage so it is injected in the constructor, and we register to AddNodeEvent, RemoveNodeEvent.

niftk::MultiViewerVisibilityManager::~MultiViewerVisibilityManager ( )
virtual

Destructor, which unregisters all the listeners.

niftk::MultiViewerVisibilityManager::MultiViewerVisibilityManager ( const MultiViewerVisibilityManager )

Member Function Documentation

void niftk::MultiViewerVisibilityManager::AddNodeToViewer ( int  windowIndex,
mitk::DataNode *  node,
bool  visibility = true 
)
protectedvirtual

For a given window, effectively sets the rendering window specific visibility property for the given node to initialVisibility.

void niftk::MultiViewerVisibilityManager::ClearViewers ( std::vcl_size_t  startIndex = 0,
std::vcl_size_t  endIndex = -1 
)

Used to clear a range of windows, meaning to set renderer specific visibility properties to false for all the nodes registered in m_DataNodes. Start index inclusive, end index exclusive.

void niftk::MultiViewerVisibilityManager::DeregisterViewers ( std::vcl_size_t  startIndex = 0,
std::vcl_size_t  endIndex = -1 
)

De-registers a range of viewers, which means actually removing them from m_DataNodes and m_Viewers. Start index inclusive, end index exclusive.

bool niftk::MultiViewerVisibilityManager::GetAccumulateWhenDropped ( ) const
inline

Gets the flag deciding whether we accumulate images each time we drop.

bool niftk::MultiViewerVisibilityManager::GetAutomaticallyAddChildren ( ) const
inline

When we drop nodes onto a window, if true, we add all the children.

WindowLayout niftk::MultiViewerVisibilityManager::GetDefaultWindowLayout ( ) const
inline

Returns the default render window layout for when images are dropped into a render window.

DnDDisplayDropType niftk::MultiViewerVisibilityManager::GetDropType ( ) const
inline

Get the drop type, which controls the behaviour when multiple images are dropped into a single viewer.

DnDDisplayInterpolationType niftk::MultiViewerVisibilityManager::GetInterpolationType ( ) const
inline

Returns the default interpolation type, which takes effect when a new image is dropped.

niftk::MultiViewerVisibilityManager::mitkClassMacro ( MultiViewerVisibilityManager  ,
DataNodePropertyListener   
)
void niftk::MultiViewerVisibilityManager::OnFocusChanged ( )

Called when one of the viewers receives the focus.

void niftk::MultiViewerVisibilityManager::OnNodeAdded ( mitk::DataNode *  node)
overrideprotectedvirtual

Called when a node is added, and we set rendering window specific visibility to false for all registered windows, plus other default properties such as interpolation type.

Note: Do not manage the visibility of the crosshair planes.

TODO This should not be handled here.

Reimplemented from niftk::DataNodePropertyListener.

void niftk::MultiViewerVisibilityManager::OnNodeRemoved ( mitk::DataNode *  node)
overrideprotectedvirtual

Called when a node is added, and we set rendering window specific visibility.

Reimplemented from niftk::DataNodePropertyListener.

void niftk::MultiViewerVisibilityManager::OnNodesDropped ( std::vector< mitk::DataNode * >  nodes)
slot

When nodes are dropped, we set all the default properties, and renderer specific visibility flags etc.

void niftk::MultiViewerVisibilityManager::OnPropertyChanged ( mitk::DataNode *  node,
const mitk::BaseRenderer *  renderer 
)
overrideprotectedvirtual

Called when the property value has changed globally or for the given renderer. If the global property has changed, renderer is NULL.

Note: The renderer must be 0 because we are listening to the global visibility only.

Only one viewer can be focused at a time.

Reimplemented from niftk::DataNodePropertyListener.

MultiViewerVisibilityManager& niftk::MultiViewerVisibilityManager::operator= ( const MultiViewerVisibilityManager )
void niftk::MultiViewerVisibilityManager::RegisterViewer ( SingleViewerWidget viewer)

Each new viewer should first be registered with this class, so this class can manage renderer specific visibility properties.

We set the renderer specific visibility of the nodes that have global visibility property. (Regardless if they are visible globally or not.)

void niftk::MultiViewerVisibilityManager::RemoveNodesFromViewer ( int  windowIndex)
protectedvirtual

For a given window (denoted by its windowIndex, or index number in m_Viewers), effectively sets the rendering window specific visibility property of all nodes registered with that window to false.

void niftk::MultiViewerVisibilityManager::SetAccumulateWhenDropping ( bool  accumulate)
inline

Sets the flag deciding whether we prefer to accumulate images each time they are dropped.

void niftk::MultiViewerVisibilityManager::SetAutomaticallyAddChildren ( bool  autoAdd)
inline

When we drop nodes onto a window, if true, we add all the children.

void niftk::MultiViewerVisibilityManager::SetDefaultWindowLayout ( WindowLayout  windowLayout)
inline

Sets the default render window layout for when images are dropped into a render window.

void niftk::MultiViewerVisibilityManager::SetDropType ( DnDDisplayDropType  dropType)
inline

Set the drop type, which controls the behaviour when multiple images are dropped into a single viewer.

void niftk::MultiViewerVisibilityManager::SetInterpolationType ( DnDDisplayInterpolationType  interpolationType)
inline

Sets the default interpolation type, which takes effect when a new image is dropped.


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