NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Public Member Functions | Protected Member Functions | List of all members
niftk::DataNodeVisibilityTracker Class Reference
Inheritance diagram for niftk::DataNodeVisibilityTracker:
Inheritance graph
[legend]
Collaboration diagram for niftk::DataNodeVisibilityTracker:
Collaboration graph
[legend]

Public Member Functions

 mitkClassMacro (DataNodeVisibilityTracker, DataNodePropertyListener) mitkNewMacro1Param(DataNodeVisibilityTracker
 
const
mitk::DataStorage::Pointer
void 
SetTrackedRenderer (const mitk::BaseRenderer *trackedRenderer)
 Sets the renderer we are tracking. More...
 
void SetManagedRenderers (const std::vector< const mitk::BaseRenderer * > &managedRenderers)
 Sets the list of renderers to propagate visibility properties onto. More...
 
void SetNodesToIgnore (const std::vector< mitk::DataNode * > &nodesToIgnore)
 Sets the list of nodes that whose visibility should not be tracked. We provide facility to ignore nodes, and not adjust their visibility, which is useful for cross hairs. More...
 
bool IsIgnored (mitk::DataNode *node)
 Tells if a node is ignored, i.e its visibility is not tracked. 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

 DataNodeVisibilityTracker (const mitk::DataStorage::Pointer dataStorage)
 
virtual ~DataNodeVisibilityTracker ()
 
 DataNodeVisibilityTracker (const DataNodeVisibilityTracker &)
 
DataNodeVisibilityTrackeroperator= (const DataNodeVisibilityTracker &)
 
virtual void OnNodeAdded (mitk::DataNode *node) override
 
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...
 
- 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 OnNodeRemoved (mitk::DataNode *node) override
 Called when a node is removed from the data storage. Notifies the observers for the node then removes them. More...
 
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
 

Constructor & Destructor Documentation

niftk::DataNodeVisibilityTracker::DataNodeVisibilityTracker ( const mitk::DataStorage::Pointer  dataStorage)
protected
niftk::DataNodeVisibilityTracker::~DataNodeVisibilityTracker ( )
protectedvirtual
niftk::DataNodeVisibilityTracker::DataNodeVisibilityTracker ( const DataNodeVisibilityTracker )
protected

Member Function Documentation

bool niftk::DataNodeVisibilityTracker::IsIgnored ( mitk::DataNode *  node)

Tells if a node is ignored, i.e its visibility is not tracked.

niftk::DataNodeVisibilityTracker::mitkClassMacro ( DataNodeVisibilityTracker  ,
DataNodePropertyListener   
)
void niftk::DataNodeVisibilityTracker::OnNodeAdded ( mitk::DataNode *  node)
overrideprotectedvirtual
See also
DataStorageListener::NodeAdded

TODO The const_cast is needed because of the MITK bug 17778. It should be removed after the bug is fixed.

Note: GetProperty() returns the global property if there is no renderer specific one. If there is no renderer specific property then we create one and set to the same visibility as in the tracked renderer. Otherwise, we leave it as it is.

TODO The const_cast is needed because of the MITK bug 17778. It should be removed after the bug is fixed.

Register the observers so that OnPropertyChanged is called when the visibility changes.

Reimplemented from niftk::DataNodePropertyListener.

void niftk::DataNodeVisibilityTracker::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.

We do not have anything to do if:

  • the data storage has not been initialised
  • there is no tracked or managed renderer
  • the node is added to the ignore list
  • a renderer specific visibility has changed for a different renderer than which we track.

TODO The const_cast is needed because of the MITK bug 17778. It should be removed after the bug is fixed.

TODO The const_cast is needed because of the MITK bug 17778. It should be removed after the bug is fixed.

Reimplemented from niftk::DataNodePropertyListener.

DataNodeVisibilityTracker& niftk::DataNodeVisibilityTracker::operator= ( const DataNodeVisibilityTracker )
protected
void niftk::DataNodeVisibilityTracker::SetManagedRenderers ( const std::vector< const mitk::BaseRenderer * > &  managedRenderers)

Sets the list of renderers to propagate visibility properties onto.

Note: We must not manage a renderer that we track, otherwise infinite recursion occurs.

void niftk::DataNodeVisibilityTracker::SetNodesToIgnore ( const std::vector< mitk::DataNode * > &  nodesToIgnore)

Sets the list of nodes that whose visibility should not be tracked. We provide facility to ignore nodes, and not adjust their visibility, which is useful for cross hairs.

void niftk::DataNodeVisibilityTracker::SetTrackedRenderer ( const mitk::BaseRenderer *  trackedRenderer)

Sets the renderer we are tracking.

Note: We must not manage a renderer that we track, otherwise infinite recursion occurs.

Note: Deliberately not checking if the new renderer to track is the same as the old one. This function can be used to reinitialise the visibility of every node.

TODO The const_cast is needed because of the MITK bug 17778. It should be removed after the bug is fixed.

TODO The const_cast is needed because of the MITK bug 17778. It should be removed after the bug is fixed.


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