ITK  5.3.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  * 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 itkImageToImageMetricv4GetValueAndDerivativeThreaderBase_h
19 #define itkImageToImageMetricv4GetValueAndDerivativeThreaderBase_h
20 
21 #include "itkDomainThreader.h"
23 
24 namespace itk
25 {
26 
43 template <typename TDomainPartitioner, typename TImageToImageMetricv4>
45  : public DomainThreader<TDomainPartitioner, TImageToImageMetricv4>
46 {
47 public:
49 
55 
57 
59  using DomainType = typename Superclass::DomainType;
60  using AssociateType = typename Superclass::AssociateType;
61 
63  using ImageToImageMetricv4Type = TImageToImageMetricv4;
64  using VirtualImageType = typename ImageToImageMetricv4Type::VirtualImageType;
65  using VirtualIndexType = typename ImageToImageMetricv4Type::VirtualIndexType;
66  using VirtualPointType = typename ImageToImageMetricv4Type::VirtualPointType;
67  using FixedImagePointType = typename ImageToImageMetricv4Type::FixedImagePointType;
68  using FixedImagePixelType = typename ImageToImageMetricv4Type::FixedImagePixelType;
69  using FixedImageIndexType = typename ImageToImageMetricv4Type::FixedImageIndexType;
70  using FixedImageGradientType = typename ImageToImageMetricv4Type::FixedImageGradientType;
71  using MovingImagePointType = typename ImageToImageMetricv4Type::MovingImagePointType;
72  using MovingImagePixelType = typename ImageToImageMetricv4Type::MovingImagePixelType;
73  using MovingImageGradientType = typename ImageToImageMetricv4Type::MovingImageGradientType;
74 
75  using FixedTransformType = typename ImageToImageMetricv4Type::FixedTransformType;
76  using FixedOutputPointType = typename FixedTransformType::OutputPointType;
77  using MovingTransformType = typename ImageToImageMetricv4Type::MovingTransformType;
78  using MovingOutputPointType = typename MovingTransformType::OutputPointType;
79 
80  using MeasureType = typename ImageToImageMetricv4Type::MeasureType;
81  using DerivativeType = typename ImageToImageMetricv4Type::DerivativeType;
82  using DerivativeValueType = typename ImageToImageMetricv4Type::DerivativeValueType;
83  using JacobianType = typename ImageToImageMetricv4Type::JacobianType;
84  using ImageDimensionType = typename ImageToImageMetricv4Type::ImageDimensionType;
85 
86  using InternalComputationValueType = typename ImageToImageMetricv4Type::InternalComputationValueType;
87  using NumberOfParametersType = typename ImageToImageMetricv4Type::NumberOfParametersType;
88 
90  using CompensatedDerivativeType = std::vector<CompensatedDerivativeValueType>;
91 
93  virtual bool
94  GetComputeDerivative() const;
95 
96 protected:
99 
101  void
102  BeforeThreadedExecution() override;
103 
110  void
111  AfterThreadedExecution() override;
112 
118  virtual bool
119  ProcessVirtualPoint(const VirtualIndexType & virtualIndex,
120  const VirtualPointType & virtualPoint,
121  const ThreadIdType threadId);
122 
151  virtual bool
152  ProcessPoint(const VirtualIndexType & virtualIndex,
153  const VirtualPointType & virtualPoint,
154  const FixedImagePointType & mappedFixedPoint,
155  const FixedImagePixelType & mappedFixedPixelValue,
156  const FixedImageGradientType & mappedFixedImageGradient,
157  const MovingImagePointType & mappedMovingPoint,
158  const MovingImagePixelType & mappedMovingPixelValue,
159  const MovingImageGradientType & mappedMovingImageGradient,
160  MeasureType & metricValueReturn,
161  DerivativeType & localDerivativeReturn,
162  const ThreadIdType threadId) const = 0;
163 
164 
168  virtual void
169  StorePointDerivativeResult(const VirtualIndexType & virtualIndex, const ThreadIdType threadId);
170 
172  {
175 
178 
181 
184 
187 
192  };
193  itkPadStruct(ITK_CACHE_LINE_ALIGNMENT,
195  PaddedGetValueAndDerivativePerThreadStruct);
196  itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT,
197  PaddedGetValueAndDerivativePerThreadStruct,
198  AlignedGetValueAndDerivativePerThreadStruct);
199  mutable AlignedGetValueAndDerivativePerThreadStruct * m_GetValueAndDerivativePerThreadVariables;
201 
206 };
207 
208 } // end namespace itk
209 
210 #ifndef ITK_MANUAL_INSTANTIATION
211 # include "itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx"
212 #endif
213 
214 #endif
itk::CompensatedSummation
Perform more precise accumulation of floating point numbers.
Definition: itkCompensatedSummation.h:66
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:44
itk::DomainThreader< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::AssociateType
TImageToImageMetricv4 AssociateType
Definition: itkDomainThreader.h:80
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::ImageToImageMetricv4Type
TImageToImageMetricv4 ImageToImageMetricv4Type
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:63
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase::GetValueAndDerivativePerThreadStruct::CompensatedDerivatives
CompensatedDerivativeType CompensatedDerivatives
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:180
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase::GetValueAndDerivativePerThreadStruct::NumberOfValidPoints
SizeValueType NumberOfValidPoints
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:186
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase::m_GetValueAndDerivativePerThreadVariables
AlignedGetValueAndDerivativePerThreadStruct * m_GetValueAndDerivativePerThreadVariables
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:199
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::ImageDimensionType
typename ImageToImageMetricv4Type::ImageDimensionType ImageDimensionType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:84
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::VirtualImageType
typename ImageToImageMetricv4Type::VirtualImageType VirtualImageType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:64
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::DerivativeValueType
typename ImageToImageMetricv4Type::DerivativeValueType DerivativeValueType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:82
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::MovingImagePointType
typename ImageToImageMetricv4Type::MovingImagePointType MovingImagePointType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:71
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::MovingImageGradientType
typename ImageToImageMetricv4Type::MovingImageGradientType MovingImageGradientType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:73
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::FixedImagePointType
typename ImageToImageMetricv4Type::FixedImagePointType FixedImagePointType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:67
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase::GetValueAndDerivativePerThreadStruct::Measure
InternalComputationValueType Measure
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:174
itk::SmartPointer< Self >
itkCompensatedSummation.h
itk::ThreadIdType
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::MovingTransformType
typename ImageToImageMetricv4Type::MovingTransformType MovingTransformType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:77
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::NumberOfParametersType
typename ImageToImageMetricv4Type::NumberOfParametersType NumberOfParametersType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:87
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::VirtualPointType
typename ImageToImageMetricv4Type::VirtualPointType VirtualPointType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:66
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase::m_CachedNumberOfLocalParameters
NumberOfParametersType m_CachedNumberOfLocalParameters
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:205
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::FixedImagePixelType
typename ImageToImageMetricv4Type::FixedImagePixelType FixedImagePixelType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:68
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase::GetValueAndDerivativePerThreadStruct::Derivatives
DerivativeType Derivatives
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:177
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase::GetValueAndDerivativePerThreadStruct::MovingTransformJacobian
JacobianType MovingTransformJacobian
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:190
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::FixedTransformType
typename ImageToImageMetricv4Type::FixedTransformType FixedTransformType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:75
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::MovingImagePixelType
typename ImageToImageMetricv4Type::MovingImagePixelType MovingImagePixelType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:72
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase::GetValueAndDerivativePerThreadStruct::MovingTransformJacobianPositional
JacobianType MovingTransformJacobianPositional
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:191
itk::DomainThreader< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::DomainType
typename DomainPartitionerType::DomainType DomainType
Definition: itkDomainThreader.h:78
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase::GetValueAndDerivativePerThreadStruct::LocalDerivatives
DerivativeType LocalDerivatives
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:183
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase::m_CachedNumberOfParameters
NumberOfParametersType m_CachedNumberOfParameters
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:204
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::CompensatedDerivativeType
std::vector< CompensatedDerivativeValueType > CompensatedDerivativeType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:90
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::MovingOutputPointType
typename MovingTransformType::OutputPointType MovingOutputPointType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:78
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::DerivativeType
typename ImageToImageMetricv4Type::DerivativeType DerivativeType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:81
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::FixedImageGradientType
typename ImageToImageMetricv4Type::FixedImageGradientType FixedImageGradientType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:70
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::VirtualIndexType
typename ImageToImageMetricv4Type::VirtualIndexType VirtualIndexType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:65
itk::DomainThreader
Multi-threaded processing on a domain by processing sub-domains per thread.
Definition: itkDomainThreader.h:66
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::FixedImageIndexType
typename ImageToImageMetricv4Type::FixedImageIndexType FixedImageIndexType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:69
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::JacobianType
typename ImageToImageMetricv4Type::JacobianType JacobianType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:83
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::FixedOutputPointType
typename FixedTransformType::OutputPointType FixedOutputPointType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:76
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase::GetValueAndDerivativePerThreadStruct
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:171
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::MeasureType
typename ImageToImageMetricv4Type::MeasureType MeasureType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:80
itkDomainThreader.h
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, TImageToImageMetricv4 >::InternalComputationValueType
typename ImageToImageMetricv4Type::InternalComputationValueType InternalComputationValueType
Definition: itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h:86