ITK  4.2.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 protected:
73 
75  virtual void BeforeThreadedExecution();
76 
84  virtual void AfterThreadedExecution();
85 
86 
87  /* Overload: don't need to compute the image gradients and store derivatives
88  *
89  * Method called by the threaders to process the given virtual point. This
90  * in turn calls \c TransformAndEvaluateFixedPoint, \c
91  * TransformAndEvaluateMovingPoint, and \c ProcessPoint.
92  */
93  virtual bool ProcessVirtualPoint( const VirtualIndexType & virtualIndex,
94  const VirtualPointType & virtualPoint,
95  const ThreadIdType threadId );
96 
97 
101  virtual bool ProcessPoint(
102  const VirtualIndexType & ,
103  const VirtualPointType & ,
104  const FixedImagePointType & ,
105  const FixedImagePixelType & ,
106  const FixedImageGradientType & ,
107  const MovingImagePointType & ,
108  const MovingImagePixelType & ,
109  const MovingImageGradientType & ,
110  MeasureType & ,
111  DerivativeType & ,
112  const ThreadIdType ) const
113  {
114  return false;
115  }
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 };
126 
127 } // end namespace itk
128 
129 #ifndef ITK_MANUAL_INSTANTIATION
130 #include "itkCorrelationImageToImageMetricv4HelperThreader.hxx"
131 #endif
132 
133 #endif
134