ITK  5.0.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:
94  ITK_DISALLOW_COPY_AND_ASSIGN(TimeVaryingBSplineVelocityFieldImageRegistrationMethod);
95 
98  using Superclass = ImageRegistrationMethodv4<TFixedImage, TMovingImage, TOutputTransform,
99  TVirtualImage, TPointSet>;
102 
104  itkNewMacro( Self );
105 
107  static constexpr unsigned int ImageDimension = TFixedImage::ImageDimension;
108 
110  itkTypeMacro( TimeVaryingBSplineVelocityFieldImageRegistrationMethod, SimpleImageRegistrationMethod );
111 
113  using FixedImageType = TFixedImage;
114  using FixedImagePointer = typename FixedImageType::Pointer;
115  using FixedImagesContainerType = typename Superclass::FixedImagesContainerType;
116  using MovingImageType = TMovingImage;
117  using MovingImagePointer = typename MovingImageType::Pointer;
118  using MovingImagesContainerType = typename Superclass::MovingImagesContainerType;
119 
120  using InputPointSetType = TPointSet;
121  using InputPointSetPointer = typename InputPointSetType::Pointer;
122  using PointSetsContainerType = typename Superclass::PointSetsContainerType;
123 
125  using ImageMetricType = typename Superclass::ImageMetricType;
129 
130  using VirtualImageType = typename Superclass::VirtualImageType;
131  using VirtualImageBaseType = typename Superclass::VirtualImageBaseType;
132  using VirtualImageBaseConstPointer = typename Superclass::VirtualImageBaseConstPointer;
133 
134  using MetricType = typename Superclass::MetricType;
135  using MultiMetricType = typename Superclass::MultiMetricType;
137  using PointSetMetricType = typename Superclass::PointSetMetricType;
138 
141  using FixedImageMaskType = typename Superclass::FixedImageMaskType;
143  using FixedImageMasksContainerType = typename Superclass::FixedImageMasksContainerType;
144  using MovingImageMaskType = typename Superclass::MovingImageMaskType;
146  using MovingImageMasksContainerType = typename Superclass::MovingImageMasksContainerType;
147 
148  using InitialTransformType = typename Superclass::InitialTransformType;
149  using OutputTransformType = TOutputTransform;
150  using OutputTransformPointer = typename OutputTransformType::Pointer;
151  using RealType = typename OutputTransformType::ScalarType;
152  using DerivativeType = typename OutputTransformType::DerivativeType;
153  using DerivativeValueType = typename DerivativeType::ValueType;
154  using DisplacementFieldType = typename OutputTransformType::DisplacementFieldType;
156 
158 
159  using TimeVaryingVelocityFieldControlPointLatticeType = typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticeType;
160  using TimeVaryingVelocityFieldControlPointLatticePointer = typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticePointer;
161  using TimeVaryingVelocityFieldType = typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticeType;
162  using TimeVaryingVelocityFieldPointer = typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticePointer;
163  using DisplacementVectorType = typename TimeVaryingVelocityFieldControlPointLatticeType::PixelType;
164 
165  using CompositeTransformType = typename Superclass::CompositeTransformType;
167 
168  using DecoratedOutputTransformType = typename Superclass::DecoratedOutputTransformType;
170 
172 
175 
181  using WeightsElementType = typename WeightsContainerType::Element;
184 
186  itkSetMacro( LearningRate, RealType );
187  itkGetConstMacro( LearningRate, RealType );
189 
191  itkSetMacro( NumberOfIterationsPerLevel, NumberOfIterationsArrayType );
192  itkGetConstMacro( NumberOfIterationsPerLevel, NumberOfIterationsArrayType );
194 
196  itkSetMacro( ConvergenceThreshold, RealType );
197  itkGetConstMacro( ConvergenceThreshold, RealType );
199 
201  itkSetMacro( ConvergenceWindowSize, unsigned int );
202  itkGetConstMacro( ConvergenceWindowSize, unsigned int );
204 
206  itkSetMacro( NumberOfTimePointSamples, SizeValueType );
207  itkGetConstMacro( NumberOfTimePointSamples, SizeValueType );
209 
210 protected:
213  void PrintSelf( std::ostream & os, Indent indent ) const override;
214 
216  void GenerateData() override;
217 
219  virtual void StartOptimization();
220 
222  void GetMetricDerivativePointSetForAllTimePoints( VelocityFieldPointSetType *, WeightsContainerType * );
223 
224  void AttachMetricGradientPointSetAtSpecificTimePoint( const RealType,
228 
229 private:
231 
233 
235  unsigned int m_ConvergenceWindowSize{ 10 };
236 
238 
239  SizeValueType m_NumberOfTimePointSamples{ 4 };
240 
242 };
243 } // end namespace itk
244 
245 #ifndef ITK_MANUAL_INSTANTIATION
246 #include "itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx"
247 #endif
248 
249 #endif
typename Superclass::TransformType TransformType
Implementation of an image mask as spatial object.
typename TimeVaryingVelocityFieldControlPointLatticeType::PixelType DisplacementVectorType
Light weight base class for most itk classes.
std::vector< FixedImageMaskConstPointer > FixedImageMasksContainerType
typename OutputTransformType::DerivativeType DerivativeType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
Provides local/dense/high-dimensionaltiy transformation via a a displacement field.
This class takes one ore more ObjectToObject metrics and assigns weights to their derivatives to comp...
Computes similarity between two point sets.
std::vector< MovingImageConstPointer > MovingImagesContainerType
typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticeType TimeVaryingVelocityFieldType
typename ImageMetricType::FixedImageMaskType FixedImageMaskType
typename VirtualImageBaseType::ConstPointer VirtualImageBaseConstPointer
Base class for all object-to-object similarlity metrics added in ITKv4.
typename Superclass::DerivativeType DerivativeType
typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticePointer TimeVaryingVelocityFieldPointer
typename MovingImageType::Pointer MovingImagePointer
typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticePointer TimeVaryingVelocityFieldControlPointLatticePointer
typename Superclass::MeasureType MeasureType
std::vector< MovingImageMaskConstPointer > MovingImageMasksContainerType
std::vector< PointSetConstPointer > PointSetsContainerType
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:83
Interface method for the current registration framework using the time varying velocity field transfo...
This class contains a list of transforms and concatenates them by composition.
Decorates any subclass of itkObject with a DataObject API.
typename DerivativeType::ValueType DerivativeValueType
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
Definition: itkPointSet.h:84
typename DecoratedOutputTransformType::Pointer DecoratedOutputTransformPointer
Image filter which provides a B-spline output approximation.
std::vector< FixedImageConstPointer > FixedImagesContainerType
typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticeType TimeVaryingVelocityFieldControlPointLatticeType
typename FixedImageType::Pointer FixedImagePointer
Base class for templated image classes.
Definition: itkImageBase.h:105
typename ImageMetricType::MovingImageMaskType MovingImageMaskType
A templated class holding a point in n-Dimensional image space.
Define a front-end to the STL &quot;vector&quot; container that conforms to the IndexedContainerInterface.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename OutputTransformType::ScalarType RealType
typename Superclass::ImageType ImageType
Interface method for the current registration framework.
Templated n-dimensional image class.
Definition: itkImage.h:75
typename MetricType::Pointer MetricPointer
typename OutputTransformType::Pointer OutputTransformPointer