Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
mitkContourModelWriter.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 mitkContourModelWriter_h
14 #define mitkContourModelWriter_h
15 
16 #include <mitkAbstractFileWriter.h>
17 #include <mitkContourModel.h>
18 
19 // DEPRECATED
20 #include <mitkTimeGeometry.h>
21 
22 namespace mitk
23 {
57  {
58  public:
59  explicit ContourModelWriter(bool writeXMLHeader = true);
60  ~ContourModelWriter() override;
61 
63  void Write() override;
64 
65  protected:
67 
68  mitk::ContourModelWriter *Clone() const override;
69 
77  template <typename T>
78  std::string ConvertToString(T value);
79 
86  void WriteXML(const mitk::ContourModel *contourModel, std::ostream &out);
87 
94  void WriteGeometryInformation(const mitk::TimeGeometry *geometry, std::ostream &out);
95 
100  void WriteXMLHeader(std::ostream &file);
101 
103  void WriteStartElement(const char *const tag, std::ostream &file);
104 
105  void WriteStartElementWithAttribut(const char *const tag,
106  std::vector<std::string> attributes,
107  std::vector<std::string> values,
108  std::ostream &file);
109 
114  void WriteEndElement(const char *const tag, std::ostream &file, const bool &indent = true);
115 
117  void WriteCharacterData(const char *const data, std::ostream &file);
118 
120  void WriteStartElement(std::string &tag, std::ostream &file);
121 
123  void WriteEndElement(std::string &tag, std::ostream &file, const bool &indent = true);
124 
126  void WriteCharacterData(std::string &data, std::ostream &file);
127 
129  void WriteIndent(std::ostream &file);
130 
132 
133  unsigned int m_IndentDepth;
134 
135  unsigned int m_Indent;
136 
137  public:
138  static const char *XML_CONTOURMODEL;
139 
140  static const char *XML_HEAD;
141 
142  static const char *XML_GEOMETRY_INFO;
143 
144  static const char *XML_DATA;
145 
146  static const char *XML_TIME_STEP;
147 
148  static const char *XML_CONTROL_POINTS;
149 
150  static const char *XML_POINT;
151 
152  static const char *XML_X;
153 
154  static const char *XML_Y;
155 
156  static const char *XML_Z;
157  };
158 }
159 
160 #endif
Base class for writing mitk::BaseData objects to files or streams.
void Write() override=0
Write the base data to the specified location or output stream.
XML-based writer for mitk::ContourModels.
ContourModelWriter(bool writeXMLHeader=true)
void WriteIndent(std::ostream &file)
static const char * XML_CONTROL_POINTS
void WriteStartElement(const char *const tag, std::ostream &file)
void WriteStartElement(std::string &tag, std::ostream &file)
void WriteCharacterData(const char *const data, std::ostream &file)
void WriteCharacterData(std::string &data, std::ostream &file)
void WriteStartElementWithAttribut(const char *const tag, std::vector< std::string > attributes, std::vector< std::string > values, std::ostream &file)
static const char * XML_TIME_STEP
ContourModelWriter(const ContourModelWriter &other)
void WriteGeometryInformation(const mitk::TimeGeometry *geometry, std::ostream &out)
void Write() override
Write the base data to the specified location or output stream.
void WriteEndElement(std::string &tag, std::ostream &file, const bool &indent=true)
void WriteXMLHeader(std::ostream &file)
static const char * XML_CONTOURMODEL
~ContourModelWriter() override
std::string ConvertToString(T value)
void WriteEndElement(const char *const tag, std::ostream &file, const bool &indent=true)
static const char * XML_GEOMETRY_INFO
mitk::ContourModelWriter * Clone() const override
void WriteXML(const mitk::ContourModel *contourModel, std::ostream &out)
ContourModel is a structure of linked vertices defining a contour in 3D space. The vertices are store...
Find image slices visible on a given plane.