ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkFastMarchingImageFilterBase.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 __itkFastMarchingImageFilterBase_h
20 #define __itkFastMarchingImageFilterBase_h
21 
22 #include "itkFastMarchingBase.h"
25 #include "itkArray.h"
26 
27 namespace itk
28 {
70 template< class TInput, class TOutput >
72  public FastMarchingBase< TInput, TOutput >
73  {
74 public:
79  typedef typename Superclass::Traits Traits;
81 
83  itkNewMacro(Self);
84 
87 
88 
92 
96  typedef typename OutputImageType::SpacingType OutputSpacingType;
97  typedef typename OutputImageType::SizeType OutputSizeType;
98  typedef typename OutputImageType::RegionType OutputRegionType;
99  typedef typename OutputImageType::PointType OutputPointType;
100  typedef typename OutputImageType::DirectionType OutputDirectionType;
101 
102  typedef typename Traits::NodeType NodeType;
103  typedef typename Traits::NodePairType NodePairType;
104  typedef typename Traits::NodePairContainerType NodePairContainerType;
105  typedef typename Traits::NodePairContainerPointer NodePairContainerPointer;
106  typedef typename Traits::NodePairContainerConstIterator
108 
109  /*
110  typedef typename Superclass::ElementIdentifier ElementIdentifier;
111 
112  typedef typename Superclass::PriorityQueueElementType PriorityQueueElementType;
113 
114  typedef typename Superclass::PriorityQueueType PriorityQueueType;
115  typedef typename Superclass::PriorityQueuePointer PriorityQueuePointer;
116  */
117 
119 
120  itkStaticConstMacro( ImageDimension, unsigned int, Traits::ImageDimension );
121 
124 
128 
131 
132  itkGetModifiableObjectMacro(LabelImage, LabelImageType );
133 
141  virtual void SetOutputSize(const OutputSizeType & size)
142  { m_OutputRegion = size; }
144  { return m_OutputRegion.GetSize(); }
145  itkSetMacro(OutputRegion, OutputRegionType);
146  itkGetConstReferenceMacro(OutputRegion, OutputRegionType);
147  itkSetMacro(OutputSpacing, OutputSpacingType);
148  itkGetConstReferenceMacro(OutputSpacing, OutputSpacingType);
149  itkSetMacro(OutputDirection, OutputDirectionType);
150  itkGetConstReferenceMacro(OutputDirection, OutputDirectionType);
151  itkSetMacro(OutputOrigin, OutputPointType);
152  itkGetConstReferenceMacro(OutputOrigin, OutputPointType);
153  itkSetMacro(OverrideOutputInformation, bool);
154  itkGetConstReferenceMacro(OverrideOutputInformation, bool);
155  itkBooleanMacro(OverrideOutputInformation);
157 
158 protected:
159 
162 
165 
166  class InternalNodeStructure;
167 
171 
177 
179  virtual void GenerateOutputInformation();
180 
181  virtual void EnlargeOutputRequestedRegion(DataObject *output);
182 
185 
187 
188  void SetOutputValue( OutputImageType* oDomain,
189  const NodeType& iNode,
190  const OutputPixelType& iValue );
191 
194  const NodeType& iNode ) const;
195 
197  unsigned char
198  GetLabelValueForGivenNode( const NodeType& iNode ) const;
199 
201  void SetLabelValueForGivenNode( const NodeType& iNode,
202  const LabelType& iLabel );
203 
205  virtual void UpdateNeighbors( OutputImageType* oImage,
206  const NodeType& iNode );
207 
209  virtual void UpdateValue( OutputImageType* oImage,
210  const NodeType& iValue );
211 
213  bool CheckTopology( OutputImageType* oImage,
214  const NodeType& iNode );
215  void InitializeOutput( OutputImageType* oImage );
217 
220  const NodeType& iNode,
221  std::vector< InternalNodeStructure >& ioNodesUsed );
222 
224  double Solve( OutputImageType* oImage,
225  const NodeType& iNode,
226  std::vector< InternalNodeStructure >& ioNeighbors ) const;
227 
228  // --------------------------------------------------------------------------
229  // --------------------------------------------------------------------------
230 
235  // Functions/data for the 2-D case
236  void InitializeIndices2D();
237  bool IsChangeWellComposed2D( const NodeType& ) const;
238  bool IsCriticalC1Configuration2D( const std::vector<bool>& ) const;
239  bool IsCriticalC2Configuration2D( const std::vector<bool>& ) const;
240  bool IsCriticalC3Configuration2D( const std::vector<bool>& ) const;
241  bool IsCriticalC4Configuration2D( const std::vector<bool>& ) const;
242 
245 
246  // Functions/data for the 3-D case
247  void InitializeIndices3D();
248  bool IsCriticalC1Configuration3D( const std::vector<bool>& ) const;
249  unsigned int IsCriticalC2Configuration3D( const std::vector<bool>& ) const;
250  bool IsChangeWellComposed3D( const NodeType& ) const;
251 
254 
255  // Functions for both 2D/3D cases
257  bool DoesVoxelChangeViolateStrictTopology( const NodeType& ) const;
258 
260 
261 private:
262 
264  void operator = ( const Self& );
265  };
266 }
267 
268 #include "itkFastMarchingImageFilterBase.hxx"
269 #endif // __itkFastMarchingImageFilterBase_h
270