ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkVariationalRegistrationCurvatureRegularizer.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 itkVariationalRegistrationCurvatureRegularizer_h
19 #define itkVariationalRegistrationCurvatureRegularizer_h
20 
22 #include "itkMultiThreaderBase.h"
23 
24 #if defined( ITK_USE_FFTWD ) || defined( ITK_USE_FFTWF )
25 
26 // other includes:
27 #include "itkFFTWCommon.h"
28 
29 namespace itk {
30 
61 template< typename TDisplacementField >
63  : public VariationalRegistrationRegularizer< TDisplacementField >
64 {
65 public:
66  ITK_DISALLOW_COPY_AND_ASSIGN(VariationalRegistrationCurvatureRegularizer);
67 
73 
75  itkNewMacro(Self);
76 
79 
81  static constexpr unsigned int ImageDimension = TDisplacementField::ImageDimension;
82 
87  using PixelType = typename Superclass::PixelType;
88  using ValueType = typename Superclass::ValueType;
91 
94  #if defined( ITK_USE_FFTWD )
95  //Prefer to use double precision
96  using RealTypeFFT = double;
97  #else
98  #if defined( ITK_USE_FFTWF )
99  //Allow to use single precision
100  #warning "Using single precision for FFT computations!"
101  using RealTypeFFT = float;
102  #endif
103  #endif
104 
106 
108  itkSetMacro( Alpha, ValueType );
109 
111  itkGetConstMacro( Alpha, ValueType );
112 
113 protected:
116 
118  void PrintSelf(std::ostream& os, Indent indent) const override;
119 
122  void GenerateData() override;
123 
126  void Initialize() override;
127 
129  virtual bool InitializeCurvatureFFTPlans();
130 
132  virtual bool InitializeCurvatureDiagonalMatrix();
133 
135  virtual void Regularize();
136 
138  virtual void SolveCurvatureLES(unsigned int currentDimension);
139 
141  virtual void ThreadedSolveCurvatureLES(unsigned int currentDimension, OffsetValueType from, OffsetValueType to );
142 
145  OffsetValueType offset );
146 
147 private:
150 
152  typename DisplacementFieldType::SpacingType m_Spacing;
153 
156 
159 
162 
165 
177  {
180  unsigned int currentDimension;
181  };
182 
184 };
185 
186 }
187 
188 #ifndef ITK_MANUAL_INSTANTIATION
189 # include "itkVariationalRegistrationCurvatureRegularizer.hxx"
190 #endif
191 
192 #endif
193 #endif
Light weight base class for most itk classes.
void PrintSelf(std::ostream &os, Indent indent) const override
unsigned long SizeValueType
Definition: itkIntTypes.h:83
typename DisplacementFieldType::ConstPointer DisplacementFieldConstPointer
Base class for regularization component in the variational registration framework.
virtual void SolveCurvatureLES(unsigned int currentDimension)
void ITK_THREAD_RETURN_TYPE
typename Superclass::DisplacementFieldConstPointer DisplacementFieldConstPointer
virtual void ThreadedSolveCurvatureLES(unsigned int currentDimension, OffsetValueType from, OffsetValueType to)
typename NumericTraits< PixelType >::ValueType ValueType
typename DisplacementFieldType::Pointer DisplacementFieldPointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
static ITK_THREAD_RETURN_TYPE SolveCurvatureLESThreaderCallback(void *vargs)
typename DisplacementFieldType::PixelType PixelType
This class performs linear elastic regularization of a vector field.
DisplacementFieldType::IndexType CalculateImageIndex(OffsetValueType offset)