Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
itkBSplineImageToImageRegistrationMethod.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: BSplineRegistrator.h,v $
5  Language: C++
6  Date: $Date: 2006/11/06 14:39:34 $
7  Version: $Revision: 1.15 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 
18 #ifndef itkBSplineImageToImageRegistrationMethod_h
19 #define itkBSplineImageToImageRegistrationMethod_h
20 
21 #include "itkImage.h"
22 #include "itkBSplineDeformableTransform.h"
23 
25 
26 namespace itk
27 {
28 
29 template <class TImage>
32 {
33 
34 public:
35 
38  typedef SmartPointer<Self> Pointer;
39  typedef SmartPointer<const Self> ConstPointer;
40 
43 
44  itkNewMacro( Self );
45 
46  //
47  // Typedefs from Superclass
48  //
49  typedef TImage ImageType;
50  itkStaticConstMacro( ImageDimension, unsigned int,
51  TImage::ImageDimension );
52 
53  // Overrides the superclass' TransformType typedef
54  typedef BSplineDeformableTransform<double,
55  itkGetStaticConstMacro( ImageDimension ),
56  itkGetStaticConstMacro( ImageDimension )>
58 
59  typedef typename BSplineTransformType::Pointer BSplineTransformPointer;
60 
62 
63  typedef typename BSplineTransformType::ParametersType ParametersType;
64 
65  //
66  // Methods from Superclass
67  //
68 
69  virtual void GenerateData( void ) ITK_OVERRIDE;
70 
71  //
72  // Custom Methods
73  //
74 
81  virtual TransformType * GetTypedTransform( void );
82 
83  virtual const TransformType * GetTypedTransform( void ) const;
84 
85  itkSetMacro( ExpectedDeformationMagnitude, double );
86  itkGetConstMacro( ExpectedDeformationMagnitude, double );
87 
88  itkSetClampMacro( NumberOfControlPoints, unsigned int, 3, 2000 );
89  itkGetConstMacro( NumberOfControlPoints, unsigned int );
90 
91  itkSetClampMacro( NumberOfLevels, unsigned int, 1, 5 );
92  itkGetConstMacro( NumberOfLevels, unsigned int );
93 
94  BSplineTransformPointer GetBSplineTransform( void ) const;
95 
96  void ComputeGridRegion( int numberOfControlPoints,
97  typename TransformType::RegionType::SizeType & regionSize,
98  typename TransformType::SpacingType & regionSpacing,
99  typename TransformType::OriginType & regionOrigin,
100  typename TransformType::DirectionType & regionDirection);
101 
102  void ResampleControlGrid( int newNumberOfControlPoints, ParametersType & newParameters );
103 
104  itkSetMacro( GradientOptimizeOnly, bool );
105  itkGetMacro( GradientOptimizeOnly, bool );
106 protected:
107 
110 
111  typedef InterpolateImageFunction<TImage, double> InterpolatorType;
112  typedef ImageToImageMetric<TImage, TImage> MetricType;
113 
114  virtual void Optimize( MetricType * metric, InterpolatorType * interpolator ) ITK_OVERRIDE;
115 
116  virtual void GradientOptimize( MetricType * metric, InterpolatorType * interpolator );
117 
118  virtual void MultiResolutionOptimize( MetricType * metric, InterpolatorType * interpolator );
119 
120  virtual void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE;
121 
122 private:
123 
124  BSplineImageToImageRegistrationMethod( const Self & ); // Purposely not implemented
125  void operator =( const Self & ); // Purposely not implemented
126 
127  double m_ExpectedDeformationMagnitude;
128 
129  unsigned int m_NumberOfControlPoints;
130 
131  unsigned int m_NumberOfLevels;
132 
133  bool m_GradientOptimizeOnly;
134 
135 };
136 
137 } // end namespace itk
138 
139 #ifndef ITK_MANUAL_INSTANTIATION
140 #include "itkBSplineImageToImageRegistrationMethod.txx"
141 #endif
142 
143 #endif // __ImageToImageRegistrationMethod_h
itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension)
void ComputeGridRegion(int numberOfControlPoints, typename TransformType::RegionType::SizeType &regionSize, typename TransformType::SpacingType &regionSpacing, typename TransformType::OriginType &regionOrigin, typename TransformType::DirectionType &regionDirection)
virtual void GenerateData(void) ITK_OVERRIDE
InterpolateImageFunction< TImage, double > InterpolatorType
itkSetClampMacro(NumberOfControlPoints, unsigned int, 3, 2000)
BSplineTransformPointer GetBSplineTransform(void) const
Simplified inverse ITK transforms.
virtual void GradientOptimize(MetricType *metric, InterpolatorType *interpolator)
OptimizedImageToImageRegistrationMethod< TImage > Superclass
itkTypeMacro(BSplineImageToImageRegistrationMethod, OptimizedImageToImageRegistrationMethod)
itkGetConstMacro(ExpectedDeformationMagnitude, double)
virtual void Optimize(MetricType *metric, InterpolatorType *interpolator) ITK_OVERRIDE
BSplineDeformableTransform< double, itkGetStaticConstMacro(ImageDimension), itkGetStaticConstMacro(ImageDimension)> BSplineTransformType
virtual TransformType * GetTypedTransform(void)
itkGetMacro(GradientOptimizeOnly, bool)
void ResampleControlGrid(int newNumberOfControlPoints, ParametersType &newParameters)
virtual void MultiResolutionOptimize(MetricType *metric, InterpolatorType *interpolator)
itkSetMacro(ExpectedDeformationMagnitude, double)
virtual void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE