ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkPDEDeformableRegistrationFilter.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 itkPDEDeformableRegistrationFilter_h
19 #define itkPDEDeformableRegistrationFilter_h
20 
23 
24 namespace itk
25 {
72 template< typename TFixedImage, typename TMovingImage, typename TDisplacementField >
73 class ITK_TEMPLATE_EXPORT PDEDeformableRegistrationFilter:
74  public DenseFiniteDifferenceImageFilter< TDisplacementField, TDisplacementField >
75 {
76 public:
77 
83 
85  itkNewMacro(Self);
86 
90 
92  typedef TFixedImage FixedImageType;
93  typedef typename FixedImageType::Pointer FixedImagePointer;
94  typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
95 
97  typedef TMovingImage MovingImageType;
98  typedef typename MovingImageType::Pointer MovingImagePointer;
99  typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
100 
102  typedef TDisplacementField DisplacementFieldType;
103  typedef typename DisplacementFieldType::Pointer DisplacementFieldPointer;
104 
105 #ifdef ITKV3_COMPATIBILITY
106  typedef TDisplacementField DeformationFieldType;
107  typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
108 #endif
109 
111  typedef typename Superclass::OutputImageType OutputImageType;
112 
114  typedef typename Superclass::FiniteDifferenceFunctionType
116 
120 
122  itkStaticConstMacro(ImageDimension, unsigned int,
123  Superclass::ImageDimension);
124 
126  itkSetInputMacro(FixedImage, FixedImageType);
127 
129  itkGetInputMacro(FixedImage, FixedImageType);
130 
132  itkSetInputMacro(MovingImage, MovingImageType);
133 
135  itkGetInputMacro(MovingImage, MovingImageType);
136 
138  itkSetInputMacro(InitialDisplacementField, DisplacementFieldType);
139 
141  itkGetInputMacro(InitialDisplacementField, DisplacementFieldType);
142 
145  { return this->GetOutput(); }
146 
147 #ifdef ITKV3_COMPATIBILITY
148  virtual void SetInitialDeformationField(DeformationFieldType *ptr)
149  {
150  this->SetInitialDisplacementField(ptr);
151  }
152 
154  DeformationFieldType * GetDeformationField(void)
155  {
156  return static_cast<DeformationFieldType *> (this->GetDisplacementField());
157  }
158 #endif
159 
165  virtual std::vector< SmartPointer< DataObject > >::size_type GetNumberOfValidRequiredInputs() const ITK_OVERRIDE;
166 
172  itkSetMacro(SmoothDisplacementField, bool);
173  itkGetConstMacro(SmoothDisplacementField, bool);
174  itkBooleanMacro(SmoothDisplacementField);
176 
177 #ifdef ITKV3_COMPATIBILITY
178  virtual void SetSmoothDeformationField(bool val)
179  {
180  SetSmoothDisplacementField(val);
181  }
182  virtual bool GetSmoothDeformationField()
183  {
184  return this->GetSmoothDisplacementField();
185  }
186  virtual void SmoothDeformationFieldOn()
187  {
188  this->SmoothDisplacementFieldOn();
189  }
190  virtual void SmoothDeformationFieldOff()
191  {
192  this->SmoothDisplacementFieldOff();
193  }
194 #endif
195 
196  typedef FixedArray< double, ImageDimension > StandardDeviationsType;
197 
201  itkSetMacro(StandardDeviations, StandardDeviationsType);
202  virtual void SetStandardDeviations(double value);
204 
207  itkGetConstReferenceMacro(StandardDeviations, StandardDeviationsType);
208 
214  itkSetMacro(SmoothUpdateField, bool);
215  itkGetConstMacro(SmoothUpdateField, bool);
216  itkBooleanMacro(SmoothUpdateField);
218 
221  itkSetMacro(UpdateFieldStandardDeviations, StandardDeviationsType);
222  virtual void SetUpdateFieldStandardDeviations(double value);
224 
227  itkGetConstReferenceMacro(UpdateFieldStandardDeviations, StandardDeviationsType);
228 
230  virtual void StopRegistration()
231  { m_StopRegistrationFlag = true; }
232 
235  itkSetMacro(MaximumError, double);
236  itkGetConstMacro(MaximumError, double);
238 
241  itkSetMacro(MaximumKernelWidth, unsigned int);
242  itkGetConstMacro(MaximumKernelWidth, unsigned int);
244 
245 protected:
248  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
249 
252  virtual bool Halt() ITK_OVERRIDE
253  {
254  if ( m_StopRegistrationFlag )
255  {
256  return true;
257  }
258 
259  return this->Superclass::Halt();
260  }
261 
264  virtual void CopyInputToOutput() ITK_OVERRIDE;
265 
268  virtual void InitializeIteration() ITK_OVERRIDE;
269 
273  virtual void SmoothDisplacementField();
274 #ifdef ITKV3_COMPATIBILITY
275  virtual void SmoothDeformationField()
276  {
277  this->SmoothDisplacementField();
278  }
279 #endif
280 
284  virtual void SmoothUpdateField();
285 
288  virtual void PostProcessOutput() ITK_OVERRIDE;
289 
291  virtual void Initialize() ITK_OVERRIDE;
292 
297  virtual void GenerateOutputInformation() ITK_OVERRIDE;
298 
305  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
306 
307 private:
308  ITK_DISALLOW_COPY_AND_ASSIGN(PDEDeformableRegistrationFilter);
309 
311  StandardDeviationsType m_StandardDeviations;
312  StandardDeviationsType m_UpdateFieldStandardDeviations;
313 
315  bool m_SmoothDisplacementField;
316  bool m_SmoothUpdateField;
317 
321 
322 private:
324  double m_MaximumError;
325 
327  unsigned int m_MaximumKernelWidth;
328 
330  bool m_StopRegistrationFlag;
331 };
332 } // end namespace itk
333 
334 #ifndef ITK_MANUAL_INSTANTIATION
335 #include "itkPDEDeformableRegistrationFilter.hxx"
336 #endif
337 
338 #endif
Light weight base class for most itk classes.
Deformably register two images using a PDE algorithm.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
DenseFiniteDifferenceImageFilter< TDisplacementField, TDisplacementField > Superclass
PDEDeformableRegistrationFunction< FixedImageType, MovingImageType, DisplacementFieldType > PDEDeformableRegistrationFunctionType
Superclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType