ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkCurvatureRegistrationFilter.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 itkCurvatureRegistrationFilter_h
19 #define itkCurvatureRegistrationFilter_h
20 
23 
24 #if !defined( ITK_USE_CUFFTW ) && defined( ITK_USE_FFTWF ) || defined( ITK_USE_FFTWD )
25 #include "fftw3.h"
26 
27 namespace itk
28 {
97 template< typename TFixedImage, typename TMovingImage, typename TDisplacementField,
98  typename TImageForceFunction =
99  MeanSquareRegistrationFunction< TFixedImage, TMovingImage, TDisplacementField > >
100 class ITK_TEMPLATE_EXPORT CurvatureRegistrationFilter:
101  public PDEDeformableRegistrationFilter< TFixedImage, TMovingImage,
102  TDisplacementField >
103 {
104 public:
105  ITK_DISALLOW_COPY_AND_ASSIGN(CurvatureRegistrationFilter);
106 
112 
114  itkNewMacro(Self);
115 
117  itkTypeMacro(CurvatureRegistrationFilter,
119 
121  using TimeStepType = typename Superclass::TimeStepType;
122 
124  using FixedImageType = typename Superclass::FixedImageType;
125  using FixedImagePointer = typename Superclass::FixedImagePointer;
126  static constexpr unsigned int ImageDimension = FixedImageType::ImageDimension;
127 
129  using MovingImageType = typename Superclass::MovingImageType;
130  using MovingImagePointer = typename Superclass::MovingImagePointer;
131 
133  using DisplacementFieldType = typename Superclass::DisplacementFieldType;
134  using DisplacementFieldPointer = typename Superclass::DisplacementFieldPointer;
135 
136  using DisplacementFieldPixelType = typename TDisplacementField::PixelType;
137  using DisplacementFieldComponentType = typename DisplacementFieldPixelType::ValueType;
138  static constexpr unsigned int DeformationVectorDimension = DisplacementFieldPixelType::Dimension;
139 
140  #if defined( ITK_USE_FFTWD )
141  //Prefer to use double precision
142  using RealTypeDFT = double;
143  #else
144  #if defined( ITK_USE_FFTWF )
145  //Allow to use single precision
146  #warning "Using single precision for FFT computations!"
147  using RealTypeDFT = double;
148  #endif
149  #endif
150 
153 
155  using FiniteDifferenceFunctionType = typename Superclass::FiniteDifferenceFunctionType;
156 
158  using RegistrationFunctionType = TImageForceFunction;
159 
161  void SetConstraintWeight(const float w) { m_ConstraintWeight = w; }
162 
164  void SetTimeStep(const TimeStepType ts) { m_TimeStep = ts; }
165 
171  virtual double GetMetric() const;
172 
173 protected:
175  ~CurvatureRegistrationFilter() override;
176  void PrintSelf(std::ostream & os, Indent indent) const override;
177 
179  void Initialize() override;
180 
182  void ApplyUpdate(const TimeStepType& dt) override;
183 
184 private:
185  unsigned int m_FixedImageDimensions[ImageDimension];
186 
189 
191 
192  fftw_plan m_PlanForwardDCT;
193  fftw_plan m_PlanBackwardDCT;
194 
196 
197  RealTypeDFT *m_DiagonalElements[ImageDimension];
198 };
199 } // end namespace itk
200 
201 #ifndef ITK_MANUAL_INSTANTIATION
202 #include "itkCurvatureRegistrationFilter.hxx"
203 #endif
204 
205 #endif //defined(ITK_USE_FFTWF) || defined(ITK_USE_FFTWD)
206 
207 #endif
Light weight base class for most itk classes.
typename Superclass::DisplacementFieldPointer DisplacementFieldPointer
Deformably register two images using the fast curvature algorithm.
typename Superclass::FixedImagePointer FixedImagePointer
typename Superclass::MovingImagePointer MovingImagePointer
typename DisplacementFieldComponentImageType::Pointer DisplacementFieldComponentImagePointer
typename Superclass::FixedImageType FixedImageType
typename DisplacementFieldPixelType::ValueType DisplacementFieldComponentType
typename Superclass::MovingImageType MovingImageType
Deformably register two images using a PDE algorithm.
typename Superclass::DisplacementFieldType DisplacementFieldType
typename TDisplacementField::PixelType DisplacementFieldPixelType
typename Superclass::TimeStepType TimeStepType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename Superclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
Templated n-dimensional image class.
Definition: itkImage.h:75