48 this->SetNumberOfRequiredInputs(1);
49 this->SetNumberOfIndexedOutputs(1);
70 itkWarningMacro(<<
"Sorry, filename has not been set!");
76 itkExceptionMacro(<<
"File " <<
m_FileName <<
" could not be opened!");
77 itkWarningMacro(<<
"Sorry, file " <<
m_FileName <<
" could not be opened!");
82 std::locale previousLocale(out.getloc());
99 for (
unsigned int i = 0; i < this->GetNumberOfInputs(); ++i)
102 assert(pointSet.IsNotNull());
103 WriteXML(pointSet.GetPointer(), out);
107 out.imbue(previousLocale);
111 throw std::ios_base::failure(
"Some error during point set writing.");
124 for (
unsigned int i = 0; i < timecount; i++)
133 mitk::PointSet::PointsContainer::Iterator it;
135 for (it = pointsContainer->Begin(); it != pointsContainer->End(); ++it)
171 unsigned int prevNum = this->GetNumberOfInputs();
172 this->SetNumberOfIndexedInputs(num);
173 for (
unsigned int i = prevNum; i < num; ++i)
181 this->ProcessObject::SetNthInput(0, pointSet);
186 if (
id >= this->GetNumberOfInputs())
188 this->ProcessObject::SetNthInput(
id, pointSet);
193 if (this->GetNumberOfInputs() < 1)
205 return dynamic_cast<InputType *
>(this->ProcessObject::GetInput(num));
208 template <
typename T>
211 std::ostringstream o;
220 return "conversion error";
225 file <<
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
232 file << '<' << tag << '>
'; 236 void mitk::PointSetWriter::WriteEndElement(const char *const tag, std::ofstream &file, const bool &indent) 244 file << '<
' << '/
' << tag << '>
'; 247 void mitk::PointSetWriter::WriteCharacterData(const char *const data, std::ofstream &file) 252 void mitk::PointSetWriter::WriteStartElement(std::string &tag, std::ofstream &file) 254 WriteStartElement(tag.c_str(), file); 257 void mitk::PointSetWriter::WriteEndElement(std::string &tag, std::ofstream &file, const bool &indent) 259 WriteEndElement(tag.c_str(), file, indent); 262 void mitk::PointSetWriter::WriteCharacterData(std::string &data, std::ofstream &file) 264 WriteCharacterData(data.c_str(), file); 267 void mitk::PointSetWriter::WriteIndent(std::ofstream &file) 269 std::string spaces(m_IndentDepth * m_Indent, ' '); 270 file << spaces.c_str(); 273 bool mitk::PointSetWriter::GetSuccess() const 278 bool mitk::PointSetWriter::CanWriteDataType(DataNode *input) 282 mitk::BaseData *data = input->GetData(); 285 mitk::PointSet::Pointer pointSet = dynamic_cast<mitk::PointSet *>(data); 286 if (pointSet.IsNotNull()) 288 // this writer has no "SetDefaultExtension()" - function 289 m_Extension = ".mps"; 297 void mitk::PointSetWriter::SetInput(DataNode *input) 299 if (input && CanWriteDataType(input)) 300 this->ProcessObject::SetNthInput(0, dynamic_cast<mitk::PointSet *>(input->GetData())); 303 std::string mitk::PointSetWriter::GetWritenMIMEType() 308 std::vector<std::string> mitk::PointSetWriter::GetPossibleFileExtensions() 310 std::vector<std::string> possibleFileExtensions; 311 possibleFileExtensions.push_back(".mps"); 312 return possibleFileExtensions; 315 std::string mitk::PointSetWriter::GetSupportedBaseData() const 317 return PointSet::GetStaticNameOfClass(); 320 std::string mitk::PointSetWriter::GetFileExtension() void SetInput(InputType *input)
virtual PointSpecificationType GetSpecificationTypeInfo(int position, int t) const
to get the type of the point at the position and the moment
static const char * XML_POINT
std::string ConvertToString(T value)
void WriteIndent(std::ofstream &file)
static const char * XML_POINT_SET_FILE
static const char * XML_ID
static const char * XML_POINT_SET
static const char * XML_TIME_SERIES
void WriteStartElement(const char *const tag, std::ofstream &file)
Data structure which stores a set of points. Superclass of mitk::Mesh.
virtual DataType::Pointer GetPointSet(int t=0) const
returns the pointset
~PointSetWriter() override
void WriteXML(mitk::PointSet *pointSet, std::ofstream &out)
DataType::PointsContainer PointsContainer
static const char * XML_TIME_SERIES_ID
void WriteEndElement(const char *const tag, std::ofstream &file, const bool &indent=true)
static const char * XML_Y
unsigned int GetTimeSteps() const
Get the number of time steps from the TimeGeometry As the base data has not a data vector given by it...
void WriteXMLHeader(std::ofstream &file)
static const char * XML_FILE_VERSION
static const char * XML_Z
static const char * XML_SPEC
static const char * VERSION_STRING
static const char * XML_X
unsigned int m_IndentDepth
virtual void ResizeInputs(const unsigned int &num)
void GenerateData() override
void WriteCharacterData(const char *const data, std::ofstream &file)