ITK  4.2.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);
241 protected:
244  void PrintSelf(std::ostream & os, Indent indent) const;
246 
249  virtual bool Halt()
250  {
251  if ( m_StopRegistrationFlag )
252  {
253  return true;
254  }
255 
256  return this->Superclass::Halt();
257  }
258 
261  virtual void CopyInputToOutput();
262 
265  virtual void InitializeIteration();
266 
270  virtual void SmoothDisplacementField();
271 #ifdef ITKV3_COMPATIBILITY
272  virtual void SmoothDeformationField()
273  {
274  this->SmoothDisplacementField();
275  }
276 #endif
277 
281  virtual void SmoothUpdateField();
282 
285  virtual void PostProcessOutput();
286 
288  virtual void Initialize();
289 
294  virtual void GenerateOutputInformation();
295 
302  virtual void GenerateInputRequestedRegion();
303 
304 private:
305  PDEDeformableRegistrationFilter(const Self &); //purposely not implemented
306  void operator=(const Self &); //purposely not implemented
307 
311 
315 
319 private:
320 
323 
325  unsigned int m_MaximumKernelWidth;
326 
329 };
330 } // end namespace itk
331 
332 #ifndef ITK_MANUAL_INSTANTIATION
333 #include "itkPDEDeformableRegistrationFilter.hxx"
334 #endif
335 
336 #endif
337