ITK  5.4.0
Insight Toolkit
itkGPUPDEDeformableRegistrationFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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,
79  typename TMovingImage,
80  typename TDisplacementField,
81  typename TParentImageFilter = PDEDeformableRegistrationFilter<TFixedImage, TMovingImage, TDisplacementField>>
82 class ITK_TEMPLATE_EXPORT GPUPDEDeformableRegistrationFilter
83  : public GPUDenseFiniteDifferenceImageFilter<TDisplacementField, TDisplacementField, TParentImageFilter>
84 {
85 public:
86  ITK_DISALLOW_COPY_AND_MOVE(GPUPDEDeformableRegistrationFilter);
87 
91  using CPUSuperclass = TParentImageFilter;
94 
96  itkNewMacro(Self);
97 
99  itkOverrideGetNameOfClassMacro(GPUPDEDeformableRegistrationFilter);
100 
102  using FixedImageType = TFixedImage;
105 
107  using MovingImageType = TMovingImage;
110 
112  using DisplacementFieldType = TDisplacementField;
114  using DeformationVectorType = typename TDisplacementField::PixelType;
115  using DeformationScalarType = typename TDisplacementField::PixelType::ValueType;
116 
119 
122 
128 
130  static constexpr unsigned int ImageDimension = GPUSuperclass::ImageDimension;
131 
133  itkGetOpenCLSourceFromKernelMacro(GPUPDEDeformableRegistrationFilterKernel);
134 
138  {
139  return this->GetOutput();
140  }
141 
143 
144 protected:
146  ~GPUPDEDeformableRegistrationFilter() override = default;
147 
148  void
149  PrintSelf(std::ostream & os, Indent indent) const override;
150 
154  void
155  CopyInputToOutput() override;
156 
159  void
160  InitializeIteration() override;
161 
165  void
166  SmoothDisplacementField() override;
167 
172  virtual void
173  GPUSmoothVectorField(DisplacementFieldPointer field,
174  typename GPUDataManager::Pointer GPUSmoothingKernels[],
175  int GPUSmoothingKernelSizes[]);
176 
177  virtual void
178  AllocateSmoothingBuffer();
179 
183  void
184  SmoothUpdateField() override;
185 
190  void
191  PostProcessOutput() override;
192 
197  void
198  Initialize() override;
199 
204  void
205  GenerateOutputInformation() override;
206 
213  void
214  GenerateInputRequestedRegion() override;
215 
216 private:
220 
221 private:
223  int m_SmoothingKernelSizes[ImageDimension]{};
224  DeformationScalarType * m_SmoothingKernels[ImageDimension]{};
225  typename GPUDataManager::Pointer m_GPUSmoothingKernels[ImageDimension]{};
226 
228  int m_UpdateFieldSmoothingKernelSizes[ImageDimension]{};
229  DeformationScalarType * m_UpdateFieldSmoothingKernels[ImageDimension]{};
230  typename GPUDataManager::Pointer m_UpdateFieldGPUSmoothingKernels[ImageDimension]{};
231 
232  int * m_ImageSizes{};
233  typename GPUDataManager::Pointer m_GPUImageSizes{};
234 
235  /* GPU kernel handle for GPUSmoothDisplacementField */
236  int m_SmoothDisplacementFieldGPUKernelHandle{};
237 };
238 } // end namespace itk
239 
240 #ifndef ITK_MANUAL_INSTANTIATION
241 # include "itkGPUPDEDeformableRegistrationFilter.hxx"
242 #endif
243 
244 #endif
itk::GPUPDEDeformableRegistrationFilter::DisplacementFieldType
TDisplacementField DisplacementFieldType
Definition: itkGPUPDEDeformableRegistrationFilter.h:112
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itkGPUPDEDeformableRegistrationFunction.h
itk::GPUPDEDeformableRegistrationFilter::FixedImagePointer
typename FixedImageType::Pointer FixedImagePointer
Definition: itkGPUPDEDeformableRegistrationFilter.h:103
itk::GPUPDEDeformableRegistrationFilter::GetDisplacementField
DisplacementFieldType * GetDisplacementField()
Definition: itkGPUPDEDeformableRegistrationFilter.h:137
itk::GPUPDEDeformableRegistrationFilter
Deformably register two images using a PDE algorithm.
Definition: itkGPUPDEDeformableRegistrationFilter.h:82
itk::GPUPDEDeformableRegistrationFilter::DeformationVectorType
typename TDisplacementField::PixelType DeformationVectorType
Definition: itkGPUPDEDeformableRegistrationFilter.h:114
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::GPUPDEDeformableRegistrationFilter::MovingImagePointer
typename MovingImageType::Pointer MovingImagePointer
Definition: itkGPUPDEDeformableRegistrationFilter.h:108
itk::GPUPDEDeformableRegistrationFilter::FixedImageType
TFixedImage FixedImageType
Definition: itkGPUPDEDeformableRegistrationFilter.h:102
itk::GPUDenseFiniteDifferenceImageFilter< TDisplacementField, TDisplacementField, TParentImageFilter >::FiniteDifferenceFunctionType
typename GPUSuperclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
Definition: itkGPUDenseFiniteDifferenceImageFilter.h:74
itk::GPUDenseFiniteDifferenceImageFilter< TDisplacementField, TDisplacementField, TParentImageFilter >::OutputImageType
typename GPUSuperclass::OutputImageType OutputImageType
Definition: itkGPUDenseFiniteDifferenceImageFilter.h:73
itk::GPUPDEDeformableRegistrationFilter::DisplacementFieldPointer
typename DisplacementFieldType::Pointer DisplacementFieldPointer
Definition: itkGPUPDEDeformableRegistrationFilter.h:113
itk::GPUPDEDeformableRegistrationFilter::FixedImageConstPointer
typename FixedImageType::ConstPointer FixedImageConstPointer
Definition: itkGPUPDEDeformableRegistrationFilter.h:104
itk::GPUPDEDeformableRegistrationFilter::OutputImageType
typename GPUSuperclass::OutputImageType OutputImageType
Definition: itkGPUPDEDeformableRegistrationFilter.h:118
itk::FixedArray< double, ImageDimension >
itk::GPUDenseFiniteDifferenceImageFilter
Definition: itkGPUDenseFiniteDifferenceImageFilter.h:55
itk::GPUPDEDeformableRegistrationFilter::FiniteDifferenceFunctionType
typename GPUSuperclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
Definition: itkGPUPDEDeformableRegistrationFilter.h:121
itk::GPUPDEDeformableRegistrationFilter::CPUSuperclass
TParentImageFilter CPUSuperclass
Definition: itkGPUPDEDeformableRegistrationFilter.h:91
itk::itkGPUKernelClassMacro
itkGPUKernelClassMacro(GPUImageOpsKernel)
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkGPUDenseFiniteDifferenceImageFilter.h
itk::GPUPDEDeformableRegistrationFilter::MovingImageConstPointer
typename MovingImageType::ConstPointer MovingImageConstPointer
Definition: itkGPUPDEDeformableRegistrationFilter.h:109
itkPDEDeformableRegistrationFilter.h
itk::GPUPDEDeformableRegistrationFunction
Definition: itkGPUPDEDeformableRegistrationFunction.h:41
itk::GPUPDEDeformableRegistrationFilter::MovingImageType
TMovingImage MovingImageType
Definition: itkGPUPDEDeformableRegistrationFilter.h:107
itk::GPUPDEDeformableRegistrationFilter::DeformationScalarType
typename TDisplacementField::PixelType::ValueType DeformationScalarType
Definition: itkGPUPDEDeformableRegistrationFilter.h:115