ITK  4.13.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:
74  virtual ~CorrelationImageToImageMetricv4HelperThreader() ITK_OVERRIDE;
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  ITK_DISALLOW_COPY_AND_ASSIGN(CorrelationImageToImageMetricv4HelperThreader);
121 
123  {
126  };
127  itkPadStruct( ITK_CACHE_LINE_ALIGNMENT, CorrelationMetricPerThreadStruct,
128  PaddedCorrelationMetricPerThreadStruct);
129  itkAlignedTypedef( ITK_CACHE_LINE_ALIGNMENT, PaddedCorrelationMetricPerThreadStruct,
130  AlignedCorrelationMetricPerThreadStruct );
131  /* per thread variables for correlation and its derivatives */
132  mutable AlignedCorrelationMetricPerThreadStruct * m_CorrelationMetricPerThreadVariables;
133 
136  TCorrelationMetric * m_CorrelationAssociate;
137 };
138 
139 } // end namespace itk
140 
141 #ifndef ITK_MANUAL_INSTANTIATION
142 #include "itkCorrelationImageToImageMetricv4HelperThreader.hxx"
143 #endif
144 
145 #endif
ImageToImageMetricv4GetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric > Superclass
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.