00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 00019 #ifndef MITKLEVELWINDOWMANAGER_H 00020 #define MITKLEVELWINDOWMANAGER_H 00021 00022 #include <mitkDataStorage.h> 00023 #include <mitkLevelWindowProperty.h> 00024 #include <mitkBaseProperty.h> 00025 #include <map> 00026 00042 namespace mitk 00043 { 00044 class MITK_CORE_EXPORT LevelWindowManager : public itk::Object 00045 { 00046 public: 00047 00048 mitkClassMacro(LevelWindowManager, itk::Object) 00049 itkNewMacro(Self); 00050 00051 void SetDataStorage(mitk::DataStorage* ds); 00052 mitk::DataStorage* GetDataStorage(); 00053 00056 void SetAutoTopMostImage(bool autoTopMost, const mitk::DataNode* removedNode = NULL); 00057 00058 void Update(const itk::EventObject& e); 00059 00065 void SetLevelWindowProperty(LevelWindowProperty::Pointer levelWindowProperty); 00066 00068 void SetLevelWindow(const mitk::LevelWindow& levelWindow); 00069 00071 const LevelWindow& GetLevelWindow(); 00072 00074 LevelWindowProperty::Pointer GetLevelWindowProperty(); 00075 00077 bool isAutoTopMost(); 00078 00080 void DataStorageChanged(const mitk::DataNode* n = NULL); 00081 00083 void DataStorageRemovedNode(const mitk::DataNode* removedNode = NULL); 00084 00086 void OnPropertyModified(const itk::EventObject& e); 00087 00088 mitk::Image* GetCurrentImage(); 00089 00094 mitk::DataStorage::SetOfObjects::ConstPointer GetRelevantNodes(); 00095 00096 protected: 00097 LevelWindowManager(); 00098 ~LevelWindowManager(); 00099 00100 DataStorage::Pointer m_DataStorage; 00101 LevelWindowProperty::Pointer m_LevelWindowProperty; 00102 typedef std::map<unsigned long, mitk::BaseProperty::Pointer> ObserverToPropertyMap; 00103 ObserverToPropertyMap m_PropObserverToNode; 00104 ObserverToPropertyMap m_PropObserverToNode2; 00105 bool m_AutoTopMost; 00106 unsigned long m_ObserverTag; 00107 bool m_IsObserverTagSet; 00108 unsigned long m_PropertyModifiedTag; 00109 mitk::Image* m_CurrentImage; 00110 bool m_IsPropertyModifiedTagSet; 00111 }; 00112 } 00113 #endif