go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkGPUResampleImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
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 itkGPUResampleImageFilter_h
19#define itkGPUResampleImageFilter_h
20
21#include "itkResampleImageFilter.h"
22
27#include "itkGPUTransformBase.h"
29
30namespace itk
31{
33itkGPUKernelClassMacro(GPUResampleImageFilterKernel);
34
46template <typename TInputImage,
47 typename TOutputImage,
48 typename TInterpolatorPrecisionType = float,
49 typename TTransformPrecisionType = TInterpolatorPrecisionType>
50class ITK_EXPORT GPUResampleImageFilter
51 : public GPUImageToImageFilter<
52 TInputImage,
53 TOutputImage,
54 ResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType>>
55{
56public:
58
62 ResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType>;
64 using Pointer = SmartPointer<Self>;
65 using ConstPointer = SmartPointer<const Self>;
66
68 itkNewMacro(Self);
69
72
74 itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
75 itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
76
78 using InputImageType = TInputImage;
79 using OutputImageType = TOutputImage;
80 using GPUInputImage = typename GPUTraits<TInputImage>::Type;
81 using GPUOutputImage = typename GPUTraits<TOutputImage>::Type;
82 using InterpolatorPrecisionType = TInterpolatorPrecisionType;
83
85 using InterpolatorType = typename CPUSuperclass::InterpolatorType;
86 using TransformType = typename CPUSuperclass::TransformType;
87 using ExtrapolatorType = typename CPUSuperclass::ExtrapolatorType;
88 using InputImageRegionType = typename CPUSuperclass::InputImageRegionType;
89 using OutputImageRegionType = typename CPUSuperclass::OutputImageRegionType;
90 using SizeType = typename CPUSuperclass::SizeType;
91 using IndexType = typename CPUSuperclass::IndexType;
92
93 using OutputImagePixelType = typename GPUSuperclass::OutputImagePixelType;
94
99
105
108
110 void
112
114 void
116
118 void
119 SetTransform(const TransformType * _arg) override;
120
123 itkSetMacro(RequestedNumberOfSplits, unsigned int);
124 itkGetConstMacro(RequestedNumberOfSplits, unsigned int);
125
126protected:
128 ~GPUResampleImageFilter() override = default;
129 void
130 PrintSelf(std::ostream & os, Indent indent) const override;
131
132 void
133 GPUGenerateData() override;
134
135 // Supported GPU transform types
137 {
142 Else
143 };
144
146 void
147 SetArgumentsForPreKernelManager(const typename GPUOutputImage::Pointer & output);
148
150 void
151 SetArgumentsForLoopKernelManager(const typename GPUInputImage::Pointer & input,
152 const typename GPUOutputImage::Pointer & output);
153
155 void
156 SetTransformParametersForLoopKernelManager(const std::size_t transformIndex);
157
159 void
160 SetArgumentsForPostKernelManager(const typename GPUInputImage::Pointer & input,
161 const typename GPUOutputImage::Pointer & output);
162
164 void
165 SetBSplineTransformCoefficientsToGPU(const std::size_t transformIndex);
166
169 GetTransformType(const int & transformIndex) const;
170
172 bool
174
176 int
178
180 bool
181 GetKernelIdFromTransformId(const std::size_t & index, std::size_t & kernelId) const;
182
185 GetGPUBSplineBaseTransform(const std::size_t transformIndex);
186
187private:
190
196
197 using TransformHandle = std::pair<int, bool>;
198 using TransformsHandle = std::map<GPUTransformTypeEnum, TransformHandle>;
199
200#if 0
201 class TransformKernelHelper
202 {
203 GPUTransformTypeEnum m_TransformType;
204 std::string m_TransformTypeAsString;
205 std::: size_t m_TransformKernelHandle;
206 bool m_Compiled;
207 TransformKernelHelper()
208 {
209 m_TransformType = GPUResampleImageFilter::Else;
210 m_TransformTypeAsString = "Else";
211 m_TransformKernelHandle = 0; // ??
212 m_Compiled = false;
213 }
214
215
216 };
217
218 std::vector< TransformKernelHelper > m_SupportedTransformKernels;
219#endif
220
221 std::vector<std::string> m_Sources;
222 std::size_t m_SourceIndex;
223
226
229
233
234 // GPU kernel managers
238};
239
240} // end namespace itk
241
242#ifndef ITK_MANUAL_INSTANTIATION
243# include "itkGPUResampleImageFilter.hxx"
244#endif
245
246#endif /* itkGPUResampleImageFilter_h */
GPU base class for the BSplineTransform.
GPU version of BSplineInterpolateImageFunction.
typename GPUCoefficientImageType::Pointer GPUCoefficientImagePointer
class to abstract the behaviour of the GPU filters.
Templated n-dimensional image class for the GPU.
Definition: itkGPUImage.h:64
Base class fro all GPU interpolators.
GPU version of ResampleImageFilter.
GPUBSplineBaseTransformType * GetGPUBSplineBaseTransform(const std::vcl_size_t transformIndex)
GPUInterpolatorBase * m_InterpolatorBase
SmartPointer< const Self > ConstPointer
~GPUResampleImageFilter() override=default
TInterpolatorPrecisionType InterpolatorPrecisionType
bool HasTransform(const GPUTransformTypeEnum type) const
GPUKernelManagerPointer m_LoopKernelManager
std::pair< int, bool > TransformHandle
typename GPUDataManager::Pointer GPUDataManagerPointer
const GPUTransformTypeEnum GetTransformType(const int &transformIndex) const
typename GPUTraits< TOutputImage >::Type GPUOutputImage
void GPUGenerateData() override
bool GetKernelIdFromTransformId(const std::vcl_size_t &index, std::vcl_size_t &kernelId) const
typename GPUBSplineInterpolatorType::GPUDataManagerPointer GPUBSplineInterpolatorDataManagerPointer
void SetBSplineTransformCoefficientsToGPU(const std::vcl_size_t transformIndex)
GPUDataManagerPointer m_InputGPUImageBase
void SetExtrapolator(ExtrapolatorType *_arg) override
GPUKernelManagerPointer m_PostKernelManager
void SetArgumentsForLoopKernelManager(const typename GPUInputImage::Pointer &input, const typename GPUOutputImage::Pointer &output)
typename GPUSuperclass::OutputImagePixelType OutputImagePixelType
GPUDataManagerPointer m_DeformationFieldBuffer
void SetArgumentsForPreKernelManager(const typename GPUOutputImage::Pointer &output)
GPUKernelManagerPointer m_PreKernelManager
int GetTransformHandle(const GPUTransformTypeEnum type) const
std::map< GPUTransformTypeEnum, TransformHandle > TransformsHandle
void SetTransformParametersForLoopKernelManager(const std::vcl_size_t transformIndex)
typename CPUSuperclass::InputImageRegionType InputImageRegionType
void SetTransform(const TransformType *_arg) override
std::vector< std::string > m_Sources
itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension)
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension)
typename OpenCLKernelManager::Pointer GPUKernelManagerPointer
typename CPUSuperclass::OutputImageRegionType OutputImageRegionType
void PrintSelf(std::ostream &os, Indent indent) const override
void SetInterpolator(InterpolatorType *_arg) override
typename GPUBSplineInterpolatorType::GPUCoefficientImagePointer GPUBSplineInterpolatorCoefficientImagePointer
ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType > CPUSuperclass
typename CPUSuperclass::IndexType IndexType
GPUDataManagerPointer m_FilterParameters
void SetArgumentsForPostKernelManager(const typename GPUInputImage::Pointer &input, const typename GPUOutputImage::Pointer &output)
typename GPUBSplineInterpolatorType::GPUCoefficientImageType GPUBSplineInterpolatorCoefficientImageType
ITK_DISALLOW_COPY_AND_MOVE(GPUResampleImageFilter)
typename CPUSuperclass::InterpolatorType InterpolatorType
typename CPUSuperclass::SizeType SizeType
typename CPUSuperclass::TransformType TransformType
typename CPUSuperclass::ExtrapolatorType ExtrapolatorType
typename GPUTraits< TInputImage >::Type GPUInputImage
GPUDataManagerPointer m_OutputGPUImageBase
Base class for all GPU transforms.
itkGPUKernelClassMacro(GPUBSplineTransformKernel)


Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo