ITK  5.2.0
Insight Toolkit
itkCurvatureRegistrationFilter.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  * 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,
98  typename TMovingImage,
99  typename TDisplacementField,
100  typename TImageForceFunction = MeanSquareRegistrationFunction<TFixedImage, TMovingImage, TDisplacementField>>
101 class ITK_TEMPLATE_EXPORT CurvatureRegistrationFilter
102  : public PDEDeformableRegistrationFilter<TFixedImage, TMovingImage, TDisplacementField>
103 {
104 public:
105  ITK_DISALLOW_COPY_AND_ASSIGN(CurvatureRegistrationFilter);
106 
112 
114  itkNewMacro(Self);
115 
118 
120  using TimeStepType = typename Superclass::TimeStepType;
121 
123  using FixedImageType = typename Superclass::FixedImageType;
124  using FixedImagePointer = typename Superclass::FixedImagePointer;
125  static constexpr unsigned int ImageDimension = FixedImageType::ImageDimension;
126 
128  using MovingImageType = typename Superclass::MovingImageType;
129  using MovingImagePointer = typename Superclass::MovingImagePointer;
130 
132  using DisplacementFieldType = typename Superclass::DisplacementFieldType;
133  using DisplacementFieldPointer = typename Superclass::DisplacementFieldPointer;
134 
135  using DisplacementFieldPixelType = typename TDisplacementField::PixelType;
136  using DisplacementFieldComponentType = typename DisplacementFieldPixelType::ValueType;
137  static constexpr unsigned int DeformationVectorDimension = DisplacementFieldPixelType::Dimension;
138 
139 # if defined(ITK_USE_FFTWD)
140  // Prefer to use double precision
141  using RealTypeDFT = double;
142 # else
143 # if defined(ITK_USE_FFTWF)
144  // Allow to use single precision
145 # warning "Using single precision for FFT computations!"
146  using RealTypeDFT = double;
147 # endif
148 # endif
149 
152 
154  using FiniteDifferenceFunctionType = typename Superclass::FiniteDifferenceFunctionType;
155 
157  using RegistrationFunctionType = TImageForceFunction;
158 
160  void
161  SetConstraintWeight(const float w)
162  {
163  m_ConstraintWeight = w;
164  }
165 
167  void
169  {
170  m_TimeStep = ts;
171  }
172 
178  virtual double
179  GetMetric() const;
180 
181 protected:
183  ~CurvatureRegistrationFilter() override;
184  void
185  PrintSelf(std::ostream & os, Indent indent) const override;
186 
188  void
189  Initialize() override;
190 
192  void
193  ApplyUpdate(const TimeStepType & dt) override;
194 
195 private:
196  unsigned int m_FixedImageDimensions[ImageDimension];
197 
200 
202 
203  fftw_plan m_PlanForwardDCT;
204  fftw_plan m_PlanBackwardDCT;
205 
207 
208  RealTypeDFT * m_DiagonalElements[ImageDimension];
209 };
210 } // end namespace itk
211 
212 # ifndef ITK_MANUAL_INSTANTIATION
213 # include "itkCurvatureRegistrationFilter.hxx"
214 # endif
215 
216 #endif // defined(ITK_USE_FFTWF) || defined(ITK_USE_FFTWD)
217 
218 #endif
itk::CurvatureRegistrationFilter::m_ConstraintWeight
float m_ConstraintWeight
Definition: itkCurvatureRegistrationFilter.h:201
itk::CurvatureRegistrationFilter::m_PlanBackwardDCT
fftw_plan m_PlanBackwardDCT
Definition: itkCurvatureRegistrationFilter.h:204
itk::CurvatureRegistrationFilter::FixedImagePointer
typename Superclass::FixedImagePointer FixedImagePointer
Definition: itkCurvatureRegistrationFilter.h:124
itk::CurvatureRegistrationFilter::SetConstraintWeight
void SetConstraintWeight(const float w)
Definition: itkCurvatureRegistrationFilter.h:161
itk::CurvatureRegistrationFilter::FixedImageType
typename Superclass::FixedImageType FixedImageType
Definition: itkCurvatureRegistrationFilter.h:123
itk::CurvatureRegistrationFilter::MovingImageType
typename Superclass::MovingImageType MovingImageType
Definition: itkCurvatureRegistrationFilter.h:128
itk::CurvatureRegistrationFilter::SetTimeStep
void SetTimeStep(const TimeStepType ts)
Definition: itkCurvatureRegistrationFilter.h:168
itk::CurvatureRegistrationFilter::RegistrationFunctionType
TImageForceFunction RegistrationFunctionType
Definition: itkCurvatureRegistrationFilter.h:157
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::CurvatureRegistrationFilter::m_PlanForwardDCT
fftw_plan m_PlanForwardDCT
Definition: itkCurvatureRegistrationFilter.h:203
itk::CurvatureRegistrationFilter::DisplacementFieldType
typename Superclass::DisplacementFieldType DisplacementFieldType
Definition: itkCurvatureRegistrationFilter.h:132
itk::CurvatureRegistrationFilter::DisplacementFieldComponentType
typename DisplacementFieldPixelType::ValueType DisplacementFieldComponentType
Definition: itkCurvatureRegistrationFilter.h:136
itk::CurvatureRegistrationFilter::m_TimeStep
TimeStepType m_TimeStep
Definition: itkCurvatureRegistrationFilter.h:206
itk::CurvatureRegistrationFilter::TimeStepType
typename Superclass::TimeStepType TimeStepType
Definition: itkCurvatureRegistrationFilter.h:120
itk::CurvatureRegistrationFilter::FiniteDifferenceFunctionType
typename Superclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
Definition: itkCurvatureRegistrationFilter.h:154
itk::CurvatureRegistrationFilter::m_DisplacementFieldComponentImageDCT
RealTypeDFT * m_DisplacementFieldComponentImageDCT
Definition: itkCurvatureRegistrationFilter.h:199
itk::CurvatureRegistrationFilter::DisplacementFieldPixelType
typename TDisplacementField::PixelType DisplacementFieldPixelType
Definition: itkCurvatureRegistrationFilter.h:135
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itkMeanSquareRegistrationFunction.h
itk::CurvatureRegistrationFilter
Deformably register two images using the fast curvature algorithm.
Definition: itkCurvatureRegistrationFilter.h:101
itk::CurvatureRegistrationFilter::DisplacementFieldPointer
typename Superclass::DisplacementFieldPointer DisplacementFieldPointer
Definition: itkCurvatureRegistrationFilter.h:133
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkPDEDeformableRegistrationFilter.h
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
itk::CurvatureRegistrationFilter::RealTypeDFT
double RealTypeDFT
Definition: itkCurvatureRegistrationFilter.h:141
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44
itk::CurvatureRegistrationFilter::m_DisplacementFieldComponentImage
RealTypeDFT * m_DisplacementFieldComponentImage
Definition: itkCurvatureRegistrationFilter.h:198
itk::PDEDeformableRegistrationFilter
Deformably register two images using a PDE algorithm.
Definition: itkPDEDeformableRegistrationFilter.h:73
itk::CurvatureRegistrationFilter::MovingImagePointer
typename Superclass::MovingImagePointer MovingImagePointer
Definition: itkCurvatureRegistrationFilter.h:129
itk::CurvatureRegistrationFilter::DisplacementFieldComponentImagePointer
typename DisplacementFieldComponentImageType::Pointer DisplacementFieldComponentImagePointer
Definition: itkCurvatureRegistrationFilter.h:151