ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkVariationalRegistrationElasticRegularizer.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 itkVariationalRegistrationElasticRegularizer_h
19 #define itkVariationalRegistrationElasticRegularizer_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 
57 template< typename TDisplacementField >
59  : public VariationalRegistrationRegularizer< TDisplacementField >
60 {
61 public:
62  ITK_DISALLOW_COPY_AND_ASSIGN(VariationalRegistrationElasticRegularizer);
63 
67  TDisplacementField >;
70 
72  itkNewMacro(Self);
73 
76 
78  static constexpr unsigned int ImageDimension = TDisplacementField::ImageDimension;
79 
84  using PixelType = typename Superclass::PixelType;
85  using ValueType = typename Superclass::ValueType;
88 
91  #if defined( ITK_USE_FFTWD )
92  //Prefer to use double precision
93  using RealTypeFFT = double;
94  #else
95  #if defined( ITK_USE_FFTWF )
96  //Allow to use single precision
97  #warning "Using single precision for FFT computations!"
98  using RealTypeFFT = float;
99  #endif
100  #endif
101 
103 
105  itkSetMacro( Lambda, ValueType );
106 
108  itkGetConstMacro( Lambda, ValueType );
109 
111  itkSetMacro( Mu, ValueType );
112 
114  itkGetConstMacro( Mu, ValueType );
115 
116 protected:
119 
121  void PrintSelf(std::ostream& os, Indent indent) const override;
122 
125  void GenerateData() override;
126 
129  void Initialize() override;
130 
132  virtual bool InitializeElasticFFTPlans();
133 
135  virtual bool InitializeElasticMatrix();
136 
138  virtual void FreeData();
139 
141  virtual void Regularize();
142 
144  virtual void SolveElasticLES();
145 
148 
151  OffsetValueType offset );
152 
153 private:
156 
159 
161  typename DisplacementFieldType::SpacingType m_Spacing;
162 
165 
168 
171 
174 
176 
180 
194  {
197  };
198 
200 };
201 
202 }
203 
204 #ifndef ITK_MANUAL_INSTANTIATION
205 # include "itkVariationalRegistrationElasticRegularizer.hxx"
206 #endif
207 
208 #endif
209 #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
This class performs linear elastic regularization of a vector field.
Base class for regularization component in the variational registration framework.
typename Superclass::DisplacementFieldPointer DisplacementFieldPointer
typename Superclass::DisplacementFieldConstPointer DisplacementFieldConstPointer
void ITK_THREAD_RETURN_TYPE
static ITK_THREAD_RETURN_TYPE SolveElasticLESThreaderCallback(void *vargs)
virtual void ThreadedSolveElasticLES(OffsetValueType from, OffsetValueType to)
typename NumericTraits< PixelType >::ValueType ValueType
typename DisplacementFieldType::Pointer DisplacementFieldPointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename DisplacementFieldType::PixelType PixelType
signed long OffsetValueType
Definition: itkIntTypes.h:94
DisplacementFieldType::IndexType CalculateComplexImageIndex(OffsetValueType offset)