1 /*=========================================================================
\r
5 * Licensed under the Apache License, Version 2.0 (the "License");
\r
6 * you may not use this file except in compliance with the License.
\r
7 * You may obtain a copy of the License at
\r
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
\r
11 * Unless required by applicable law or agreed to in writing, software
\r
12 * distributed under the License is distributed on an "AS IS" BASIS,
\r
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 * See the License for the specific language governing permissions and
\r
15 * limitations under the License.
\r
17 *=========================================================================*/
\r
19 #ifndef itkFastMarchingQuadEdgeMeshFilterBase_h
\r
20 #define itkFastMarchingQuadEdgeMeshFilterBase_h
\r
22 #include "itkFastMarchingBase.h"
\r
23 #include "itkFastMarchingTraits.h"
\r
28 *\class FastMarchingQuadEdgeMeshFilterBase
\r
29 \brief Fast Marching Method on QuadEdgeMesh
\r
31 The speed function is specified by the input mesh. Data associated to each
\r
32 point is considered as the speed function. The speed function is set using
\r
33 the method SetInput().
\r
35 If the speed function is constant and of value one, fast marching results is
\r
36 an approximate geodesic function from the initial alive points.
\r
38 Implementation of this class is based on
\r
39 "Fast Marching Methods on Triangulated Domains", Kimmel, R., and Sethian, J.A.,
\r
40 Proc. Nat. Acad. Sci., 95, pp. 8341-8435, 1998.
\r
42 \ingroup ITKFastMarching
\r
44 template <typename TInput, typename TOutput>
\r
45 //2023-04-27-PG class ITK_TEMPLATE_EXPORT FastMarchingQuadEdgeMeshFilterBase : public FastMarchingBase<TInput, TOutput>
\r
46 class ITK_TEMPLATE_EXPORT FastMarchingQuadEdgeMeshFilterResultsBase : public FastMarchingBase<TInput, TOutput>
\r
49 //ITK_DISALLOW_COPY_AND_MOVE(FastMarchingQuadEdgeMeshFilterBase);
\r
50 ITK_DISALLOW_COPY_AND_MOVE(FastMarchingQuadEdgeMeshFilterResultsBase);
\r
52 //using Self = FastMarchingQuadEdgeMeshFilterBase;
\r
53 using Self =FastMarchingQuadEdgeMeshFilterResultsBase;
\r
54 using Superclass = FastMarchingBase<TInput, TOutput>;
\r
55 using Pointer = SmartPointer<Self>;
\r
56 using ConstPointer = SmartPointer<const Self>;
\r
57 using Traits = typename Superclass::Traits;
\r
59 /** Method for creation through the object factory. */
\r
62 /** Run-time type information (and related methods). */
\r
63 //itkTypeMacro(FastMarchingQuadEdgeMeshFilterBase, FastMarchingBase);
\r
64 itkTypeMacro(FastMarchingQuadEdgeMeshFilterResultsBase, FastMarchingBase);
\r
66 using InputMeshType = typename Superclass::InputDomainType;
\r
67 using InputMeshPointer = typename Superclass::InputDomainPointer;
\r
68 using InputPixelType = typename Superclass::InputPixelType;
\r
69 using InputPointType = typename InputMeshType::PointType;
\r
70 using InputPointIdentifierType = typename InputMeshType::PointIdentifier;
\r
72 using OutputMeshType = typename Superclass::OutputDomainType;
\r
73 using OutputMeshPointer = typename Superclass::OutputDomainPointer;
\r
74 using OutputPixelType = typename Superclass::OutputPixelType;
\r
75 using OutputPointType = typename OutputMeshType::PointType;
\r
76 using OutputVectorType = typename OutputPointType::VectorType;
\r
77 using OutputVectorRealType = typename OutputVectorType::RealValueType;
\r
78 using OutputQEType = typename OutputMeshType::QEType;
\r
79 using OutputPointIdentifierType = typename OutputMeshType::PointIdentifier;
\r
80 using OutputPointsContainer = typename OutputMeshType::PointsContainer;
\r
81 using OutputPointsContainerPointer = typename OutputPointsContainer::Pointer;
\r
82 using OutputPointsContainerIterator = typename OutputPointsContainer::Iterator;
\r
83 using OutputPointDataContainer = typename OutputMeshType::PointDataContainer;
\r
84 using OutputPointDataContainerPointer = typename OutputPointDataContainer::Pointer;
\r
86 using OutputCellsContainer = typename OutputMeshType::CellsContainer;
\r
87 using OutputCellsContainerPointer = typename OutputCellsContainer::Pointer;
\r
88 using OutputCellsContainerConstIterator = typename OutputCellsContainer::ConstIterator;
\r
89 using OutputCellType = typename OutputMeshType::CellType;
\r
92 using NodeType = typename Traits::NodeType;
\r
93 using NodePairType = typename Traits::NodePairType;
\r
94 using NodePairContainerType = typename Traits::NodePairContainerType;
\r
95 using NodePairContainerPointer = typename Traits::NodePairContainerPointer;
\r
96 using NodePairContainerConstIterator = typename Traits::NodePairContainerConstIterator;
\r
98 // using NodeContainerType = typename Traits::NodeContainerType;
\r
99 // using NodeContainerPointer = typename Traits::NodeContainerPointer;
\r
100 // using NodeContainerConstIterator = typename Traits::NodeContainerConstIterator;
\r
102 using LabelType = typename Superclass::LabelType;
\r
104 using NodeLabelMapType = std::map<NodeType, LabelType>;
\r
105 using NodeLabelMapIterator = typename NodeLabelMapType::iterator;
\r
106 using NodeLabelMapConstIterator = typename NodeLabelMapType::const_iterator;
\r
109 //FastMarchingQuadEdgeMeshFilterBase();
\r
110 FastMarchingQuadEdgeMeshFilterResultsBase();
\r
111 //~FastMarchingQuadEdgeMeshFilterBase() override = default;
\r
112 ~FastMarchingQuadEdgeMeshFilterResultsBase() override = default;
\r
114 NodeLabelMapType m_Label;
\r
117 GetTotalNumberOfNodes() const override;
\r
120 SetOutputValue(OutputMeshType * oMesh, const NodeType & iNode, const OutputPixelType & iValue) override;
\r
122 const OutputPixelType
\r
123 GetOutputValue(OutputMeshType * oMesh, const NodeType & iNode) const override;
\r
126 GetLabelValueForGivenNode(const NodeType & iNode) const override;
\r
129 SetLabelValueForGivenNode(const NodeType & iNode, const LabelType & iLabel) override;
\r
132 UpdateNeighbors(OutputMeshType * oMesh, const NodeType & iNode) override;
\r
135 UpdateValue(OutputMeshType * oMesh, const NodeType & iNode) override;
\r
137 const OutputVectorRealType
\r
138 Solve(OutputMeshType * oMesh,
\r
139 const NodeType & iId,
\r
140 const OutputPointType & iCurrentPoint,
\r
141 const OutputVectorRealType & iF,
\r
142 const NodeType & iId1,
\r
143 const OutputPointType & iP1,
\r
144 const bool & iIsFar1,
\r
145 const OutputVectorRealType iVal1,
\r
146 const NodeType & iId2,
\r
147 const OutputPointType & iP2,
\r
148 const bool & iIsFar2,
\r
149 const OutputVectorRealType & iVal2) const;
\r
152 const OutputVectorRealType
\r
153 ComputeUpdate(const OutputVectorRealType & iVal1,
\r
154 const OutputVectorRealType & iVal2,
\r
155 const OutputVectorRealType & iNorm1,
\r
156 const OutputVectorRealType & iSqNorm1,
\r
157 const OutputVectorRealType & iNorm2,
\r
158 const OutputVectorRealType & iSqNorm2,
\r
159 const OutputVectorRealType & iDot,
\r
160 const OutputVectorRealType & iF) const;
\r
163 UnfoldTriangle(OutputMeshType * oMesh,
\r
164 const OutputPointIdentifierType & iId,
\r
165 const OutputPointType & iP,
\r
166 const OutputPointIdentifierType & iId1,
\r
167 const OutputPointType & iP1,
\r
168 const OutputPointIdentifierType & iId2,
\r
169 const OutputPointType & iP2,
\r
170 OutputVectorRealType & oNorm,
\r
171 OutputVectorRealType & oSqNorm,
\r
172 OutputVectorRealType & oDot1,
\r
173 OutputVectorRealType & oDot2,
\r
174 OutputPointIdentifierType & oId) const;
\r
177 CheckTopology(OutputMeshType * oMesh, const NodeType & iNode) override;
\r
180 InitializeOutput(OutputMeshType * oMesh) override;
\r
183 const InputMeshType * m_InputMesh;
\r
184 const InputMeshType * m_BackInputMesh;
\r
188 #ifndef ITK_MANUAL_INSTANTIATION
\r
189 //# include "itkFastMarchingQuadEdgeMeshFilterBase.hxx"
\r
190 # include "itkFastMarchingQuadEdgeMeshFilterResultsBase.hxx"
\r
193 #endif // itkFastMarchingQuadEdgeMeshFilterBase_h
\r