ITK  5.0.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  ITK_DISALLOW_COPY_AND_ASSIGN(FiniteDifferenceImageFilter);
137 
143 
146 
148  using InputImageType = TInputImage;
149  using OutputImageType = TOutputImage;
150 
152  static constexpr unsigned int ImageDimension = OutputImageType::ImageDimension;
153 
155  using OutputPixelType = typename TOutputImage::PixelType;
156  using InputPixelType = typename TInputImage::PixelType;
158 
162 
168 
171 
173  itkGetConstReferenceMacro(ElapsedIterations, IdentifierType);
174 
178  itkGetConstReferenceObjectMacro(DifferenceFunction,
180 
184  itkSetObjectMacro(DifferenceFunction, FiniteDifferenceFunctionType);
185 
187  itkSetMacro(NumberOfIterations, IdentifierType);
188  itkGetConstReferenceMacro(NumberOfIterations, IdentifierType);
190 
193  itkSetMacro(UseImageSpacing, bool);
194  itkBooleanMacro(UseImageSpacing);
195  itkGetConstReferenceMacro(UseImageSpacing, bool);
197 
200  itkSetMacro(MaximumRMSError, double);
201  itkGetConstReferenceMacro(MaximumRMSError, double);
203 
206  itkSetMacro(RMSChange, double);
207  itkGetConstReferenceMacro(RMSChange, double);
209 
212  itkSetMacro(ManualReinitialization, bool);
213  itkGetConstReferenceMacro(ManualReinitialization, bool);
214  itkBooleanMacro(ManualReinitialization);
216 
217  itkSetMacro( IsInitialized, bool );
218  itkGetMacro( IsInitialized, bool );
219 
220  void SetStateToUninitialized() { this->SetIsInitialized( false ); }
221  void SetStateToInitialized() { this->SetIsInitialized( true ); }
222 
223 #ifdef ITK_USE_CONCEPT_CHECKING
224  // Begin concept checking
225  itkConceptMacro( OutputPixelIsFloatingPointCheck,
227  // End concept checking
228 #endif
229 
230 protected:
231 
233  ~FiniteDifferenceImageFilter() override = default;
234 
237 
238  void PrintSelf(std::ostream & os, Indent indent) const override;
239 
241  virtual void AllocateUpdateBuffer() = 0;
242 
246  virtual void ApplyUpdate(const TimeStepType& dt) = 0;
247 
253  virtual TimeStepType CalculateChange() = 0;
254 
258  virtual void CopyInputToOutput() = 0;
259 
263  void GenerateData() override;
264 
276  void GenerateInputRequestedRegion() override;
277 
280  virtual bool Halt();
281 
291  virtual bool ThreadedHalt( void *itkNotUsed(threadInfo) ) { return this->Halt(); }
292 
298  virtual void Initialize() {}
299 
306  virtual void InitializeIteration()
307  { m_DifferenceFunction->InitializeIteration(); }
308 
321  virtual TimeStepType ResolveTimeStep(const std::vector< TimeStepType >& timeStepList,
322  const std::vector< bool >& valid ) const;
323 
325  itkSetMacro(ElapsedIterations, IdentifierType);
326 
329  virtual void PostProcessOutput() {}
330 
333 
337 
341 
342  double m_RMSChange;
344 
345 private:
349  void InitializeFunctionCoefficients();
350 
354 
357 };
358 } // end namespace itk
359 
360 #ifndef ITK_MANUAL_INSTANTIATION
361 #include "itkFiniteDifferenceImageFilter.hxx"
362 #endif
363 
364 #endif
typename FiniteDifferenceFunctionType::NeighborhoodScalesType NeighborhoodScalesType
Light weight base class for most itk classes.
Define numeric traits for std::vector.
typename ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
SizeValueType IdentifierType
Definition: itkIntTypes.h:87
FiniteDifferenceFunctionType::Pointer m_DifferenceFunction
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for filters that take an image as input and overwrite that image as the output...
#define itkConceptMacro(name, concept)