18#ifndef itkEdgeDecimationQuadEdgeMeshFilter_h
19#define itkEdgeDecimationQuadEdgeMeshFilter_h
39template <
typename TInput,
typename TOutput,
typename TCriterion>
82 using QueueMapType = std::map<OutputQEType *, PriorityQueueItemType *>;
93 bool m_Relocate{
true };
94 bool m_CheckOrientation{
false };
225 std::list<OutputCellIdentifier> r1, r2, elements_to_be_tested;
231 r1.push_back(qe_it->GetLeft());
232 qe_it = qe_it->GetOnext();
233 }
while (qe_it != qe);
235 qe = iEdge->GetSym();
236 qe_it = qe->GetOnext();
240 r2.push_back(qe_it->GetLeft());
241 qe_it = qe_it->GetOnext();
242 }
while (qe_it != qe);
247 std::set_symmetric_difference(
248 r1.begin(), r1.end(), r2.begin(), r2.end(), std::back_inserter(elements_to_be_tested));
250 typename std::list<OutputCellIdentifier>::iterator it = elements_to_be_tested.begin();
254 bool orientation_ok(
true);
259 int k(0), replace_k(0);
264 while ((it != elements_to_be_tested.end()) && orientation_ok)
275 p_id = qe_it->GetOrigin();
280 pt[k++] = output->GetPoint(p_id);
281 qe_it = qe_it->GetLnext();
282 }
while (qe_it != qe);
284 n_bef = TriangleType::ComputeNormal(pt[0], pt[1], pt[2]);
289 n_aft = TriangleType::ComputeNormal(iPt, pt[1], pt[2]);
292 n_aft = TriangleType::ComputeNormal(pt[0], iPt, pt[2]);
295 n_aft = TriangleType::ComputeNormal(pt[0], pt[1], iPt);
299 orientation_ok = (n_bef * n_aft) < 0.;
303 return orientation_ok;
315#include "itkEdgeDecimationQuadEdgeMeshFilter.hxx"
typename CriterionType::Pointer CriterionPointer
typename CriterionType::PriorityQueueWrapperType PriorityQueueItemType
typename InputMeshType::Pointer InputMeshPointer
typename CriterionType::PriorityType PriorityType
typename CriterionType::MeasureType MeasureType
typename OutputMeshType::Pointer OutputMeshPointer
typename PriorityQueueType::Pointer PriorityQueuePointer
typename OutputPointType::VectorType OutputVectorType
bool ProcessWithTopologicalGuarantee() override
virtual unsigned int CheckQEProcessingStatus()
void TagElementOut(OutputQEType *iEdge)
void DeleteElement(OutputQEType *iEdge)
Delete a given edge in the priority queue.
typename OperatorType::Pointer OperatorPointer
bool CheckOrientation(OutputQEType *iEdge, const OutputPointIdentifier &iId, const OutputPointType &iPt)
typename QueueMapType::const_iterator QueueMapConstIterator
typename OutputMeshType::PointIdentifier OutputPointIdentifier
void FillPriorityQueue() override
Fill the priority queue.
~EdgeDecimationQuadEdgeMeshFilter() override
bool IsCriterionSatisfied() override
typename OutputMeshType::QEType OutputQEType
typename OutputMeshType::CellType OutputCellType
virtual void PushOrUpdateElement(OutputQEType *iEdge)
Push iEdge in the priority queue if it is not already, else its corresponding priority value is updat...
void Extract() override
Extract the edge to be processed.
typename OutputMeshType::PointType OutputPointType
typename OutputMeshType::EdgeCellType OutputEdgeCellType
void PushElement(OutputQEType *iEdge)
Push one edge in the priority queue.
typename OutputMeshType::CellsContainerPointer OutputCellsContainerPointer
std::map< OutputQEType *, PriorityQueueItemType * > QueueMapType
typename OutputMeshType::CellsContainerIterator OutputCellsContainerIterator
bool ProcessWithoutAnyTopologicalGuarantee() override
typename QueueMapType::iterator QueueMapIterator
virtual void DeletePoint(const OutputPointIdentifier &iIdToBeDeleted, const OutputPointIdentifier &iRemaining)
bool IsEdgeOKToBeProcessed(OutputQEType *iEdge)
Check if iEdge is valid and then can be processed.
virtual OutputPointType Relocate(OutputQEType *iEdge)=0
virtual MeasureType MeasureEdge(OutputQEType *iEdge)=0
Compute the measure value for iEdge.
virtual void JoinVertexFailed()
typename OutputMeshType::CellIdentifier OutputCellIdentifier
SizeValueType NumberOfCommonVerticesIn0Ring() const
EdgeDecimationQuadEdgeMeshFilter()
Light weight base class for most itk classes.
Collapse a given edge by joining its dest and its org.
QuadEdgeType * GetEdgeRingEntry() const
A convenience class for computation of various triangle elements in 2D or 3D.
SmartPointer< Self > Pointer
ImageBaseType::PointType PointType
ImageBaseType::SpacingType VectorType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType