ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkPDEDeformableRegistrationFunction.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 __itkPDEDeformableRegistrationFunction_h
19 #define __itkPDEDeformableRegistrationFunction_h
20 
22 
23 namespace itk
24 {
40 template< class TFixedImage, class TMovingImage, class TDisplacementField >
42  public FiniteDifferenceFunction< TDisplacementField >
43 {
44 public:
50 
54 
56  typedef TMovingImage MovingImageType;
57  typedef typename MovingImageType::ConstPointer MovingImagePointer;
58 
60  typedef TFixedImage FixedImageType;
61  typedef typename FixedImageType::ConstPointer FixedImagePointer;
62 
64  typedef TDisplacementField DisplacementFieldType;
65  typedef typename DisplacementFieldType::Pointer DisplacementFieldTypePointer;
66 
67 #ifdef ITKV3_COMPATIBILITY
68  typedef TDisplacementField DeformationFieldType;
69  typedef typename DeformationFieldType::Pointer DeformationFieldTypePointer;
70 #endif
71 
73  void SetMovingImage(const MovingImageType *ptr)
74  { m_MovingImage = ptr; }
75 
77  const MovingImageType * GetMovingImage(void) const
78  { return m_MovingImage; }
79 
81  void SetFixedImage(const FixedImageType *ptr)
82  { m_FixedImage = ptr; }
83 
85  const FixedImageType * GetFixedImage(void) const
86  { return m_FixedImage; }
87 
89  void SetDisplacementField(DisplacementFieldTypePointer ptr)
90  { m_DisplacementField = ptr; }
91 
94  DisplacementFieldType * GetDisplacementField(void)
95  { return m_DisplacementField; }
96 
97 #ifdef ITKV3_COMPATIBILITY
98  void SetDeformationField(DeformationFieldTypePointer ptr)
99  { this->SetDisplacementField(ptr); }
100 
101  DeformationFieldType * GetDeformationField(void)
102  { return itkDynamicCastInDebugMode<DeformationFieldType *> (this->GetDisplacementField()); }
103 #endif
104 
105  void SetEnergy(double e) { m_Energy = e; }
106  double GetEnergy() const { return m_Energy; }
107  void SetGradientStep(double e) { m_GradientStep = e; }
108  double GetGradientStep() const { return m_GradientStep; }
109  void SetNormalizeGradient(bool e) { m_NormalizeGradient = e; }
110  bool GetNormalizeGradient() const { return m_NormalizeGradient; }
111 
112 protected:
114  {
115  m_MovingImage = NULL;
116  m_FixedImage = NULL;
117  m_DisplacementField = NULL;
118  m_Energy = 0.0;
119  m_NormalizeGradient = true;
120  m_GradientStep = 1.0;
121  }
122 
124 
125  void PrintSelf(std::ostream & os, Indent indent) const
126  {
127  Superclass::PrintSelf(os, indent);
128  os << indent << "MovingImage: ";
129  os << m_MovingImage.GetPointer() << std::endl;
130  os << indent << "FixedImage: ";
131  os << m_FixedImage.GetPointer() << std::endl;
132  }
133 
136 
139 
142 
143  mutable double m_Energy;
144 
146 
147  mutable double m_GradientStep;
148 
149 private:
150  PDEDeformableRegistrationFunction(const Self &); //purposely not implemented
151  void operator=(const Self &); //purposely not implemented
152 };
153 } // end namespace itk
154 
155 #endif
156