ITK  4.4.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< class TFixedImage, class TMovingImage, class TDisplacementField,
79  class TParentImageFilter = PDEDeformableRegistrationFilter< TFixedImage, TMovingImage, TDisplacementField >
80  >
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 
137  void SetFixedImage(const FixedImageType *ptr);
138 
140  const FixedImageType * GetFixedImage(void) const;
141 
143  void SetMovingImage(const MovingImageType *ptr);
144 
146  const MovingImageType * GetMovingImage(void) const;
147 
149  void SetInitialDisplacementField(const DisplacementFieldType *ptr)
150  {
151  this->SetInput(ptr);
152  }
153 
155  DisplacementFieldType * GetDisplacementField()
156  {
157  return this->GetOutput();
158  }
159 
165  virtual std::vector< SmartPointer< DataObject > >::size_type GetNumberOfValidRequiredInputs() const;
166 
168 
169 protected:
172  }
173  void PrintSelf(std::ostream & os, Indent indent) const;
174 
177  virtual void CopyInputToOutput();
178 
181  virtual void InitializeIteration();
182 
186  virtual void SmoothDisplacementField();
187 
190  virtual void GPUSmoothVectorField(DisplacementFieldPointer field,
191  typename GPUDataManager::Pointer GPUSmoothingKernels[],
192  int GPUSmoothingKernelSizes[]);
193 
194  virtual void AllocateSmoothingBuffer();
195 
199  virtual void SmoothUpdateField();
200 
203  virtual void PostProcessOutput();
204 
206  virtual void Initialize();
207 
212  virtual void GenerateOutputInformation();
213 
220  virtual void GenerateInputRequestedRegion();
221 
222 private:
223  GPUPDEDeformableRegistrationFilter(const Self &); //purposely not implemented
224  void operator=(const Self &); //purposely not implemented
225 
229 
230 private:
232  int m_SmoothingKernelSizes[ImageDimension];
233  DeformationScalarType* m_SmoothingKernels[ImageDimension];
234  typename GPUDataManager::Pointer m_GPUSmoothingKernels[ImageDimension];
235 
237  int m_UpdateFieldSmoothingKernelSizes[ImageDimension];
238  DeformationScalarType* m_UpdateFieldSmoothingKernels[ImageDimension];
239  typename GPUDataManager::Pointer m_UpdateFieldGPUSmoothingKernels[ImageDimension];
240 
243 
244  /* GPU kernel handle for GPUSmoothDisplacementField */
246 
247 };
248 } // end namespace itk
249 
250 #ifndef ITK_MANUAL_INSTANTIATION
251 #include "itkGPUPDEDeformableRegistrationFilter.hxx"
252 #endif
253 
254 #endif
255