Medical Imaging Interaction Toolkit  2016.11.0
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,
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 _MITK_POINT_SET_WRITER__H_
18 #define _MITK_POINT_SET_WRITER__H_
19 
20 #include <MitkLegacyIOExports.h>
21 
22 #include <itkProcessObject.h>
23 #include <mitkFileWriter.h>
24 #include <mitkPointSet.h>
25 
26 namespace mitk
27 {
41  {
42  public:
44 
46 
47  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
48 
50 
51  typedef InputType::Pointer InputTypePointer;
52 
57  itkSetStringMacro(FileName);
58 
62  itkGetStringMacro(FileName);
63 
67  itkSetStringMacro(FilePrefix);
68 
72  itkGetStringMacro(FilePrefix);
73 
77  itkSetStringMacro(FilePattern);
78 
82  itkGetStringMacro(FilePattern);
83 
88  void SetInput(InputType *input);
89 
96  void SetInput(const unsigned int &num, InputType *input);
97 
101  PointSet *GetInput();
102 
107  PointSet *GetInput(const unsigned int &num);
108 
112  virtual std::vector<std::string> GetPossibleFileExtensions() override;
113 
114  virtual std::string GetSupportedBaseData() const override;
115 
119  virtual std::string GetFileExtension() override;
120 
124  virtual bool CanWriteDataType(DataNode *) override;
125 
129  virtual std::string GetWritenMIMEType() override;
130 
131  using mitk::FileWriter::SetInput;
135  virtual void SetInput(DataNode *);
136 
140  bool GetSuccess() const;
141 
142  protected:
146  PointSetWriter();
147 
151  virtual ~PointSetWriter();
152 
156  virtual void GenerateData() override;
157 
163  virtual void ResizeInputs(const unsigned int &num);
164 
172  template <typename T>
173  std::string ConvertToString(T value);
174 
181  void WriteXML(mitk::PointSet *pointSet, std::ofstream &out);
182 
187  void WriteXMLHeader(std::ofstream &file);
188 
190  void WriteStartElement(const char *const tag, std::ofstream &file);
191 
196  void WriteEndElement(const char *const tag, std::ofstream &file, const bool &indent = true);
197 
199  void WriteCharacterData(const char *const data, std::ofstream &file);
200 
202  void WriteStartElement(std::string &tag, std::ofstream &file);
203 
205  void WriteEndElement(std::string &tag, std::ofstream &file, const bool &indent = true);
206 
208  void WriteCharacterData(std::string &data, std::ofstream &file);
209 
211  void WriteIndent(std::ofstream &file);
212 
213  std::string m_FileName;
214 
215  std::string m_FilePrefix;
216 
217  std::string m_FilePattern;
218 
219  std::string m_Extension;
220 
221  std::string m_MimeType;
222 
223  unsigned int m_IndentDepth;
224 
225  unsigned int m_Indent;
226 
227  bool m_Success;
228 
229  public:
230  static const char *XML_POINT_SET;
231 
232  static const char *XML_TIME_SERIES;
233 
234  static const char *XML_TIME_SERIES_ID;
235 
236  static const char *XML_POINT_SET_FILE;
237 
238  static const char *XML_FILE_VERSION;
239 
240  static const char *XML_POINT;
241 
242  static const char *XML_SPEC;
243 
244  static const char *XML_ID;
245 
246  static const char *XML_X;
247 
248  static const char *XML_Y;
249 
250  static const char *XML_Z;
251 
252  static const char *VERSION_STRING;
253  };
254 }
255 
256 #endif
#define MITKLEGACYIO_EXPORT
STL namespace.
DataCollection - Class to facilitate loading/accessing structured data.
Data structure which stores a set of points. Superclass of mitk::Mesh.
Definition: mitkPointSet.h:79
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
Interface class of writers that write data to files.
XML-based writer for mitk::PointSets.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66