ITK  4.12.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;
95 
97  typedef TMovingImage MovingImageType;
100 
102  typedef TDisplacementField DisplacementFieldType;
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  void SetFixedImage(const FixedImageType *ptr);
127 
129  const FixedImageType * GetFixedImage() const;
130 
132  void SetMovingImage(const MovingImageType *ptr);
133 
135  const MovingImageType * GetMovingImage() const;
136 
139  { this->SetInput(ptr); }
140 
143  { return this->GetOutput(); }
144 
145 #ifdef ITKV3_COMPATIBILITY
146  virtual void SetInitialDeformationField(DeformationFieldType *ptr)
147  {
148  this->SetInitialDisplacementField(ptr);
149  }
150 
152  DeformationFieldType * GetDeformationField(void)
153  {
154  return static_cast<DeformationFieldType *> (this->GetDisplacementField());
155  }
156 #endif
157 
163  virtual std::vector< SmartPointer< DataObject > >::size_type GetNumberOfValidRequiredInputs() const ITK_OVERRIDE;
164 
170  itkSetMacro(SmoothDisplacementField, bool);
171  itkGetConstMacro(SmoothDisplacementField, bool);
172  itkBooleanMacro(SmoothDisplacementField);
174 
175 #ifdef ITKV3_COMPATIBILITY
176  virtual void SetSmoothDeformationField(bool val)
177  {
178  SetSmoothDisplacementField(val);
179  }
180  virtual bool GetSmoothDeformationField()
181  {
182  return this->GetSmoothDisplacementField();
183  }
184  virtual void SmoothDeformationFieldOn()
185  {
186  this->SmoothDisplacementFieldOn();
187  }
188  virtual void SmoothDeformationFieldOff()
189  {
190  this->SmoothDisplacementFieldOff();
191  }
192 #endif
193 
194  typedef FixedArray< double, ImageDimension > StandardDeviationsType;
195 
199  itkSetMacro(StandardDeviations, StandardDeviationsType);
200  virtual void SetStandardDeviations(double value);
202 
205  itkGetConstReferenceMacro(StandardDeviations, StandardDeviationsType);
206 
212  itkSetMacro(SmoothUpdateField, bool);
213  itkGetConstMacro(SmoothUpdateField, bool);
214  itkBooleanMacro(SmoothUpdateField);
216 
219  itkSetMacro(UpdateFieldStandardDeviations, StandardDeviationsType);
220  virtual void SetUpdateFieldStandardDeviations(double value);
222 
225  itkGetConstReferenceMacro(UpdateFieldStandardDeviations, StandardDeviationsType);
226 
228  virtual void StopRegistration()
229  { m_StopRegistrationFlag = true; }
230 
233  itkSetMacro(MaximumError, double);
234  itkGetConstMacro(MaximumError, double);
236 
239  itkSetMacro(MaximumKernelWidth, unsigned int);
240  itkGetConstMacro(MaximumKernelWidth, unsigned int);
242 
243 protected:
246  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
247 
250  virtual bool Halt() ITK_OVERRIDE
251  {
252  if ( m_StopRegistrationFlag )
253  {
254  return true;
255  }
256 
257  return this->Superclass::Halt();
258  }
259 
262  virtual void CopyInputToOutput() ITK_OVERRIDE;
263 
266  virtual void InitializeIteration() ITK_OVERRIDE;
267 
271  virtual void SmoothDisplacementField();
272 #ifdef ITKV3_COMPATIBILITY
273  virtual void SmoothDeformationField()
274  {
275  this->SmoothDisplacementField();
276  }
277 #endif
278 
282  virtual void SmoothUpdateField();
283 
286  virtual void PostProcessOutput() ITK_OVERRIDE;
287 
289  virtual void Initialize() ITK_OVERRIDE;
290 
295  virtual void GenerateOutputInformation() ITK_OVERRIDE;
296 
303  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
304 
305 private:
306  ITK_DISALLOW_COPY_AND_ASSIGN(PDEDeformableRegistrationFilter);
307 
309  StandardDeviationsType m_StandardDeviations;
310  StandardDeviationsType m_UpdateFieldStandardDeviations;
311 
313  bool m_SmoothDisplacementField;
314  bool m_SmoothUpdateField;
315 
319 
320 private:
322  double m_MaximumError;
323 
325  unsigned int m_MaximumKernelWidth;
326 
328  bool m_StopRegistrationFlag;
329 };
330 } // end namespace itk
331 
332 #ifndef ITK_MANUAL_INSTANTIATION
333 #include "itkPDEDeformableRegistrationFilter.hxx"
334 #endif
335 
336 #endif
virtual void PrintSelf(std::ostream &os, Indent indent) const override
Light weight base class for most itk classes.
virtual void Initialize()
SmartPointer< Self > Pointer
void SetInitialDisplacementField(const DisplacementFieldType *ptr)
SmartPointer< const Self > ConstPointer
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