ITK  4.2.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 
28 namespace itk
29 {
100 template< class TInput, class TOutput >
102  {
103 public:
105  typedef typename Traits::SuperclassType SuperclassType;
107 
112 
114  typedef typename Traits::InputDomainType InputDomainType;
115  typedef typename Traits::InputDomainPointer InputDomainPointer;
116  typedef typename Traits::InputPixelType InputPixelType;
117 
119  typedef typename Traits::OutputDomainType OutputDomainType;
120  typedef typename Traits::OutputDomainPointer OutputDomainPointer;
121  typedef typename Traits::OutputPixelType OutputPixelType;
122 
124  typedef typename Traits::NodeType NodeType;
125 
127  typedef typename Traits::NodePairType NodePairType;
128  typedef typename Traits::NodePairContainerType NodePairContainerType;
129  typedef typename Traits::NodePairContainerPointer NodePairContainerPointer;
130  typedef typename Traits::NodePairContainerConstIterator
132 
133  typedef typename Traits::LabelType LabelType;
134 
138 
139  /*
140  typedef long ElementIdentifier;
141 
142  typedef MinPriorityQueueElementWrapper< NodeType,
143  OutputPixelType,
144  ElementIdentifier > PriorityQueueElementType;
145 
146  typedef PriorityQueueContainer< PriorityQueueElementType,
147  PriorityQueueElementType,
148  OutputPixelType,
149  ElementIdentifier > PriorityQueueType;
150  typedef typename PriorityQueueType::Pointer PriorityQueuePointer;
151  */
152 
155 
157  Nothing = 0,
158 
161 
164 
167  itkSetMacro( TopologyCheck, TopologyCheckType );
168  itkGetConstReferenceMacro( TopologyCheck, TopologyCheckType );
170 
172  itkSetObjectMacro( TrialPoints, NodePairContainerType );
173  itkGetObjectMacro( TrialPoints, NodePairContainerType );
175 
177  itkSetObjectMacro( AlivePoints, NodePairContainerType );
178  itkGetObjectMacro( AlivePoints, NodePairContainerType );
180 
182  itkSetObjectMacro( ProcessedPoints, NodePairContainerType );
183  itkGetObjectMacro( ProcessedPoints, NodePairContainerType );
185 
187  itkSetObjectMacro( ForbiddenPoints, NodePairContainerType );
188  itkGetObjectMacro( ForbiddenPoints, NodePairContainerType );
190 
192  itkGetObjectMacro( StoppingCriterion, StoppingCriterionType );
193  itkSetObjectMacro( StoppingCriterion, StoppingCriterionType );
194 
196  itkGetMacro( SpeedConstant, double );
197  itkSetMacro( SpeedConstant, double );
198 
200  itkGetMacro( NormalizationFactor, double );
201  itkSetMacro( NormalizationFactor, double );
202 
204  itkGetMacro( TargetReachedValue, OutputPixelType );
205 
210  itkSetMacro(CollectPoints, bool);
211 
213  itkGetConstReferenceMacro(CollectPoints, bool);
214  itkBooleanMacro(CollectPoints);
216 
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();
310 
312  void PrintSelf(std::ostream & os, Indent indent) const;
313 
314 private:
315  FastMarchingBase( const Self& );
316  void operator = ( const Self& );
317  };
318 }
319 
320 #include "itkFastMarchingBase.hxx"
321 #endif
322