ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkVariationalRegistrationDiffusionRegularizer.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 __itkVariationalRegistrationDiffusionRegularizer_h
19 #define __itkVariationalRegistrationDiffusionRegularizer_h
20 
22 #include "itkMultiThreader.h"
23 
24 namespace itk {
25 
50 template< class TDisplacementField >
52  : public VariationalRegistrationRegularizer< TDisplacementField >
53 {
54 public:
58  TDisplacementField > Superclass;
61 
63  itkNewMacro(Self);
64 
66  itkTypeMacro(itkVariationalRegistrationDiffusionRegularizer, itkVariationalRegistrationRegularizer);
67 
69  itkStaticConstMacro(ImageDimension, unsigned int, TDisplacementField::ImageDimension);
70 
73  typedef typename Superclass::DisplacementFieldPointer DisplacementFieldPointer;
74  typedef typename Superclass::DisplacementFieldConstPointer DisplacementFieldConstPointer;
75  typedef typename Superclass::PixelType PixelType;
76  typedef typename Superclass::ValueType ValueType;
77 
82 
84  itkSetMacro( Alpha, ValueType );
85 
87  itkGetConstMacro( Alpha, ValueType );
88 
89 protected:
92 
94  virtual void PrintSelf(std::ostream& os, Indent indent) const;
95 
98  virtual void GenerateData();
99 
102  virtual void Initialize();
103 
106  virtual void InitLUMatrices( ValueType** alpha, ValueType** beta,
107  ValueType** gamma, int n, int dim );
108 
111  virtual void RegularizeComponent( const int component );
112 
115  {
117  unsigned int component; // The current dimension.
118  BufferImagePointer bPtr; // Pointer to the image buffer.
119  };
120 
123  {
125  unsigned int direction; // Current direction.
126  ValueType* alpha; // Pointer to matrix diagonal.
127  ValueType* beta; // Pointer to matrix subdiagonal.
128  ValueType* gamma; // Pointer to matrix superdiagonal.
129  BufferImagePointer bPtr; // Pointer to force field image buffer.
130  BufferImagePointer vPtr; // Pointer to temporal result image buffer.
131  };
132 
135  {
137  unsigned int component; // The current dimension.
138  BufferImagePointer* vPtr; // Pointer to temporal image buffers.
139  };
140 
142  static ITK_THREAD_RETURN_TYPE CalcBufferCallback( void *arg );
143 
145  static ITK_THREAD_RETURN_TYPE RegularizeDirectionCallback( void *arg );
146 
148  static ITK_THREAD_RETURN_TYPE MergeDirectionsCallback( void *arg );
149 
155  virtual int SplitBoundaryFaceRegion( int i, int num, int inDir,
156  BufferImageRegionType& splitRegion );
157 
158 private:
159  VariationalRegistrationDiffusionRegularizer(const Self&); //purposely not implemented
160  void operator=(const Self&); //purposely not implemented
161 
164 
166  typename DisplacementFieldType::SizeType m_Size;
167 
169  typename DisplacementFieldType::SpacingType m_Spacing;
170 
171  // Attributes for AOS calculation
174 
177  BufferImagePointer m_V[ImageDimension];
178 
180  ValueType* m_MatrixAlpha[ImageDimension];
181 
183  ValueType* m_MatrixBeta[ImageDimension];
184 
186  ValueType* m_MatrixGamma[ImageDimension];
187 };
188 
189 }
190 
191 #ifndef ITK_MANUAL_INSTANTIATION
192 # include "itkVariationalRegistrationDiffusionRegularizer.hxx"
193 #endif
194 
195 #endif
Superclass::RegionType RegionType
Definition: itkImage.h:137
Light weight base class for most itk classes.
Base class for regularization component in the variational registration framework.
#define ITK_THREAD_RETURN_TYPE
VariationalRegistrationRegularizer< TDisplacementField > Superclass
Control indentation during Print() invocation.
Definition: itkIndent.h:49
This class performs diffusive regularization of a vector field.
Templated n-dimensional image class.
Definition: itkImage.h:75