ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkDenseFiniteDifferenceImageFilter.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 itkDenseFiniteDifferenceImageFilter_h
19 #define itkDenseFiniteDifferenceImageFilter_h
20 
22 #include "itkMultiThreaderBase.h"
23 
24 namespace itk
25 {
68 template< typename TInputImage, typename TOutputImage >
69 class ITK_TEMPLATE_EXPORT DenseFiniteDifferenceImageFilter:
70  public FiniteDifferenceImageFilter< TInputImage, TOutputImage >
71 {
72 public:
73  ITK_DISALLOW_COPY_AND_ASSIGN(DenseFiniteDifferenceImageFilter);
74 
78  TInputImage, TOutputImage >;
79 
82 
85 
87  using InputImageType = typename Superclass::InputImageType;
88  using OutputImageType = typename Superclass::OutputImageType;
89  using FiniteDifferenceFunctionType = typename Superclass::FiniteDifferenceFunctionType;
90 
93  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
94 
97  using PixelType = typename Superclass::PixelType;
98 
100  using TimeStepType = typename Superclass::TimeStepType;
101 
104 
105 #ifdef ITK_USE_CONCEPT_CHECKING
106  // Begin concept checking
107  itkConceptMacro( OutputTimesDoubleCheck,
109  itkConceptMacro( OutputAdditiveOperatorsCheck,
111  itkConceptMacro( OutputAdditiveAndAssignOperatorsCheck,
113  itkConceptMacro( InputConvertibleToOutputCheck,
115  // End concept checking
116 #endif
117 
118 protected:
120  { m_UpdateBuffer = UpdateBufferType::New(); }
121  ~DenseFiniteDifferenceImageFilter() override = default;
122  void PrintSelf(std::ostream & os, Indent indent) const override;
123 
127  void CopyInputToOutput() override;
128 
132  void ApplyUpdate(const TimeStepType& dt) override;
133 
137  { return m_UpdateBuffer; }
138 
142  TimeStepType CalculateChange() override;
143 
146  void AllocateUpdateBuffer() override;
147 
150 
155  virtual
156  void ThreadedApplyUpdate(const TimeStepType& dt,
157  const ThreadRegionType & regionToProcess,
158  ThreadIdType threadId);
159 
164  virtual
165  TimeStepType ThreadedCalculateChange(const ThreadRegionType & regionToProcess,
166  ThreadIdType threadId);
167 
168 private:
174  std::vector< TimeStepType > TimeStepList;
175  std::vector< bool > ValidTimeStepList;
176  };
177 
180  static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ApplyUpdateThreaderCallback(void *arg);
181 
184  static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION CalculateChangeThreaderCallback(void *arg);
185 
187  typename UpdateBufferType::Pointer m_UpdateBuffer;
188 };
189 } // end namespace itk
190 
191 #ifndef ITK_MANUAL_INSTANTIATION
192 #include "itkDenseFiniteDifferenceImageFilter.hxx"
193 #endif
194 
195 #endif
Light weight base class for most itk classes.
itk::ITK_THREAD_RETURN_TYPE ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
#define itkConceptMacro(name, concept)