ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod_h
19 #define itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod_h
20 
22 
26 
27 namespace itk
28 {
29 
86 template<typename TFixedImage, typename TMovingImage, typename TOutputTransform =
87  TimeVaryingBSplineVelocityFieldTransform<double, TFixedImage::ImageDimension>,
88  typename TVirtualImage = TFixedImage,
89  typename TPointSet = PointSet<unsigned int, TFixedImage::ImageDimension> >
91 : public ImageRegistrationMethodv4<TFixedImage, TMovingImage, TOutputTransform, TVirtualImage, TPointSet>
92 {
93 public:
96  typedef ImageRegistrationMethodv4<TFixedImage, TMovingImage, TOutputTransform,
97  TVirtualImage, TPointSet> Superclass;
100 
102  itkNewMacro( Self );
103 
105  itkStaticConstMacro( ImageDimension, unsigned int, TFixedImage::ImageDimension );
106 
108  itkTypeMacro( TimeVaryingBSplineVelocityFieldImageRegistrationMethod, SimpleImageRegistrationMethod );
109 
111  typedef TFixedImage FixedImageType;
112  typedef typename FixedImageType::Pointer FixedImagePointer;
113  typedef typename Superclass::FixedImagesContainerType FixedImagesContainerType;
114  typedef TMovingImage MovingImageType;
115  typedef typename MovingImageType::Pointer MovingImagePointer;
116  typedef typename Superclass::MovingImagesContainerType MovingImagesContainerType;
117 
118  typedef TPointSet InputPointSetType;
119  typedef typename InputPointSetType::Pointer InputPointSetPointer;
120  typedef typename Superclass::PointSetsContainerType PointSetsContainerType;
121 
123  typedef typename Superclass::ImageMetricType ImageMetricType;
127 
128  typedef typename Superclass::VirtualImageType VirtualImageType;
129  typedef typename Superclass::VirtualImageBaseType VirtualImageBaseType;
130  typedef typename Superclass::VirtualImageBaseConstPointer VirtualImageBaseConstPointer;
131 
132  typedef typename Superclass::MetricType MetricType;
133  typedef typename Superclass::MultiMetricType MultiMetricType;
135  typedef typename Superclass::PointSetMetricType PointSetMetricType;
136 
139  typedef typename Superclass::FixedImageMaskType FixedImageMaskType;
141  typedef typename Superclass::FixedImageMasksContainerType FixedImageMasksContainerType;
142  typedef typename Superclass::MovingImageMaskType MovingImageMaskType;
144  typedef typename Superclass::MovingImageMasksContainerType MovingImageMasksContainerType;
145 
146  typedef typename Superclass::InitialTransformType InitialTransformType;
147  typedef TOutputTransform OutputTransformType;
148  typedef typename OutputTransformType::Pointer OutputTransformPointer;
149  typedef typename OutputTransformType::ScalarType RealType;
150  typedef typename OutputTransformType::DerivativeType DerivativeType;
151  typedef typename DerivativeType::ValueType DerivativeValueType;
152  typedef typename OutputTransformType::DisplacementFieldType DisplacementFieldType;
154 
156 
157  typedef typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticeType TimeVaryingVelocityFieldControlPointLatticeType;
158  typedef typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticePointer TimeVaryingVelocityFieldControlPointLatticePointer;
159  typedef typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticeType TimeVaryingVelocityFieldType;
160  typedef typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticePointer TimeVaryingVelocityFieldPointer;
161  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::PixelType DisplacementVectorType;
162 
163  typedef typename Superclass::CompositeTransformType CompositeTransformType;
165 
166  typedef typename Superclass::DecoratedOutputTransformType DecoratedOutputTransformType;
168 
170 
173 
182 
184  itkSetMacro( LearningRate, RealType );
185  itkGetConstMacro( LearningRate, RealType );
187 
189  itkSetMacro( NumberOfIterationsPerLevel, NumberOfIterationsArrayType );
190  itkGetConstMacro( NumberOfIterationsPerLevel, NumberOfIterationsArrayType );
192 
194  itkSetMacro( ConvergenceThreshold, RealType );
195  itkGetConstMacro( ConvergenceThreshold, RealType );
197 
199  itkSetMacro( ConvergenceWindowSize, unsigned int );
200  itkGetConstMacro( ConvergenceWindowSize, unsigned int );
202 
204  itkSetMacro( NumberOfTimePointSamples, SizeValueType );
205  itkGetConstMacro( NumberOfTimePointSamples, SizeValueType );
207 
208 protected:
211  virtual void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE;
212 
214  virtual void GenerateData() ITK_OVERRIDE;
215 
217  virtual void StartOptimization();
218 
220  void GetMetricDerivativePointSetForAllTimePoints( VelocityFieldPointSetType *, WeightsContainerType * );
221 
222  void AttachMetricGradientPointSetAtSpecificTimePoint( const RealType,
223  VelocityFieldPointSetType *, WeightsContainerType *, const FixedImagesContainerType,
225  const PointSetsContainerType, const TransformBaseType *, const FixedImageMasksContainerType );
226 
227 private:
229 
230  DisplacementFieldTransformPointer m_IdentityDisplacementFieldTransform;
231 
232  RealType m_LearningRate;
233 
234  RealType m_ConvergenceThreshold;
235  unsigned int m_ConvergenceWindowSize;
236 
237  NumberOfIterationsArrayType m_NumberOfIterationsPerLevel;
238 
239  SizeValueType m_NumberOfTimePointSamples;
240 
241  WeightsElementType m_BoundaryWeight;
242 };
243 } // end namespace itk
244 
245 #ifndef ITK_MANUAL_INSTANTIATION
246 #include "itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx"
247 #endif
248 
249 #endif
Implementation of an image mask as spatial object.
Light weight base class for most itk classes.
Superclass::MeasureType MeasureType
BSplineScatteredDataPointSetToImageFilter< VelocityFieldPointSetType, TimeVaryingVelocityFieldType > BSplineFilterType
Provides local/dense/high-dimensionaltiy transformation via a a displacement field.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
ImageRegistrationMethodv4< TFixedImage, TMovingImage, TOutputTransform, TVirtualImage, TPointSet > Superclass
OutputTransformType::TimeVaryingVelocityFieldControlPointLatticePointer TimeVaryingVelocityFieldControlPointLatticePointer
Interface method for the current registration framework using the time varying velocity field transfo...
std::vector< FixedImageMaskConstPointer > FixedImageMasksContainerType
Superclass::DerivativeType DerivativeType
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
Definition: itkPointSet.h:84
OutputTransformType::TimeVaryingVelocityFieldControlPointLatticeType TimeVaryingVelocityFieldControlPointLatticeType
Image filter which provides a B-spline output approximation.
std::vector< MovingImagePointer > MovingImagesContainerType
A templated class holding a point in n-Dimensional image space.
OutputTransformType::TimeVaryingVelocityFieldControlPointLatticePointer TimeVaryingVelocityFieldPointer
Define a front-end to the STL &quot;vector&quot; container that conforms to the IndexedContainerInterface.
Superclass::TransformType TransformType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
std::vector< FixedImagePointer > FixedImagesContainerType
Interface method for the current registration framework.
OutputTransformType::ScalarType RealType
std::vector< PointSetConstPointer > PointSetsContainerType
ContinuousIndex< typename DisplacementFieldPointType::CoordRepType, ImageDimension > ContinuousIndexType
Templated n-dimensional image class.
Definition: itkImage.h:75
OutputTransformType::TimeVaryingVelocityFieldControlPointLatticeType TimeVaryingVelocityFieldType