ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkGPUPDEDeformableRegistrationFilter.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 itkGPUPDEDeformableRegistrationFilter_h
19 #define itkGPUPDEDeformableRegistrationFilter_h
20 
24 
25 namespace itk
26 {
76 itkGPUKernelClassMacro(GPUPDEDeformableRegistrationFilterKernel);
77 
78 template< typename TFixedImage, typename TMovingImage, typename TDisplacementField,
79  typename TParentImageFilter = PDEDeformableRegistrationFilter< TFixedImage, TMovingImage, TDisplacementField >
80  >
81 class ITK_TEMPLATE_EXPORT GPUPDEDeformableRegistrationFilter :
82  public GPUDenseFiniteDifferenceImageFilter< TDisplacementField, TDisplacementField, TParentImageFilter >
83 {
84 public:
88  typedef TParentImageFilter CPUSuperclass;
91 
93  itkNewMacro(Self);
94 
98 
100  typedef TFixedImage FixedImageType;
101  typedef typename FixedImageType::Pointer FixedImagePointer;
102  typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
103 
105  typedef TMovingImage MovingImageType;
106  typedef typename MovingImageType::Pointer MovingImagePointer;
107  typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
108 
110  typedef TDisplacementField DisplacementFieldType;
111  typedef typename DisplacementFieldType::Pointer DisplacementFieldPointer;
112  typedef typename TDisplacementField::PixelType DeformationVectorType;
113  typedef typename TDisplacementField::PixelType::ValueType
115 
118 
122 
128 
130  itkStaticConstMacro(ImageDimension, unsigned int,
131  GPUSuperclass::ImageDimension);
132 
134  itkGetOpenCLSourceFromKernelMacro(GPUPDEDeformableRegistrationFilterKernel);
135 
138  {
139  return this->GetOutput();
140  }
141 
143 
144 protected:
147 
148  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
149 
152  virtual void CopyInputToOutput() ITK_OVERRIDE;
153 
156  virtual void InitializeIteration() ITK_OVERRIDE;
157 
161  virtual void SmoothDisplacementField() ITK_OVERRIDE;
162 
165  virtual void GPUSmoothVectorField(DisplacementFieldPointer field,
166  typename GPUDataManager::Pointer GPUSmoothingKernels[],
167  int GPUSmoothingKernelSizes[]);
168 
169  virtual void AllocateSmoothingBuffer();
170 
174  virtual void SmoothUpdateField() ITK_OVERRIDE;
175 
178  virtual void PostProcessOutput() ITK_OVERRIDE;
179 
181  virtual void Initialize() ITK_OVERRIDE;
182 
187  virtual void GenerateOutputInformation() ITK_OVERRIDE;
188 
195  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
196 
197 private:
198  ITK_DISALLOW_COPY_AND_ASSIGN(GPUPDEDeformableRegistrationFilter);
199 
202  DisplacementFieldPointer m_TempField;
203 
204 private:
206  int m_SmoothingKernelSizes[ImageDimension];
207  DeformationScalarType* m_SmoothingKernels[ImageDimension];
208  typename GPUDataManager::Pointer m_GPUSmoothingKernels[ImageDimension];
209 
211  int m_UpdateFieldSmoothingKernelSizes[ImageDimension];
212  DeformationScalarType* m_UpdateFieldSmoothingKernels[ImageDimension];
213  typename GPUDataManager::Pointer m_UpdateFieldGPUSmoothingKernels[ImageDimension];
214 
215  int* m_ImageSizes;
216  typename GPUDataManager::Pointer m_GPUImageSizes;
217 
218  /* GPU kernel handle for GPUSmoothDisplacementField */
219  int m_SmoothDisplacementFieldGPUKernelHandle;
220 
221 };
222 } // end namespace itk
223 
224 #ifndef ITK_MANUAL_INSTANTIATION
225 #include "itkGPUPDEDeformableRegistrationFilter.hxx"
226 #endif
227 
228 #endif
GPUSuperclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
itkGPUKernelClassMacro(GPUImageOpsKernel)
GPU memory manager implemented using OpenCL. Required by GPUImage class.
GPUDenseFiniteDifferenceImageFilter< TDisplacementField, TDisplacementField, TParentImageFilter > GPUSuperclass
Deformably register two images using a PDE algorithm.
TDisplacementField::PixelType::ValueType DeformationScalarType
GPUPDEDeformableRegistrationFunction< FixedImageType, MovingImageType, DisplacementFieldType > GPUPDEDeformableRegistrationFunctionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
FixedArray< double, ImageDimension > StandardDeviationsType