ITK  5.3.0
Insight Toolkit
itkFiniteDifferenceImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 : public InPlaceImageFilter<TInputImage, TOutputImage>
133 {
134 public:
135  ITK_DISALLOW_COPY_AND_MOVE(FiniteDifferenceImageFilter);
136 
142 
145 
147  using InputImageType = TInputImage;
148  using OutputImageType = TOutputImage;
149 
151  static constexpr unsigned int ImageDimension = OutputImageType::ImageDimension;
152 
154  using OutputPixelType = typename TOutputImage::PixelType;
155  using InputPixelType = typename TInputImage::PixelType;
157 
161 
167 
170 
172  itkGetConstReferenceMacro(ElapsedIterations, IdentifierType);
173 
177  itkGetConstReferenceObjectMacro(DifferenceFunction, FiniteDifferenceFunctionType);
178 
182  itkSetObjectMacro(DifferenceFunction, FiniteDifferenceFunctionType);
183 
185  itkSetMacro(NumberOfIterations, IdentifierType);
186  itkGetConstReferenceMacro(NumberOfIterations, IdentifierType);
188 
191  itkSetMacro(UseImageSpacing, bool);
192  itkBooleanMacro(UseImageSpacing);
193  itkGetConstReferenceMacro(UseImageSpacing, bool);
195 
198  itkSetMacro(MaximumRMSError, double);
199  itkGetConstReferenceMacro(MaximumRMSError, double);
201 
204  itkSetMacro(RMSChange, double);
205  itkGetConstReferenceMacro(RMSChange, double);
207 
210  itkSetMacro(ManualReinitialization, bool);
211  itkGetConstReferenceMacro(ManualReinitialization, bool);
212  itkBooleanMacro(ManualReinitialization);
214 
215  itkSetMacro(IsInitialized, bool);
216  itkGetMacro(IsInitialized, bool);
217 
218  void
220  {
221  this->SetIsInitialized(false);
222  }
223  void
225  {
226  this->SetIsInitialized(true);
227  }
228 
229 #ifdef ITK_USE_CONCEPT_CHECKING
230  // Begin concept checking
231  itkConceptMacro(OutputPixelIsFloatingPointCheck, (Concept::IsFloatingPoint<OutputPixelValueType>));
232  // End concept checking
233 #endif
234 
235 protected:
237  ~FiniteDifferenceImageFilter() override = default;
238 
241 
242  void
243  PrintSelf(std::ostream & os, Indent indent) const override;
244 
246  virtual void
247  AllocateUpdateBuffer() = 0;
248 
252  virtual void
253  ApplyUpdate(const TimeStepType & dt) = 0;
254 
260  virtual TimeStepType
261  CalculateChange() = 0;
262 
266  virtual void
267  CopyInputToOutput() = 0;
268 
272  void
273  GenerateData() override;
274 
286  void
287  GenerateInputRequestedRegion() override;
288 
291  virtual bool
292  Halt();
293 
303  virtual bool
304  ThreadedHalt(void * itkNotUsed(threadInfo))
305  {
306  return this->Halt();
307  }
308 
314  virtual void
316  {}
317 
324  virtual void
326  {
327  m_DifferenceFunction->InitializeIteration();
328  }
329 
342  virtual TimeStepType
343  ResolveTimeStep(const std::vector<TimeStepType> & timeStepList, const std::vector<bool> & valid) const;
344 
346  itkSetMacro(ElapsedIterations, IdentifierType);
347 
350  virtual void
352  {}
353 
356 
360 
364 
365  double m_RMSChange;
367 
368 private:
372  void
373  InitializeFunctionCoefficients();
374 
378 
381 };
382 } // end namespace itk
383 
384 #ifndef ITK_MANUAL_INSTANTIATION
385 # include "itkFiniteDifferenceImageFilter.hxx"
386 #endif
387 
388 #endif
itk::FiniteDifferenceImageFilter::PostProcessOutput
virtual void PostProcessOutput()
Definition: itkFiniteDifferenceImageFilter.h:351
itk::FiniteDifferenceImageFilter::InitializeIteration
virtual void InitializeIteration()
Definition: itkFiniteDifferenceImageFilter.h:325
itk::FiniteDifferenceImageFilter::m_NumberOfIterations
IdentifierType m_NumberOfIterations
Definition: itkFiniteDifferenceImageFilter.h:355
itk::FiniteDifferenceFunction::RadiusType
typename ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
Definition: itkFiniteDifferenceFunction.h:97
itk::FiniteDifferenceImageFilter::SetStateToInitialized
void SetStateToInitialized()
Definition: itkFiniteDifferenceImageFilter.h:224
itk::InPlaceImageFilter
Base class for filters that take an image as input and overwrite that image as the output.
Definition: itkInPlaceImageFilter.h:77
itk::FiniteDifferenceImageFilter< TInputImageType, TSparseOutputImageType >::TimeStepType
typename FiniteDifferenceFunctionType::TimeStepType TimeStepType
Definition: itkFiniteDifferenceImageFilter.h:166
itk::Vector
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
itk::FiniteDifferenceImageFilter::m_DifferenceFunction
FiniteDifferenceFunctionType::Pointer m_DifferenceFunction
Definition: itkFiniteDifferenceImageFilter.h:380
itk::FiniteDifferenceImageFilter< TInputImageType, TSparseOutputImageType >::InputPixelValueType
typename NumericTraits< InputPixelType >::ValueType InputPixelValueType
Definition: itkFiniteDifferenceImageFilter.h:160
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::FiniteDifferenceImageFilter::m_ManualReinitialization
bool m_ManualReinitialization
Definition: itkFiniteDifferenceImageFilter.h:363
itk::FiniteDifferenceImageFilter::m_ElapsedIterations
IdentifierType m_ElapsedIterations
Definition: itkFiniteDifferenceImageFilter.h:359
itkFiniteDifferenceFunction.h
itk::FiniteDifferenceImageFilter< TInputImageType, TSparseOutputImageType >::NeighborhoodScalesType
typename FiniteDifferenceFunctionType::NeighborhoodScalesType NeighborhoodScalesType
Definition: itkFiniteDifferenceImageFilter.h:169
itk::FiniteDifferenceImageFilter< TInputImageType, TSparseOutputImageType >::RadiusType
typename FiniteDifferenceFunctionType::RadiusType RadiusType
Definition: itkFiniteDifferenceImageFilter.h:168
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::FiniteDifferenceImageFilter< TInputImageType, TSparseOutputImageType >::OutputPixelValueType
typename NumericTraits< OutputPixelType >::ValueType OutputPixelValueType
Definition: itkFiniteDifferenceImageFilter.h:159
itk::FiniteDifferenceImageFilter::m_MaximumRMSError
double m_MaximumRMSError
Definition: itkFiniteDifferenceImageFilter.h:366
itk::FiniteDifferenceImageFilter< TInputImageType, TSparseOutputImageType >::OutputPixelType
typename TSparseOutputImageType ::PixelType OutputPixelType
Definition: itkFiniteDifferenceImageFilter.h:154
itk::FiniteDifferenceImageFilter::Initialize
virtual void Initialize()
Definition: itkFiniteDifferenceImageFilter.h:315
itk::Concept::IsFloatingPoint
Definition: itkConceptChecking.h:946
itk::FiniteDifferenceImageFilter::ThreadedHalt
virtual bool ThreadedHalt(void *)
Definition: itkFiniteDifferenceImageFilter.h:304
itk::FiniteDifferenceImageFilter::m_UseImageSpacing
bool m_UseImageSpacing
Definition: itkFiniteDifferenceImageFilter.h:377
itk::ImageToImageFilter< TInputImageType, TSparseOutputImageType >::InputImageType
TInputImageType InputImageType
Definition: itkImageToImageFilter.h:129
itk::FiniteDifferenceImageFilter
Definition: itkFiniteDifferenceImageFilter.h:132
itk::FiniteDifferenceImageFilter< TInputImageType, TSparseOutputImageType >::PixelType
OutputPixelType PixelType
Definition: itkFiniteDifferenceImageFilter.h:156
itk::FiniteDifferenceImageFilter::SetStateToUninitialized
void SetStateToUninitialized()
Definition: itkFiniteDifferenceImageFilter.h:219
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkInPlaceImageFilter.h
itk::FiniteDifferenceImageFilter::m_RMSChange
double m_RMSChange
Definition: itkFiniteDifferenceImageFilter.h:365
itk::FiniteDifferenceFunction
Definition: itkFiniteDifferenceFunction.h:66
itk::FiniteDifferenceImageFilter< TInputImageType, TSparseOutputImageType >::InputPixelType
typename TInputImageType ::PixelType InputPixelType
Definition: itkFiniteDifferenceImageFilter.h:155
itk::IdentifierType
SizeValueType IdentifierType
Definition: itkIntTypes.h:87
itk::FiniteDifferenceImageFilter::m_IsInitialized
bool m_IsInitialized
Definition: itkFiniteDifferenceImageFilter.h:240
itk::ImageSource< TSparseOutputImageType >::OutputImageType
TSparseOutputImageType OutputImageType
Definition: itkImageSource.h:90
itk::FiniteDifferenceFunction::TimeStepType
double TimeStepType
Definition: itkFiniteDifferenceFunction.h:90