ITK  4.8.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 >
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 
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();
225 
227 
231 
235 
240 
242 
243  //PriorityQueuePointer m_Heap;
244  typedef std::vector< NodePairType > HeapContainerType;
245  typedef std::greater< NodePairType > NodeComparerType;
246 
247  typedef std::priority_queue<
248  NodeType,
252 
254 
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  FastMarchingBase( const Self& );
316  void operator = ( const Self& );
317  };
318 }
319 
320 #include "itkFastMarchingBase.hxx"
321 #endif
void GenerateData() override
std::vector< NodePairType > HeapContainerType
NodePairContainerPointer m_ProcessedPoints
virtual void UpdateNeighbors(OutputDomainType *oDomain, const NodeType &iNode)=0
Update neighbors to a given node.
Traits::SuperclassType SuperclassType
PriorityQueueType m_Heap
Traits::NodePairContainerConstIterator NodePairContainerConstIterator
NodePairContainerPointer m_AlivePoints
OutputPixelType m_LargeValue
virtual bool CheckTopology(OutputDomainType *oDomain, const NodeType &iNode)=0
Check if the current node violate topological criterion.
TopologyCheckType m_TopologyCheck
OutputPixelType m_TopologyValue
SmartPointer< Self > Pointer
Traits::NodePairContainerPointer NodePairContainerPointer
virtual void InitializeOutput(OutputDomainType *oDomain)=0
SizeValueType IdentifierType
Definition: itkIntTypes.h:147
FastMarchingStoppingCriterionBase< TInput, TOutput > StoppingCriterionType
Abstract class to solve an Eikonal based-equation using Fast Marching Method.
virtual IdentifierType GetTotalNumberOfNodes() const =0
Get the total number of nodes in the domain.
Traits::OutputDomainPointer OutputDomainPointer
void PrintSelf(std::ostream &os, Indent indent) const override
PrintSelf method.
FastMarchingBase()
Constructor.
std::greater< NodePairType > NodeComparerType
Traits::InputDomainType InputDomainType
StoppingCriterionPointer m_StoppingCriterion
Traits::InputPixelType InputPixelType
Traits::NodePairContainerType NodePairContainerType
Traits::NodePairType NodePairType
NodePairContainerPointer m_TrialPoints
Traits::OutputPixelType OutputPixelType
NodePairContainerPointer m_ForbiddenPoints
virtual ~FastMarchingBase()
Destructor.
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.
void Initialize(OutputDomainType *oDomain)
Base class traits to be used by the FastMarchingBase.
virtual void SetLabelValueForGivenNode(const NodeType &iNode, const LabelType &iLabel)=0
Set the Label Value for a given node.
virtual const OutputPixelType GetOutputValue(OutputDomainType *oDomain, const NodeType &iNode) const =0
Get the ouput value (front value) for a given node.
StoppingCriterionType::Pointer StoppingCriterionPointer
Traits::LabelType LabelType
std::priority_queue< NodeType, HeapContainerType, NodeComparerType > PriorityQueueType
Traits::OutputDomainType OutputDomainType
Traits::InputDomainPointer InputDomainPointer
virtual unsigned char GetLabelValueForGivenNode(const NodeType &iNode) const =0
Get the LabelType Value for a given node.
virtual void UpdateValue(OutputDomainType *oDomain, const NodeType &iNode)=0
Update value for a given node.
virtual void SetOutputValue(OutputDomainType *oDomain, const NodeType &iNode, const OutputPixelType &iValue)=0
Set the output value (front value) for a given node.
OutputPixelType m_TargetReachedValue