ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkFiniteDifferenceImageFilter.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 #ifndef itkFiniteDifferenceImageFilter_h
19 #define itkFiniteDifferenceImageFilter_h
20 
21 #include "itkInPlaceImageFilter.h"
23 
24 namespace itk
25 {
131 template< typename TInputImage, typename TOutputImage >
132 class ITK_TEMPLATE_EXPORT FiniteDifferenceImageFilter:
133  public InPlaceImageFilter< TInputImage, TOutputImage >
134 {
135 public:
136 
142 
145 
147  typedef TInputImage InputImageType;
148  typedef TOutputImage OutputImageType;
149 
151  itkStaticConstMacro(ImageDimension, unsigned int, OutputImageType::ImageDimension);
152 
154  typedef typename TOutputImage::PixelType OutputPixelType;
155  typedef typename TInputImage::PixelType InputPixelType;
157 
161 
167 
170 
172  itkGetConstReferenceMacro(ElapsedIterations, IdentifierType);
173 
177  itkGetConstReferenceObjectMacro(DifferenceFunction,
179 
183  itkSetObjectMacro(DifferenceFunction, FiniteDifferenceFunctionType);
184 
186  itkSetMacro(NumberOfIterations, IdentifierType);
187  itkGetConstReferenceMacro(NumberOfIterations, IdentifierType);
189 
192  itkSetMacro(UseImageSpacing, bool);
193  itkBooleanMacro(UseImageSpacing);
194  itkGetConstReferenceMacro(UseImageSpacing, bool);
196 
199  itkSetMacro(MaximumRMSError, double);
200  itkGetConstReferenceMacro(MaximumRMSError, double);
202 
205  itkSetMacro(RMSChange, double);
206  itkGetConstReferenceMacro(RMSChange, double);
208 
211  itkSetMacro(ManualReinitialization, bool);
212  itkGetConstReferenceMacro(ManualReinitialization, bool);
213  itkBooleanMacro(ManualReinitialization);
215 
216  itkSetMacro( IsInitialized, bool );
217  itkGetMacro( IsInitialized, bool );
218 
219  void SetStateToUninitialized() { this->SetIsInitialized( false ); }
220  void SetStateToInitialized() { this->SetIsInitialized( true ); }
221 
222 #ifdef ITK_USE_STRICT_CONCEPT_CHECKING
223  // Begin concept checking
224  itkConceptMacro( OutputPixelIsFloatingPointCheck,
226  // End concept checking
227 #endif
228 
229 protected:
230 
232  virtual ~FiniteDifferenceImageFilter() ITK_OVERRIDE;
233 
235  bool m_IsInitialized;
236 
237  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
238 
240  virtual void AllocateUpdateBuffer() = 0;
241 
245  virtual void ApplyUpdate(const TimeStepType& dt) = 0;
246 
252  virtual TimeStepType CalculateChange() = 0;
253 
257  virtual void CopyInputToOutput() = 0;
258 
262  virtual void GenerateData() ITK_OVERRIDE;
263 
275  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
276 
279  virtual bool Halt();
280 
290  virtual bool ThreadedHalt( void *itkNotUsed(threadInfo) ) { return this->Halt(); }
291 
297  virtual void Initialize() {}
298 
305  virtual void InitializeIteration()
306  { m_DifferenceFunction->InitializeIteration(); }
307 
320  virtual TimeStepType ResolveTimeStep(const std::vector< TimeStepType >& timeStepList,
321  const std::vector< bool >& valid ) const;
322 
324  itkSetMacro(ElapsedIterations, IdentifierType);
325 
328  virtual void PostProcessOutput() {}
329 
332 
336 
340 
341  double m_RMSChange;
343 
344 private:
345  ITK_DISALLOW_COPY_AND_ASSIGN(FiniteDifferenceImageFilter);
346 
350  void InitializeFunctionCoefficients();
351 
355 
358 };
359 } // end namespace itk
360 
361 #ifndef ITK_MANUAL_INSTANTIATION
362 #include "itkFiniteDifferenceImageFilter.hxx"
363 #endif
364 
365 #endif
NumericTraits< InputPixelType >::ValueType InputPixelValueType
ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
InPlaceImageFilter< TInputImage, TOutputImage > Superclass
SizeValueType IdentifierType
Definition: itkIntTypes.h:147
FiniteDifferenceFunctionType::NeighborhoodScalesType NeighborhoodScalesType
NumericTraits< OutputPixelType >::ValueType OutputPixelValueType
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
FiniteDifferenceFunctionType::RadiusType RadiusType
FiniteDifferenceFunctionType::Pointer m_DifferenceFunction
FiniteDifferenceFunctionType::TimeStepType TimeStepType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
FiniteDifferenceFunction< TOutputImage > FiniteDifferenceFunctionType
Define additional traits for native types such as int or float.
Base class for filters that take an image as input and overwrite that image as the output...
#define itkConceptMacro(name, concept)