ITK  5.0.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:
40  ITK_DISALLOW_COPY_AND_ASSIGN(CorrelationImageToImageMetricv4HelperThreader);
41 
47 
49 
50  itkNewMacro( Self );
51 
52  using DomainType = typename Superclass::DomainType;
53  using AssociateType = typename Superclass::AssociateType;
54 
55  using ImageToImageMetricv4Type = typename Superclass::ImageToImageMetricv4Type;
56  using VirtualIndexType = typename Superclass::VirtualIndexType;
57  using VirtualPointType = typename Superclass::VirtualPointType;
58  using FixedImagePointType = typename Superclass::FixedImagePointType;
59  using FixedImagePixelType = typename Superclass::FixedImagePixelType;
60  using FixedImageGradientType = typename Superclass::FixedImageGradientType;
61  using MovingImagePointType = typename Superclass::MovingImagePointType;
62  using MovingImagePixelType = typename Superclass::MovingImagePixelType;
63  using MovingImageGradientType = typename Superclass::MovingImageGradientType;
64  using MeasureType = typename Superclass::MeasureType;
65  using DerivativeType = typename Superclass::DerivativeType;
66  using DerivativeValueType = typename Superclass::DerivativeValueType;
67 
68  using InternalComputationValueType = typename Superclass::InternalComputationValueType;
69  using NumberOfParametersType = typename Superclass::NumberOfParametersType;
70 
71  using FixedOutputPointType = typename Superclass::FixedOutputPointType;
72  using MovingOutputPointType = typename Superclass::MovingOutputPointType;
73 
74 protected:
77 
79  void BeforeThreadedExecution() override;
80 
88  void AfterThreadedExecution() override;
89 
90 
91  /* Overload: don't need to compute the image gradients and store derivatives
92  *
93  * Method called by the threaders to process the given virtual point. This
94  * in turn calls \c TransformAndEvaluateFixedPoint, \c
95  * TransformAndEvaluateMovingPoint, and \c ProcessPoint.
96  */
97  bool ProcessVirtualPoint( const VirtualIndexType & virtualIndex,
98  const VirtualPointType & virtualPoint,
99  const ThreadIdType threadId ) override;
100 
101 
106  const VirtualIndexType & ,
107  const VirtualPointType & ,
108  const FixedImagePointType & ,
109  const FixedImagePixelType & ,
110  const FixedImageGradientType & ,
111  const MovingImagePointType & ,
112  const MovingImagePixelType & ,
113  const MovingImageGradientType & ,
114  MeasureType & ,
115  DerivativeType & ,
116  const ThreadIdType ) const override
117  {
118  return false;
119  }
120 
121 private:
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
typename Superclass::InternalComputationValueType InternalComputationValueType
bool ProcessPoint(const VirtualIndexType &, const VirtualPointType &, const FixedImagePointType &, const FixedImagePixelType &, const FixedImageGradientType &, const MovingImagePointType &, const MovingImagePixelType &, const MovingImageGradientType &, MeasureType &, DerivativeType &, const ThreadIdType) const override
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.