]> Creatis software - bbtk.git/blob - packages/itkvtk/src/itkFastMarchingQuadEdgeMeshFilterResultsBase.h
#3501 Geodesic Deformation
[bbtk.git] / packages / itkvtk / src / itkFastMarchingQuadEdgeMeshFilterResultsBase.h
1 /*=========================================================================\r
2  *\r
3  *  Copyright NumFOCUS\r
4  *\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
8  *\r
9  *         http://www.apache.org/licenses/LICENSE-2.0.txt\r
10  *\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
16  *\r
17  *=========================================================================*/\r
18 \r
19 #ifndef itkFastMarchingQuadEdgeMeshFilterBase_h\r
20 #define itkFastMarchingQuadEdgeMeshFilterBase_h\r
21 \r
22 #include "itkFastMarchingBase.h"\r
23 #include "itkFastMarchingTraits.h"\r
24 \r
25 namespace itk\r
26 {\r
27 /**\r
28  *\class FastMarchingQuadEdgeMeshFilterBase\r
29   \brief Fast Marching Method on QuadEdgeMesh\r
30 \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
34 \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
37 \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
41 \r
42   \ingroup ITKFastMarching\r
43 */\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
47 {\r
48 public:\r
49   //ITK_DISALLOW_COPY_AND_MOVE(FastMarchingQuadEdgeMeshFilterBase);\r
50   ITK_DISALLOW_COPY_AND_MOVE(FastMarchingQuadEdgeMeshFilterResultsBase);\r
51 \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
58 \r
59   /** Method for creation through the object factory. */\r
60   itkNewMacro(Self);\r
61 \r
62   /** Run-time type information (and related methods). */\r
63   //itkTypeMacro(FastMarchingQuadEdgeMeshFilterBase, FastMarchingBase);\r
64   itkTypeMacro(FastMarchingQuadEdgeMeshFilterResultsBase, FastMarchingBase);\r
65 \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
71 \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
85 \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
90 \r
91 \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
97 \r
98   //  using NodeContainerType = typename Traits::NodeContainerType;\r
99   //  using NodeContainerPointer = typename Traits::NodeContainerPointer;\r
100   //  using NodeContainerConstIterator = typename Traits::NodeContainerConstIterator;\r
101 \r
102   using LabelType = typename Superclass::LabelType;\r
103 \r
104   using NodeLabelMapType = std::map<NodeType, LabelType>;\r
105   using NodeLabelMapIterator = typename NodeLabelMapType::iterator;\r
106   using NodeLabelMapConstIterator = typename NodeLabelMapType::const_iterator;\r
107 \r
108 protected:\r
109   //FastMarchingQuadEdgeMeshFilterBase();\r
110   FastMarchingQuadEdgeMeshFilterResultsBase();\r
111   //~FastMarchingQuadEdgeMeshFilterBase() override = default;\r
112   ~FastMarchingQuadEdgeMeshFilterResultsBase() override = default;\r
113 \r
114   NodeLabelMapType m_Label;\r
115 \r
116   IdentifierType\r
117   GetTotalNumberOfNodes() const override;\r
118 \r
119   void\r
120   SetOutputValue(OutputMeshType * oMesh, const NodeType & iNode, const OutputPixelType & iValue) override;\r
121 \r
122   const OutputPixelType\r
123   GetOutputValue(OutputMeshType * oMesh, const NodeType & iNode) const override;\r
124 \r
125   unsigned char\r
126   GetLabelValueForGivenNode(const NodeType & iNode) const override;\r
127 \r
128   void\r
129   SetLabelValueForGivenNode(const NodeType & iNode, const LabelType & iLabel) override;\r
130 \r
131   void\r
132   UpdateNeighbors(OutputMeshType * oMesh, const NodeType & iNode) override;\r
133 \r
134   void\r
135   UpdateValue(OutputMeshType * oMesh, const NodeType & iNode) override;\r
136 \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
150 \r
151 \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
161 \r
162   bool\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
175 \r
176   bool\r
177   CheckTopology(OutputMeshType * oMesh, const NodeType & iNode) override;\r
178 \r
179   void\r
180   InitializeOutput(OutputMeshType * oMesh) override;\r
181 \r
182 private:\r
183   const InputMeshType * m_InputMesh;\r
184   const InputMeshType * m_BackInputMesh;\r
185 };\r
186 } // namespace itk\r
187 \r
188 #ifndef ITK_MANUAL_INSTANTIATION\r
189 //#  include "itkFastMarchingQuadEdgeMeshFilterBase.hxx"\r
190 #  include "itkFastMarchingQuadEdgeMeshFilterResultsBase.hxx"\r
191 #endif\r
192 \r
193 #endif // itkFastMarchingQuadEdgeMeshFilterBase_h\r