Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkLevelWindowPreset.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 mitkLevelWindowPreset_h
14 #define mitkLevelWindowPreset_h
15 
16 #include <MitkCoreExports.h>
17 #include <map>
18 #include <string>
19 #include <vtkXMLParser.h>
20 
21 namespace mitk
22 {
29  class MITKCORE_EXPORT LevelWindowPreset : public vtkXMLParser
30  {
31  public:
34 
38  bool LoadPreset();
39 
44  bool LoadPreset(std::string fileName);
45 
50  double getLevel(std::string name);
51 
56  double getWindow(std::string window);
57 
61  std::map<std::string, double> &getLevelPresets();
62 
66  std::map<std::string, double> &getWindowPresets();
67 
72  void newPresets(std::map<std::string, double> newLevel, std::map<std::string, double> newWindow);
73 
74  protected:
76  ~LevelWindowPreset() override;
77 
78  private:
80  void StartElement(const char *elementName, const char **atts) override;
81 
83  void save();
84 
90  std::string ReadXMLStringAttribut(std::string name, const char **atts);
91 
92  static const std::string PRESET;
93  std::map<std::string, double> m_Level;
94  std::map<std::string, double> m_Window;
95  std::string m_XmlFileName;
96  };
97 }
98 #endif
#define MITKCORE_EXPORT
Manages level/window presets loaded from an XML file.
vtkTypeMacro(LevelWindowPreset, vtkXMLParser)
bool LoadPreset(std::string fileName)
Load presets from a specified XML file.
double getLevel(std::string name)
Get the level value for a named preset.
double getWindow(std::string window)
Get the window value for a named preset.
void newPresets(std::map< std::string, double > newLevel, std::map< std::string, double > newWindow)
Replace all presets with new level and window maps and save.
static LevelWindowPreset * New()
std::map< std::string, double > & getWindowPresets()
Get a reference to the map of all window presets.
bool LoadPreset()
Load presets from the default module resource file.
~LevelWindowPreset() override
std::map< std::string, double > & getLevelPresets()
Get a reference to the map of all level presets.
Find image slices visible on a given plane.