Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkParamapPresetsParser.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 mitkParamapPresetsParser_h
14 #define mitkParamapPresetsParser_h
15 
16 #include <MitkDICOMPMExports.h>
17 #include <vtkXMLParser.h>
18 #include <map>
19 #include <string>
20 #include <vtkSetGet.h>
21 
22 
23 
24 namespace mitk {
25 
38 class MITKDICOMPM_EXPORT ParamapPresetsParser : public vtkXMLParser
39 {
40 public:
44  struct Type
45  {
46  std::string codeValue;
47  std::string codeScheme;
48  Type() = default;
49 
56  Type(std::string value, std::string scheme) : codeValue(value), codeScheme(scheme){}
57  };
58 
60  using ParamapPrestsType = std::map<std::string, Type>;
61 
65 
73  bool LoadPreset();
74 
82  bool LoadPreset(const std::string& fileName);
83 
91  Type GetType(const std::string& name);
92 
99 
105  void NewPresets(ParamapPrestsType & newType);
106 
107 
108 protected:
109  ParamapPresetsParser() = default;
110  ~ParamapPresetsParser() override = default;
111 
112 private:
113  //##Documentation
114  //## @brief method used in XLM-Reading; gets called when a start-tag is read
115  void StartElement (const char *elementName, const char **atts) override;
116 
117 
118  //##Documentation
119  //## @brief reads an XML-String-Attribute
120  std::string ReadXMLStringAttribute(const std::string& name, const char **atts);
121 
122  static const std::string PRESET;
123  static const std::string TYPE;
124  static const std::string CODE_VALUE;
125  static const std::string CODE_SCHEME;
126 
127  std::string m_presetName;
128  ParamapPrestsType m_Type;
129  std::string m_XmlFileName;
130 };
131 }
132 #endif
#define MITKDICOMPM_EXPORT
Parser for DICOM Parametric Map (PM) preset definitions stored in XML format.
bool LoadPreset(const std::string &fileName)
Load presets from a custom XML file.
bool LoadPreset()
Load presets from the default module resource file.
ParamapPrestsType const GetTypePresets()
Get all currently loaded type presets.
~ParamapPresetsParser() override=default
Type GetType(const std::string &name)
Retrieve the type definition for a given preset name.
static ParamapPresetsParser * New()
VTK-style factory method.
void NewPresets(ParamapPrestsType &newType)
Replace all current presets with a new set.
std::map< std::string, Type > ParamapPrestsType
Map type associating preset names to their Type definitions.
vtkTypeMacro(ParamapPresetsParser, vtkXMLParser)
Find image slices visible on a given plane.
Represents a single parametric map type preset with a coded value and coding scheme.
std::string codeValue
Coded value identifying the parametric map type.
Type(std::string value, std::string scheme)
Construct a Type with a given coded value and coding scheme.
std::string codeScheme
Coding scheme designator (e.g., "DCM").