18 #ifndef itkSimplexMeshAdaptTopologyFilter_h
19 #define itkSimplexMeshAdaptTopologyFilter_h
28 #include "vxl_version.h"
29 #include "vnl/vnl_cross.h"
44 template <
typename TInputMesh,
typename TOutputMesh>
114 areaMap = DoubleValueMapType::New();
115 curvatureMap = DoubleValueMapType::New();
130 typename InputPolygonType::PointIdIterator it = poly->
PointIdsBegin();
132 double meanCurvature = 0;
134 double val = mesh->GetMeanCurvature(*it++);
135 meanCurvature += std::abs(val);
138 val = mesh->GetMeanCurvature(*it++);
139 meanCurvature += std::abs(val);
150 area += ComputeArea(refPoint, id1, id2);
152 val = mesh->GetMeanCurvature(*it);
153 meanCurvature += std::abs(val);
158 meanCurvature /= (double)cnt;
160 totalCurvature += meanCurvature;
162 areaMap->InsertElement(cellId, area);
163 curvatureMap->InsertElement(cellId, meanCurvature);
165 if (area > maxCellSize)
169 if (area < minCellSize)
173 if (meanCurvature > maxCurvature)
175 maxCurvature = meanCurvature;
177 if (meanCurvature < minCurvature)
179 minCurvature = meanCurvature;
192 mesh->GetPoint(p1, &v1);
193 mesh->GetPoint(p2, &v2);
194 mesh->GetPoint(p3, &v3);
195 return std::abs(vnl_cross_3d((v2 - v1).GetVnlVector(), (v3 - v1).GetVnlVector()).two_norm() / 2.0);
198 typename DoubleValueMapType::Pointer
204 typename DoubleValueMapType::Pointer
219 return totalCurvature / (curvatureMap->Size());
248 using SimplexVisitorInterfaceType =
255 itkSetMacro(Threshold,
double);
256 itkGetConstMacro(Threshold,
double);
258 itkSetMacro(SelectionMethod,
int);
259 itkGetConstMacro(SelectionMethod,
int);
261 itkGetConstMacro(ModifiedCount,
int);
268 PrintSelf(std::ostream & os,
Indent indent)
const override;
271 GenerateData()
override;
285 ComputeCellParameters();
289 CopyInputMeshToOutputMeshGeometryData();
314 double m_Threshold{ 0.5 };
319 int m_SelectionMethod{ 0 };
325 int m_ModifiedCount{ 0 };
337 #ifndef ITK_MANUAL_INSTANTIATION
338 # include "itkSimplexMeshAdaptTopologyFilter.hxx"
341 #endif // itkSimplexMeshAdaptTopologyFilter_h