Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
mitkPointSetWriter.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 mitkPointSetWriter_h
14 #define mitkPointSetWriter_h
15 
16 #include <MitkLegacyIOExports.h>
17 
18 #include <itkProcessObject.h>
19 #include <mitkFileWriter.h>
20 #include <mitkPointSet.h>
21 
22 namespace mitk
23 {
37  {
38  public:
40 
42 
43  itkFactorylessNewMacro(Self);
44 
45  itkCloneMacro(Self);
46 
47  typedef mitk::PointSet InputType;
48 
50 
54  itkSetStringMacro(FileName);
55 
59  itkGetStringMacro(FileName);
60 
64  itkSetStringMacro(FilePrefix);
65 
69  itkGetStringMacro(FilePrefix);
70 
74  itkSetStringMacro(FilePattern);
75 
79  itkGetStringMacro(FilePattern);
80 
85  void SetInput(InputType *input);
86 
94  void SetInput(const unsigned int &num, InputType *input);
95 
99  PointSet *GetInput();
100 
105  PointSet *GetInput(const unsigned int &num);
106 
110  std::vector<std::string> GetPossibleFileExtensions() override;
111 
112  std::string GetSupportedBaseData() const override;
113 
117  std::string GetFileExtension() override;
118 
122  bool CanWriteDataType(DataNode *) override;
123 
127  std::string GetWritenMIMEType() override;
128 
133  virtual void SetInput(DataNode *);
134 
138  bool GetSuccess() const;
139 
140  protected:
144  PointSetWriter();
145 
149  ~PointSetWriter() override;
150 
154  void GenerateData() override;
155 
161  virtual void ResizeInputs(const unsigned int &num);
162 
170  template <typename T>
171  std::string ConvertToString(T value);
172 
179  void WriteXML(mitk::PointSet *pointSet, std::ofstream &out);
180 
185  void WriteXMLHeader(std::ofstream &file);
186 
188  void WriteStartElement(const char *const tag, std::ofstream &file);
189 
194  void WriteEndElement(const char *const tag, std::ofstream &file, const bool &indent = true);
195 
197  void WriteCharacterData(const char *const data, std::ofstream &file);
198 
200  void WriteStartElement(std::string &tag, std::ofstream &file);
201 
203  void WriteEndElement(std::string &tag, std::ofstream &file, const bool &indent = true);
204 
206  void WriteCharacterData(std::string &data, std::ofstream &file);
207 
209  void WriteIndent(std::ofstream &file);
210 
211  std::string m_FileName;
212 
213  std::string m_FilePrefix;
214 
215  std::string m_FilePattern;
216 
217  std::string m_Extension;
218 
219  std::string m_MimeType;
220 
221  unsigned int m_IndentDepth;
222 
223  unsigned int m_Indent;
224 
225  bool m_Success;
226 
227  public:
228  static const char *XML_POINT_SET;
229 
230  static const char *XML_TIME_SERIES;
231 
232  static const char *XML_TIME_SERIES_ID;
233 
234  static const char *XML_POINT_SET_FILE;
235 
236  static const char *XML_FILE_VERSION;
237 
238  static const char *XML_POINT;
239 
240  static const char *XML_SPEC;
241 
242  static const char *XML_ID;
243 
244  static const char *XML_X;
245 
246  static const char *XML_Y;
247 
248  static const char *XML_Z;
249 
250  static const char *VERSION_STRING;
251  };
252 }
253 
254 #endif
mitk::PointSetWriter::InputTypePointer
InputType::Pointer InputTypePointer
Definition: mitkPointSetWriter.h:49
mitk::PointSetWriter::XML_TIME_SERIES
static const char * XML_TIME_SERIES
Definition: mitkPointSetWriter.h:230
mitk::PointSetWriter::m_IndentDepth
unsigned int m_IndentDepth
Definition: mitkPointSetWriter.h:221
mitk::PointSetWriter::m_Extension
std::string m_Extension
Definition: mitkPointSetWriter.h:217
itk::SmartPointer< Self >
mitk::PointSetWriter::XML_X
static const char * XML_X
Definition: mitkPointSetWriter.h:244
mitk::PointSetWriter::XML_POINT_SET
static const char * XML_POINT_SET
Definition: mitkPointSetWriter.h:228
MitkLegacyIOExports.h
mitk::PointSetWriter::XML_SPEC
static const char * XML_SPEC
Definition: mitkPointSetWriter.h:240
mitk::FileWriter::SetInput
void SetInput(BaseData *data)
mitk::FileWriter
Interface class of writers that write data to files.
Definition: mitkFileWriter.h:26
mitk::PointSetWriter::XML_Z
static const char * XML_Z
Definition: mitkPointSetWriter.h:248
mitkPointSet.h
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::PointSetWriter::XML_POINT_SET_FILE
static const char * XML_POINT_SET_FILE
Definition: mitkPointSetWriter.h:234
mitk::PointSetWriter::XML_ID
static const char * XML_ID
Definition: mitkPointSetWriter.h:242
mitk::PointSetWriter::VERSION_STRING
static const char * VERSION_STRING
Definition: mitkPointSetWriter.h:250
mitk::PointSetWriter::InputType
mitk::PointSet InputType
Definition: mitkPointSetWriter.h:45
mitk::PointSetWriter::XML_Y
static const char * XML_Y
Definition: mitkPointSetWriter.h:246
mitk::PointSetWriter::m_Success
bool m_Success
Definition: mitkPointSetWriter.h:225
mitk::PointSetWriter::m_MimeType
std::string m_MimeType
Definition: mitkPointSetWriter.h:219
mitkFileWriter.h
mitk::PointSetWriter::m_FilePrefix
std::string m_FilePrefix
Definition: mitkPointSetWriter.h:213
mitk::PointSetWriter::mitkWriterMacro
mitkWriterMacro
Definition: mitkPointSetWriter.h:41
mitk::PointSetWriter::XML_FILE_VERSION
static const char * XML_FILE_VERSION
Definition: mitkPointSetWriter.h:236
mitk::PointSetWriter
XML-based writer for mitk::PointSets.
Definition: mitkPointSetWriter.h:36
mitk::PointSetWriter::XML_TIME_SERIES_ID
static const char * XML_TIME_SERIES_ID
Definition: mitkPointSetWriter.h:232
MITKLEGACYIO_EXPORT
#define MITKLEGACYIO_EXPORT
Definition: MitkLegacyIOExports.h:15
mitk::PointSetWriter::m_FilePattern
std::string m_FilePattern
Definition: mitkPointSetWriter.h:215
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::PointSet
Data structure which stores a set of points.
Definition: mitkPointSet.h:71
mitk::PointSetWriter::XML_POINT
static const char * XML_POINT
Definition: mitkPointSetWriter.h:238
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
mitk::PointSetWriter::m_Indent
unsigned int m_Indent
Definition: mitkPointSetWriter.h:223
mitk::PointSetWriter::m_FileName
std::string m_FileName
Definition: mitkPointSetWriter.h:211