ITK  4.1.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 TTransform =
00092   TimeVaryingBSplineVelocityFieldTransform<double, GetImageDimension<TFixedImage>::ImageDimension> >
00093 class ITK_EXPORT TimeVaryingBSplineVelocityFieldImageRegistrationMethod
00094 : public ImageRegistrationMethodv4<TFixedImage, TMovingImage, TTransform>
00095 {
00096 public:
00098   typedef TimeVaryingBSplineVelocityFieldImageRegistrationMethod                Self;
00099   typedef ImageRegistrationMethodv4<TFixedImage, TMovingImage, TTransform>      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 TTransform                                                                     TransformType;
00125   typedef typename TransformType::Pointer                                                TransformPointer;
00126   typedef typename TransformType::ScalarType                                             RealType;
00127   typedef typename TransformType::DerivativeType                                         DerivativeType;
00128   typedef typename DerivativeType::ValueType                                             DerivativeValueType;
00129   typedef typename TransformType::DisplacementFieldType                                  DisplacementFieldType;
00130   typedef typename TransformType::TimeVaryingVelocityFieldControlPointLatticeType        TimeVaryingVelocityFieldControlPointLatticeType;
00131   typedef typename TransformType::TimeVaryingVelocityFieldControlPointLatticePointer     TimeVaryingVelocityFieldControlPointLatticePointer;
00132   typedef typename TransformType::TimeVaryingVelocityFieldControlPointLatticeType        TimeVaryingVelocityFieldType;
00133   typedef typename TransformType::TimeVaryingVelocityFieldControlPointLatticePointer     TimeVaryingVelocityFieldPointer;
00134   typedef typename TimeVaryingVelocityFieldControlPointLatticeType::PixelType            DisplacementVectorType;
00135 
00136   typedef CompositeTransform<RealType, ImageDimension>                CompositeTransformType;
00137 
00138   typedef typename Superclass::TransformOutputType                    TransformOutputType;
00139   typedef typename TransformOutputType::Pointer                       TransformOutputPointer;
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( NumberOfTimePointSamples, SizeValueType );
00160   itkGetConstMacro( NumberOfTimePointSamples, SizeValueType );
00162 
00163 protected:
00164   TimeVaryingBSplineVelocityFieldImageRegistrationMethod();
00165   virtual ~TimeVaryingBSplineVelocityFieldImageRegistrationMethod();
00166   virtual void PrintSelf( std::ostream & os, Indent indent ) const;
00167 
00169   virtual void  GenerateData();
00170 
00172   virtual void StartOptimization();
00173 
00174 private:
00175   TimeVaryingBSplineVelocityFieldImageRegistrationMethod( const Self & );   //purposely not
00176                                                              // implemented
00177   void operator=( const Self & );                            //purposely not
00178 
00179   RealType                                                        m_LearningRate;
00180 
00181   RealType                                                        m_ConvergenceThreshold;
00182 
00183   NumberOfIterationsArrayType                                     m_NumberOfIterationsPerLevel;
00184 
00185   SizeValueType                                                   m_NumberOfTimePointSamples;
00186 };
00187 } // end namespace itk
00188 
00189 #ifndef ITK_MANUAL_INSTANTIATION
00190 #include "itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx"
00191 #endif
00192 
00193 #endif
00194