go home Home | Main Page | Topics | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Loading...
Searching...
No Matches
itkPCAMetric.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_h
19#define itkPCAMetric_h
20
22
23#include "itkSmoothingRecursiveGaussianImageFilter.h"
25#include "itkNearestNeighborInterpolateImageFunction.h"
26#include "itkExtractImageFilter.h"
27#include <vector>
28
29namespace itk
30{
31template <typename TFixedImage, typename 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(UseZeroAverageDisplacementConstraint, 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::TransformJacobianType;
70 using typename Superclass::InterpolatorType;
71 using typename Superclass::InterpolatorPointer;
72 using typename Superclass::RealType;
73 using typename Superclass::GradientPixelType;
74 using typename Superclass::GradientImageType;
75 using typename Superclass::GradientImagePointer;
76 using typename Superclass::FixedImageMaskType;
80 using typename Superclass::MeasureType;
81 using typename Superclass::DerivativeType;
82 using typename Superclass::ParametersType;
85 using typename Superclass::ImageSamplerType;
95 using typename Superclass::ThreadInfoType;
96
97 using MatrixType = vnl_matrix<RealType>;
98 using DerivativeMatrixType = vnl_matrix<DerivativeValueType>;
99
100 // using MatrixType = vnl_matrix< double >;
101 // using DerivativeMatrixType = vnl_matrix< double >;
102
104 itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension);
105
107 itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension);
108
110 MeasureType
111 GetValue(const ParametersType & parameters) const override;
112
114 void
115 GetDerivative(const ParametersType & parameters, DerivativeType & derivative) const override;
116
118 void
119 GetValueAndDerivativeSingleThreaded(const ParametersType & parameters,
120 MeasureType & Value,
121 DerivativeType & Derivative) const;
122
123 void
124 GetValueAndDerivative(const ParametersType & parameters,
125 MeasureType & Value,
126 DerivativeType & Derivative) const override;
127
131
132 void
133 Initialize() override;
134
135protected:
137 ~PCAMetric() override = default;
138 void
139 PrintSelf(std::ostream & os, Indent indent) const override;
140
142
144 using typename Superclass::FixedImageIndexType;
147 using typename Superclass::FixedImagePointType;
149 typename itk::ContinuousIndex<CoordinateRepresentationType, FixedImageDimension>;
155
159 void
160 EvaluateTransformJacobianInnerProduct(const TransformJacobianType & jacobian,
161 const MovingImageDerivativeType & movingImageDerivative,
162 DerivativeType & imageJacobian) const override;
163
165 void
166 ThreadedGetSamples(ThreadIdType threadID);
167
168 void
169 ThreadedComputeDerivative(ThreadIdType threadID);
170
172 void
173 AfterThreadedGetSamples(MeasureType & value) const;
174
175 void
176 AfterThreadedComputeDerivative(DerivativeType & derivative) const;
177
179 static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
181
182 static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
184
186 void
188
189 void
191
193 void
195
196private:
201
202 PCAMetricMultiThreaderParameterType m_PCAMetricThreaderParameters{};
203
205 {
208 std::vector<FixedImagePointType> st_ApprovedSamples;
209 DerivativeType st_Derivative;
210 };
211
212 itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, PCAMetricGetSamplesPerThreadStruct, PaddedPCAMetricGetSamplesPerThreadStruct);
213
214 itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT,
215 PaddedPCAMetricGetSamplesPerThreadStruct,
216 AlignedPCAMetricGetSamplesPerThreadStruct);
217
218 mutable std::vector<AlignedPCAMetricGetSamplesPerThreadStruct> m_PCAMetricGetSamplesPerThreadVariables{};
219
220 unsigned int m_G{};
221 unsigned int m_LastDimIndex{};
222
225
228
231
233 unsigned int m_NumEigenValues{ 6 };
234
236 mutable std::vector<unsigned int> m_PixelStartIndex{};
242};
243
244} // end namespace itk
245
246#ifndef ITK_MANUAL_INSTANTIATION
247# include "itkPCAMetric.hxx"
248#endif
249
250#endif // end #ifndef itkPCAMetric_h
typename TransformType::OutputPointType MovingImagePointType
typename ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
typename MovingImageType::RegionType MovingImageRegionType
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
FixedArray< double, Self::MovingImageDimension > MovingImageDerivativeScalesType
typename FixedImageType::PixelType FixedImagePixelType
typename DerivativeType::ValueType DerivativeValueType
typename FixedImageIndexType::IndexValueType FixedImageIndexValueType
typename MovingImageType::IndexType MovingImageIndexType
typename ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
ImageMaskSpatialObject< Self::FixedImageDimension > FixedImageMaskType
typename FixedImageType::IndexType FixedImageIndexType
SmartPointer< MovingImageMaskType > MovingImageMaskPointer
LimiterFunctionBase< RealType, FixedImageDimension > FixedImageLimiterType
ImageSamplerBase< FixedImageType > ImageSamplerType
MultiThreaderBase::WorkUnitInfo ThreadInfoType
typename BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
LimiterFunctionBase< RealType, MovingImageDimension > MovingImageLimiterType
typename MovingImageLimiterType::OutputType MovingImageLimiterOutputType
typename TransformType::InputPointType FixedImagePointType
typename FixedImageLimiterType::OutputType FixedImageLimiterOutputType
SmartPointer< FixedImageMaskType > FixedImageMaskPointer
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
typename ImageSamplerType::Pointer ImageSamplerPointer
typename InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
ImageMaskSpatialObject< Self::MovingImageDimension > MovingImageMaskType
void GetDerivative(const ParametersType &parameters, DerivativeType &derivative) const override
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)
void GetValueAndDerivativeSingleThreaded(const ParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const
AdvancedImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType > Superclass
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedPCAMetricGetSamplesPerThreadStruct, AlignedPCAMetricGetSamplesPerThreadStruct)
void EvaluateTransformJacobianInnerProduct(const TransformJacobianType &jacobian, const MovingImageDerivativeType &movingImageDerivative, DerivativeType &imageJacobian) const override
itkOverrideGetNameOfClassMacro(PCAMetric)
typename itk::ContinuousIndex< CoordinateRepresentationType, FixedImageDimension > FixedImageContinuousIndexType
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
void LaunchComputeDerivativeThreaderCallback() const
void Initialize() override
void GetValueAndDerivative(const ParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const override
void ThreadedComputeDerivative(ThreadIdType threadID)
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION GetSamplesThreaderCallback(void *arg)
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)
MeasureType GetValue(const ParametersType &parameters) const override
std::vector< FixedImagePointType > st_ApprovedSamples


Generated on 1774142652 for elastix by doxygen 1.15.0 elastix logo