Medical Imaging Interaction Toolkit  2026.06.00
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 #include <mitkTimeGeometry.h>
19 
20 namespace mitk
21 {
55  {
56  public:
61  explicit ContourModelWriter(bool writeXMLHeader = true);
62  ~ContourModelWriter() override;
63 
65 
67  void Write() override;
68 
69  protected:
71 
72  mitk::ContourModelWriter *Clone() const override;
73 
84  template <typename T>
85  std::string ConvertToString(T value);
86 
95  void WriteXML(const mitk::ContourModel *contourModel, std::ostream &out);
96 
105  void WriteGeometryInformation(const mitk::TimeGeometry *geometry, std::ostream &out);
106 
111  void WriteXMLHeader(std::ostream &file);
112 
118  void WriteStartElement(const char *const tag, std::ostream &file);
119 
127  void WriteStartElementWithAttribut(const char *const tag,
128  std::vector<std::string> attributes,
129  std::vector<std::string> values,
130  std::ostream &file);
131 
141  void WriteEndElement(const char *const tag, std::ostream &file, const bool &indent = true);
142 
148  void WriteCharacterData(const char *const data, std::ostream &file);
149 
155  void WriteStartElement(std::string &tag, std::ostream &file);
156 
163  void WriteEndElement(std::string &tag, std::ostream &file, const bool &indent = true);
164 
170  void WriteCharacterData(std::string &data, std::ostream &file);
171 
173  void WriteIndent(std::ostream &file);
174 
176 
177  unsigned int m_IndentDepth;
178 
179  unsigned int m_Indent;
180 
181  public:
182  static const char *XML_CONTOURMODEL;
183 
184  static const char *XML_HEAD;
185 
186  static const char *XML_GEOMETRY_INFO;
187 
188  static const char *XML_DATA;
189 
190  static const char *XML_TIME_STEP;
191 
192  static const char *XML_CONTROL_POINTS;
193 
194  static const char *XML_POINT;
195 
196  static const char *XML_X;
197 
198  static const char *XML_Y;
199 
200  static const char *XML_Z;
201  };
202 }
203 
204 #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)
Construct the writer, optionally including an XML header.
void WriteIndent(std::ostream &file)
Write indentation spaces to the stream according to m_IndentDepth and m_Indent.
static const char * XML_CONTROL_POINTS
void WriteStartElement(const char *const tag, std::ostream &file)
Write a start element tag.
void WriteStartElement(std::string &tag, std::ostream &file)
Write a start element tag (std::string overload).
void WriteCharacterData(const char *const data, std::ostream &file)
Write character data inside a tag.
void WriteCharacterData(std::string &data, std::ostream &file)
Write character data inside a tag (std::string overload).
void WriteStartElementWithAttribut(const char *const tag, std::vector< std::string > attributes, std::vector< std::string > values, std::ostream &file)
Write a start element tag with attributes.
static const char * XML_TIME_STEP
ContourModelWriter(const ContourModelWriter &other)
void WriteGeometryInformation(const mitk::TimeGeometry *geometry, std::ostream &out)
Write the geometry information of a TimeGeometry to a stream.
void Write() override
Write the ContourModel to the configured output location.
void WriteEndElement(std::string &tag, std::ostream &file, const bool &indent=true)
Write an end element tag (std::string overload).
void WriteXMLHeader(std::ostream &file)
Write a standard XML header to the given stream.
static const char * XML_CONTOURMODEL
~ContourModelWriter() override
std::string ConvertToString(T value)
Convert an arbitrary type to a string.
void WriteEndElement(const char *const tag, std::ostream &file, const bool &indent=true)
Write an end element tag.
static const char * XML_GEOMETRY_INFO
mitk::ContourModelWriter * Clone() const override
void WriteXML(const mitk::ContourModel *contourModel, std::ostream &out)
Write an XML representation of the given contour model to a stream.
A time-resolved contour representation consisting of linked vertices in 3D space.
Find image slices visible on a given plane.