#pragma once#include"itkDataObject.h"#include"itkWeakPointer.h"#include"itkParticleContainer.h"#include"itkParticleContainerArrayAttribute.h"#include"ParticleImageDomainWithCurvature.h"#include"itkParticleSystem.h"namespaceitk{template<classTNumericType,unsignedintVDimension>classITK_EXPORTParticleMeanCurvatureAttribute:publicParticleContainerArrayAttribute<TNumericType,VDimension>{public:typedefTNumericTypeNumericType;typedefParticleMeanCurvatureAttributeSelf;typedefParticleContainerArrayAttribute<TNumericType,VDimension>Superclass;typedefSmartPointer<Self>Pointer;typedefSmartPointer<constSelf>ConstPointer;typedefWeakPointer<constSelf>ConstWeakPointer;typedefParticleSystemParticleSystemType;typedeftypenameParticleSystemType::PointTypePointType;typedefvnl_vector_fixed<TNumericType,VDimension>VnlVectorType;itkNewMacro(Self);itkTypeMacro(ParticleMeanCurvatureAttribute,ParticleContainerArrayAttribute);voidSetVerbosity(unsignedintval){m_verbosity=val;}unsignedintGetVerbosity(){returnm_verbosity;}virtualvoidPositionAddEventCallback(Object*o,constEventObject&e){Superclass::PositionAddEventCallback(o,e);constParticlePositionAddEvent&event=dynamic_cast<constParticlePositionAddEvent&>(e);constParticleSystemType*ps=dynamic_cast<constParticleSystemType*>(o);this->ComputeMeanCurvature(ps,event.GetPositionIndex(),event.GetDomainIndex());}virtualvoidPositionSetEventCallback(Object*o,constEventObject&e){constParticlePositionSetEvent&event=dynamic_cast<constParticlePositionSetEvent&>(e);constParticleSystemType*ps=dynamic_cast<constParticleSystemType*>(o);this->ComputeMeanCurvature(ps,event.GetPositionIndex(),event.GetDomainIndex());}virtualvoidDomainAddEventCallback(Object*o,constEventObject&e){Superclass::DomainAddEventCallback(o,e);m_MeanCurvatureList.push_back(0.0);m_CurvatureStandardDeviationList.push_back(0.0);constParticleDomainAddEvent&event=dynamic_cast<constParticleDomainAddEvent&>(e);constParticleSystemType*ps=dynamic_cast<constParticleSystemType*>(o);if(!ps->GetDomainFlag(event.GetDomainIndex())){this->ComputeCurvatureStatistics(ps,event.GetDomainIndex());}}inlinevoidComputeMeanCurvature(constParticleSystemType*system,unsignedintidx,unsignedintdom){// Get the position and index.PointTypepos=system->GetPosition(idx,dom);this->operator[](dom)->operator[](idx)=system->GetDomain(dom)->GetCurvature(pos,idx);}virtualvoidComputeCurvatureStatistics(constParticleSystemType*,unsignedintd);doubleGetMeanCurvature(intd){returnm_MeanCurvatureList[d];}doubleGetCurvatureStandardDeviation(intd){returnm_CurvatureStandardDeviationList[d];}protected:ParticleMeanCurvatureAttribute(){this->m_DefinedCallbacks.PositionSetEvent=true;this->m_DefinedCallbacks.DomainAddEvent=true;}virtual~ParticleMeanCurvatureAttribute(){};voidPrintSelf(std::ostream&os,Indentindent)const{Superclass::PrintSelf(os,indent);}private:ParticleMeanCurvatureAttribute(constSelf&);//purposely not implementedvoidoperator=(constSelf&);//purposely not implementedstd::vector<double>m_MeanCurvatureList;std::vector<double>m_CurvatureStandardDeviationList;unsignedintm_verbosity;};}// end namespace#include"itkParticleMeanCurvatureAttribute.txx"