ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkJointHistogramMutualInformationGetValueAndDerivativeThreader.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 itkJointHistogramMutualInformationGetValueAndDerivativeThreader_h
19 #define itkJointHistogramMutualInformationGetValueAndDerivativeThreader_h
20 
22 
23 namespace itk
24 {
25 
33 template < typename TDomainPartitioner, typename TImageToImageMetric, typename TJointHistogramMetric >
35  : public ImageToImageMetricv4GetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric >
36 {
37 public:
39 
42  using Superclass =
46 
48 
49  itkNewMacro( Self );
50 
51  using DomainType = typename Superclass::DomainType;
52  using AssociateType = typename Superclass::AssociateType;
53 
54  using VirtualPointType = typename Superclass::VirtualPointType;
55  using VirtualIndexType = typename Superclass::VirtualIndexType;
56  using FixedImagePointType = typename Superclass::FixedImagePointType;
57  using FixedImagePixelType = typename Superclass::FixedImagePixelType;
58  using FixedImageGradientType = typename Superclass::FixedImageGradientType;
59  using MovingImagePointType = typename Superclass::MovingImagePointType;
60  using MovingImagePixelType = typename Superclass::MovingImagePixelType;
61  using MovingImageGradientType = typename Superclass::MovingImageGradientType;
62  using MeasureType = typename Superclass::MeasureType;
63  using DerivativeType = typename Superclass::DerivativeType;
64  using DerivativeValueType = typename Superclass::DerivativeValueType;
65  using JacobianType = typename Superclass::JacobianType;
66 
67  using JointHistogramMetricType = TJointHistogramMetric;
68  using InternalComputationValueType = typename JointHistogramMetricType::InternalComputationValueType;
69  using JointPDFInterpolatorType = typename JointHistogramMetricType::JointPDFInterpolatorType;
70  using MarginalPDFInterpolatorType = typename JointHistogramMetricType::MarginalPDFInterpolatorType;
71  using JointPDFInterpolatorPointer = typename JointHistogramMetricType::JointPDFInterpolatorPointer;
72  using MarginalPDFInterpolatorPointer = typename JointHistogramMetricType::MarginalPDFInterpolatorPointer;
73  using NumberOfParametersType = typename JointHistogramMetricType::NumberOfParametersType;
74  using JointPDFType = typename JointHistogramMetricType::JointPDFType;
75  using MarginalPDFType = typename JointHistogramMetricType::MarginalPDFType;
78  using JointPDFValueType = typename JointHistogramMetricType::JointPDFValueType;
79 
80 protected:
83 
85 
86  void BeforeThreadedExecution() override;
87 
88  void AfterThreadedExecution() override;
89 
90  bool ProcessPoint(
91  const VirtualIndexType & virtualIndex,
92  const VirtualPointType & virtualPoint,
93  const FixedImagePointType & mappedFixedPoint,
94  const FixedImagePixelType & mappedFixedPixelValue,
95  const FixedImageGradientType & mappedFixedImageGradient,
96  const MovingImagePointType & mappedMovingPoint,
97  const MovingImagePixelType & mappedMovingPixelValue,
98  const MovingImageGradientType & mappedMovingImageGradient,
99  MeasureType & metricValueReturn,
100  DerivativeType & localDerivativeReturn,
101  const ThreadIdType threadId ) const override;
102 
103  inline InternalComputationValueType ComputeFixedImageMarginalPDFDerivative(
104  const MarginalPDFPointType & margPDFpoint,
105  const ThreadIdType threadId ) const;
106 
107  inline InternalComputationValueType ComputeMovingImageMarginalPDFDerivative(
108  const MarginalPDFPointType & margPDFpoint,
109  const ThreadIdType threadId ) const;
110 
111  inline InternalComputationValueType ComputeJointPDFDerivative(
112  const JointPDFPointType & jointPDFpoint,
113  const ThreadIdType threadId,
114  const SizeValueType ind ) const;
116  {
120  };
121  itkPadStruct( ITK_CACHE_LINE_ALIGNMENT, JointHistogramMIPerThreadStruct,
122  PaddedJointHistogramMIPerThreadStruct);
123  itkAlignedTypedef( ITK_CACHE_LINE_ALIGNMENT, PaddedJointHistogramMIPerThreadStruct,
124  AlignedJointHistogramMIPerThreadStruct );
125  AlignedJointHistogramMIPerThreadStruct * m_JointHistogramMIPerThreadVariables;
126 
127 private:
130  TJointHistogramMetric * m_JointAssociate;
131 };
132 
133 } // end namespace itk
134 
135 #endif
136 
137 #ifndef ITK_MANUAL_INSTANTIATION
138 #include "itkJointHistogramMutualInformationGetValueAndDerivativeThreader.hxx"
139 #endif
unsigned long SizeValueType
Definition: itkIntTypes.h:83
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
Processes points for JointHistogramMutualInformationImageToImageMetricv4 GetValueAndDerivative().
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
Templated n-dimensional image class.
Definition: itkImage.h:75