ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkGPUFiniteDifferenceImageFilter.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 itkGPUFiniteDifferenceImageFilter_h
19#define itkGPUFiniteDifferenceImageFilter_h
20
24#include "itkTimeProbe.h"
26
27namespace itk
28{
29
37template <typename TInputImage,
38 typename TOutputImage,
40class ITK_TEMPLATE_EXPORT GPUFiniteDifferenceImageFilter
41 : public GPUInPlaceImageFilter<TInputImage, TOutputImage, TParentImageFilter>
42{
43public:
44 ITK_DISALLOW_COPY_AND_MOVE(GPUFiniteDifferenceImageFilter);
45
49 using CPUSuperclass = TParentImageFilter;
52
54 itkOverrideGetNameOfClassMacro(GPUFiniteDifferenceImageFilter);
55
57 using InputImageType = TInputImage;
58 using OutputImageType = TOutputImage;
59
61 static constexpr unsigned int ImageDimension = OutputImageType::ImageDimension;
62
64 using OutputPixelType = typename TOutputImage::PixelType;
65 using InputPixelType = typename TInputImage::PixelType;
67
71
76 using TimeStepType = typename FiniteDifferenceFunctionType::TimeStepType;
77 using RadiusType = typename FiniteDifferenceFunctionType::RadiusType;
78 using NeighborhoodScalesType = typename FiniteDifferenceFunctionType::NeighborhoodScalesType;
79
83 const typename FiniteDifferenceFunctionType::Pointer &
84 GetDifferenceFunction() const override
85 {
86 return this->m_DifferenceFunction;
87 }
88
91 void
93 {
94 itkDebugMacro("setting m_DifferenceFunction to " << differenceFunction);
95 if (this->m_DifferenceFunction != differenceFunction)
96 {
97 this->m_DifferenceFunction = differenceFunction;
98 this->Modified();
99 }
100 }
101
102
103#if !defined(ITK_LEGACY_REMOVE)
105 using FilterStateType = GPUFiniteDifferenceFilterEnum;
106 // We need to expose the enum values at the class level for backwards compatibility
109#endif
110
112 void
117
119 void
124
126#if !defined(ITK_WRAPPING_PARSER)
127 itkSetMacro(State, GPUFiniteDifferenceFilterEnum);
128 itkGetConstReferenceMacro(State, GPUFiniteDifferenceFilterEnum);
129#endif
131
132 itkConceptMacro(OutputPixelIsFloatingPointCheck, (Concept::IsFloatingPoint<OutputPixelValueType>));
133
135 itkGetConstReferenceMacro(InitTime, TimeProbe);
136 itkGetConstReferenceMacro(ComputeUpdateTime, TimeProbe);
137 itkGetConstReferenceMacro(ApplyUpdateTime, TimeProbe);
138 itkGetConstReferenceMacro(SmoothFieldTime, TimeProbe);
140
141protected:
144
145 void
146 PrintSelf(std::ostream & os, Indent indent) const override;
147
149 void
150 AllocateUpdateBuffer() override = 0;
151
155 virtual void
157
163 virtual TimeStepType
165
169 void
170 CopyInputToOutput() override = 0;
171
175 void
176 GPUGenerateData() override;
177
189 void
191
194 bool
195 Halt() override;
196
206 bool
207 ThreadedHalt(void * itkNotUsed(threadInfo)) override
208 {
209 return this->Halt();
210 }
211
217 void
218 Initialize() override
219 {}
220
227 void
229 {
230 m_DifferenceFunction->InitializeIteration();
231 }
232
245 TimeStepType
246 ResolveTimeStep(const std::vector<TimeStepType> & timeStepList, const BooleanStdVectorType & valid) const override;
247
250 void
252 {}
253
256
257private:
261 void
263
265 typename FiniteDifferenceFunctionType::Pointer m_DifferenceFunction{};
266
270
273};
274
275} // end namespace itk
276
277#ifndef ITK_MANUAL_INSTANTIATION
278# include "itkGPUFiniteDifferenceImageFilter.hxx"
279#endif
280
281#endif
typename GPUFiniteDifferenceFunction< TOutputImage >::DifferenceFunctionType FiniteDifferenceFunctionType
void SetDifferenceFunction(FiniteDifferenceFunctionType *differenceFunction) override
virtual TimeStepType GPUCalculateChange()=0
GPUInPlaceImageFilter< TInputImage, TOutputImage, TParentImageFilter > GPUSuperclass
const FiniteDifferenceFunctionType::Pointer & GetDifferenceFunction() const override
void GenerateInputRequestedRegion() override
TimeStepType ResolveTimeStep(const std::vector< TimeStepType > &timeStepList, const BooleanStdVectorType &valid) const override
void PrintSelf(std::ostream &os, Indent indent) const override
void AllocateUpdateBuffer() override=0
virtual void GPUApplyUpdate(const TimeStepType &dt)=0
Control indentation during Print() invocation.
Definition itkIndent.h:50
Implements transparent reference counting.
Computes the time passed between two points in code.
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
std::vector< Boolean > BooleanStdVectorType