ITK  4.6.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 < typename TDomainPartitioner, typename 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  {
169 
172 
175 
178 
181 
186  };
187  itkPadStruct( ITK_CACHE_LINE_ALIGNMENT, GetValueAndDerivativePerThreadStruct,
188  PaddedGetValueAndDerivativePerThreadStruct);
189  itkAlignedTypedef( ITK_CACHE_LINE_ALIGNMENT, PaddedGetValueAndDerivativePerThreadStruct,
190  AlignedGetValueAndDerivativePerThreadStruct );
191  mutable AlignedGetValueAndDerivativePerThreadStruct * m_GetValueAndDerivativePerThreadVariables;
193 
198 
199 private:
200  ImageToImageMetricv4GetValueAndDerivativeThreaderBase( const Self & ); // purposely not implemented
201  void operator=( const Self & ); // purposely not implemented
202 };
203 
204 } // end namespace itk
205 
206 #ifndef ITK_MANUAL_INSTANTIATION
207 #include "itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx"
208 #endif
209 
210 #endif
virtual bool ProcessPoint(const VirtualIndexType &virtualIndex, const VirtualPointType &virtualPoint, const FixedImagePointType &mappedFixedPoint, const FixedImagePixelType &mappedFixedPixelValue, const FixedImageGradientType &mappedFixedImageGradient, const MovingImagePointType &mappedMovingPoint, const MovingImagePixelType &mappedMovingPixelValue, const MovingImageGradientType &mappedMovingImageGradient, MeasureType &metricValueReturn, DerivativeType &localDerivativeReturn, const ThreadIdType threadId) const =0
virtual void StorePointDerivativeResult(const VirtualIndexType &virtualIndex, const ThreadIdType threadId)
Light weight base class for most itk classes.
Multi-threaded processing on a domain by processing sub-domains per thread.
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedGetValueAndDerivativePerThreadStruct, AlignedGetValueAndDerivativePerThreadStruct)
unsigned long SizeValueType
Definition: itkIntTypes.h:143
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, GetValueAndDerivativePerThreadStruct, PaddedGetValueAndDerivativePerThreadStruct)
Perform more precise accumulation of floating point numbers.
virtual bool ProcessVirtualPoint(const VirtualIndexType &virtualIndex, const VirtualPointType &virtualPoint, const ThreadIdType threadId)
unsigned int ThreadIdType
Definition: itkIntTypes.h:159