Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
mitkLevelWindowManager.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkLevelWindowManager_h
14 #define mitkLevelWindowManager_h
15 
16 // mitk core
17 #include "mitkBaseProperty.h"
18 #include "mitkDataStorage.h"
20 
21 // c++
22 #include <map>
23 #include <utility>
24 
25 namespace mitk
26 {
51  class MITKCORE_EXPORT LevelWindowManager : public itk::Object
52  {
53  public:
54 
56  itkFactorylessNewMacro(Self);
57  itkCloneMacro(Self);
58 
59  void SetDataStorage(DataStorage* dataStorage);
60  DataStorage *GetDataStorage();
61 
69  void SetAutoTopMostImage(bool autoTopMost, const DataNode *removedNode = nullptr);
77  void SetSelectedImages(bool selectedImagesMode, const DataNode *removedNode = nullptr);
78 
79  void RecalculateLevelWindowForSelectedComponent(const itk::EventObject&);
85  void Update(const itk::EventObject&);
93  void UpdateSelected(const itk::EventObject&);
99  void SetLevelWindowProperty(LevelWindowProperty::Pointer levelWindowProperty);
103  void SetLevelWindow(const LevelWindow &levelWindow);
109  LevelWindowProperty::Pointer GetLevelWindowProperty() const;
115  const LevelWindow &GetLevelWindow() const;
121  bool IsAutoTopMost() const;
127  bool IsSelectedImages() const;
134  void DataStorageAddedNode(const DataNode *dataNode = nullptr);
141  void DataStorageRemovedNode(const DataNode *dataNode = nullptr);
145  void OnPropertyModified(const itk::EventObject&);
151  Image *GetCurrentImage() const;
158  int GetNumberOfObservers() const;
167  DataStorage::SetOfObjects::ConstPointer GetRelevantNodes() const;
168 
169  private:
171  ~LevelWindowManager() override;
172 
173  DataStorage::Pointer m_DataStorage;
174  LevelWindowProperty::Pointer m_LevelWindowProperty;
175 
176  typedef std::pair<unsigned long, DataNode::Pointer> PropDataPair;
177  typedef std::map<PropDataPair, BaseProperty::Pointer> ObserverToPropertyValueMap;
178 
179  ObserverToPropertyValueMap m_ObserverToVisibleProperty;
180  ObserverToPropertyValueMap m_ObserverToLayerProperty;
181  ObserverToPropertyValueMap m_ObserverToRenderingModeProperty;
182  ObserverToPropertyValueMap m_ObserverToDisplayedComponentProperty;
183  ObserverToPropertyValueMap m_ObserverToLevelWindowImageProperty;
184  ObserverToPropertyValueMap m_ObserverToSelectedProperty;
185 
186  void UpdateObservers();
187  void ClearPropertyObserverMaps();
188  void CreatePropertyObserverMaps();
189 
190  bool HasLevelWindowRenderingMode(DataNode *dataNode) const;
191 
192  // This variable holds a data node which will be deleted from the datastorage immediately.
193  const DataNode *m_NodeMarkedToDelete;
194 
195  bool m_AutoTopMost;
196  bool m_SelectedImagesMode;
197  unsigned long m_PropertyModifiedTag;
198  Image *m_CurrentImage;
199  std::vector<DataNode::Pointer> m_DataNodesForLevelWindow;
200  bool m_IsPropertyModifiedTagSet;
201  bool m_LevelWindowMutex;
202  };
203 }
204 
205 #endif
mitkDataStorage.h
mitk::Image
Image class for storing images.
Definition: mitkImage.h:69
itk::SmartPointer< Self >
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk::LevelWindowManager
Provides access to the LevelWindowProperty object and LevelWindow of the "current" image.
Definition: mitkLevelWindowManager.h:51
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::LevelWindow
The LevelWindow class Class to store level/window values.
Definition: mitkLevelWindow.h:45
mitk::DataStorage
Data management class that handles 'was created by' relations.
Definition: mitkDataStorage.h:43
mitkLevelWindowProperty.h
mitkBaseProperty.h
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63