/*========================================================================= Program: ShapeWorks: Particle-based Shape Correspondence & Visualization Module: $RCSfile: itkParticleMeanCurvatureAttribute.h,v $ Date: $Date: 2011/03/24 01:17:33 $ Version: $Revision: 1.2 $ Author: $Author: wmartin $ Copyright (c) 2009 Scientific Computing and Imaging Institute. See ShapeWorksLicense.txt for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information.=========================================================================*/#ifndef __itkParticleMeanCurvatureAttribute_h#define __itkParticleMeanCurvatureAttribute_h#include"itkDataObject.h"#include"itkWeakPointer.h"#include"itkParticleContainer.h"#include"itkParticleContainerArrayAttribute.h"#include"itkParticleImageDomainWithCurvature.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;typedefParticleSystem<VDimension>ParticleSystemType;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#if ITK_TEMPLATE_EXPLICIT#include"Templates/itkParticleMeanCurvatureAttribute+-.h"#endif#if ITK_TEMPLATE_TXX#include"itkParticleMeanCurvatureAttribute.txx"#endif#include"itkParticleMeanCurvatureAttribute.txx"#endif