Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef ANATOMICALSTRUCTURECOLORPRESETS_H_HEADER
18 #define ANATOMICALSTRUCTURECOLORPRESETS_H_HEADER
19 
20 #include <vtkXMLParser.h>
21 #include <MitkCoreExports.h>
22 #include <mitkColorProperty.h>
23 #include <map>
24 #include <string>
25 
26 namespace mitk {
27 
29 {
30 public:
31  struct Category
32  {
33  std::string codeValue;
34  std::string codeScheme;
35  std::string codeName;
36  Category() = default;
37  Category(std::string value, std::string scheme, std::string name) : codeValue(value), codeScheme(scheme), codeName(name){}
38  };
39 
40  struct Type
41  {
42  struct Modifier
43  {
44  std::string codeValue;
45  std::string codeScheme;
46  std::string codeName;
47  Modifier() = default;
48  Modifier(std::string value, std::string scheme, std::string name) : codeValue(value), codeScheme(scheme), codeName(name){}
49  };
50  std::string codeValue;
51  std::string codeScheme;
52  std::string codeName;
54  Type() = default;
55  Type(std::string value, std::string scheme, std::string name) : codeValue(value), codeScheme(scheme), codeName(name){}
56  };
57 
59  vtkTypeMacro(AnatomicalStructureColorPresets,vtkXMLParser);
60 
61  bool LoadPreset();
62  bool LoadPreset(const std::string& fileName);
63  Category GetCategory(const std::string& name);
64  Type GetType(const std::string& name);
65  Color GetColor(const std::string& name);
66  std::map<std::string, Category> const GetCategoryPresets();
67  std::map<std::string, Type> const GetTypePresets();
68  std::map<std::string, Color> const GetColorPresets();
69  void NewPresets(std::map<std::string, Category>& newCategory, std::map<std::string, Type>& newType, std::map<std::string, Color>& newColor);
70 
71 protected:
74 
75 private:
76  //##Documentation
77  //## @brief method used in XLM-Reading; gets called when a start-tag is read
78  void StartElement (const char *elementName, const char **atts) override;
79 
80  void Save();
81 
82  //##Documentation
83  //## @brief reads an XML-String-Attribute
84  std::string ReadXMLStringAttribute(const std::string& name, const char **atts);
85 
86  static const std::string PRESET;
87  static const std::string CATEGORY;
88  static const std::string TYPE;
89  static const std::string MODIFIER;
90  static const std::string COLOR;
91  static const std::string CODE_VALUE;
92  static const std::string CODE_SCHEME;
93  static const std::string CODE_NAME;
94 
95  static const std::string COLOR_R;
96  static const std::string COLOR_G;
97  static const std::string COLOR_B;
98 
99  std::string m_presetName;
100  std::map<std::string, Category> m_Category;
101  std::map<std::string, Type> m_Type;
102  std::map<std::string, Color> m_Color;
103  std::string m_XmlFileName;
104 };
105 }
106 #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)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.