go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkAdvancedKappaStatisticImageToImageMetric.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 itkAdvancedKappaStatisticImageToImageMetric_h
19#define itkAdvancedKappaStatisticImageToImageMetric_h
20
22#include <vector>
23
24namespace itk
25{
26
56template <class TFixedImage, class TMovingImage>
58 : public AdvancedImageToImageMetric<TFixedImage, TMovingImage>
59{
60public:
62
66 using Pointer = SmartPointer<Self>;
67 using ConstPointer = SmartPointer<const Self>;
68
70 itkNewMacro(Self);
71
74
76 using typename Superclass::CoordinateRepresentationType;
77 using typename Superclass::MovingImageType;
78 using typename Superclass::MovingImagePixelType;
79 using typename Superclass::MovingImageConstPointer;
80 using typename Superclass::FixedImageType;
81 using typename Superclass::FixedImageConstPointer;
82 using typename Superclass::FixedImageRegionType;
83 using typename Superclass::TransformType;
84 using typename Superclass::TransformPointer;
85 using typename Superclass::InputPointType;
86 using typename Superclass::OutputPointType;
87 using typename Superclass::TransformParametersType;
88 using typename Superclass::TransformJacobianType;
90 using typename Superclass::InterpolatorType;
91 using typename Superclass::InterpolatorPointer;
92 using typename Superclass::RealType;
93 using typename Superclass::GradientPixelType;
94 using typename Superclass::GradientImageType;
95 using typename Superclass::GradientImagePointer;
96 using typename Superclass::GradientImageFilterType;
97 using typename Superclass::GradientImageFilterPointer;
98 using typename Superclass::FixedImageMaskType;
99 using typename Superclass::FixedImageMaskPointer;
100 using typename Superclass::MovingImageMaskType;
101 using typename Superclass::MovingImageMaskPointer;
102 using typename Superclass::MeasureType;
103 using typename Superclass::DerivativeType;
104 using typename Superclass::DerivativeValueType;
105 using typename Superclass::ParametersType;
106 using typename Superclass::FixedImagePixelType;
108 using typename Superclass::ImageSamplerType;
109 using typename Superclass::ImageSamplerPointer;
117 using typename Superclass::ThreaderType;
118 using typename Superclass::ThreadInfoType;
119
121 itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension);
122
124 itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension);
125
127 MeasureType
128 GetValue(const TransformParametersType & parameters) const override;
129
131 void
132 GetDerivative(const TransformParametersType & parameters, DerivativeType & derivative) const override;
133
135 virtual void
136 GetValueAndDerivativeSingleThreaded(const TransformParametersType & parameters,
137 MeasureType & Value,
138 DerivativeType & Derivative) const;
139
140 void
141 GetValueAndDerivative(const TransformParametersType & parameters,
142 MeasureType & Value,
143 DerivativeType & Derivative) const override;
144
146 void
147 ComputeGradient() override;
148
150 itkSetMacro(ForegroundValue, RealType);
151 itkGetConstReferenceMacro(ForegroundValue, RealType);
152
157 itkSetMacro(UseForegroundValue, bool);
158
164 itkSetMacro(Complement, bool);
165 itkGetConstReferenceMacro(Complement, bool);
166 itkBooleanMacro(Complement);
167
169 itkSetMacro(Epsilon, RealType);
170 itkGetConstReferenceMacro(Epsilon, RealType);
171
172protected:
175
177 void
178 PrintSelf(std::ostream & os, Indent indent) const override;
179
183 using typename Superclass::FixedImageIndexType;
186 using typename Superclass::FixedImagePointType;
193
197 void
198 UpdateValueAndDerivativeTerms(const RealType & fixedImageValue,
199 const RealType & movingImageValue,
200 std::size_t & fixedForegroundArea,
201 std::size_t & movingForegroundArea,
202 std::size_t & intersection,
203 const DerivativeType & imageJacobian,
204 const NonZeroJacobianIndicesType & nzji,
205 DerivativeType & sum1,
206 DerivativeType & sum2) const;
207
212 void
214
216 void
217 ThreadedGetValueAndDerivative(ThreadIdType threadID) override;
218
220 void
221 AfterThreadedGetValueAndDerivative(MeasureType & value, DerivativeType & derivative) const override;
222
224 static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
226
227private:
230 RealType m_Epsilon;
232
239 {
241
242 MeasureType st_Coefficient1;
243 MeasureType st_Coefficient2;
245 };
246
248 {
250 SizeValueType st_AreaSum;
251 SizeValueType st_AreaIntersection;
252 DerivativeType st_DerivativeSum1;
253 DerivativeType st_DerivativeSum2;
254 };
255 itkPadStruct(ITK_CACHE_LINE_ALIGNMENT,
257 PaddedKappaGetValueAndDerivativePerThreadStruct);
258 itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT,
259 PaddedKappaGetValueAndDerivativePerThreadStruct,
260 AlignedKappaGetValueAndDerivativePerThreadStruct);
261 mutable std::vector<AlignedKappaGetValueAndDerivativePerThreadStruct> m_KappaGetValueAndDerivativePerThreadVariables;
262};
263
264} // end namespace itk
265
266#ifndef ITK_MANUAL_INSTANTIATION
267# include "itkAdvancedKappaStatisticImageToImageMetric.hxx"
268#endif
269
270#endif // end #ifndef itkAdvancedKappaStatisticImageToImageMetric_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
typename DerivativeType::ValueType DerivativeValueType
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
typename AdvancedTransformType::NumberOfParametersType NumberOfParametersType
Computes similarity between two objects to be registered.
void UpdateValueAndDerivativeTerms(const RealType &fixedImageValue, const RealType &movingImageValue, std::vcl_size_t &fixedForegroundArea, std::vcl_size_t &movingForegroundArea, std::vcl_size_t &intersection, const DerivativeType &imageJacobian, const NonZeroJacobianIndicesType &nzji, DerivativeType &sum1, DerivativeType &sum2) const
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, KappaGetValueAndDerivativePerThreadStruct, PaddedKappaGetValueAndDerivativePerThreadStruct)
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
void AfterThreadedGetValueAndDerivative(MeasureType &value, DerivativeType &derivative) const override
void PrintSelf(std::ostream &os, Indent indent) const override
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION AccumulateDerivativesThreaderCallback(void *arg)
ITK_DISALLOW_COPY_AND_MOVE(AdvancedKappaStatisticImageToImageMetric)
void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const override
void ThreadedGetValueAndDerivative(ThreadIdType threadID) override
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
virtual void GetValueAndDerivativeSingleThreaded(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const
void InitializeThreadingParameters() const override
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const override
~AdvancedKappaStatisticImageToImageMetric() override=default
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedKappaGetValueAndDerivativePerThreadStruct, AlignedKappaGetValueAndDerivativePerThreadStruct)
std::vector< AlignedKappaGetValueAndDerivativePerThreadStruct > m_KappaGetValueAndDerivativePerThreadVariables
MeasureType GetValue(const TransformParametersType &parameters) const override
This class is a base class for any image sampler.
Base class for all ITK limiter function objects.


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