ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkCorrelationImageToImageMetricv4HelperThreader.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 __itkCorrelationImageToImageMetricv4HelperThreader_h
19 #define __itkCorrelationImageToImageMetricv4HelperThreader_h
20 
22 
23 namespace itk
24 {
25 
35 template < class TDomainPartitioner, class TImageToImageMetric, class TCorrelationMetric >
37  : public ImageToImageMetricv4GetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric >
38 {
39 public:
45 
47 
48  itkNewMacro( Self );
49 
50  typedef typename Superclass::DomainType DomainType;
51  typedef typename Superclass::AssociateType AssociateType;
52 
53  typedef typename Superclass::ImageToImageMetricv4Type ImageToImageMetricv4Type;
54  typedef typename Superclass::VirtualIndexType VirtualIndexType;
55  typedef typename Superclass::VirtualPointType VirtualPointType;
56  typedef typename Superclass::FixedImagePointType FixedImagePointType;
57  typedef typename Superclass::FixedImagePixelType FixedImagePixelType;
58  typedef typename Superclass::FixedImageGradientType FixedImageGradientType;
59  typedef typename Superclass::MovingImagePointType MovingImagePointType;
60  typedef typename Superclass::MovingImagePixelType MovingImagePixelType;
61  typedef typename Superclass::MovingImageGradientType MovingImageGradientType;
62  typedef typename Superclass::MeasureType MeasureType;
63  typedef typename Superclass::DerivativeType DerivativeType;
64  typedef typename Superclass::DerivativeValueType DerivativeValueType;
65 
66  typedef typename Superclass::InternalComputationValueType InternalComputationValueType;
67  typedef typename Superclass::NumberOfParametersType NumberOfParametersType;
68 
69  typedef typename Superclass::FixedOutputPointType FixedOutputPointType;
70  typedef typename Superclass::MovingOutputPointType MovingOutputPointType;
71 
72 protected:
74 
76  virtual void BeforeThreadedExecution();
77 
85  virtual void AfterThreadedExecution();
86 
87 
88  /* Overload: don't need to compute the image gradients and store derivatives
89  *
90  * Method called by the threaders to process the given virtual point. This
91  * in turn calls \c TransformAndEvaluateFixedPoint, \c
92  * TransformAndEvaluateMovingPoint, and \c ProcessPoint.
93  */
94  virtual bool ProcessVirtualPoint( const VirtualIndexType & virtualIndex,
95  const VirtualPointType & virtualPoint,
96  const ThreadIdType threadId );
97 
98 
102  virtual bool ProcessPoint(
103  const VirtualIndexType & ,
104  const VirtualPointType & ,
105  const FixedImagePointType & ,
106  const FixedImagePixelType & ,
107  const FixedImageGradientType & ,
108  const MovingImagePointType & ,
109  const MovingImagePixelType & ,
110  const MovingImageGradientType & ,
111  MeasureType & ,
112  DerivativeType & ,
113  const ThreadIdType ) const
114  {
115  return false;
116  }
117 
118 private:
119  CorrelationImageToImageMetricv4HelperThreader( const Self & ); // purposely not implemented
120  void operator=( const Self & ); // purposely not implemented
121 
122  /* per thread variables for correlation and its derivatives */
123  mutable std::vector< InternalComputationValueType > m_FixSumPerThread;
124  mutable std::vector< InternalComputationValueType > m_MovSumPerThread;
125 
128  TCorrelationMetric * m_CorrelationAssociate;
129 };
130 
131 } // end namespace itk
132 
133 #ifndef ITK_MANUAL_INSTANTIATION
134 #include "itkCorrelationImageToImageMetricv4HelperThreader.hxx"
135 #endif
136 
137 #endif
138