go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkPCAMetric_F_multithreaded.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
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 itkPCAMetric_F_multithreaded_h
19#define itkPCAMetric_F_multithreaded_h
20
22
23#include "itkSmoothingRecursiveGaussianImageFilter.h"
25#include "itkNearestNeighborInterpolateImageFunction.h"
26#include "itkExtractImageFilter.h"
27#include <vector>
28
29namespace itk
30{
31template <class TFixedImage, class TMovingImage>
32class ITK_TEMPLATE_EXPORT PCAMetric : public AdvancedImageToImageMetric<TFixedImage, TMovingImage>
33{
34public:
36
38 using Self = PCAMetric;
40 using Pointer = SmartPointer<Self>;
41 using ConstPointer = SmartPointer<const Self>;
42
43 using typename Superclass::FixedImageRegionType;
44 using FixedImageSizeType = typename FixedImageRegionType::SizeType;
45
47 itkNewMacro(Self);
48
51
53 itkSetMacro(SubtractMean, bool);
54 itkSetMacro(GridSize, FixedImageSizeType);
55 itkSetMacro(TransformIsStackTransform, bool);
56 itkSetMacro(NumEigenValues, unsigned int);
57
59 using typename Superclass::CoordinateRepresentationType;
60 using typename Superclass::MovingImageType;
61 using typename Superclass::MovingImagePixelType;
62 using typename Superclass::MovingImageConstPointer;
63 using typename Superclass::FixedImageType;
64 using typename Superclass::FixedImageConstPointer;
65 using typename Superclass::TransformType;
66 using typename Superclass::TransformPointer;
67 using typename Superclass::InputPointType;
68 using typename Superclass::OutputPointType;
69 using typename Superclass::TransformParametersType;
70 using typename Superclass::TransformJacobianType;
71 using typename Superclass::InterpolatorType;
72 using typename Superclass::InterpolatorPointer;
73 using typename Superclass::RealType;
74 using typename Superclass::GradientPixelType;
75 using typename Superclass::GradientImageType;
76 using typename Superclass::GradientImagePointer;
77 using typename Superclass::GradientImageFilterType;
78 using typename Superclass::GradientImageFilterPointer;
79 using typename Superclass::FixedImageMaskType;
80 using typename Superclass::FixedImageMaskPointer;
81 using typename Superclass::MovingImageMaskType;
82 using typename Superclass::MovingImageMaskPointer;
83 using typename Superclass::MeasureType;
84 using typename Superclass::DerivativeType;
85 using typename Superclass::ParametersType;
88 using typename Superclass::ImageSamplerType;
97 using DerivativeValueType = typename DerivativeType::ValueType;
98 using typename Superclass::ThreaderType;
99 using typename Superclass::ThreadInfoType;
100
101 using MatrixType = vnl_matrix<RealType>;
102 using DerivativeMatrixType = vnl_matrix<DerivativeValueType>;
103
104 // using MatrixType = vnl_matrix< double >;
105 // using DerivativeMatrixType = vnl_matrix< double >;
106
108 itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension);
109
111 itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension);
112
114 MeasureType
115 GetValue(const TransformParametersType & parameters) const override;
116
118 void
119 GetDerivative(const TransformParametersType & parameters, DerivativeType & derivative) const override;
120
122 void
123 GetValueAndDerivativeSingleThreaded(const TransformParametersType & parameters,
124 MeasureType & Value,
125 DerivativeType & Derivative) const;
126
127 void
128 GetValueAndDerivative(const TransformParametersType & parameters,
129 MeasureType & Value,
130 DerivativeType & Derivative) const override;
131
136 void
137 Initialize() override;
138
139protected:
141 ~PCAMetric() override = default;
142 void
143 PrintSelf(std::ostream & os, Indent indent) const override;
144
148 using typename Superclass::FixedImageIndexType;
151 using typename Superclass::FixedImagePointType;
153 typename itk::ContinuousIndex<CoordinateRepresentationType, FixedImageDimension>;
160
164 void
165 EvaluateTransformJacobianInnerProduct(const TransformJacobianType & jacobian,
166 const MovingImageDerivativeType & movingImageDerivative,
167 DerivativeType & imageJacobian) const override;
168
170 void
171 ThreadedGetSamples(ThreadIdType threadID);
172
173 void
174 ThreadedComputeDerivative(ThreadIdType threadID);
175
177 void
178 AfterThreadedGetSamples(MeasureType & value) const;
179
180 void
181 AfterThreadedComputeDerivative(DerivativeType & derivative) const;
182
184 static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
186
187 static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
189
191 void
193
194 void
196
198 void
200
201private:
203 {
205 };
206
208
210 {
213 std::vector<FixedImagePointType> st_ApprovedSamples;
214 DerivativeType st_Derivative;
215 };
216
217 itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, PCAMetricGetSamplesPerThreadStruct, PaddedPCAMetricGetSamplesPerThreadStruct);
218
219 itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT,
220 PaddedPCAMetricGetSamplesPerThreadStruct,
221 AlignedPCAMetricGetSamplesPerThreadStruct);
222
223 mutable std::vector<AlignedPCAMetricGetSamplesPerThreadStruct> m_PCAMetricGetSamplesPerThreadVariables;
224
225 unsigned int m_G;
226 unsigned int m_LastDimIndex;
227
229 bool m_SubtractMean{ false };
230
232 FixedImageSizeType m_GridSize;
233
235 bool m_TransformIsStackTransform{ false };
236
238 unsigned int m_NumEigenValues{ 6 };
239
241 mutable std::vector<unsigned int> m_PixelStartIndex;
247};
248
249} // end namespace itk
250
251#ifndef ITK_MANUAL_INSTANTIATION
252# include "itkPCAMetric_F_multithreaded.hxx"
253#endif
254
255#endif // end #ifndef itkPCAMetric_F_multithreaded_h
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics.
typename TransformType::OutputPointType MovingImagePointType
typename ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
typename MovingImageType::RegionType MovingImageRegionType
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
typename FixedImageType::PixelType FixedImagePixelType
GradientImageFilter< MovingImageType, RealType, RealType > CentralDifferenceGradientFilterType
typename FixedImageIndexType::IndexValueType FixedImageIndexValueType
typename MovingImageType::IndexType MovingImageIndexType
typename ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
typename ThreaderType::WorkUnitInfo ThreadInfoType
typename FixedImageType::IndexType FixedImageIndexType
typename BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
typename MovingImageLimiterType::OutputType MovingImageLimiterOutputType
typename TransformType::InputPointType FixedImagePointType
typename FixedImageLimiterType::OutputType FixedImageLimiterOutputType
typename ImageSamplerType::Pointer ImageSamplerPointer
typename InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
This class is a base class for any image sampler.
Base class for all ITK limiter function objects.
void GetValueAndDerivativeSingleThreaded(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const
void InitializeThreadingParameters() const override
void AfterThreadedGetSamples(MeasureType &value) const
void PrintSelf(std::ostream &os, Indent indent) const override
ITK_DISALLOW_COPY_AND_MOVE(PCAMetric)
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
std::vector< unsigned int > m_PixelStartIndex
typename itk::ContinuousIndex< CoordinateRepresentationType, FixedImageDimension > FixedImageContinuousIndexType
Definition: itkPCAMetric.h:151
PCAMetricMultiThreaderParameterType m_PCAMetricThreaderParameters
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedPCAMetricGetSamplesPerThreadStruct, AlignedPCAMetricGetSamplesPerThreadStruct)
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const override
MeasureType GetValue(const TransformParametersType &parameters) const override
void EvaluateTransformJacobianInnerProduct(const TransformJacobianType &jacobian, const MovingImageDerivativeType &movingImageDerivative, DerivativeType &imageJacobian) const override
DerivativeMatrixType m_Sv
typename DerivativeType::ValueType DerivativeValueType
DerivativeMatrixType m_vSAtmm
typename FixedImageRegionType::SizeType FixedImageSizeType
Definition: itkPCAMetric.h:45
SmartPointer< const Self > ConstPointer
Definition: itkPCAMetric.h:42
DerivativeMatrixType m_CSv
typename BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
void LaunchComputeDerivativeThreaderCallback() const
void Initialize() override
void ThreadedComputeDerivative(ThreadIdType threadID)
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION GetSamplesThreaderCallback(void *arg)
std::vector< AlignedPCAMetricGetSamplesPerThreadStruct > m_PCAMetricGetSamplesPerThreadVariables
void AfterThreadedComputeDerivative(DerivativeType &derivative) const
void LaunchGetSamplesThreaderCallback() const
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ComputeDerivativeThreaderCallback(void *arg)
~PCAMetric() override=default
void ThreadedGetSamples(ThreadIdType threadID)
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, PCAMetricGetSamplesPerThreadStruct, PaddedPCAMetricGetSamplesPerThreadStruct)
DerivativeMatrixType m_vdSdmu_part1
void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const override


Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo