/*========================================================================= 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.=========================================================================*/#pragma once#include"itkParticleImageDomainWithCurvature.h"#include"vnl/vnl_inverse.h"#include"TriMesh.h"#include"TriMesh_algo.h"#include"meshFIM.h"namespaceitk{template<classT>classParticleImplicitSurfaceDomain:publicParticleImageDomainWithCurvature<T>{public:typedefParticleImageDomainWithCurvature<T>Superclass;typedefSmartPointer<ParticleImplicitSurfaceDomain>Pointer;typedeftypenameSuperclass::ImageTypeImageType;typedeftypenameSuperclass::PointTypePointType;itkNewMacro(ParticleImplicitSurfaceDomain);virtualvoidSetTolerance(constT_Tolerance){if(this->m_Tolerance!=_Tolerance){this->m_Tolerance=_Tolerance;this->Modified();}}virtualTGetTolerance(){returnthis->m_Tolerance;}shapeworks::DomainTypeGetDomainType()constoverride{returnshapeworks::DomainType::Image;}virtualboolApplyConstraints(PointType&p,intidx,booldbg=false)constoverride;inlinePointTypeUpdateParticlePosition(constPointType&point,intidx,vnl_vector_fixed<double,DIMENSION>&update)constoverride{PointTypenewpoint;// Master merge conflict//vnl_vector_fixed<float, DIMENSION> negativeUpdate;//for (unsigned int i = 0; i < DIMENSION; i++) { negativeUpdate[i] = -update[i]; }//for (unsigned int i = 0; i < DIMENSION; i++) { newpoint[i] = point[i] + negativeUpdate[i]; }for(unsignedinti=0;i<3;i++){newpoint[i]=point[i]-update[i];}//for (unsigned int i = 0; i < DIMENSION; i++) { newpoint[i] = point[i] - update[i]; }// debugggApplyConstraints(newpoint,idx);// debuggg/* if(!this->GetConstraints()->IsAnyViolated(point) && this->GetConstraints()->IsAnyViolated(newpoint)){ std::cerr << "####### Violation within apply constraints #######" << std::endl; } *//* if(point[2] >= 0 && newpoint[2] < 0){ std::cerr << "NewPoint " << newpoint << std::endl; std::cerr << "Point " << point << std::endl; std::cerr << "Update " << update << std::endl; } */returnnewpoint;}voidSetMesh(TriMesh*mesh);voidSetFeaMesh(constchar*feaFile);voidSetFeaGrad(constchar*feaGradFile);voidSetFids(constchar*fidsFile);meshFIM*GetMesh(){returnm_mesh;}meshFIM*GetMesh()const{returnm_mesh;}PointTypeGetZeroCrossingPoint()constoverride{PointTypep;// TODO Hong// Return point that doesn't violate plane constraints.returnp;}protected:ParticleImplicitSurfaceDomain():m_Tolerance(1.0e-4){m_mesh=NULL;}voidPrintSelf(std::ostream&os,Indentindent)const{Superclass::PrintSelf(os,indent);os<<indent<<"m_Tolerance = "<<m_Tolerance<<std::endl;}virtual~ParticleImplicitSurfaceDomain(){};private:Tm_Tolerance;meshFIM*m_mesh;};}// end namespace itk#include"itkParticleImplicitSurfaceDomain.txx"