ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.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 itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader_h
19 #define itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader_h
20 
22 
23 #include <mutex>
24 
25 namespace itk
26 {
27 
34 template < typename TDomainPartitioner, typename TImageToImageMetric, typename TMattesMutualInformationMetric >
36  : public ImageToImageMetricv4GetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric >
37 {
38 public:
40 
46 
48 
49  itkNewMacro( Self );
50 
51  using DomainType = typename Superclass::DomainType;
52  using AssociateType = typename Superclass::AssociateType;
53 
54  using ImageToImageMetricv4Type = typename Superclass::ImageToImageMetricv4Type;
55  using VirtualPointType = typename Superclass::VirtualPointType;
56  using VirtualIndexType = typename Superclass::VirtualIndexType;
57  using FixedImagePointType = typename Superclass::FixedImagePointType;
58  using FixedImageIndexType = typename Superclass::FixedImageIndexType;
59  using FixedImagePixelType = typename Superclass::FixedImagePixelType;
60  using FixedImageGradientType = typename Superclass::FixedImageGradientType;
61  using MovingImagePointType = typename Superclass::MovingImagePointType;
62  using MovingImagePixelType = typename Superclass::MovingImagePixelType;
63  using MovingImageGradientType = typename Superclass::MovingImageGradientType;
64  using MeasureType = typename Superclass::MeasureType;
65  using DerivativeType = typename Superclass::DerivativeType;
66  using DerivativeValueType = typename Superclass::DerivativeValueType;
67  using NumberOfParametersType = typename Superclass::NumberOfParametersType;
68 
69  using MovingTransformType = typename ImageToImageMetricv4Type::MovingTransformType;
70 
71  using PDFValueType = typename TMattesMutualInformationMetric::PDFValueType;
72  using JointPDFType = typename TMattesMutualInformationMetric::JointPDFType;
73  using JointPDFRegionType = typename TMattesMutualInformationMetric::JointPDFRegionType;
74  using JointPDFIndexType = typename TMattesMutualInformationMetric::JointPDFIndexType;
75  using JointPDFValueType = typename TMattesMutualInformationMetric::JointPDFValueType;
76  using JointPDFSizeType = typename TMattesMutualInformationMetric::JointPDFSizeType;
77  using JointPDFDerivativesType = typename TMattesMutualInformationMetric::JointPDFDerivativesType;
78  using JointPDFDerivativesIndexType = typename TMattesMutualInformationMetric::JointPDFDerivativesIndexType;
79  using JointPDFDerivativesValueType = typename TMattesMutualInformationMetric::JointPDFDerivativesValueType;
80  using JointPDFDerivativesRegionType = typename TMattesMutualInformationMetric::JointPDFDerivativesRegionType;
81  using JointPDFDerivativesSizeType = typename TMattesMutualInformationMetric::JointPDFDerivativesSizeType;
82 
83  using CubicBSplineFunctionType = typename TMattesMutualInformationMetric::CubicBSplineFunctionType;
84  using CubicBSplineDerivativeFunctionType = typename TMattesMutualInformationMetric::CubicBSplineDerivativeFunctionType;
85 
86  using JacobianType = typename TMattesMutualInformationMetric::JacobianType;
87 
88 protected:
90  m_MattesAssociate(nullptr)
91  {}
92 
93  void BeforeThreadedExecution() override;
94 
95  void AfterThreadedExecution() override;
96 
100  bool ProcessPoint(
101  const VirtualIndexType & virtualIndex,
102  const VirtualPointType & virtualPoint,
103  const FixedImagePointType & mappedFixedPoint,
104  const FixedImagePixelType & mappedFixedPixelValue,
105  const FixedImageGradientType & mappedFixedImageGradient,
106  const MovingImagePointType & mappedMovingPoint,
107  const MovingImagePixelType & mappedMovingPixelValue,
108  const MovingImageGradientType & mappedMovingImageGradient,
109  MeasureType & metricValueReturn,
110  DerivativeType & localDerivativeReturn,
111  const ThreadIdType threadId ) const override;
112 
114  virtual void ComputePDFDerivativesLocalSupportTransform(
115  const JacobianType & jacobian,
116  const MovingImageGradientType & movingGradient,
117  const PDFValueType & cubicBSplineDerivativeValue,
118  DerivativeValueType * localSupportDerivativeResultPtr) const;
119 
120 private:
123  TMattesMutualInformationMetric * m_MattesAssociate;
124 };
125 
126 } // end namespace itk
127 
128 #ifndef ITK_MANUAL_INSTANTIATION
129 #include "itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.hxx"
130 #endif
131 
132 #endif
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.