ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.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 __itkImageToImageMetricv4GetValueAndDerivativeThreaderBase_h
19 #define __itkImageToImageMetricv4GetValueAndDerivativeThreaderBase_h
20 
21 #include "itkDomainThreader.h"
23 
24 namespace itk
25 {
26 
43 template < class TDomainPartitioner, class TImageToImageMetricv4 >
45  : public DomainThreader< TDomainPartitioner, TImageToImageMetricv4 >
46 {
47 public:
53 
55 
57  typedef typename Superclass::DomainType DomainType;
59 
61  typedef TImageToImageMetricv4 ImageToImageMetricv4Type;
62  typedef typename ImageToImageMetricv4Type::VirtualImageType VirtualImageType;
63  typedef typename ImageToImageMetricv4Type::VirtualIndexType VirtualIndexType;
64  typedef typename ImageToImageMetricv4Type::VirtualPointType VirtualPointType;
65  typedef typename ImageToImageMetricv4Type::FixedImagePointType FixedImagePointType;
66  typedef typename ImageToImageMetricv4Type::FixedImagePixelType FixedImagePixelType;
67  typedef typename ImageToImageMetricv4Type::FixedImageIndexType FixedImageIndexType;
68  typedef typename ImageToImageMetricv4Type::FixedImageGradientType FixedImageGradientType;
69  typedef typename ImageToImageMetricv4Type::MovingImagePointType MovingImagePointType;
70  typedef typename ImageToImageMetricv4Type::MovingImagePixelType MovingImagePixelType;
71  typedef typename ImageToImageMetricv4Type::MovingImageGradientType MovingImageGradientType;
72 
73  typedef typename ImageToImageMetricv4Type::FixedTransformType FixedTransformType;
74  typedef typename FixedTransformType::OutputPointType FixedOutputPointType;
75  typedef typename ImageToImageMetricv4Type::MovingTransformType MovingTransformType;
76  typedef typename MovingTransformType::OutputPointType MovingOutputPointType;
77 
78  typedef typename ImageToImageMetricv4Type::MeasureType MeasureType;
79  typedef typename ImageToImageMetricv4Type::DerivativeType DerivativeType;
80  typedef typename ImageToImageMetricv4Type::DerivativeValueType DerivativeValueType;
81  typedef typename ImageToImageMetricv4Type::JacobianType JacobianType;
82  typedef typename ImageToImageMetricv4Type::ImageDimensionType ImageDimensionType;
83 
84  typedef typename ImageToImageMetricv4Type::InternalComputationValueType InternalComputationValueType;
85  typedef typename ImageToImageMetricv4Type::NumberOfParametersType NumberOfParametersType;
86 
88  typedef std::vector<CompensatedDerivativeValueType> CompensatedDerivativeType;
89 
91  virtual bool GetComputeDerivative() const;
92 
93 protected:
96 
98  virtual void BeforeThreadedExecution();
99 
106  virtual void AfterThreadedExecution();
107 
113  virtual bool ProcessVirtualPoint( const VirtualIndexType & virtualIndex,
114  const VirtualPointType & virtualPoint,
115  const ThreadIdType threadId );
116 
145  virtual bool ProcessPoint(
146  const VirtualIndexType & virtualIndex,
147  const VirtualPointType & virtualPoint,
148  const FixedImagePointType & mappedFixedPoint,
149  const FixedImagePixelType & mappedFixedPixelValue,
150  const FixedImageGradientType & mappedFixedImageGradient,
151  const MovingImagePointType & mappedMovingPoint,
152  const MovingImagePixelType & mappedMovingPixelValue,
153  const MovingImageGradientType & mappedMovingImageGradient,
154  MeasureType & metricValueReturn,
155  DerivativeType & localDerivativeReturn,
156  const ThreadIdType threadID ) const = 0;
157 
158 
162  virtual void StorePointDerivativeResult( const VirtualIndexType & virtualIndex,
163  const ThreadIdType threadID );
164 
166  mutable std::vector< InternalComputationValueType > m_MeasurePerThread;
167 
169  mutable std::vector< DerivativeType > m_DerivativesPerThread;
170 
172  mutable std::vector< CompensatedDerivativeType > m_CompensatedDerivativesPerThread;
173 
175  mutable std::vector< DerivativeType > m_LocalDerivativesPerThread;
176 
178  mutable std::vector< SizeValueType > m_NumberOfValidPointsPerThread;
179 
182  mutable std::vector< JacobianType > m_MovingTransformJacobianPerThread;
183 
188 
189 private:
190  ImageToImageMetricv4GetValueAndDerivativeThreaderBase( const Self & ); // purposely not implemented
191  void operator=( const Self & ); // purposely not implemented
192 };
193 
194 } // end namespace itk
195 
196 #ifndef ITK_MANUAL_INSTANTIATION
197 #include "itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx"
198 #endif
199 
200 #endif
201