ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkPDEDeformableRegistrationFunction.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkPDEDeformableRegistrationFunction_h
00019 #define __itkPDEDeformableRegistrationFunction_h
00020 
00021 #include "itkFiniteDifferenceFunction.h"
00022 
00023 namespace itk
00024 {
00040 template< class TFixedImage, class TMovingImage, class TDisplacementField >
00041 class ITK_EXPORT PDEDeformableRegistrationFunction:
00042   public FiniteDifferenceFunction< TDisplacementField >
00043 {
00044 public:
00046   typedef PDEDeformableRegistrationFunction              Self;
00047   typedef FiniteDifferenceFunction< TDisplacementField > Superclass;
00048   typedef SmartPointer< Self >                           Pointer;
00049   typedef SmartPointer< const Self >                     ConstPointer;
00050 
00052   itkTypeMacro(PDEDeformableRegistrationFunction,
00053                FiniteDifferenceFunction);
00054 
00056   typedef TMovingImage                           MovingImageType;
00057   typedef typename MovingImageType::ConstPointer MovingImagePointer;
00058 
00060   typedef TFixedImage                           FixedImageType;
00061   typedef typename FixedImageType::ConstPointer FixedImagePointer;
00062 
00064   typedef TDisplacementField                      DisplacementFieldType;
00065   typedef typename DisplacementFieldType::Pointer DisplacementFieldTypePointer;
00066 
00067 #ifdef ITKV3_COMPATIBILITY
00068   typedef TDisplacementField                     DeformationFieldType;
00069   typedef typename DeformationFieldType::Pointer DeformationFieldTypePointer;
00070 #endif
00071 
00073   void SetMovingImage(const MovingImageType *ptr)
00074   { m_MovingImage = ptr; }
00075 
00077   const MovingImageType * GetMovingImage(void) const
00078   { return m_MovingImage; }
00079 
00081   void SetFixedImage(const FixedImageType *ptr)
00082   { m_FixedImage = ptr; }
00083 
00085   const FixedImageType * GetFixedImage(void) const
00086   { return m_FixedImage; }
00087 
00089   void SetDisplacementField(DisplacementFieldTypePointer ptr)
00090   { m_DisplacementField = ptr; }
00091 
00094   DisplacementFieldType * GetDisplacementField(void)
00095   { return m_DisplacementField; }
00096 
00097 #ifdef ITKV3_COMPATIBILITY
00098   void SetDeformationField(DeformationFieldTypePointer ptr)
00099   { this->SetDisplacementField(ptr); }
00100 
00101   DeformationFieldType * GetDeformationField(void)
00102   { return static_cast<DeformationFieldType *> (this->GetDisplacementField()); }
00103 #endif
00104 
00105   void SetEnergy(double e) { m_Energy = e; }
00106   double GetEnergy() const { return m_Energy; }
00107   void SetGradientStep(double e) { m_GradientStep = e; }
00108   double GetGradientStep() const { return m_GradientStep; }
00109   void SetNormalizeGradient(bool e) { m_NormalizeGradient = e; }
00110   bool GetNormalizeGradient() const { return m_NormalizeGradient; }
00111 protected:
00112   PDEDeformableRegistrationFunction()
00113   {
00114     m_MovingImage = NULL;
00115     m_FixedImage = NULL;
00116     m_DisplacementField = NULL;
00117     m_Energy = 0.0;
00118     m_NormalizeGradient = true;
00119     m_GradientStep = 1.0;
00120   }
00121 
00122   ~PDEDeformableRegistrationFunction() {}
00123 
00124   void PrintSelf(std::ostream & os, Indent indent) const
00125   {
00126     Superclass::PrintSelf(os, indent);
00127     os << indent << "MovingImage: ";
00128     os << m_MovingImage.GetPointer() << std::endl;
00129     os << indent << "FixedImage: ";
00130     os << m_FixedImage.GetPointer() << std::endl;
00131   }
00132 
00134   MovingImagePointer m_MovingImage;
00135 
00137   FixedImagePointer m_FixedImage;
00138 
00140   DisplacementFieldTypePointer m_DisplacementField;
00141 
00142   mutable double m_Energy;
00143 
00144   bool m_NormalizeGradient;
00145 
00146   mutable double m_GradientStep;
00147 private:
00148   PDEDeformableRegistrationFunction(const Self &); //purposely not implemented
00149   void operator=(const Self &);                    //purposely not implemented
00150 };
00151 } // end namespace itk
00152 
00153 #endif
00154