ITK  4.8.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 "itkMultiThreader.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< class TDisplacementField >
59  : public VariationalRegistrationRegularizer< TDisplacementField >
60 {
61 public:
65  TDisplacementField > Superclass;
68 
70  itkNewMacro(Self);
71 
74 
76  itkStaticConstMacro(ImageDimension, unsigned int, TDisplacementField::ImageDimension);
77 
80  typedef typename Superclass::DisplacementFieldPointer DisplacementFieldPointer;
81  typedef typename Superclass::DisplacementFieldConstPointer DisplacementFieldConstPointer;
82  typedef typename Superclass::PixelType PixelType;
83  typedef typename Superclass::ValueType ValueType;
86 
89  #if defined( ITK_USE_FFTWD )
90  //Prefer to use double precision
91  typedef double RealTypeFFT;
92  #else
93  #if defined( ITK_USE_FFTWF )
94  //Allow to use single precision
95  #warning "Using single precision for FFT computations!"
96  typedef float RealTypeFFT;
97  #endif
98  #endif
99 
101 
103  itkSetMacro( Lambda, ValueType );
104 
106  itkGetConstMacro( Lambda, ValueType );
107 
109  itkSetMacro( Mu, ValueType );
110 
112  itkGetConstMacro( Mu, ValueType );
113 
114 protected:
117 
119  virtual void PrintSelf(std::ostream& os, Indent indent) const;
120 
123  virtual void GenerateData();
124 
127  virtual void Initialize();
128 
130  virtual bool InitializeElasticFFTPlans();
131 
133  virtual bool InitializeElasticMatrix();
134 
136  virtual void FreeData();
137 
139  virtual void Regularize();
140 
142  virtual void SolveElasticLES();
143 
145  virtual void ThreadedSolveElasticLES( OffsetValueType from, OffsetValueType to );
146 
148  typename DisplacementFieldType::IndexType CalculateComplexImageIndex(
149  OffsetValueType offset );
150 
151 private:
152  VariationalRegistrationElasticRegularizer(const Self&); //purposely not implemented
153  void operator=(const Self&); //purposely not implemented
154 
157 
160 
162  typename DisplacementFieldType::SpacingType m_Spacing;
163 
165  typename DisplacementFieldType::SizeType m_Size;
166 
169 
171  typename DisplacementFieldType::SizeType m_ComplexSize;
172 
175 
176  OffsetValueType m_ComplexOffsetTable[ImageDimension];
177 
179  double * m_MatrixCos[ImageDimension];
180  double * m_MatrixSin[ImageDimension];
181 
195  {
198  };
199 
200  static ITK_THREAD_RETURN_TYPE SolveElasticLESThreaderCallback(void *vargs);
201 };
202 
203 }
204 
205 #ifndef ITK_MANUAL_INSTANTIATION
206 # include "itkVariationalRegistrationElasticRegularizer.hxx"
207 #endif
208 
209 #endif
210 #endif
Light weight base class for most itk classes.
signed long OffsetValueType
Definition: itkIntTypes.h:154
This class performs linear elastic regularization of a vector field.
Base class for regularization component in the variational registration framework.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
#define ITK_THREAD_RETURN_TYPE
VariationalRegistrationRegularizer< TDisplacementField > Superclass
Control indentation during Print() invocation.
Definition: itkIndent.h:49