#pragma once#include<string>#include<vector>#include"itkDataObject.h"#include"itkObjectFactory.h"#include"itkPoint.h"#include"itkWeakPointer.h"namespaceitk{classITK_EXPORTParticlePositionWriter:publicDataObject{public:typedefParticlePositionWriterSelf;typedefDataObjectSuperclass;typedefSmartPointer<Self>Pointer;typedefSmartPointer<constSelf>ConstPointer;typedefWeakPointer<constSelf>ConstWeakPointer;typedefPoint<double,3>PointType;itkNewMacro(Self);itkTypeMacro(ParticlePositionWriter,DataObject);voidSetInput(conststd::vector<PointType>&p){m_Input=p;}itkSetStringMacro(FileName);itkGetStringMacro(FileName);inlinevoidWrite(){this->Update();}voidUpdate(){// Open the output file.std::ofstreamout(m_FileName.c_str());if(!out){itkExceptionMacro("Could not open point file for output: "<<m_FileName.c_str());}// out << num_points;// Write points.for(typenamestd::vector<PointType>::const_iteratorit=m_Input.begin();it!=m_Input.end();it++){for(unsignedinti=0;i<3;i++){out<<(*it)[i]<<" ";}out<<std::endl;}out.close();};protected:ParticlePositionWriter(){}voidPrintSelf(std::ostream&os,Indentindent)const{Superclass::PrintSelf(os,indent);os<<indent<<"ParticlePositionWriter: "<<std::endl;}virtual~ParticlePositionWriter(){};private:ParticlePositionWriter(constSelf&);// purposely not implementedvoidoperator=(constSelf&);// purposely not implementedstd::vector<PointType>m_Input;std::stringm_FileName;};}// end namespace itk