ITK  4.3.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< class TFixedImage, class TMovingImage, class TDisplacementField >
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  void SetFixedImage(const FixedImageType *ptr);
127 
129  const FixedImageType * GetFixedImage(void) const;
130 
132  void SetMovingImage(const MovingImageType *ptr);
133 
135  const MovingImageType * GetMovingImage(void) const;
136 
138  void SetInitialDisplacementField(const DisplacementFieldType *ptr)
139  { this->SetInput(ptr); }
140 
142  DisplacementFieldType * GetDisplacementField()
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;
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;
247 
250  virtual bool Halt()
251  {
252  if ( m_StopRegistrationFlag )
253  {
254  return true;
255  }
256 
257  return this->Superclass::Halt();
258  }
259 
262  virtual void CopyInputToOutput();
263 
266  virtual void InitializeIteration();
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();
287 
289  virtual void Initialize();
290 
295  virtual void GenerateOutputInformation();
296 
303  virtual void GenerateInputRequestedRegion();
304 
305 private:
306  PDEDeformableRegistrationFilter(const Self &); //purposely not implemented
307  void operator=(const Self &); //purposely not implemented
308 
312 
316 
320 
321 private:
324 
326  unsigned int m_MaximumKernelWidth;
327 
330 };
331 } // end namespace itk
332 
333 #ifndef ITK_MANUAL_INSTANTIATION
334 #include "itkPDEDeformableRegistrationFilter.hxx"
335 #endif
336 
337 #endif
338