Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkAnatomicalStructureColorPresets.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 mitkAnatomicalStructureColorPresets_h
14 #define mitkAnatomicalStructureColorPresets_h
15 
16 #include <vtkXMLParser.h>
17 #include <MitkCoreExports.h>
18 #include <mitkColorProperty.h>
19 #include <map>
20 #include <string>
21 
22 namespace mitk {
23 
33 {
34 public:
36  struct Category
37  {
38  std::string codeValue;
39  std::string codeScheme;
40  std::string codeName;
41  Category() = default;
42  Category(std::string value, std::string scheme, std::string name) : codeValue(value), codeScheme(scheme), codeName(name){}
43  };
44 
46  struct Type
47  {
49  struct Modifier
50  {
51  std::string codeValue;
52  std::string codeScheme;
53  std::string codeName;
54  Modifier() = default;
55  Modifier(std::string value, std::string scheme, std::string name) : codeValue(value), codeScheme(scheme), codeName(name){}
56  };
57  std::string codeValue;
58  std::string codeScheme;
59  std::string codeName;
61  Type() = default;
62  Type(std::string value, std::string scheme, std::string name) : codeValue(value), codeScheme(scheme), codeName(name){}
63  };
64 
67 
71  bool LoadPreset();
72 
77  bool LoadPreset(const std::string& fileName);
78 
83  Category GetCategory(const std::string& name);
84 
89  Type GetType(const std::string& name);
90 
95  Color GetColor(const std::string& name);
96 
100  std::map<std::string, Category> const GetCategoryPresets();
101 
105  std::map<std::string, Type> const GetTypePresets();
106 
110  std::map<std::string, Color> const GetColorPresets();
111 
117  void NewPresets(std::map<std::string, Category>& newCategory, std::map<std::string, Type>& newType, std::map<std::string, Color>& newColor);
118 
119 protected:
123  ~AnatomicalStructureColorPresets() override = default;
124 
125 private:
127  void StartElement (const char *elementName, const char **atts) override;
128 
130  void Save();
131 
137  std::string ReadXMLStringAttribute(const std::string& name, const char **atts);
138 
139  static const std::string PRESET;
140  static const std::string CATEGORY;
141  static const std::string TYPE;
142  static const std::string MODIFIER;
143  static const std::string COLOR;
144  static const std::string CODE_VALUE;
145  static const std::string CODE_SCHEME;
146  static const std::string CODE_NAME;
147 
148  static const std::string COLOR_R;
149  static const std::string COLOR_G;
150  static const std::string COLOR_B;
151 
152  std::string m_presetName;
153  std::map<std::string, Category> m_Category;
154  std::map<std::string, Type> m_Type;
155  std::map<std::string, Color> m_Color;
156  std::string m_XmlFileName;
157 };
158 }
159 #endif
#define MITKCORE_EXPORT
Provides anatomical structure color presets loaded from XML.
vtkTypeMacro(AnatomicalStructureColorPresets, vtkXMLParser)
AnatomicalStructureColorPresets()=default
Default constructor.
Category GetCategory(const std::string &name)
Get the category for the given preset name.
Color GetColor(const std::string &name)
Get the color for the given preset name.
Type GetType(const std::string &name)
Get the type for the given preset name.
bool LoadPreset(const std::string &fileName)
Load presets from the specified XML file.
static AnatomicalStructureColorPresets * New()
~AnatomicalStructureColorPresets() override=default
Destructor.
std::map< std::string, Category > const GetCategoryPresets()
Get all category presets.
std::map< std::string, Color > const GetColorPresets()
Get all color presets.
bool LoadPreset()
Load the default presets from the module resource XML file.
std::map< std::string, Type > const GetTypePresets()
Get all type presets.
void NewPresets(std::map< std::string, Category > &newCategory, std::map< std::string, Type > &newType, std::map< std::string, Color > &newColor)
Replace all presets with new ones and save.
Find image slices visible on a given plane.
itk::RGBPixel< float > Color
Standard RGB color typedef using float components.
Represents a DICOM coding scheme category entry.
Category(std::string value, std::string scheme, std::string name)
Represents a DICOM coding scheme modifier for a type.
Modifier(std::string value, std::string scheme, std::string name)
Represents a DICOM coding scheme type entry with an optional modifier.
Type(std::string value, std::string scheme, std::string name)