ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkFastMarchingBase.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef itkFastMarchingBase_h
20 #define itkFastMarchingBase_h
21 
22 #include "itkIntTypes.h"
24 #include "itkFastMarchingTraits.h"
25 
26 #include <queue>
27 #include <functional>
28 
29 namespace itk
30 {
101 template< typename TInput, typename TOutput >
102 class ITK_TEMPLATE_EXPORT FastMarchingBase : public FastMarchingTraits<TInput, TOutput>::SuperclassType
103  {
104 public:
105  ITK_DISALLOW_COPY_AND_ASSIGN(FastMarchingBase);
106 
108  using SuperclassType = typename Traits::SuperclassType;
109 
114 
116  itkTypeMacro(FastMarchingBase, FastMarchingTraits);
117 
119  using InputDomainType = typename Traits::InputDomainType;
120  using InputDomainPointer = typename Traits::InputDomainPointer;
121  using InputPixelType = typename Traits::InputPixelType;
122 
124  using OutputDomainType = typename Traits::OutputDomainType;
125  using OutputDomainPointer = typename Traits::OutputDomainPointer;
126  using OutputPixelType = typename Traits::OutputPixelType;
127 
129  using NodeType = typename Traits::NodeType;
130 
132  using NodePairType = typename Traits::NodePairType;
133  using NodePairContainerType = typename Traits::NodePairContainerType;
134  using NodePairContainerPointer = typename Traits::NodePairContainerPointer;
135  using NodePairContainerConstIterator = typename Traits::NodePairContainerConstIterator;
136 
137  using LabelType = typename Traits::LabelType;
138 
140  using StoppingCriterionType = FastMarchingStoppingCriterionBase< TInput, TOutput >;
141  using StoppingCriterionPointer = typename StoppingCriterionType::Pointer;
142 
143  /*
144  using ElementIdentifier = long;
145 
146  using PriorityQueueElementType = MinPriorityQueueElementWrapper< NodeType,
147  OutputPixelType,
148  ElementIdentifier >;
149 
150  using PriorityQueueType = PriorityQueueContainer< PriorityQueueElementType,
151  PriorityQueueElementType, OutputPixelType, ElementIdentifier >;
152  using PriorityQueuePointer = typename PriorityQueueType::Pointer;
153  */
154 
157 
159  Nothing = 0,
160 
163 
165  Strict };
166 
169  itkSetMacro( TopologyCheck, TopologyCheckType );
170  itkGetConstReferenceMacro( TopologyCheck, TopologyCheckType );
172 
174  itkSetObjectMacro( TrialPoints, NodePairContainerType );
175  itkGetModifiableObjectMacro(TrialPoints, NodePairContainerType );
177 
179  itkSetObjectMacro( AlivePoints, NodePairContainerType );
180  itkGetModifiableObjectMacro(AlivePoints, NodePairContainerType );
182 
184  itkSetObjectMacro( ProcessedPoints, NodePairContainerType );
185  itkGetModifiableObjectMacro(ProcessedPoints, NodePairContainerType );
187 
189  itkSetObjectMacro( ForbiddenPoints, NodePairContainerType );
190  itkGetModifiableObjectMacro(ForbiddenPoints, NodePairContainerType );
192 
194  itkSetObjectMacro( StoppingCriterion, StoppingCriterionType );
195  itkGetModifiableObjectMacro(StoppingCriterion, StoppingCriterionType );
196 
198  itkGetMacro( SpeedConstant, double );
199  itkSetMacro( SpeedConstant, double );
200 
202  itkGetMacro( NormalizationFactor, double );
203  itkSetMacro( NormalizationFactor, double );
204 
206  itkGetMacro( TargetReachedValue, OutputPixelType );
207 
212  itkSetMacro(CollectPoints, bool);
213 
215  itkGetConstReferenceMacro(CollectPoints, bool);
216  itkBooleanMacro(CollectPoints);
218 
219 protected:
220 
223 
225  ~FastMarchingBase() override = default;
226 
228 
232 
236 
241 
243 
244  //PriorityQueuePointer m_Heap;
245  using HeapContainerType = std::vector< NodePairType >;
246  using NodeComparerType = std::greater< NodePairType >;
247 
248  using PriorityQueueType = std::priority_queue<
250 
252 
254 
256  virtual IdentifierType GetTotalNumberOfNodes() const = 0;
257 
259  virtual const OutputPixelType GetOutputValue( OutputDomainType* oDomain,
260  const NodeType& iNode ) const = 0;
261 
263  virtual void SetOutputValue( OutputDomainType* oDomain,
264  const NodeType& iNode,
265  const OutputPixelType& iValue ) = 0;
266 
270  virtual unsigned char
271  GetLabelValueForGivenNode( const NodeType& iNode ) const = 0;
272 
276  virtual void SetLabelValueForGivenNode( const NodeType& iNode,
277  const LabelType& iLabel ) = 0;
278 
283  virtual void UpdateNeighbors( OutputDomainType* oDomain,
284  const NodeType& iNode ) = 0;
285 
290  virtual void UpdateValue( OutputDomainType* oDomain,
291  const NodeType& iNode ) = 0;
292 
297  virtual bool CheckTopology( OutputDomainType* oDomain,
298  const NodeType& iNode ) = 0;
299 
301  void Initialize( OutputDomainType* oDomain );
302 
304  virtual void InitializeOutput( OutputDomainType* oDomain ) = 0;
305 
307  void GenerateData() override;
308 
310  void PrintSelf(std::ostream & os, Indent indent) const override;
311  };
312 }
313 
314 #ifndef ITK_MANUAL_INSTANTIATION
315 #include "itkFastMarchingBase.hxx"
316 #endif
317 
318 #endif
typename Traits::LabelType LabelType
NodePairContainerPointer m_ProcessedPoints
typename StoppingCriterionType::Pointer StoppingCriterionPointer
typename Traits::NodeType NodeType
typename Traits::NodePairContainerConstIterator NodePairContainerConstIterator
PriorityQueueType m_Heap
NodePairContainerPointer m_AlivePoints
typename Traits::OutputPixelType OutputPixelType
OutputPixelType m_LargeValue
std::vector< NodePairType > HeapContainerType
typename Traits::InputDomainType InputDomainType
typename Traits::NodePairType NodePairType
std::greater< NodePairType > NodeComparerType
TopologyCheckType m_TopologyCheck
OutputPixelType m_TopologyValue
FastMarchingStoppingCriterionBase< TInput, TOutput > StoppingCriterionType
typename Traits::SuperclassType SuperclassType
typename Traits::OutputDomainPointer OutputDomainPointer
Abstract class to solve an Eikonal based-equation using Fast Marching Method.
typename FastMarchingTraits< TInput, TOutput >::SuperclassType Superclass
SizeValueType IdentifierType
Definition: itkIntTypes.h:87
typename Traits::NodePairContainerType NodePairContainerType
StoppingCriterionPointer m_StoppingCriterion
std::priority_queue< NodePairType, HeapContainerType, NodeComparerType > PriorityQueueType
NodePairContainerPointer m_TrialPoints
typename Traits::InputPixelType InputPixelType
typename Traits::InputDomainPointer InputDomainPointer
NodePairContainerPointer m_ForbiddenPoints
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class traits to be used by the FastMarchingBase.
typename Traits::OutputDomainType OutputDomainType
OutputPixelType m_TargetReachedValue
typename Traits::NodePairContainerPointer NodePairContainerPointer