Medical Imaging Interaction Toolkit  2022.04.99-194dd5d8
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 ANATOMICALSTRUCTURECOLORPRESETS_H_HEADER
14 #define ANATOMICALSTRUCTURECOLORPRESETS_H_HEADER
15 
16 #include <vtkXMLParser.h>
17 #include <MitkCoreExports.h>
18 #include <mitkColorProperty.h>
19 #include <map>
20 #include <string>
21 
22 namespace mitk {
23 
25 {
26 public:
27  struct Category
28  {
29  std::string codeValue;
30  std::string codeScheme;
31  std::string codeName;
32  Category() = default;
33  Category(std::string value, std::string scheme, std::string name) : codeValue(value), codeScheme(scheme), codeName(name){}
34  };
35 
36  struct Type
37  {
38  struct Modifier
39  {
40  std::string codeValue;
41  std::string codeScheme;
42  std::string codeName;
43  Modifier() = default;
44  Modifier(std::string value, std::string scheme, std::string name) : codeValue(value), codeScheme(scheme), codeName(name){}
45  };
46  std::string codeValue;
47  std::string codeScheme;
48  std::string codeName;
50  Type() = default;
51  Type(std::string value, std::string scheme, std::string name) : codeValue(value), codeScheme(scheme), codeName(name){}
52  };
53 
54  static AnatomicalStructureColorPresets *New();
55  vtkTypeMacro(AnatomicalStructureColorPresets,vtkXMLParser);
56 
57  bool LoadPreset();
58  bool LoadPreset(const std::string& fileName);
59  Category GetCategory(const std::string& name);
60  Type GetType(const std::string& name);
61  Color GetColor(const std::string& name);
62  std::map<std::string, Category> const GetCategoryPresets();
63  std::map<std::string, Type> const GetTypePresets();
64  std::map<std::string, Color> const GetColorPresets();
65  void NewPresets(std::map<std::string, Category>& newCategory, std::map<std::string, Type>& newType, std::map<std::string, Color>& newColor);
66 
67 protected:
69  ~AnatomicalStructureColorPresets() override = default;
70 
71 private:
72  //##Documentation
73  //## @brief method used in XLM-Reading; gets called when a start-tag is read
74  void StartElement (const char *elementName, const char **atts) override;
75 
76  void Save();
77 
78  //##Documentation
79  //## @brief reads an XML-String-Attribute
80  std::string ReadXMLStringAttribute(const std::string& name, const char **atts);
81 
82  static const std::string PRESET;
83  static const std::string CATEGORY;
84  static const std::string TYPE;
85  static const std::string MODIFIER;
86  static const std::string COLOR;
87  static const std::string CODE_VALUE;
88  static const std::string CODE_SCHEME;
89  static const std::string CODE_NAME;
90 
91  static const std::string COLOR_R;
92  static const std::string COLOR_G;
93  static const std::string COLOR_B;
94 
95  std::string m_presetName;
96  std::map<std::string, Category> m_Category;
97  std::map<std::string, Type> m_Type;
98  std::map<std::string, Color> m_Color;
99  std::string m_XmlFileName;
100 };
101 }
102 #endif
#define MITKCORE_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
Type(std::string value, std::string scheme, std::string name)
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
Modifier(std::string value, std::string scheme, std::string name)
Category(std::string value, std::string scheme, std::string name)