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 
30 namespace itk
31 {
33 itkGPUKernelClassMacro( GPUResampleImageFilterKernel );
34 
46 template< typename TInputImage, typename TOutputImage, typename TInterpolatorPrecisionType = float >
47 class ITK_EXPORT GPUResampleImageFilter :
48  public GPUImageToImageFilter< TInputImage, TOutputImage,
49  ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType > >
50 {
51 public:
52 
55  typedef ResampleImageFilter<
56  TInputImage, TOutputImage, TInterpolatorPrecisionType > CPUSuperclass;
57  typedef GPUImageToImageFilter<
58  TInputImage, TOutputImage, CPUSuperclass > GPUSuperclass;
59  typedef SmartPointer< Self > Pointer;
60  typedef SmartPointer< const Self > ConstPointer;
61 
63  itkNewMacro( Self );
64 
67 
69  itkStaticConstMacro( InputImageDimension, unsigned int,
70  TInputImage::ImageDimension );
71  itkStaticConstMacro( OutputImageDimension, unsigned int,
72  TOutputImage::ImageDimension );
73 
75  typedef TInputImage InputImageType;
76  typedef TOutputImage OutputImageType;
77  typedef typename GPUTraits< TInputImage >::Type GPUInputImage;
78  typedef typename GPUTraits< TOutputImage >::Type GPUOutputImage;
79  typedef TInterpolatorPrecisionType InterpolatorPrecisionType;
80 
82  typedef typename CPUSuperclass::InterpolatorType InterpolatorType;
83  typedef typename CPUSuperclass::TransformType TransformType;
84  typedef typename CPUSuperclass::ExtrapolatorType ExtrapolatorType;
85  typedef typename CPUSuperclass::InputImageRegionType InputImageRegionType;
86  typedef typename CPUSuperclass::OutputImageRegionType OutputImageRegionType;
87  typedef typename CPUSuperclass::SizeType SizeType;
88  typedef typename CPUSuperclass::IndexType IndexType;
89 
91 
97 
104 
106  typedef GPUBSplineBaseTransform<
108 
110  virtual void SetInterpolator( InterpolatorType * _arg );
111 
113  virtual void SetExtrapolator( ExtrapolatorType * _arg );
114 
116  virtual void SetTransform( const TransformType * _arg );
117 
120  itkSetMacro( RequestedNumberOfSplits, unsigned int );
121  itkGetConstMacro( RequestedNumberOfSplits, unsigned int );
122 
123 protected:
124 
127  void PrintSelf( std::ostream & os, Indent indent ) const override;
128 
129  virtual void GPUGenerateData( void );
130 
131  // Supported GPU transform types
132  typedef enum {
137  Else
138  } GPUTransformTypeEnum;
139 
142  const typename GPUOutputImage::Pointer & output );
143 
146  const typename GPUInputImage::Pointer & input,
147  const typename GPUOutputImage::Pointer & output );
148 
151  const std::size_t transformIndex );
152 
155  const typename GPUInputImage::Pointer & input,
156  const typename GPUOutputImage::Pointer & output );
157 
160  const std::size_t transformIndex );
161 
163  const GPUTransformTypeEnum GetTransformType( const int & transformIndex ) const;
164 
166  bool HasTransform( const GPUTransformTypeEnum type ) const;
167 
169  int GetTransformHandle( const GPUTransformTypeEnum type ) const;
170 
173  const std::size_t & index, std::size_t & kernelId ) const;
174 
177  const std::size_t transformIndex );
178 
179 private:
180 
181  GPUResampleImageFilter( const Self & ); // purposely not implemented
182  void operator=( const Self & ); // purposely not implemented
183 
186 
192 
193  typedef std::pair< int, bool > TransformHandle;
194  typedef std::map< GPUTransformTypeEnum, TransformHandle > TransformsHandle;
195 
196 #if 0
197  class TransformKernelHelper
198  {
199  GPUTransformTypeEnum m_TransformType;
200  std::string m_TransformTypeAsString;
201  std::: size_t m_TransformKernelHandle;
202  bool m_Compiled;
203  TransformKernelHelper()
204  {
205  m_TransformType = GPUResampleImageFilter::Else;
206  m_TransformTypeAsString = "Else";
207  m_TransformKernelHandle = 0; // ??
208  m_Compiled = false;
209  }
210 
211 
212  };
213 
214  std::vector< TransformKernelHelper > m_SupportedTransformKernels;
215 #endif
216 
217  std::vector< std::string > m_Sources;
218  std::size_t m_SourceIndex;
219 
222 
225 
229 
230  // GPU kernel managers
234 };
235 
236 } // end namespace itk
237 
238 #ifndef ITK_MANUAL_INSTANTIATION
239 #include "itkGPUResampleImageFilter.hxx"
240 #endif
241 
242 #endif /* __itkGPUResampleImageFilter_h */
GPU base class for the BSplineTransform.
GPU version of BSplineInterpolateImageFunction.
SmartPointer< Self > Pointer
class to abstract the behaviour of the GPU filters.
Superclass::OutputImagePixelType OutputImagePixelType
Templated n-dimensional image class for the GPU.
Definition: itkGPUImage.h:64
Base class fro all GPU interpolators.
GPU version of ResampleImageFilter.
GPUResampleImageFilter(const Self &)
GPUDataManagerPointer m_OutputGPUImageBase
GPUTraits< TOutputImage >::Type GPUOutputImage
GPUDataManagerPointer m_InputGPUImageBase
GPUImageToImageFilter< TInputImage, TOutputImage, CPUSuperclass > GPUSuperclass
GPUBSplineBaseTransformType * GetGPUBSplineBaseTransform(const std::vcl_size_t transformIndex)
itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension)
GPUInterpolatorBase * m_InterpolatorBase
bool HasTransform(const GPUTransformTypeEnum type) const
SmartPointer< const Self > ConstPointer
virtual void SetTransform(const TransformType *_arg)
std::map< GPUTransformTypeEnum, TransformHandle > TransformsHandle
void SetArgumentsForLoopKernelManager(const typename GPUInputImage::Pointer &input, const typename GPUOutputImage::Pointer &output)
const GPUTransformTypeEnum GetTransformType(const int &transformIndex) const
GPUDataManager::Pointer GPUDataManagerPointer
GPUTraits< TInputImage >::Type GPUInputImage
void SetArgumentsForPreKernelManager(const typename GPUOutputImage::Pointer &output)
virtual void SetExtrapolator(ExtrapolatorType *_arg)
GPUDataManagerPointer m_FilterParameters
GPUSuperclass::OutputImagePixelType OutputImagePixelType
GPUBSplineInterpolateImageFunction< InputImageType, InterpolatorPrecisionType > GPUBSplineInterpolatorType
GPUBSplineInterpolatorType::GPUDataManagerPointer GPUBSplineInterpolatorDataManagerPointer
GPUBSplineInterpolatorType::GPUCoefficientImagePointer GPUBSplineInterpolatorCoefficientImagePointer
CPUSuperclass::InterpolatorType InterpolatorType
int GetTransformHandle(const GPUTransformTypeEnum type) const
GPUBSplineBaseTransform< InterpolatorPrecisionType, InputImageDimension > GPUBSplineBaseTransformType
GPUCompositeTransformBase< InterpolatorPrecisionType, InputImageDimension > CompositeTransformBaseType
void SetBSplineTransformCoefficientsToGPU(const std::vcl_size_t transformIndex)
CPUSuperclass::TransformType TransformType
GPUKernelManagerPointer m_PostKernelManager
void SetArgumentsForPostKernelManager(const typename GPUInputImage::Pointer &input, const typename GPUOutputImage::Pointer &output)
bool GetKernelIdFromTransformId(const std::vcl_size_t &index, std::vcl_size_t &kernelId) const
void PrintSelf(std::ostream &os, Indent indent) const override
CPUSuperclass::IndexType IndexType
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension)
CPUSuperclass::InputImageRegionType InputImageRegionType
virtual void GPUGenerateData(void)
void SetTransformParametersForLoopKernelManager(const std::vcl_size_t transformIndex)
GPUDataManagerPointer m_DeformationFieldBuffer
TInterpolatorPrecisionType InterpolatorPrecisionType
std::pair< int, bool > TransformHandle
std::vector< std::string > m_Sources
GPUKernelManagerPointer m_LoopKernelManager
GPUBSplineInterpolatorType::GPUCoefficientImageType GPUBSplineInterpolatorCoefficientImageType
GPUKernelManagerPointer m_PreKernelManager
OpenCLKernelManager::Pointer GPUKernelManagerPointer
virtual void SetInterpolator(InterpolatorType *_arg)
CPUSuperclass::OutputImageRegionType OutputImageRegionType
void operator=(const Self &)
CPUSuperclass::ExtrapolatorType ExtrapolatorType
ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType > CPUSuperclass
Base class for all GPU transforms.
SmartPointer< Self > Pointer
itkGPUKernelClassMacro(GPUBSplineTransformKernel)


Generated on 1641078589 for elastix by doxygen 1.9.1 elastix logo