ITK  4.2.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 static_cast<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 protected:
113  {
114  m_MovingImage = NULL;
115  m_FixedImage = NULL;
116  m_DisplacementField = NULL;
117  m_Energy = 0.0;
118  m_NormalizeGradient = true;
119  m_GradientStep = 1.0;
120  }
121 
123 
124  void PrintSelf(std::ostream & os, Indent indent) const
125  {
126  Superclass::PrintSelf(os, indent);
127  os << indent << "MovingImage: ";
128  os << m_MovingImage.GetPointer() << std::endl;
129  os << indent << "FixedImage: ";
130  os << m_FixedImage.GetPointer() << std::endl;
131  }
132 
135 
138 
141 
142  mutable double m_Energy;
143 
145 
146  mutable double m_GradientStep;
147 private:
148  PDEDeformableRegistrationFunction(const Self &); //purposely not implemented
149  void operator=(const Self &); //purposely not implemented
150 };
151 } // end namespace itk
152 
153 #endif
154