Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
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 
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
mitk::AnatomicalStructureColorPresets::Category::codeName
std::string codeName
Definition: mitkAnatomicalStructureColorPresets.h:31
mitk::AnatomicalStructureColorPresets::Type::Modifier::codeScheme
std::string codeScheme
Definition: mitkAnatomicalStructureColorPresets.h:41
mitk::AnatomicalStructureColorPresets::Type::Modifier::codeValue
std::string codeValue
Definition: mitkAnatomicalStructureColorPresets.h:40
mitk::Color
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
Definition: mitkColorProperty.h:38
mitk::AnatomicalStructureColorPresets::Type::modifier
Modifier modifier
Definition: mitkAnatomicalStructureColorPresets.h:49
mitk::AnatomicalStructureColorPresets::Category::codeValue
std::string codeValue
Definition: mitkAnatomicalStructureColorPresets.h:29
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::AnatomicalStructureColorPresets::Category
Definition: mitkAnatomicalStructureColorPresets.h:27
mitk::AnatomicalStructureColorPresets::Type::codeValue
std::string codeValue
Definition: mitkAnatomicalStructureColorPresets.h:46
MitkCoreExports.h
mitk::AnatomicalStructureColorPresets::Type::Modifier::Modifier
Modifier(std::string value, std::string scheme, std::string name)
Definition: mitkAnatomicalStructureColorPresets.h:44
mitk::AnatomicalStructureColorPresets::Type::codeScheme
std::string codeScheme
Definition: mitkAnatomicalStructureColorPresets.h:47
mitk::AnatomicalStructureColorPresets::Type::Modifier::codeName
std::string codeName
Definition: mitkAnatomicalStructureColorPresets.h:42
mitk::AnatomicalStructureColorPresets::Category::Category
Category(std::string value, std::string scheme, std::string name)
Definition: mitkAnatomicalStructureColorPresets.h:33
mitk::AnatomicalStructureColorPresets::Type::codeName
std::string codeName
Definition: mitkAnatomicalStructureColorPresets.h:48
mitkColorProperty.h
mitk::AnatomicalStructureColorPresets::Type::Modifier
Definition: mitkAnatomicalStructureColorPresets.h:38
mitk::AnatomicalStructureColorPresets::Category::codeScheme
std::string codeScheme
Definition: mitkAnatomicalStructureColorPresets.h:30
mitk::AnatomicalStructureColorPresets::Type
Definition: mitkAnatomicalStructureColorPresets.h:36
mitk::AnatomicalStructureColorPresets
Definition: mitkAnatomicalStructureColorPresets.h:24
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::AnatomicalStructureColorPresets::Type::Type
Type(std::string value, std::string scheme, std::string name)
Definition: mitkAnatomicalStructureColorPresets.h:51