ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.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 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:
48  ITK_DISALLOW_COPY_AND_ASSIGN(ImageToImageMetricv4GetValueAndDerivativeThreaderBase);
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 GetComputeDerivative() const;
94 
95 protected:
98 
100  void BeforeThreadedExecution() override;
101 
108  void AfterThreadedExecution() override;
109 
115  virtual bool ProcessVirtualPoint( const VirtualIndexType & virtualIndex,
116  const VirtualPointType & virtualPoint,
117  const ThreadIdType threadId );
118 
147  virtual bool ProcessPoint(
148  const VirtualIndexType & virtualIndex,
149  const VirtualPointType & virtualPoint,
150  const FixedImagePointType & mappedFixedPoint,
151  const FixedImagePixelType & mappedFixedPixelValue,
152  const FixedImageGradientType & mappedFixedImageGradient,
153  const MovingImagePointType & mappedMovingPoint,
154  const MovingImagePixelType & mappedMovingPixelValue,
155  const MovingImageGradientType & mappedMovingImageGradient,
156  MeasureType & metricValueReturn,
157  DerivativeType & localDerivativeReturn,
158  const ThreadIdType threadId ) const = 0;
159 
160 
164  virtual void StorePointDerivativeResult( const VirtualIndexType & virtualIndex,
165  const ThreadIdType threadId );
166 
168  {
171 
174 
177 
180 
183 
188  };
189  itkPadStruct( ITK_CACHE_LINE_ALIGNMENT, GetValueAndDerivativePerThreadStruct,
190  PaddedGetValueAndDerivativePerThreadStruct);
191  itkAlignedTypedef( ITK_CACHE_LINE_ALIGNMENT, PaddedGetValueAndDerivativePerThreadStruct,
192  AlignedGetValueAndDerivativePerThreadStruct );
193  mutable AlignedGetValueAndDerivativePerThreadStruct * m_GetValueAndDerivativePerThreadVariables;
195 
200 };
201 
202 } // end namespace itk
203 
204 #ifndef ITK_MANUAL_INSTANTIATION
205 #include "itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx"
206 #endif
207 
208 #endif
Light weight base class for most itk classes.
Multi-threaded processing on a domain by processing sub-domains per thread.
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
Perform more precise accumulation of floating point numbers.
unsigned int ThreadIdType
Definition: itkIntTypes.h:99