ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.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 __itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod_h
00019 #define __itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod_h
00020 
00021 #include "itkImageRegistrationMethodv4.h"
00022 
00023 #include "itkBSplineScatteredDataPointSetToImageFilter.h"
00024 #include "itkTimeVaryingBSplineVelocityFieldTransform.h"
00025 
00026 namespace itk
00027 {
00028 //Forward-declare these because of module dependency conflict.
00029 //They will soon be moved to a different module, at which
00030 // time this can be removed.
00031 template <unsigned int VDimension, class TDataHolder>
00032 class ImageToData;
00033 template <class TDataHolder>
00034 class Array1DToData;
00035 
00091 template<typename TFixedImage, typename TMovingImage, typename TOutputTransform =
00092   TimeVaryingBSplineVelocityFieldTransform<double, GetImageDimension<TFixedImage>::ImageDimension> >
00093 class ITK_EXPORT TimeVaryingBSplineVelocityFieldImageRegistrationMethod
00094 : public ImageRegistrationMethodv4<TFixedImage, TMovingImage, TOutputTransform>
00095 {
00096 public:
00098   typedef TimeVaryingBSplineVelocityFieldImageRegistrationMethod                      Self;
00099   typedef ImageRegistrationMethodv4<TFixedImage, TMovingImage, TOutputTransform>      Superclass;
00100   typedef SmartPointer<Self>                                                          Pointer;
00101   typedef SmartPointer<const Self>                                                    ConstPointer;
00102 
00104   itkNewMacro( Self );
00105 
00107   itkStaticConstMacro( ImageDimension, unsigned int, TFixedImage::ImageDimension );
00108 
00110   itkTypeMacro( TimeVaryingBSplineVelocityFieldImageRegistrationMethod, SimpleImageRegistrationMethod );
00111 
00113   typedef TFixedImage                                                 FixedImageType;
00114   typedef typename FixedImageType::Pointer                            FixedImagePointer;
00115   typedef TMovingImage                                                MovingImageType;
00116   typedef typename MovingImageType::Pointer                           MovingImagePointer;
00117 
00119   typedef typename Superclass::MetricType                             MetricType;
00120   typedef typename MetricType::Pointer                                MetricPointer;
00121   typedef typename MetricType::VirtualImageType                       VirtualImageType;
00122   typedef typename MetricType::MeasureType                            MeasureType;
00123 
00124   typedef TOutputTransform                                                                     OutputTransformType;
00125   typedef typename OutputTransformType::Pointer                                                OutputTransformPointer;
00126   typedef typename OutputTransformType::ScalarType                                             RealType;
00127   typedef typename OutputTransformType::DerivativeType                                         DerivativeType;
00128   typedef typename DerivativeType::ValueType                                                   DerivativeValueType;
00129   typedef typename OutputTransformType::DisplacementFieldType                                  DisplacementFieldType;
00130   typedef typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticeType        TimeVaryingVelocityFieldControlPointLatticeType;
00131   typedef typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticePointer     TimeVaryingVelocityFieldControlPointLatticePointer;
00132   typedef typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticeType        TimeVaryingVelocityFieldType;
00133   typedef typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticePointer     TimeVaryingVelocityFieldPointer;
00134   typedef typename TimeVaryingVelocityFieldControlPointLatticeType::PixelType                  DisplacementVectorType;
00135 
00136   typedef typename Superclass::CompositeTransformType                                    CompositeTransformType;
00137 
00138   typedef typename Superclass::DecoratedOutputTransformType           DecoratedOutputTransformType;
00139   typedef typename DecoratedOutputTransformType::Pointer              DecoratedOutputTransformPointer;
00140 
00141   typedef Array<SizeValueType>                                        NumberOfIterationsArrayType;
00142 
00144   itkSetMacro( LearningRate, RealType );
00145   itkGetConstMacro( LearningRate, RealType );
00147 
00149   itkSetMacro( NumberOfIterationsPerLevel, NumberOfIterationsArrayType );
00150   itkGetConstMacro( NumberOfIterationsPerLevel, NumberOfIterationsArrayType );
00152 
00154   itkSetMacro( ConvergenceThreshold, RealType );
00155   itkGetConstMacro( ConvergenceThreshold, RealType );
00157 
00159   itkSetMacro( ConvergenceWindowSize, unsigned int );
00160   itkGetConstMacro( ConvergenceWindowSize, unsigned int );
00162 
00164   itkSetMacro( NumberOfTimePointSamples, SizeValueType );
00165   itkGetConstMacro( NumberOfTimePointSamples, SizeValueType );
00167 
00168 protected:
00169   TimeVaryingBSplineVelocityFieldImageRegistrationMethod();
00170   virtual ~TimeVaryingBSplineVelocityFieldImageRegistrationMethod();
00171   virtual void PrintSelf( std::ostream & os, Indent indent ) const;
00172 
00174   virtual void  GenerateData();
00175 
00177   virtual void StartOptimization();
00178 
00179 private:
00180   TimeVaryingBSplineVelocityFieldImageRegistrationMethod( const Self & );   //purposely not
00181                                                              // implemented
00182   void operator=( const Self & );                            //purposely not
00183 
00184   RealType                                                        m_LearningRate;
00185 
00186   RealType                                                        m_ConvergenceThreshold;
00187   unsigned int                                                    m_ConvergenceWindowSize;
00188 
00189   NumberOfIterationsArrayType                                     m_NumberOfIterationsPerLevel;
00190 
00191   SizeValueType                                                   m_NumberOfTimePointSamples;
00192 };
00193 } // end namespace itk
00194 
00195 #ifndef ITK_MANUAL_INSTANTIATION
00196 #include "itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx"
00197 #endif
00198 
00199 #endif
00200