ITK  5.4.0
Insight Toolkit
itkCorrelationImageToImageMetricv4.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 itkCorrelationImageToImageMetricv4_h
19 #define itkCorrelationImageToImageMetricv4_h
20 
22 
25 
26 namespace itk
27 {
28 
72 template <typename TFixedImage,
73  typename TMovingImage,
74  typename TVirtualImage = TFixedImage,
75  typename TInternalComputationValueType = double,
76  typename TMetricTraits =
77  DefaultImageToImageMetricTraitsv4<TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType>>
78 class ITK_TEMPLATE_EXPORT CorrelationImageToImageMetricv4
79  : public ImageToImageMetricv4<TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType, TMetricTraits>
80 {
81 public:
82  ITK_DISALLOW_COPY_AND_MOVE(CorrelationImageToImageMetricv4);
83 
86  using Superclass =
90 
92  itkNewMacro(Self);
93 
95  itkOverrideGetNameOfClassMacro(CorrelationImageToImageMetricv4);
96 
98  using typename Superclass::MeasureType;
99  using typename Superclass::DerivativeType;
100 
101  using typename Superclass::FixedImagePointType;
102  using typename Superclass::FixedImagePixelType;
103  using typename Superclass::FixedImageGradientType;
104 
105  using typename Superclass::MovingImagePointType;
106  using typename Superclass::MovingImagePixelType;
107  using typename Superclass::MovingImageGradientType;
108 
109  using typename Superclass::MovingTransformType;
110  using typename Superclass::JacobianType;
111  using VirtualImageType = typename Superclass::VirtualImageType;
112  using typename Superclass::VirtualIndexType;
113  using typename Superclass::VirtualPointType;
114  using typename Superclass::VirtualPointSetType;
115 
116  /* Image dimension accessors */
117  static constexpr typename TVirtualImage::ImageDimensionType VirtualImageDimension = TVirtualImage::ImageDimension;
118  static constexpr typename TFixedImage::ImageDimensionType FixedImageDimension = TFixedImage::ImageDimension;
119  static constexpr typename TMovingImage::ImageDimensionType MovingImageDimension = TMovingImage::ImageDimension;
120 
121 protected:
123  ~CorrelationImageToImageMetricv4() override = default;
124 
129  void
130  InitializeForIteration() const override;
131 
133  ThreadedImageRegionPartitioner<Superclass::VirtualImageDimension>,
135  friend class ImageToImageMetricv4GetValueAndDerivativeThreaderBase<ThreadedIndexedContainerPartitioner, Self>;
137  ThreadedImageRegionPartitioner<Superclass::VirtualImageDimension>,
138  Self>;
139  friend class ImageToImageMetricv4GetValueAndDerivativeThreader<ThreadedIndexedContainerPartitioner, Self>;
140 
142  ThreadedImageRegionPartitioner<Superclass::VirtualImageDimension>,
143  Superclass,
144  Self>;
145  friend class CorrelationImageToImageMetricv4GetValueAndDerivativeThreader<ThreadedIndexedContainerPartitioner,
146  Superclass,
147  Self>;
150  ThreadedImageRegionPartitioner<Superclass::VirtualImageDimension>,
151  Superclass,
152  Self>;
154  CorrelationImageToImageMetricv4GetValueAndDerivativeThreader<ThreadedIndexedContainerPartitioner, Superclass, Self>;
155 
157  ThreadedImageRegionPartitioner<Superclass::VirtualImageDimension>,
158  Superclass,
159  Self>;
160  friend class CorrelationImageToImageMetricv4HelperThreader<ThreadedIndexedContainerPartitioner, Superclass, Self>;
161 
163  CorrelationImageToImageMetricv4HelperThreader<ThreadedImageRegionPartitioner<Superclass::VirtualImageDimension>,
164  Superclass,
165  Self>;
167  CorrelationImageToImageMetricv4HelperThreader<ThreadedIndexedContainerPartitioner, Superclass, Self>;
168 
169  typename CorrelationHelperDenseThreaderType::Pointer m_HelperDenseThreader{};
170  typename CorrelationHelperSparseThreaderType::Pointer m_HelperSparseThreader{};
171 
172  /* These values are computed during InitializeForIteration(),
173  * using the helper class
174  * */
175  mutable MeasureType m_AverageFix{};
176  mutable MeasureType m_AverageMov{};
177 
178  void
179  PrintSelf(std::ostream & os, Indent indent) const override;
180 };
181 
182 } // end namespace itk
183 
184 #ifndef ITK_MANUAL_INSTANTIATION
185 # include "itkCorrelationImageToImageMetricv4.hxx"
186 #endif
187 
188 #endif
itkCorrelationImageToImageMetricv4HelperThreader.h
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:46
itk::ImageToImageMetricv4GetValueAndDerivativeThreader
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreader.h:44
itk::CorrelationImageToImageMetricv4HelperThreader
Definition: itkCorrelationImageToImageMetricv4HelperThreader.h:38
itk::ThreadedImageRegionPartitioner
Class for partitioning of an ImageRegion.
Definition: itkThreadedImageRegionPartitioner.h:45
itk::CorrelationImageToImageMetricv4GetValueAndDerivativeThreader
Processes points for CorrelationImageToImageMetricv4 GetValueAndDerivative.
Definition: itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h:35
itk::CorrelationImageToImageMetricv4
Class implementing normalized cross correlation image metric.
Definition: itkCorrelationImageToImageMetricv4.h:78
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h
itk::CorrelationImageToImageMetricv4::VirtualImageType
typename Superclass::VirtualImageType VirtualImageType
Definition: itkCorrelationImageToImageMetricv4.h:111
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkImageToImageMetricv4.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ImageToImageMetricv4
Definition: itkImageToImageMetricv4.h:174