ITK  4.13.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:
106  typedef typename Traits::SuperclassType SuperclassType;
108 
113 
115  typedef typename Traits::InputDomainType InputDomainType;
116  typedef typename Traits::InputDomainPointer InputDomainPointer;
117  typedef typename Traits::InputPixelType InputPixelType;
118 
120  typedef typename Traits::OutputDomainType OutputDomainType;
121  typedef typename Traits::OutputDomainPointer OutputDomainPointer;
122  typedef typename Traits::OutputPixelType OutputPixelType;
123 
125  typedef typename Traits::NodeType NodeType;
126 
128  typedef typename Traits::NodePairType NodePairType;
129  typedef typename Traits::NodePairContainerType NodePairContainerType;
130  typedef typename Traits::NodePairContainerPointer NodePairContainerPointer;
131  typedef typename Traits::NodePairContainerConstIterator
133 
134  typedef typename Traits::LabelType LabelType;
135 
139 
140  /*
141  typedef long ElementIdentifier;
142 
143  typedef MinPriorityQueueElementWrapper< NodeType,
144  OutputPixelType,
145  ElementIdentifier > PriorityQueueElementType;
146 
147  typedef PriorityQueueContainer< PriorityQueueElementType,
148  PriorityQueueElementType,
149  OutputPixelType,
150  ElementIdentifier > PriorityQueueType;
151  typedef typename PriorityQueueType::Pointer PriorityQueuePointer;
152  */
153 
156 
158  Nothing = 0,
159 
162 
164  Strict };
165 
168  itkSetMacro( TopologyCheck, TopologyCheckType );
169  itkGetConstReferenceMacro( TopologyCheck, TopologyCheckType );
171 
173  itkSetObjectMacro( TrialPoints, NodePairContainerType );
174  itkGetModifiableObjectMacro(TrialPoints, NodePairContainerType );
176 
178  itkSetObjectMacro( AlivePoints, NodePairContainerType );
179  itkGetModifiableObjectMacro(AlivePoints, NodePairContainerType );
181 
183  itkSetObjectMacro( ProcessedPoints, NodePairContainerType );
184  itkGetModifiableObjectMacro(ProcessedPoints, NodePairContainerType );
186 
188  itkSetObjectMacro( ForbiddenPoints, NodePairContainerType );
189  itkGetModifiableObjectMacro(ForbiddenPoints, NodePairContainerType );
191 
193  itkSetObjectMacro( StoppingCriterion, StoppingCriterionType );
194  itkGetModifiableObjectMacro(StoppingCriterion, StoppingCriterionType );
195 
197  itkGetMacro( SpeedConstant, double );
198  itkSetMacro( SpeedConstant, double );
199 
201  itkGetMacro( NormalizationFactor, double );
202  itkSetMacro( NormalizationFactor, double );
203 
205  itkGetMacro( TargetReachedValue, OutputPixelType );
206 
211  itkSetMacro(CollectPoints, bool);
212 
214  itkGetConstReferenceMacro(CollectPoints, bool);
215  itkBooleanMacro(CollectPoints);
217 
218 protected:
219 
222 
224  virtual ~FastMarchingBase() ITK_OVERRIDE;
225 
226  StoppingCriterionPointer m_StoppingCriterion;
227 
228  double m_SpeedConstant;
229  double m_InverseSpeed;
230  double m_NormalizationFactor;
231 
232  OutputPixelType m_TargetReachedValue;
233  OutputPixelType m_LargeValue;
234  OutputPixelType m_TopologyValue;
235 
238  NodePairContainerPointer m_ProcessedPoints;
239  NodePairContainerPointer m_ForbiddenPoints;
240 
241  bool m_CollectPoints;
242 
243  //PriorityQueuePointer m_Heap;
244  typedef std::vector< NodePairType > HeapContainerType;
245  typedef std::greater< NodePairType > NodeComparerType;
246 
247  typedef std::priority_queue<
248  NodePairType,
249  HeapContainerType,
250  NodeComparerType >
252 
254 
255  TopologyCheckType m_TopologyCheck;
256 
258  virtual IdentifierType GetTotalNumberOfNodes() const = 0;
259 
261  virtual const OutputPixelType GetOutputValue( OutputDomainType* oDomain,
262  const NodeType& iNode ) const = 0;
263 
265  virtual void SetOutputValue( OutputDomainType* oDomain,
266  const NodeType& iNode,
267  const OutputPixelType& iValue ) = 0;
268 
272  virtual unsigned char
273  GetLabelValueForGivenNode( const NodeType& iNode ) const = 0;
274 
278  virtual void SetLabelValueForGivenNode( const NodeType& iNode,
279  const LabelType& iLabel ) = 0;
280 
285  virtual void UpdateNeighbors( OutputDomainType* oDomain,
286  const NodeType& iNode ) = 0;
287 
292  virtual void UpdateValue( OutputDomainType* oDomain,
293  const NodeType& iNode ) = 0;
294 
299  virtual bool CheckTopology( OutputDomainType* oDomain,
300  const NodeType& iNode ) = 0;
301 
303  void Initialize( OutputDomainType* oDomain );
304 
306  virtual void InitializeOutput( OutputDomainType* oDomain ) = 0;
307 
309  void GenerateData() ITK_OVERRIDE;
310 
312  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
313 
314 private:
315  ITK_DISALLOW_COPY_AND_ASSIGN(FastMarchingBase);
316  };
317 }
318 
319 #ifndef ITK_MANUAL_INSTANTIATION
320 #include "itkFastMarchingBase.hxx"
321 #endif
322 
323 #endif
std::vector< NodePairType > HeapContainerType
Traits::SuperclassType SuperclassType
Traits::NodePairContainerConstIterator NodePairContainerConstIterator
std::priority_queue< NodePairType, HeapContainerType, NodeComparerType > PriorityQueueType
SmartPointer< Self > Pointer
Traits::NodePairContainerPointer NodePairContainerPointer
SizeValueType IdentifierType
Definition: itkIntTypes.h:147
FastMarchingStoppingCriterionBase< TInput, TOutput > StoppingCriterionType
Abstract class to solve an Eikonal based-equation using Fast Marching Method.
Traits::OutputDomainPointer OutputDomainPointer
std::greater< NodePairType > NodeComparerType
Traits::InputDomainType InputDomainType
Traits::InputPixelType InputPixelType
Traits::NodePairContainerType NodePairContainerType
Traits::NodePairType NodePairType
Traits::OutputPixelType OutputPixelType
FastMarchingTraits< TInput, TOutput > Traits
SmartPointer< const Self > ConstPointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Abstract Stopping Criterion dedicated for Fast Marching Methods.
Base class traits to be used by the FastMarchingBase.
StoppingCriterionType::Pointer StoppingCriterionPointer
Traits::LabelType LabelType
Traits::OutputDomainType OutputDomainType
Traits::InputDomainPointer InputDomainPointer