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();
129 typename InputPolygonType::PointIdIterator it = poly->
PointIdsBegin();
131 double meanCurvature = 0;
133 double val = mesh->GetMeanCurvature(*it++);
134 meanCurvature += std::abs(val);
137 val = mesh->GetMeanCurvature(*it++);
138 meanCurvature += std::abs(val);
149 area += ComputeArea(refPoint, id1, id2);
151 val = mesh->GetMeanCurvature(*it);
152 meanCurvature += std::abs(val);
157 meanCurvature /= (double)cnt;
159 totalCurvature += meanCurvature;
161 areaMap->InsertElement(cellId, area);
162 curvatureMap->InsertElement(cellId, meanCurvature);
164 if ( area > maxCellSize ) { maxCellSize = area; }
165 if ( area < minCellSize ) { minCellSize = area; }
166 if ( meanCurvature > maxCurvature ) { maxCurvature = meanCurvature; }
167 if ( meanCurvature < minCurvature ) { minCurvature = meanCurvature; }
178 mesh->GetPoint(p1, &v1);
179 mesh->GetPoint(p2, &v2);
180 mesh->GetPoint(p3, &v3);
181 return std::abs (vnl_cross_3d( ( v2 - v1 ).GetVnlVector(), ( v3 - v1 ).GetVnlVector() ).two_norm() / 2.0);
201 return totalCurvature / ( curvatureMap->Size() );
236 itkSetMacro(Threshold,
double);
237 itkGetConstMacro(Threshold,
double);
239 itkSetMacro(SelectionMethod,
int);
240 itkGetConstMacro(SelectionMethod,
int);
242 itkGetConstMacro(ModifiedCount,
int);
249 void PrintSelf(std::ostream & os,
Indent indent)
const override;
251 void GenerateData()
override;
263 void ComputeCellParameters();
266 void CopyInputMeshToOutputMeshGeometryData();
289 double m_Threshold{0.5};
294 int m_SelectionMethod{0};
300 int m_ModifiedCount{0};
312 #ifndef ITK_MANUAL_INSTANTIATION
313 #include "itkSimplexMeshAdaptTopologyFilter.hxx"
316 #endif // itkSimplexMeshAdaptTopologyFilter_h
typename InputMeshType::PointType InputPointType
double GetMinimumCurvature()
typename CellMultiVisitorType::Pointer CellMultiVisitorPointer
typename itk::MapContainer< CellIdentifier, double > DoubleValueMapType
Light weight base class for most itk classes.
typename InputMeshType::CellIdentifier CellIdentifier
TOutputMesh OutputMeshType
A template class used to implement a visitor object.
Define numeric traits for std::vector.
CellIdentifier m_IdOffset
DoubleValueMapType::Pointer curvatureMap
typename InputMeshType::CellType InputCellType
A wrapper of the STL "map" container.
PointIdIterator PointIdsBegin() override
MeshToMeshFilter is the base class for all process objects that output mesh data, and require mesh da...
typename InputMeshType::MeshTraits::CellTraits InputCellTraitsType
double GetMaximumCellSize()
double GetTotalMeanCurvature()
typename InputMeshType::Pointer InputMeshPointer
This filter changes the topology of a 2-simplex mesh.
InputCellAutoPointer m_NewSimplexCellPointer
typename SimplexVisitorInterfaceType::Pointer SimplexVisitorInterfacePointer
void Visit(CellIdentifier cellId, InputPolygonType *poly)
visits all polygon cells and computes the area, NOTE: works for convex polygons only!!! ...
DoubleValueMapType::Pointer areaMap
double ComputeArea(PointIdentifier p1, PointIdentifier p2, PointIdentifier p3)
typename InputMeshType::PixelType InputPixelType
DoubleValueMapType::Pointer GetAreaMap()
Represents a polygon in a Mesh.
OutputMeshPointer m_Output
member for accessing the filter result during creation
typename InputCellType::PointIdIterator InputCellPointIdIterator
typename InputMeshType::CellAutoPointer CellAutoPointer
typename OutputMeshType::Pointer OutputMeshPointer
typename InputCellType::CellAutoPointer InputCellAutoPointer
typename InputPolygonType::PointIdIterator InputPolygonPointIdIterator
typename InputMeshType::VectorType InputVectorType
typename DoubleValueMapType::Iterator DoubleContainerIterator
typename InputCellType::MultiVisitor CellMultiVisitorType
double GetMinimumCellSize()
Control indentation during Print() invocation.
ImageBaseType::PointType PointType
double GetTotalMeshArea()
ImageBaseType::SpacingType VectorType
typename InputMeshType::PointIdentifier PointIdentifier
A templated class holding a n-Dimensional covariant vector.
DoubleValueMapType::Pointer GetCurvatureMap()
double GetMaximumCurvature()
typename OutputMeshType::CellType OutputCellType
PointIdIterator PointIdsEnd() override