ITK  4.2.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( USE_FFTWF ) || defined( USE_FFTWD )
25 #include "fftw3.h"
26 
27 namespace itk
28 {
97 template< class TFixedImage, class TMovingImage, class TDisplacementField,
98  class TImageForceFunction =
99  MeanSquareRegistrationFunction< TFixedImage, TMovingImage, TDisplacementField > >
101  public PDEDeformableRegistrationFilter< TFixedImage, TMovingImage,
102  TDisplacementField >
103 {
104 public:
110 
112  itkNewMacro(Self);
113 
115  itkTypeMacro(CurvatureRegistrationFilter,
117 
119  typedef typename Superclass::TimeStepType TimeStepType;
120 
122  typedef typename Superclass::FixedImageType FixedImageType;
123  typedef typename Superclass::FixedImagePointer FixedImagePointer;
124  itkStaticConstMacro(ImageDimension, unsigned int, FixedImageType::ImageDimension);
125 
127  typedef typename Superclass::MovingImageType MovingImageType;
128  typedef typename Superclass::MovingImagePointer MovingImagePointer;
129 
131  typedef typename Superclass::DisplacementFieldType
133  typedef typename Superclass::DisplacementFieldPointer
135 
136  typedef typename TDisplacementField::PixelType DisplacementFieldPixelType;
137  typedef typename DisplacementFieldPixelType::ValueType DisplacementFieldComponentType;
138  itkStaticConstMacro(DeformationVectorDimension, unsigned int, DisplacementFieldPixelType::Dimension);
139 
140  #if defined( USE_FFTWD )
141  //Prefer to use double precision
142  typedef double RealTypeDFT;
143  #else
144  #if defined( USE_FFTWF )
145  //Allow to use single precision
146  #warning "Using single precision for FFT computations!"
147  typedef double RealTypeDFT;
148  #endif
149  #endif
150 
153 
155  typedef typename Superclass::FiniteDifferenceFunctionType
157 
159  typedef TImageForceFunction RegistrationFunctionType;
160 
162  void SetConstraintWeight(const float w) { m_ConstraintWeight = w; }
163 
165  void SetTimeStep(const TimeStepType ts) { m_TimeStep = ts; }
166 
172  virtual double GetMetric() const;
173 
174 protected:
177  void PrintSelf(std::ostream & os, Indent indent) const;
178 
180  virtual void Initialize();
181 
183  virtual void ApplyUpdate(const TimeStepType& dt);
184 
185 private:
186  CurvatureRegistrationFilter(const Self &); //purposely not implemented
187  void operator=(const Self &); //purposely not implemented
188 
189  unsigned int m_FixedImageDimensions[ImageDimension];
190 
193 
195 
196  fftw_plan m_PlanForwardDCT;
197  fftw_plan m_PlanBackwardDCT;
198 
200 
201  RealTypeDFT *m_DiagonalElements[ImageDimension];
202 };
203 } // end namespace itk
204 
205 #ifndef ITK_MANUAL_INSTANTIATION
206 #include "itkCurvatureRegistrationFilter.hxx"
207 #endif
208 
209 #endif //defined(USE_FFTWF) || defined(USE_FFTWD)
210 
211 #endif
212