Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::LevelWindowManager Class Reference

Provides access to the LevelWindowProperty object and LevelWindow of the "current" image. More...

#include <mitkLevelWindowManager.h>

Inheritance diagram for mitk::LevelWindowManager:
Collaboration diagram for mitk::LevelWindowManager:

Public Types

typedef LevelWindowManager Self
 
typedef itk::Object Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 

Public Member Functions

virtual std::vector< std::string > GetClassHierarchy () const
 
virtual const char * GetClassName () const
 
Pointer Clone () const
 
void SetDataStorage (DataStorage *ds)
 
DataStorageGetDataStorage ()
 returns the datastorage More...
 
void SetAutoTopMostImage (bool autoTopMost, const DataNode *removedNode=nullptr)
 (Re-)Initializes the LevelWindowManager by setting the topmost image. Use the removedNode parameter if a node was removed... More...
 
void RecaluclateLevelWindowForSelectedComponent (const itk::EventObject &)
 
void Update (const itk::EventObject &e)
 gets called if a visible property changes More...
 
void SetLevelWindowProperty (LevelWindowProperty::Pointer levelWindowProperty)
 Sets an specific LevelWindowProperty, all changes will affect the image belonging to this property. More...
 
void SetLevelWindow (const LevelWindow &levelWindow)
 Sets new Level/Window values and informs all listeners about changes. More...
 
const LevelWindowGetLevelWindow ()
 
LevelWindowProperty::Pointer GetLevelWindowProperty ()
 
bool isAutoTopMost ()
 
void DataStorageAddedNode (const DataNode *n=nullptr)
 This method is called when a node is added to the data storage. A listener on the data storage is used to call this method automatically after a node was added. More...
 
void DataStorageRemovedNode (const DataNode *removedNode=nullptr)
 This method is called when a node is removed to the data storage. A listener on the data storage is used to call this method automatically directly before a node will be removed. More...
 
void OnPropertyModified (const itk::EventObject &e)
 change notifications from mitkLevelWindowProperty More...
 
ImageGetCurrentImage ()
 return the currently active image More...
 
int GetNumberOfObservers ()
 
DataStorage::SetOfObjects::ConstPointer GetRelevantNodes ()
 

Static Public Member Functions

static const char * GetStaticNameOfClass ()
 
static Pointer New ()
 

Protected Types

typedef std::pair< unsigned long, DataNode::PointerPropDataPair
 
typedef std::map< PropDataPair, BaseProperty::PointerObserverToPropertyMap
 

Protected Member Functions

 LevelWindowManager ()
 
 ~LevelWindowManager ()
 
void UpdateObservers ()
 
void ClearPropObserverLists ()
 internal help method to clear both lists/maps. More...
 
void CreatePropObserverLists ()
 internal help method to create both lists/maps. More...
 

Protected Attributes

DataStorage::Pointer m_DataStorage
 
LevelWindowProperty::Pointer m_LevelWindowProperty
 pointer to the LevelWindowProperty of the current image More...
 
ObserverToPropertyMap m_PropObserverToNode
 map to hold observer IDs to every visible property of DataNode�s BaseProperty More...
 
ObserverToPropertyMap m_PropObserverToNode2
 map to hold observer IDs to every layer property of DataNode�s BaseProperty More...
 
ObserverToPropertyMap m_PropObserverToNode3
 
ObserverToPropertyMap m_PropObserverToNode4
 
ObserverToPropertyMap m_PropObserverToNode5
 
const mitk::DataNodem_NodeMarkedToDelete
 
bool m_AutoTopMost
 
unsigned long m_ObserverTag
 
bool m_IsObserverTagSet
 
unsigned long m_PropertyModifiedTag
 
Imagem_CurrentImage
 
bool m_IsPropertyModifiedTagSet
 
bool m_SettingImgForLvlWinProp
 

Detailed Description

Provides access to the LevelWindowProperty object and LevelWindow of the "current" image.

  • provides a LevelWindowProperty for purposes like GUI editors
  • this property comes from one of two possible sources
    • either something (e.g. the application) sets the property because of some user selection
    • OR the "Auto top-most" logic is used to search a DataStorage for the image with the highest "layer" property value

Changes on Level/Window can be set with SetLevelWindow() and will affect either the topmost layer image, if isAutoTopMost() returns true, or an image which is set by SetLevelWindowProperty(LevelWindowProperty::Pointer levelWindowProperty).

Changes to Level/Window, when another image gets active or by SetLevelWindow(const LevelWindow& levelWindow), will be sent to all listeners by Modified().

DataStorageChanged() listens to the DataStorage for new or removed images. Depending on how m_AutoTopMost is set, the new image becomes active or not. If an image is removed from the DataStorage and m_AutoTopMost is false, there is a check to proof, if the active image is still available. If not, then m_AutoTopMost becomes true.

Note that this class is not thread safe at the moment!

Definition at line 51 of file mitkLevelWindowManager.h.

Member Typedef Documentation

typedef std::pair<unsigned long, DataNode::Pointer> mitk::LevelWindowManager::PropDataPair
protected

Definition at line 129 of file mitkLevelWindowManager.h.

Definition at line 54 of file mitkLevelWindowManager.h.

Constructor & Destructor Documentation

mitk::LevelWindowManager::LevelWindowManager ( )
protected

Definition at line 31 of file mitkLevelWindowManager.cpp.

mitk::LevelWindowManager::~LevelWindowManager ( )
protected

Member Function Documentation

void mitk::LevelWindowManager::ClearPropObserverLists ( )
protected

internal help method to clear both lists/maps.

Definition at line 517 of file mitkLevelWindowManager.cpp.

Pointer mitk::LevelWindowManager::Clone ( ) const
void mitk::LevelWindowManager::CreatePropObserverLists ( )
protected

internal help method to create both lists/maps.

Definition at line 559 of file mitkLevelWindowManager.cpp.

References m_DataStorage, mitk::New(), RecaluclateLevelWindowForSelectedComponent(), and Update().

void mitk::LevelWindowManager::DataStorageAddedNode ( const DataNode n = nullptr)

This method is called when a node is added to the data storage. A listener on the data storage is used to call this method automatically after a node was added.

Exceptions
mitk::ExceptionThrows an exception if something is wrong, e.g. if the number of observers differs from the number of nodes.

Definition at line 266 of file mitkLevelWindowManager.cpp.

References mitkThrow.

Referenced by SetDataStorage(), and ~LevelWindowManager().

void mitk::LevelWindowManager::DataStorageRemovedNode ( const DataNode removedNode = nullptr)

This method is called when a node is removed to the data storage. A listener on the data storage is used to call this method automatically directly before a node will be removed.

Exceptions
mitk::ExceptionThrows an exception if something is wrong, e.g. if the number of observers differs from the number of nodes.

Definition at line 282 of file mitkLevelWindowManager.cpp.

References m_DataStorage, mitkThrow, and mitk::NodePredicateProperty::New().

Referenced by SetDataStorage(), and ~LevelWindowManager().

virtual std::vector<std::string> mitk::LevelWindowManager::GetClassHierarchy ( ) const
inlinevirtual

Definition at line 54 of file mitkLevelWindowManager.h.

virtual const char* mitk::LevelWindowManager::GetClassName ( ) const
virtual
mitk::Image * mitk::LevelWindowManager::GetCurrentImage ( )
mitk::DataStorage * mitk::LevelWindowManager::GetDataStorage ( )

returns the datastorage

Definition at line 348 of file mitkLevelWindowManager.cpp.

References m_DataStorage.

const mitk::LevelWindow & mitk::LevelWindowManager::GetLevelWindow ( )
Returns
Returns Level/Window values for the current image.

Definition at line 244 of file mitkLevelWindowManager.cpp.

Referenced by QmitkLevelWindowWidgetContextMenu::getContextMenu().

mitk::LevelWindowProperty::Pointer mitk::LevelWindowManager::GetLevelWindowProperty ( )
Returns
Returns the current mitkLevelWindowProperty object from the image that is affected by changes.

Definition at line 238 of file mitkLevelWindowManager.cpp.

Referenced by QmitkLevelWindowWidgetContextMenu::getContextMenu().

int mitk::LevelWindowManager::GetNumberOfObservers ( )
Returns
Returns the current number of observers which are registered in this object.
Exceptions
mitk::ExceptionThrows an exception if the number of observers differs from the number of relevant objects which means that something is wrong.

Definition at line 343 of file mitkLevelWindowManager.cpp.

mitk::DataStorage::SetOfObjects::ConstPointer mitk::LevelWindowManager::GetRelevantNodes ( )

returns all nodes in the DataStorage that have the following properties: "visible" == true, "binary" == false, "levelwindow", and DataType == Image

Definition at line 483 of file mitkLevelWindowManager.cpp.

References m_DataStorage, mitk::BoolProperty::New(), mitk::NodePredicateOr::New(), mitk::NodePredicateAnd::New(), mitk::NodePredicateDataType::New(), mitk::NodePredicateProperty::New(), and mitk::New().

Referenced by QmitkLevelWindowWidgetContextMenu::getContextMenu().

static const char* mitk::LevelWindowManager::GetStaticNameOfClass ( )
inlinestatic

Definition at line 54 of file mitkLevelWindowManager.h.

bool mitk::LevelWindowManager::isAutoTopMost ( )
Returns
true if changes on slider or line-edits will affect always the topmost layer image.

Definition at line 354 of file mitkLevelWindowManager.cpp.

Referenced by QmitkLevelWindowWidgetContextMenu::getContextMenu(), and QmitkLevelWindowWidgetContextMenu::setImage().

void mitk::LevelWindowManager::OnPropertyModified ( const itk::EventObject &  e)

change notifications from mitkLevelWindowProperty

Definition at line 87 of file mitkLevelWindowManager.cpp.

Referenced by SetLevelWindowProperty().

void mitk::LevelWindowManager::RecaluclateLevelWindowForSelectedComponent ( const itk::EventObject &  event)

Definition at line 359 of file mitkLevelWindowManager.cpp.

References mitk::LevelWindow::SetAuto(), and Update().

Referenced by CreatePropObserverLists().

void mitk::LevelWindowManager::SetAutoTopMostImage ( bool  autoTopMost,
const DataNode removedNode = nullptr 
)

(Re-)Initializes the LevelWindowManager by setting the topmost image. Use the removedNode parameter if a node was removed...

Parameters
autoTopMosttrue: sets the topmost layer image to be affected by changes
removedNode!= NULL a node was removed from DataStorage

Definition at line 92 of file mitkLevelWindowManager.cpp.

References mitk::RenderingModeProperty::COLORTRANSFERFUNCTION_COLOR, mitk::RenderingModeProperty::LOOKUPTABLE_COLOR, m_DataStorage, and min().

Referenced by QmitkLevelWindowWidgetContextMenu::setImage().

void mitk::LevelWindowManager::SetDataStorage ( mitk::DataStorage ds)
void mitk::LevelWindowManager::SetLevelWindowProperty ( LevelWindowProperty::Pointer  levelWindowProperty)

Sets an specific LevelWindowProperty, all changes will affect the image belonging to this property.

Exceptions
mitk::ExceptionThrows an exception if the there is no image in the data storage which belongs to this property.

Definition at line 180 of file mitkLevelWindowManager.cpp.

References m_DataStorage, mitkThrow, mitk::New(), and OnPropertyModified().

Referenced by QmitkLevelWindowWidgetContextMenu::setImage().

void mitk::LevelWindowManager::Update ( const itk::EventObject &  e)

gets called if a visible property changes

Definition at line 392 of file mitkLevelWindowManager.cpp.

References min(), and MITK_ERROR.

Referenced by CreatePropObserverLists().

void mitk::LevelWindowManager::UpdateObservers ( )
protected

updates the internal observer list. Ignores nodes which are marked to be deleted in the variable m_NodeMarkedToDelete

Definition at line 337 of file mitkLevelWindowManager.cpp.

Member Data Documentation

bool mitk::LevelWindowManager::m_AutoTopMost
protected

Definition at line 152 of file mitkLevelWindowManager.h.

Image* mitk::LevelWindowManager::m_CurrentImage
protected

Definition at line 156 of file mitkLevelWindowManager.h.

DataStorage::Pointer mitk::LevelWindowManager::m_DataStorage
protected

Definition at line 127 of file mitkLevelWindowManager.h.

bool mitk::LevelWindowManager::m_IsObserverTagSet
protected

Definition at line 154 of file mitkLevelWindowManager.h.

bool mitk::LevelWindowManager::m_IsPropertyModifiedTagSet
protected

Definition at line 157 of file mitkLevelWindowManager.h.

LevelWindowProperty::Pointer mitk::LevelWindowManager::m_LevelWindowProperty
protected

pointer to the LevelWindowProperty of the current image

Definition at line 128 of file mitkLevelWindowManager.h.

const mitk::DataNode* mitk::LevelWindowManager::m_NodeMarkedToDelete
protected

this variable holds a data node which will be deleted from the datastorage immedeately (if there is one, NULL otherways)

Definition at line 149 of file mitkLevelWindowManager.h.

unsigned long mitk::LevelWindowManager::m_ObserverTag
protected

Definition at line 153 of file mitkLevelWindowManager.h.

unsigned long mitk::LevelWindowManager::m_PropertyModifiedTag
protected

Definition at line 155 of file mitkLevelWindowManager.h.

ObserverToPropertyMap mitk::LevelWindowManager::m_PropObserverToNode
protected

map to hold observer IDs to every visible property of DataNode�s BaseProperty

Definition at line 133 of file mitkLevelWindowManager.h.

ObserverToPropertyMap mitk::LevelWindowManager::m_PropObserverToNode2
protected

map to hold observer IDs to every layer property of DataNode�s BaseProperty

Definition at line 135 of file mitkLevelWindowManager.h.

ObserverToPropertyMap mitk::LevelWindowManager::m_PropObserverToNode3
protected

map to hold observer IDs to every Image Rendering.Mode property of DataNode�s BaseProperty

Definition at line 136 of file mitkLevelWindowManager.h.

ObserverToPropertyMap mitk::LevelWindowManager::m_PropObserverToNode4
protected

map to hold observer IDs to every Image.Displayed Component property of DataNode�s BaseProperty

Definition at line 139 of file mitkLevelWindowManager.h.

ObserverToPropertyMap mitk::LevelWindowManager::m_PropObserverToNode5
protected

map to hold observer IDs to every image for level window property of DataNode�s BaseProperty

Definition at line 142 of file mitkLevelWindowManager.h.

bool mitk::LevelWindowManager::m_SettingImgForLvlWinProp
protected

Definition at line 158 of file mitkLevelWindowManager.h.


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