ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkTimeVaryingVelocityFieldImageRegistrationMethodv4.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 __itkTimeVaryingVelocityFieldImageRegistrationMethodv4_h
00019 #define __itkTimeVaryingVelocityFieldImageRegistrationMethodv4_h
00020 
00021 #include "itkImageRegistrationMethodv4.h"
00022 
00023 #include "itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.h"
00024 
00025 namespace itk
00026 {
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   GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform<double, GetImageDimension<TFixedImage>::ImageDimension> >
00093 class ITK_EXPORT TimeVaryingVelocityFieldImageRegistrationMethodv4
00094 : public ImageRegistrationMethodv4<TFixedImage, TMovingImage, TTransform>
00095 {
00096 public:
00098   typedef TimeVaryingVelocityFieldImageRegistrationMethodv4                       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( TimeVaryingVelocityFieldImageRegistrationMethodv4, ImageRegistrationMethodv4 );
00111 
00113   typedef TFixedImage                                                 FixedImageType;
00114   typedef typename FixedImageType::Pointer                            FixedImagePointer;
00115   typedef TMovingImage                                                MovingImageType;
00116   typedef typename MovingImageType::Pointer                           MovingImagePointer;
00117 
00118   typedef typename MovingImageType::RegionType                        RegionType;
00119 
00121   typedef typename Superclass::MetricType                             MetricType;
00122   typedef typename MetricType::Pointer                                MetricPointer;
00123   typedef typename MetricType::VirtualImageType                       VirtualImageType;
00124   typedef typename MetricType::MeasureType                            MeasureType;
00125 
00126   typedef TTransform                                                  TransformType;
00127   typedef typename TransformType::Pointer                             TransformPointer;
00128   typedef typename TransformType::ScalarType                          RealType;
00129   typedef typename TransformType::DerivativeType                      DerivativeType;
00130   typedef typename TransformType::DerivativeValueType                 DerivativeValueType;
00131   typedef typename TransformType::TimeVaryingVelocityFieldType        TimeVaryingVelocityFieldType;
00132   typedef typename TimeVaryingVelocityFieldType::Pointer              TimeVaryingVelocityFieldPointer;
00133   typedef typename TransformType::DisplacementFieldType               DisplacementFieldType;
00134   typedef typename DisplacementFieldType::Pointer                     DisplacementFieldPointer;
00135   typedef typename TimeVaryingVelocityFieldType::PixelType            DisplacementVectorType;
00136 
00137   typedef CompositeTransform<RealType, ImageDimension>                CompositeTransformType;
00138 
00139   typedef typename Superclass::TransformOutputType                    TransformOutputType;
00140   typedef typename TransformOutputType::Pointer                       TransformOutputPointer;
00141 
00142   typedef Array<SizeValueType>                                        NumberOfIterationsArrayType;
00143 
00145   itkSetMacro( LearningRate, RealType );
00146   itkGetConstMacro( LearningRate, RealType );
00148 
00150   itkSetMacro( NumberOfIterationsPerLevel, NumberOfIterationsArrayType );
00151   itkGetConstMacro( NumberOfIterationsPerLevel, NumberOfIterationsArrayType );
00153 
00155   itkSetMacro( ConvergenceThreshold, RealType );
00156   itkGetConstMacro( ConvergenceThreshold, RealType );
00158 
00159 protected:
00160   TimeVaryingVelocityFieldImageRegistrationMethodv4();
00161   virtual ~TimeVaryingVelocityFieldImageRegistrationMethodv4();
00162   virtual void PrintSelf( std::ostream & os, Indent indent ) const;
00163 
00165   virtual void  GenerateData();
00166 
00168   void ThreadedGenerateData( const RegionType &, ThreadIdType );
00169 
00171   virtual void StartOptimization();
00172 
00173 private:
00174   TimeVaryingVelocityFieldImageRegistrationMethodv4( const Self & );   //purposely not
00175                                                              // implemented
00176   void operator=( const Self & );                            //purposely not
00177 
00178   RealType                                                        m_LearningRate;
00179 
00180   RealType                                                        m_ConvergenceThreshold;
00181 
00182   RealType                                                        m_VelocityFieldNorm;
00183 
00184   NumberOfIterationsArrayType                                     m_NumberOfIterationsPerLevel;
00185 };
00186 } // end namespace itk
00187 
00188 #ifndef ITK_MANUAL_INSTANTIATION
00189 #include "itkTimeVaryingVelocityFieldImageRegistrationMethodv4.hxx"
00190 #endif
00191 
00192 #endif
00193