ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkCorrelationImageToImageMetricv4.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 itkCorrelationImageToImageMetricv4_h
19 #define itkCorrelationImageToImageMetricv4_h
20 
22 
25 
26 namespace itk
27 {
28 
72 template <typename TFixedImage, typename TMovingImage, typename TVirtualImage = TFixedImage,
73  typename TInternalComputationValueType = double,
74  typename TMetricTraits = DefaultImageToImageMetricTraitsv4<TFixedImage,TMovingImage,TVirtualImage,TInternalComputationValueType>
75  >
76 class ITK_TEMPLATE_EXPORT CorrelationImageToImageMetricv4 :
77  public ImageToImageMetricv4<TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType, TMetricTraits>
78 {
79 public:
80  ITK_DISALLOW_COPY_AND_ASSIGN(CorrelationImageToImageMetricv4);
81 
84  using Superclass = ImageToImageMetricv4<TFixedImage, TMovingImage, TVirtualImage,
85  TInternalComputationValueType,TMetricTraits>;
88 
90  itkNewMacro(Self);
91 
94 
97  using DerivativeType = typename Superclass::DerivativeType;
98 
99  using FixedImagePointType = typename Superclass::FixedImagePointType;
100  using FixedImagePixelType = typename Superclass::FixedImagePixelType;
101  using FixedImageGradientType = typename Superclass::FixedImageGradientType;
102 
103  using MovingImagePointType = typename Superclass::MovingImagePointType;
104  using MovingImagePixelType = typename Superclass::MovingImagePixelType;
105  using MovingImageGradientType = typename Superclass::MovingImageGradientType;
106 
107  using MovingTransformType = typename Superclass::MovingTransformType;
108  using JacobianType = typename Superclass::JacobianType;
109  using VirtualImageType = typename Superclass::VirtualImageType;
110  using VirtualIndexType = typename Superclass::VirtualIndexType;
111  using VirtualPointType = typename Superclass::VirtualPointType;
112  using VirtualPointSetType = typename Superclass::VirtualPointSetType;
113 
114  /* Image dimension accessors */
115  static constexpr typename TVirtualImage::ImageDimensionType VirtualImageDimension = TVirtualImage::ImageDimension;
116  static constexpr typename TFixedImage::ImageDimensionType FixedImageDimension = TFixedImage::ImageDimension;
117  static constexpr typename TMovingImage::ImageDimensionType MovingImageDimension = TMovingImage::ImageDimension;
118 
119 protected:
121  ~CorrelationImageToImageMetricv4() override = default;
122 
127  void InitializeForIteration() const override;
128 
130  friend class ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, Self >;
131  friend class ImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Self >;
132  friend class ImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Self >;
133 
134  friend class CorrelationImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Superclass, Self >;
135  friend class CorrelationImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >;
137  CorrelationImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Superclass, Self >;
139  CorrelationImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >;
140 
141  friend class CorrelationImageToImageMetricv4HelperThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Superclass, Self >;
142  friend class CorrelationImageToImageMetricv4HelperThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >;
143 
145  CorrelationImageToImageMetricv4HelperThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Superclass, Self >;
147  CorrelationImageToImageMetricv4HelperThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >;
148 
149  typename CorrelationHelperDenseThreaderType::Pointer m_HelperDenseThreader;
150  typename CorrelationHelperSparseThreaderType::Pointer m_HelperSparseThreader;
151 
152  /* These values are computed during InitializeForIteration(),
153  * using the helper class
154  * */
155  mutable MeasureType m_AverageFix;
156  mutable MeasureType m_AverageMov;
157 
158  void PrintSelf(std::ostream& os, Indent indent) const override;
159 };
160 
161 } // end namespace itk
162 
163 #ifndef ITK_MANUAL_INSTANTIATION
164 #include "itkCorrelationImageToImageMetricv4.hxx"
165 #endif
166 
167 #endif
typename Superclass::MovingImagePixelType MovingImagePixelType
Light weight base class for most itk classes.
typename Superclass::VirtualImageType VirtualImageType
typename Superclass::MovingImageGradientType MovingImageGradientType
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
typename Superclass::MovingImagePointType MovingImagePointType
Class for partitioning of an ImageRegion.
typename Superclass::FixedImagePointType FixedImagePointType
typename Superclass::MeasureType MeasureType
typename Superclass::MeasureType MeasureType
typename Superclass::VirtualIndexType VirtualIndexType
typename Superclass::VirtualPointType VirtualPointType
Class implementing normalized cross correlation image metric.
typename Superclass::MovingTransformType MovingTransformType
typename Superclass::FixedImageGradientType FixedImageGradientType
typename Superclass::VirtualPointSetType VirtualPointSetType
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
typename Superclass::FixedImagePixelType FixedImagePixelType
typename Superclass::DerivativeType DerivativeType