ITK  4.2.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 
90 protected:
93 
95  virtual void BeforeThreadedExecution();
96 
103  virtual void AfterThreadedExecution();
104 
110  virtual bool ProcessVirtualPoint( const VirtualIndexType & virtualIndex,
111  const VirtualPointType & virtualPoint,
112  const ThreadIdType threadId );
113 
142  virtual bool ProcessPoint(
143  const VirtualIndexType & virtualIndex,
144  const VirtualPointType & virtualPoint,
145  const FixedImagePointType & mappedFixedPoint,
146  const FixedImagePixelType & mappedFixedPixelValue,
147  const FixedImageGradientType & mappedFixedImageGradient,
148  const MovingImagePointType & mappedMovingPoint,
149  const MovingImagePixelType & mappedMovingPixelValue,
150  const MovingImageGradientType & mappedMovingImageGradient,
151  MeasureType & metricValueReturn,
152  DerivativeType & localDerivativeReturn,
153  const ThreadIdType threadID ) const = 0;
154 
155 
159  virtual void StorePointDerivativeResult( const VirtualIndexType & virtualIndex,
160  const ThreadIdType threadID );
161 
163  mutable std::vector< InternalComputationValueType > m_MeasurePerThread;
164 
166  mutable std::vector< DerivativeType > m_DerivativesPerThread;
167 
169  mutable std::vector< CompensatedDerivativeType > m_CompensatedDerivativesPerThread;
170 
172  mutable std::vector< DerivativeType > m_LocalDerivativesPerThread;
173 
175  mutable std::vector< SizeValueType > m_NumberOfValidPointsPerThread;
176 
179  mutable std::vector< JacobianType > m_MovingTransformJacobianPerThread;
180 
181 private:
182  ImageToImageMetricv4GetValueAndDerivativeThreaderBase( const Self & ); // purposely not implemented
183  void operator=( const Self & ); // purposely not implemented
184 };
185 
186 } // end namespace itk
187 
188 #ifndef ITK_MANUAL_INSTANTIATION
189 #include "itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx"
190 #endif
191 
192 #endif
193