ITK  6.0.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 * https://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 "itkBooleanStdVector.h"
24
25namespace itk
26{
132template <typename TInputImage, typename TOutputImage>
133class ITK_TEMPLATE_EXPORT FiniteDifferenceImageFilter : public InPlaceImageFilter<TInputImage, TOutputImage>
134{
135public:
136 ITK_DISALLOW_COPY_AND_MOVE(FiniteDifferenceImageFilter);
137
143
145 itkOverrideGetNameOfClassMacro(FiniteDifferenceImageFilter);
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, FiniteDifferenceFunctionType);
179
183 itkSetObjectMacro(DifferenceFunction, FiniteDifferenceFunctionType);
184
186 itkSetMacro(NumberOfIterations, IdentifierType);
187 itkGetConstReferenceMacro(NumberOfIterations, IdentifierType);
192 itkSetMacro(UseImageSpacing, bool);
193 itkBooleanMacro(UseImageSpacing);
194 itkGetConstReferenceMacro(UseImageSpacing, bool);
199 itkSetMacro(MaximumRMSError, double);
200 itkGetConstReferenceMacro(MaximumRMSError, double);
205 itkSetMacro(RMSChange, double);
206 itkGetConstReferenceMacro(RMSChange, double);
211 itkSetMacro(ManualReinitialization, bool);
212 itkGetConstReferenceMacro(ManualReinitialization, bool);
213 itkBooleanMacro(ManualReinitialization);
216 itkSetMacro(IsInitialized, bool);
217 itkGetMacro(IsInitialized, bool);
218
219 void
221 {
222 this->SetIsInitialized(false);
223 }
224 void
226 {
227 this->SetIsInitialized(true);
228 }
229
230#ifdef ITK_USE_CONCEPT_CHECKING
231 // Begin concept checking
232 itkConceptMacro(OutputPixelIsFloatingPointCheck, (Concept::IsFloatingPoint<OutputPixelValueType>));
233 // End concept checking
234#endif
235
236protected:
238 ~FiniteDifferenceImageFilter() override = default;
239
241 bool m_IsInitialized{};
242
243 void
244 PrintSelf(std::ostream & os, Indent indent) const override;
245
247 virtual void
249
253 virtual void
254 ApplyUpdate(const TimeStepType & dt) = 0;
255
261 virtual TimeStepType
263
267 virtual void
269
273 void
274 GenerateData() override;
275
287 void
289
292 virtual bool
294
304 virtual bool
305 ThreadedHalt(void * itkNotUsed(threadInfo))
306 {
307 return this->Halt();
308 }
309
315 virtual void
317 {}
318
325 virtual void
327 {
328 m_DifferenceFunction->InitializeIteration();
329 }
330
343 virtual TimeStepType
344 ResolveTimeStep(const std::vector<TimeStepType> & timeStepList, const BooleanStdVectorType & valid) const;
345
347 itkSetMacro(ElapsedIterations, IdentifierType);
348
351 virtual void
353 {}
354
356 IdentifierType m_NumberOfIterations{};
357
360 IdentifierType m_ElapsedIterations{};
361
364 bool m_ManualReinitialization{};
365
366 double m_RMSChange{};
367 double m_MaximumRMSError{};
368
369private:
373 void
375
378 bool m_UseImageSpacing{ true };
379
381 typename FiniteDifferenceFunctionType::Pointer m_DifferenceFunction{};
382};
383} // end namespace itk
384
385#ifndef ITK_MANUAL_INSTANTIATION
386# include "itkFiniteDifferenceImageFilter.hxx"
387#endif
388
389#endif
typename ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
typename FiniteDifferenceFunctionType::TimeStepType TimeStepType
virtual void CopyInputToOutput()=0
void PrintSelf(std::ostream &os, Indent indent) const override
typename FiniteDifferenceFunctionType::NeighborhoodScalesType NeighborhoodScalesType
virtual TimeStepType ResolveTimeStep(const std::vector< TimeStepType > &timeStepList, const BooleanStdVectorType &valid) const
typename NumericTraits< InputPixelType >::ValueType InputPixelValueType
~FiniteDifferenceImageFilter() override=default
void GenerateInputRequestedRegion() override
typename TInputImage::PixelType InputPixelType
virtual void ApplyUpdate(const TimeStepType &dt)=0
typename FiniteDifferenceFunctionType::RadiusType RadiusType
virtual void AllocateUpdateBuffer()=0
virtual TimeStepType CalculateChange()=0
typename TOutputImage::PixelType OutputPixelType
typename NumericTraits< OutputPixelType >::ValueType OutputPixelValueType
Base class for all process objects that output image data.
TOutputImage OutputImageType
Base class for filters that take an image as input and overwrite that image as the output.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Define additional traits for native types such as int or float.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:63
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
SizeValueType IdentifierType
Definition: itkIntTypes.h:90
std::vector< Boolean > BooleanStdVectorType