ITK  4.12.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;
103 
105  typedef TMovingImage MovingImageType;
108 
110  typedef TDisplacementField DisplacementFieldType;
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 
137  void SetFixedImage(const FixedImageType *ptr);
138 
140  const FixedImageType * GetFixedImage() const;
141 
143  void SetMovingImage(const MovingImageType *ptr);
144 
146  const MovingImageType * GetMovingImage() const;
147 
150  {
151  this->SetInput(ptr);
152  }
153 
156  {
157  return this->GetOutput();
158  }
159 
161 
162 protected:
165  }
166  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
167 
170  virtual void CopyInputToOutput() ITK_OVERRIDE;
171 
174  virtual void InitializeIteration() ITK_OVERRIDE;
175 
179  virtual void SmoothDisplacementField() ITK_OVERRIDE;
180 
183  virtual void GPUSmoothVectorField(DisplacementFieldPointer field,
184  typename GPUDataManager::Pointer GPUSmoothingKernels[],
185  int GPUSmoothingKernelSizes[]);
186 
187  virtual void AllocateSmoothingBuffer();
188 
192  virtual void SmoothUpdateField() ITK_OVERRIDE;
193 
196  virtual void PostProcessOutput() ITK_OVERRIDE;
197 
199  virtual void Initialize() ITK_OVERRIDE;
200 
205  virtual void GenerateOutputInformation() ITK_OVERRIDE;
206 
213  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
214 
215 private:
216  ITK_DISALLOW_COPY_AND_ASSIGN(GPUPDEDeformableRegistrationFilter);
217 
220  DisplacementFieldPointer m_TempField;
221 
222 private:
224  int m_SmoothingKernelSizes[ImageDimension];
225  DeformationScalarType* m_SmoothingKernels[ImageDimension];
226  typename GPUDataManager::Pointer m_GPUSmoothingKernels[ImageDimension];
227 
229  int m_UpdateFieldSmoothingKernelSizes[ImageDimension];
230  DeformationScalarType* m_UpdateFieldSmoothingKernels[ImageDimension];
231  typename GPUDataManager::Pointer m_UpdateFieldGPUSmoothingKernels[ImageDimension];
232 
233  int* m_ImageSizes;
234  typename GPUDataManager::Pointer m_GPUImageSizes;
235 
236  /* GPU kernel handle for GPUSmoothDisplacementField */
237  int m_SmoothDisplacementFieldGPUKernelHandle;
238 
239 };
240 } // end namespace itk
241 
242 #ifndef ITK_MANUAL_INSTANTIATION
243 #include "itkGPUPDEDeformableRegistrationFilter.hxx"
244 #endif
245 
246 #endif
virtual void PrintSelf(std::ostream &os, Indent indent) const override
GPUSuperclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
virtual void Initialize()
itkGPUKernelClassMacro(GPUImageOpsKernel)
GPU memory manager implemented using OpenCL. Required by GPUImage class.
SmartPointer< Self > Pointer
void SetInitialDisplacementField(const DisplacementFieldType *ptr)
GPUDenseFiniteDifferenceImageFilter< TDisplacementField, TDisplacementField, TParentImageFilter > GPUSuperclass
SmartPointer< const Self > ConstPointer
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