ITK  4.3.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 < class TDomainPartitioner, class TImageToImageMetric, class TJointHistogramMetric >
35  : public ImageToImageMetricv4GetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric >
36 {
37 public:
44 
46 
47  itkNewMacro( Self );
48 
49  typedef typename Superclass::DomainType DomainType;
50  typedef typename Superclass::AssociateType AssociateType;
51 
52  typedef typename Superclass::VirtualPointType VirtualPointType;
53  typedef typename Superclass::VirtualIndexType VirtualIndexType;
54  typedef typename Superclass::FixedImagePointType FixedImagePointType;
55  typedef typename Superclass::FixedImagePixelType FixedImagePixelType;
56  typedef typename Superclass::FixedImageGradientType FixedImageGradientType;
57  typedef typename Superclass::MovingImagePointType MovingImagePointType;
58  typedef typename Superclass::MovingImagePixelType MovingImagePixelType;
59  typedef typename Superclass::MovingImageGradientType MovingImageGradientType;
60  typedef typename Superclass::MeasureType MeasureType;
61  typedef typename Superclass::DerivativeType DerivativeType;
62  typedef typename Superclass::DerivativeValueType DerivativeValueType;
63 
64  typedef TJointHistogramMetric JointHistogramMetricType;
65  typedef typename JointHistogramMetricType::InternalComputationValueType InternalComputationValueType;
66  typedef typename JointHistogramMetricType::JointPDFInterpolatorType JointPDFInterpolatorType;
67  typedef typename JointHistogramMetricType::MarginalPDFInterpolatorType MarginalPDFInterpolatorType;
68  typedef typename JointHistogramMetricType::JointPDFInterpolatorPointer JointPDFInterpolatorPointer;
69  typedef typename JointHistogramMetricType::MarginalPDFInterpolatorPointer MarginalPDFInterpolatorPointer;
70  typedef typename JointHistogramMetricType::FixedTransformJacobianType FixedTransformJacobianType;
71  typedef typename JointHistogramMetricType::NumberOfParametersType NumberOfParametersType;
72  typedef typename JointHistogramMetricType::JointPDFType JointPDFType;
73  typedef typename JointHistogramMetricType::MarginalPDFType MarginalPDFType;
74  typedef typename MarginalPDFType::PointType MarginalPDFPointType;
75  typedef typename JointPDFType::PointType JointPDFPointType;
76  typedef typename JointHistogramMetricType::JointPDFValueType JointPDFValueType;
77 
78 protected:
80 
82  std::vector< typename JointHistogramType::Pointer > m_JointHistogramPerThread;
83 
84  virtual void BeforeThreadedExecution();
85 
86  virtual void AfterThreadedExecution();
87 
88  virtual bool ProcessPoint(
89  const VirtualIndexType & virtualIndex,
90  const VirtualPointType & virtualPoint,
91  const FixedImagePointType & mappedFixedPoint,
92  const FixedImagePixelType & mappedFixedPixelValue,
93  const FixedImageGradientType & mappedFixedImageGradient,
94  const MovingImagePointType & mappedMovingPoint,
95  const MovingImagePixelType & mappedMovingPixelValue,
96  const MovingImageGradientType & mappedMovingImageGradient,
97  MeasureType & metricValueReturn,
98  DerivativeType & localDerivativeReturn,
99  const ThreadIdType threadID ) const;
100 
102  const MarginalPDFPointType & margPDFpoint,
103  const ThreadIdType threadID ) const;
104 
106  const MarginalPDFPointType & margPDFpoint,
107  const ThreadIdType threadID ) const;
108 
110  const JointPDFPointType & jointPDFpoint,
111  const ThreadIdType threadID,
112  const SizeValueType ind ) const;
113 
114  std::vector< SizeValueType > m_JointHistogramCountPerThread;
115  std::vector< JointPDFInterpolatorPointer > m_JointPDFInterpolatorPerThread;
116  std::vector< MarginalPDFInterpolatorPointer > m_FixedImageMarginalPDFInterpolatorPerThread;
117  std::vector< MarginalPDFInterpolatorPointer > m_MovingImageMarginalPDFInterpolatorPerThread;
118 
119 private:
120  JointHistogramMutualInformationGetValueAndDerivativeThreader( const Self & ); // purposely not implemented
121  void operator=( const Self & ); // purposely not implemented
122 
125  TJointHistogramMetric * m_JointAssociate;
126 };
127 
128 } // end namespace itk
129 
130 #endif
131 
132 #ifndef ITK_MANUAL_INSTANTIATION
133 #include "itkJointHistogramMutualInformationGetValueAndDerivativeThreader.hxx"
134 #endif
135