ITK  4.8.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 < typename TDomainPartitioner, typename TImageToImageMetric, typename 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:
75 
77  virtual void BeforeThreadedExecution() ITK_OVERRIDE;
78 
86  virtual void AfterThreadedExecution() ITK_OVERRIDE;
87 
88 
89  /* Overload: don't need to compute the image gradients and store derivatives
90  *
91  * Method called by the threaders to process the given virtual point. This
92  * in turn calls \c TransformAndEvaluateFixedPoint, \c
93  * TransformAndEvaluateMovingPoint, and \c ProcessPoint.
94  */
95  virtual bool ProcessVirtualPoint( const VirtualIndexType & virtualIndex,
96  const VirtualPointType & virtualPoint,
97  const ThreadIdType threadId ) ITK_OVERRIDE;
98 
99 
103  virtual bool ProcessPoint(
104  const VirtualIndexType & ,
105  const VirtualPointType & ,
106  const FixedImagePointType & ,
107  const FixedImagePixelType & ,
108  const FixedImageGradientType & ,
109  const MovingImagePointType & ,
110  const MovingImagePixelType & ,
111  const MovingImageGradientType & ,
112  MeasureType & ,
113  DerivativeType & ,
114  const ThreadIdType ) const ITK_OVERRIDE
115  {
116  return false;
117  }
118 
119 private:
120  CorrelationImageToImageMetricv4HelperThreader( const Self & ); // purposely not implemented
121  void operator=( const Self & ); // purposely not implemented
122 
124  {
127  };
128  itkPadStruct( ITK_CACHE_LINE_ALIGNMENT, CorrelationMetricPerThreadStruct,
129  PaddedCorrelationMetricPerThreadStruct);
130  itkAlignedTypedef( ITK_CACHE_LINE_ALIGNMENT, PaddedCorrelationMetricPerThreadStruct,
131  AlignedCorrelationMetricPerThreadStruct );
132  /* per thread variables for correlation and its derivatives */
133  mutable AlignedCorrelationMetricPerThreadStruct * m_CorrelationMetricPerThreadVariables;
134 
137  TCorrelationMetric * m_CorrelationAssociate;
138 };
139 
140 } // end namespace itk
141 
142 #ifndef ITK_MANUAL_INSTANTIATION
143 #include "itkCorrelationImageToImageMetricv4HelperThreader.hxx"
144 #endif
145 
146 #endif
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, CorrelationMetricPerThreadStruct, PaddedCorrelationMetricPerThreadStruct)
virtual bool ProcessVirtualPoint(const VirtualIndexType &virtualIndex, const VirtualPointType &virtualPoint, const ThreadIdType threadId) override
ImageToImageMetricv4GetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric > Superclass
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
virtual bool ProcessPoint(const VirtualIndexType &, const VirtualPointType &, const FixedImagePointType &, const FixedImagePixelType &, const FixedImageGradientType &, const MovingImagePointType &, const MovingImagePixelType &, const MovingImageGradientType &, MeasureType &, DerivativeType &, const ThreadIdType) const override
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedCorrelationMetricPerThreadStruct, AlignedCorrelationMetricPerThreadStruct)