Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _MITK_POINT_SET_WRITER__H_
00020 #define _MITK_POINT_SET_WRITER__H_
00021
00022 #include <itkProcessObject.h>
00023 #include <mitkFileWriter.h>
00024 #include <mitkPointSet.h>
00025
00026 namespace mitk
00027 {
00028
00039 class MITK_CORE_EXPORT PointSetWriter : public mitk::FileWriter
00040 {
00041 public:
00042
00043 mitkClassMacro( PointSetWriter, mitk::FileWriter );
00044
00045 mitkWriterMacro;
00046
00047 itkNewMacro( Self );
00048
00049 typedef mitk::PointSet InputType;
00050
00051 typedef InputType::Pointer InputTypePointer;
00052
00057 itkSetStringMacro( FileName );
00058
00062 itkGetStringMacro( FileName );
00063
00067 itkSetStringMacro( FilePrefix );
00068
00072 itkGetStringMacro( FilePrefix );
00073
00077 itkSetStringMacro( FilePattern );
00078
00082 itkGetStringMacro( FilePattern );
00083
00088 void SetInput( InputType* input );
00089
00096 void SetInput( const unsigned int& num, InputType* input);
00097
00101 PointSet* GetInput();
00102
00107 PointSet* GetInput( const unsigned int& num );
00108
00109
00113 virtual std::vector<std::string> GetPossibleFileExtensions();
00114
00118 virtual std::string GetFileExtension();
00119
00123 virtual bool CanWriteDataType( DataNode* );
00124
00128 virtual std::string GetWritenMIMEType();
00129
00133 virtual void SetInput( DataNode* );
00134
00138 bool GetSuccess() const;
00139
00140 protected:
00141
00145 PointSetWriter();
00146
00150 virtual ~PointSetWriter();
00151
00152
00156 virtual void GenerateData();
00157
00158
00164 virtual void ResizeInputs( const unsigned int& num );
00165
00166
00174 template < typename T>
00175 std::string ConvertToString( T value );
00176
00183 void WriteXML( mitk::PointSet* pointSet, std::ofstream& out );
00184
00189 void WriteXMLHeader( std::ofstream &file );
00190
00192 void WriteStartElement( const char *const tag, std::ofstream &file );
00193
00198 void WriteEndElement( const char *const tag, std::ofstream &file, const bool& indent = true );
00199
00201 void WriteCharacterData( const char *const data, std::ofstream &file );
00202
00204 void WriteStartElement( std::string &tag, std::ofstream &file );
00205
00207 void WriteEndElement( std::string &tag, std::ofstream &file, const bool& indent = true );
00208
00210 void WriteCharacterData( std::string &data, std::ofstream &file );
00211
00213 void WriteIndent( std::ofstream& file );
00214
00215 std::string m_FileName;
00216
00217 std::string m_FilePrefix;
00218
00219 std::string m_FilePattern;
00220
00221 std::string m_Extension;
00222
00223 std::string m_MimeType;
00224
00225 unsigned int m_IndentDepth;
00226
00227 unsigned int m_Indent;
00228
00229 bool m_Success;
00230
00231
00232
00233 public:
00234
00235 static const char* XML_POINT_SET;
00236
00237 static const char* XML_TIME_SERIES;
00238
00239 static const char* XML_TIME_SERIES_ID;
00240
00241 static const char* XML_POINT_SET_FILE;
00242
00243 static const char* XML_FILE_VERSION;
00244
00245 static const char* XML_POINT;
00246
00247 static const char* XML_SPEC;
00248
00249 static const char* XML_ID;
00250
00251 static const char* XML_X;
00252
00253 static const char* XML_Y;
00254
00255 static const char* XML_Z;
00256
00257 static const char* VERSION_STRING;
00258
00259 };
00260
00261
00262
00263 }
00264
00265
00266 #endif