ITK  5.4.0
Insight Toolkit
itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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,
87  typename TMovingImage,
88  typename TOutputTransform = TimeVaryingBSplineVelocityFieldTransform<double, TFixedImage::ImageDimension>,
89  typename TVirtualImage = TFixedImage,
90  typename TPointSet = PointSet<unsigned int, TFixedImage::ImageDimension>>
92  : public ImageRegistrationMethodv4<TFixedImage, TMovingImage, TOutputTransform, TVirtualImage, TPointSet>
93 {
94 public:
96 
102 
104  itkNewMacro(Self);
105 
107  static constexpr unsigned int ImageDimension = TFixedImage::ImageDimension;
108 
110  itkOverrideGetNameOfClassMacro(TimeVaryingBSplineVelocityFieldImageRegistrationMethod);
111 
113  using FixedImageType = TFixedImage;
115  using typename Superclass::FixedImagesContainerType;
116  using MovingImageType = TMovingImage;
118  using typename Superclass::MovingImagesContainerType;
119 
120  using InputPointSetType = TPointSet;
122  using typename Superclass::PointSetsContainerType;
123 
125  using typename Superclass::ImageMetricType;
129 
130  using VirtualImageType = typename Superclass::VirtualImageType;
131  using typename Superclass::VirtualImageBaseType;
132  using typename Superclass::VirtualImageBaseConstPointer;
133 
134  using typename Superclass::MetricType;
135  using typename Superclass::MultiMetricType;
137  using typename Superclass::PointSetMetricType;
138 
141  using typename Superclass::FixedImageMaskType;
143  using typename Superclass::FixedImageMasksContainerType;
144  using typename Superclass::MovingImageMaskType;
146  using typename Superclass::MovingImageMasksContainerType;
147 
148  using typename Superclass::InitialTransformType;
149  using OutputTransformType = TOutputTransform;
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 
160  typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticeType;
162  typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticePointer;
163  using TimeVaryingVelocityFieldType = typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticeType;
165  typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticePointer;
166  using DisplacementVectorType = typename TimeVaryingVelocityFieldControlPointLatticeType::PixelType;
167 
168  using typename Superclass::CompositeTransformType;
170 
171  using typename Superclass::DecoratedOutputTransformType;
173 
175 
178 
181  using BSplineFilterType =
184  using WeightsElementType = typename WeightsContainerType::Element;
187 
189  itkSetMacro(LearningRate, RealType);
190  itkGetConstMacro(LearningRate, RealType);
194  itkSetMacro(NumberOfIterationsPerLevel, NumberOfIterationsArrayType);
195  itkGetConstMacro(NumberOfIterationsPerLevel, NumberOfIterationsArrayType);
199  itkSetMacro(ConvergenceThreshold, RealType);
200  itkGetConstMacro(ConvergenceThreshold, RealType);
204  itkSetMacro(ConvergenceWindowSize, unsigned int);
205  itkGetConstMacro(ConvergenceWindowSize, unsigned int);
209  itkSetMacro(NumberOfTimePointSamples, SizeValueType);
210  itkGetConstMacro(NumberOfTimePointSamples, SizeValueType);
213 protected:
216  void
217  PrintSelf(std::ostream & os, Indent indent) const override;
218 
220  void
221  GenerateData() override;
222 
227  virtual void
228  StartOptimization();
229 
231  void
232  GetMetricDerivativePointSetForAllTimePoints(VelocityFieldPointSetType *, WeightsContainerType *);
233 
234  void
235  AttachMetricGradientPointSetAtSpecificTimePoint(const RealType,
240  const TransformBaseType *,
243  const TransformBaseType *,
245 
246 private:
247  DisplacementFieldTransformPointer m_IdentityDisplacementFieldTransform{};
248 
249  RealType m_LearningRate{};
250 
251  RealType m_ConvergenceThreshold{};
252  unsigned int m_ConvergenceWindowSize{ 10 };
253 
254  NumberOfIterationsArrayType m_NumberOfIterationsPerLevel{};
255 
256  SizeValueType m_NumberOfTimePointSamples{ 4 };
257 
258  WeightsElementType m_BoundaryWeight{};
259 };
260 } // end namespace itk
261 
262 #ifndef ITK_MANUAL_INSTANTIATION
263 # include "itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx"
264 #endif
265 
266 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::ImageRegistrationMethodv4::MovingImageType
TMovingImage MovingImageType
Definition: itkImageRegistrationMethodv4.h:142
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::TimeVaryingVelocityFieldPointer
typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticePointer TimeVaryingVelocityFieldPointer
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:165
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::DisplacementFieldTransformPointer
typename DisplacementFieldTransformType::Pointer DisplacementFieldTransformPointer
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:177
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::DisplacementVectorType
typename TimeVaryingVelocityFieldControlPointLatticeType::PixelType DisplacementVectorType
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:166
itk::PointSet
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
Definition: itkPointSet.h:82
itk::ImageRegistrationMethodv4::PointSetsContainerType
std::vector< PointSetConstPointer > PointSetsContainerType
Definition: itkImageRegistrationMethodv4.h:149
itk::ImageRegistrationMethodv4::FixedImagePointer
typename FixedImageType::Pointer FixedImagePointer
Definition: itkImageRegistrationMethodv4.h:139
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::MetricDerivativeType
typename ImageMetricType::DerivativeType MetricDerivativeType
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:128
itkTimeVaryingBSplineVelocityFieldTransform.h
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::InputPointSetPointer
typename InputPointSetType::Pointer InputPointSetPointer
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:121
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::DisplacementFieldType
typename OutputTransformType::DisplacementFieldType DisplacementFieldType
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:154
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::FixedMaskImageType
typename ImageMaskSpatialObjectType::ImageType FixedMaskImageType
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:142
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::BSplineScatteredDataPointSetToImageFilter
Image filter which provides a B-spline output approximation.
Definition: itkBSplineScatteredDataPointSetToImageFilter.h:132
itk::ImageRegistrationMethodv4::MovingImagesContainerType
std::vector< MovingImageConstPointer > MovingImagesContainerType
Definition: itkImageRegistrationMethodv4.h:145
itk::ImageRegistrationMethodv4::MetricPointer
typename MetricType::Pointer MetricPointer
Definition: itkImageRegistrationMethodv4.h:165
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::ImageMetricPointer
typename ImageMetricType::Pointer ImageMetricPointer
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:126
itkImageRegistrationMethodv4.h
itk::DisplacementFieldTransform
Provides local/dense/high-dimensionality transformation via a a displacement field.
Definition: itkDisplacementFieldTransform.h:87
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::TimeVaryingVelocityFieldControlPointLatticeType
typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticeType TimeVaryingVelocityFieldControlPointLatticeType
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:160
itk::ImageRegistrationMethodv4::RealType
typename OutputTransformType::ScalarType RealType
Definition: itkImageRegistrationMethodv4.h:154
itk::SingleValuedCostFunctionv4Template::MeasureType
TInternalComputationValueType MeasureType
Definition: itkSingleValuedCostFunctionv4.h:67
itk::ImageRegistrationMethodv4::FixedImageMasksContainerType
std::vector< FixedImageMaskConstPointer > FixedImageMasksContainerType
Definition: itkImageRegistrationMethodv4.h:180
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::TimeVaryingVelocityFieldControlPointLatticePointer
typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticePointer TimeVaryingVelocityFieldControlPointLatticePointer
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:162
itk::ImageRegistrationMethodv4::FixedImageType
TFixedImage FixedImageType
Definition: itkImageRegistrationMethodv4.h:138
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::VelocityFieldPointSetPointer
typename VelocityFieldPointSetType::Pointer VelocityFieldPointSetPointer
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:180
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::InputPointSetType
TPointSet InputPointSetType
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:120
itkBSplineScatteredDataPointSetToImageFilter.h
itk::ImageRegistrationMethodv4::MovingImagePointer
typename MovingImageType::Pointer MovingImagePointer
Definition: itkImageRegistrationMethodv4.h:143
itk::CompositeTransform::TransformType
typename Superclass::TransformType TransformType
Definition: itkCompositeTransform.h:105
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::TransformBaseType
typename CompositeTransformType::TransformType TransformBaseType
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:169
itk::ImageMaskSpatialObject
Implementation of an image mask as spatial object.
Definition: itkImageMaskSpatialObject.h:45
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::MovingMaskImageType
typename ImageMaskSpatialObjectType::ImageType MovingMaskImageType
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:145
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::WeightsContainerType
typename BSplineFilterType::WeightsContainerType WeightsContainerType
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:183
itk::ImageRegistrationMethodv4::FixedImagesContainerType
std::vector< FixedImageConstPointer > FixedImagesContainerType
Definition: itkImageRegistrationMethodv4.h:141
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::MeasureType
typename ImageMetricType::MeasureType MeasureType
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:127
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkImageMaskSpatialObject.h
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod
Interface method for the current registration framework using the time varying velocity field transfo...
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:91
itk::ImageRegistrationMethodv4
Interface method for the current registration framework.
Definition: itkImageRegistrationMethodv4.h:117
itk::ContinuousIndex
A templated class holding a point in n-Dimensional image space.
Definition: itkContinuousIndex.h:46
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::WeightsElementType
typename WeightsContainerType::Element WeightsElementType
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:184
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::DisplacementFieldPointType
typename DisplacementFieldType::PointType DisplacementFieldPointType
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:155
itk::ImageRegistrationMethodv4::OutputTransformPointer
typename OutputTransformType::Pointer OutputTransformPointer
Definition: itkImageRegistrationMethodv4.h:153
itk::Array< TInternalComputationValueType >
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::ImageRegistrationMethodv4::VirtualImageType
TVirtualImage VirtualImageType
Definition: itkImageRegistrationMethodv4.h:169
itk::ImageRegistrationMethodv4::DecoratedOutputTransformPointer
typename DecoratedOutputTransformType::Pointer DecoratedOutputTransformPointer
Definition: itkImageRegistrationMethodv4.h:190
itk::ImageRegistrationMethodv4::OutputTransformType
TOutputTransform OutputTransformType
Definition: itkImageRegistrationMethodv4.h:152
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::MaskImageType
typename ImageMaskSpatialObjectType::ImageType MaskImageType
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:140
itk::ImageRegistrationMethodv4::DerivativeValueType
typename DerivativeType::ValueType DerivativeValueType
Definition: itkImageRegistrationMethodv4.h:156
itk::TimeVaryingBSplineVelocityFieldImageRegistrationMethod::TimeVaryingVelocityFieldType
typename OutputTransformType::TimeVaryingVelocityFieldControlPointLatticeType TimeVaryingVelocityFieldType
Definition: itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h:163
itk::VectorContainer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
Definition: itkVectorContainer.h:48
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::ImageRegistrationMethodv4::DerivativeType
typename OutputTransformType::DerivativeType DerivativeType
Definition: itkImageRegistrationMethodv4.h:155