ITK  4.2.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 TOutputTransform =
00092   GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform<double, GetImageDimension<TFixedImage>::ImageDimension> >
00093 class ITK_EXPORT TimeVaryingVelocityFieldImageRegistrationMethodv4
00094 : public ImageRegistrationMethodv4<TFixedImage, TMovingImage, TOutputTransform>
00095 {
00096 public:
00098   typedef TimeVaryingVelocityFieldImageRegistrationMethodv4                       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( 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 TOutputTransform                                            OutputTransformType;
00127   typedef typename OutputTransformType::Pointer                       OutputTransformPointer;
00128   typedef typename OutputTransformType::ScalarType                    RealType;
00129   typedef typename OutputTransformType::DerivativeType                DerivativeType;
00130   typedef typename DerivativeType::ValueType                          DerivativeValueType;
00131   typedef typename OutputTransformType::TimeVaryingVelocityFieldType  TimeVaryingVelocityFieldType;
00132   typedef typename TimeVaryingVelocityFieldType::Pointer              TimeVaryingVelocityFieldPointer;
00133   typedef typename OutputTransformType::DisplacementFieldType         DisplacementFieldType;
00134   typedef typename DisplacementFieldType::Pointer                     DisplacementFieldPointer;
00135   typedef typename TimeVaryingVelocityFieldType::PixelType            DisplacementVectorType;
00136 
00137   typedef typename Superclass::CompositeTransformType                 CompositeTransformType;
00138 
00139   typedef typename Superclass::DecoratedOutputTransformType           DecoratedOutputTransformType;
00140   typedef typename DecoratedOutputTransformType::Pointer              DecoratedOutputTransformPointer;
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 
00160   itkSetMacro( ConvergenceWindowSize, unsigned int );
00161   itkGetConstMacro( ConvergenceWindowSize, unsigned int );
00163 
00164 protected:
00165   TimeVaryingVelocityFieldImageRegistrationMethodv4();
00166   virtual ~TimeVaryingVelocityFieldImageRegistrationMethodv4();
00167   virtual void PrintSelf( std::ostream & os, Indent indent ) const;
00168 
00170   virtual void  GenerateData();
00171 
00173   void ThreadedGenerateData( const RegionType &, ThreadIdType );
00174 
00176   virtual void StartOptimization();
00177 
00178 private:
00179   TimeVaryingVelocityFieldImageRegistrationMethodv4( const Self & );   //purposely not
00180                                                              // implemented
00181   void operator=( const Self & );                            //purposely not
00182 
00183   RealType                                                        m_LearningRate;
00184 
00185   RealType                                                        m_ConvergenceThreshold;
00186   unsigned int                                                    m_ConvergenceWindowSize;
00187 
00188   NumberOfIterationsArrayType                                     m_NumberOfIterationsPerLevel;
00189 };
00190 } // end namespace itk
00191 
00192 #ifndef ITK_MANUAL_INSTANTIATION
00193 #include "itkTimeVaryingVelocityFieldImageRegistrationMethodv4.hxx"
00194 #endif
00195 
00196 #endif
00197