ITK  6.0.0
Insight Toolkit
itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.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 itkImageToImageMetricv4GetValueAndDerivativeThreaderBase_h
19#define itkImageToImageMetricv4GetValueAndDerivativeThreaderBase_h
20
21#include "itkDomainThreader.h"
23
24#include <memory> // For unique_ptr.
25
26namespace itk
27{
28
45template <typename TDomainPartitioner, typename TImageToImageMetricv4>
47 : public DomainThreader<TDomainPartitioner, TImageToImageMetricv4>
48{
49public:
51
57
59
61 using typename Superclass::DomainType;
62 using typename Superclass::AssociateType;
63
65 using ImageToImageMetricv4Type = TImageToImageMetricv4;
66 using VirtualImageType = typename ImageToImageMetricv4Type::VirtualImageType;
67 using VirtualIndexType = typename ImageToImageMetricv4Type::VirtualIndexType;
68 using VirtualPointType = typename ImageToImageMetricv4Type::VirtualPointType;
69 using FixedImagePointType = typename ImageToImageMetricv4Type::FixedImagePointType;
70 using FixedImagePixelType = typename ImageToImageMetricv4Type::FixedImagePixelType;
71 using FixedImageIndexType = typename ImageToImageMetricv4Type::FixedImageIndexType;
72 using FixedImageGradientType = typename ImageToImageMetricv4Type::FixedImageGradientType;
73 using MovingImagePointType = typename ImageToImageMetricv4Type::MovingImagePointType;
74 using MovingImagePixelType = typename ImageToImageMetricv4Type::MovingImagePixelType;
75 using MovingImageGradientType = typename ImageToImageMetricv4Type::MovingImageGradientType;
76
77 using FixedTransformType = typename ImageToImageMetricv4Type::FixedTransformType;
78 using FixedOutputPointType = typename FixedTransformType::OutputPointType;
79 using MovingTransformType = typename ImageToImageMetricv4Type::MovingTransformType;
80 using MovingOutputPointType = typename MovingTransformType::OutputPointType;
81
82 using MeasureType = typename ImageToImageMetricv4Type::MeasureType;
83 using DerivativeType = typename ImageToImageMetricv4Type::DerivativeType;
84 using DerivativeValueType = typename ImageToImageMetricv4Type::DerivativeValueType;
85 using JacobianType = typename ImageToImageMetricv4Type::JacobianType;
86 using ImageDimensionType = typename ImageToImageMetricv4Type::ImageDimensionType;
87
88 using InternalComputationValueType = typename ImageToImageMetricv4Type::InternalComputationValueType;
89 using NumberOfParametersType = typename ImageToImageMetricv4Type::NumberOfParametersType;
90
92 using CompensatedDerivativeType = std::vector<CompensatedDerivativeValueType>;
93
95 virtual bool
97
98protected:
101
103 void
105
112 void
114
120 virtual bool
122 const VirtualPointType & virtualPoint,
123 const ThreadIdType threadId);
124
153 virtual bool
154 ProcessPoint(const VirtualIndexType & virtualIndex,
155 const VirtualPointType & virtualPoint,
156 const FixedImagePointType & mappedFixedPoint,
157 const FixedImagePixelType & mappedFixedPixelValue,
158 const FixedImageGradientType & mappedFixedImageGradient,
159 const MovingImagePointType & mappedMovingPoint,
160 const MovingImagePixelType & mappedMovingPixelValue,
161 const MovingImageGradientType & mappedMovingImageGradient,
162 MeasureType & metricValueReturn,
163 DerivativeType & localDerivativeReturn,
164 const ThreadIdType threadId) const = 0;
165
166
170 virtual void
171 StorePointDerivativeResult(const VirtualIndexType & virtualIndex, const ThreadIdType threadId);
172
174 {
177
180
183
186
189
194 };
195 itkPadStruct(ITK_CACHE_LINE_ALIGNMENT,
197 PaddedGetValueAndDerivativePerThreadStruct);
198 itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT,
199 PaddedGetValueAndDerivativePerThreadStruct,
200 AlignedGetValueAndDerivativePerThreadStruct);
201 std::unique_ptr<AlignedGetValueAndDerivativePerThreadStruct[]> m_GetValueAndDerivativePerThreadVariables;
206 mutable NumberOfParametersType m_CachedNumberOfParameters{};
207 mutable NumberOfParametersType m_CachedNumberOfLocalParameters{};
208};
209
210} // end namespace itk
211
212#ifndef ITK_MANUAL_INSTANTIATION
213# include "itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx"
214#endif
215
216#endif
Perform more precise accumulation of floating point numbers.
Multi-threaded processing on a domain by processing sub-domains per thread.
virtual bool ProcessVirtualPoint(const VirtualIndexType &virtualIndex, const VirtualPointType &virtualPoint, const ThreadIdType threadId)
virtual bool ProcessPoint(const VirtualIndexType &virtualIndex, const VirtualPointType &virtualPoint, const FixedImagePointType &mappedFixedPoint, const FixedImagePixelType &mappedFixedPixelValue, const FixedImageGradientType &mappedFixedImageGradient, const MovingImagePointType &mappedMovingPoint, const MovingImagePixelType &mappedMovingPixelValue, const MovingImageGradientType &mappedMovingImageGradient, MeasureType &metricValueReturn, DerivativeType &localDerivativeReturn, const ThreadIdType threadId) const =0
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, GetValueAndDerivativePerThreadStruct, PaddedGetValueAndDerivativePerThreadStruct)
typename ImageToImageMetricv4Type::InternalComputationValueType InternalComputationValueType
std::unique_ptr< AlignedGetValueAndDerivativePerThreadStruct[]> m_GetValueAndDerivativePerThreadVariables
virtual void StorePointDerivativeResult(const VirtualIndexType &virtualIndex, const ThreadIdType threadId)
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedGetValueAndDerivativePerThreadStruct, AlignedGetValueAndDerivativePerThreadStruct)
Light weight base class for most itk classes.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned int ThreadIdType
Definition: itkIntTypes.h:102
unsigned long SizeValueType
Definition: itkIntTypes.h:86