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::FixedImageMaskType;
100 using typename Superclass::MeasureType;
101 using typename Superclass::DerivativeType;
102 using typename Superclass::DerivativeValueType;
103 using typename Superclass::ParametersType;
104 using typename Superclass::FixedImagePixelType;
106 using typename Superclass::ImageSamplerType;
107 using typename Superclass::ImageSamplerPointer;
115 using typename Superclass::ThreadInfoType;
116
118 itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension);
119
121 itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension);
122
124 MeasureType
125 GetValue(const TransformParametersType & parameters) const override;
126
128 void
129 GetDerivative(const TransformParametersType & parameters, DerivativeType & derivative) const override;
130
132 virtual void
133 GetValueAndDerivativeSingleThreaded(const TransformParametersType & parameters,
134 MeasureType & Value,
135 DerivativeType & Derivative) const;
136
137 void
138 GetValueAndDerivative(const TransformParametersType & parameters,
139 MeasureType & Value,
140 DerivativeType & Derivative) const override;
141
143 void
144 ComputeGradient() override;
145
147 itkSetMacro(ForegroundValue, RealType);
148 itkGetConstReferenceMacro(ForegroundValue, RealType);
149
154 itkSetMacro(UseForegroundValue, bool);
155
161 itkSetMacro(Complement, bool);
162 itkGetConstReferenceMacro(Complement, bool);
163 itkBooleanMacro(Complement);
164
166 itkSetMacro(Epsilon, RealType);
167 itkGetConstReferenceMacro(Epsilon, RealType);
168
169protected:
172
174 void
175 PrintSelf(std::ostream & os, Indent indent) const override;
176
180 using typename Superclass::FixedImageIndexType;
183 using typename Superclass::FixedImagePointType;
189
193 void
194 UpdateValueAndDerivativeTerms(const RealType fixedImageValue,
195 const RealType movingImageValue,
196 std::size_t & fixedForegroundArea,
197 std::size_t & movingForegroundArea,
198 std::size_t & intersection,
199 const DerivativeType & imageJacobian,
200 const NonZeroJacobianIndicesType & nzji,
201 DerivativeType & sum1,
202 DerivativeType & sum2) const;
203
208 void
210
212 void
213 ThreadedGetValueAndDerivative(ThreadIdType threadID) const override;
214
216 void
217 AfterThreadedGetValueAndDerivative(MeasureType & value, DerivativeType & derivative) const override;
218
220 static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
222
223private:
224 bool m_UseForegroundValue{ true }; // for backwards compatibility
225 RealType m_ForegroundValue{ 1.0 };
226 RealType m_Epsilon{ 1e-3 };
227 bool m_Complement{ true };
228
242
244 {
246 SizeValueType st_AreaSum;
247 SizeValueType st_AreaIntersection;
248 DerivativeType st_DerivativeSum1;
249 DerivativeType st_DerivativeSum2;
250 };
251 itkPadStruct(ITK_CACHE_LINE_ALIGNMENT,
253 PaddedKappaGetValueAndDerivativePerThreadStruct);
254 itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT,
255 PaddedKappaGetValueAndDerivativePerThreadStruct,
256 AlignedKappaGetValueAndDerivativePerThreadStruct);
257 mutable std::vector<AlignedKappaGetValueAndDerivativePerThreadStruct>
258 m_KappaGetValueAndDerivativePerThreadVariables{};
259};
260
261} // end namespace itk
262
263#ifndef ITK_MANUAL_INSTANTIATION
264# include "itkAdvancedKappaStatisticImageToImageMetric.hxx"
265#endif
266
267#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
typename FixedImageIndexType::IndexValueType FixedImageIndexValueType
typename MovingImageType::IndexType MovingImageIndexType
typename ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
ImageMaskSpatialObject< Self::FixedImageDimension > FixedImageMaskType
typename FixedImageType::IndexType FixedImageIndexType
SmartPointer< MovingImageMaskType > MovingImageMaskPointer
MultiThreaderBase::WorkUnitInfo ThreadInfoType
typename BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
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
typename AdvancedTransformType::NumberOfParametersType NumberOfParametersType
ImageMaskSpatialObject< Self::MovingImageDimension > MovingImageMaskType
Computes similarity between two objects to be registered.
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)
void ThreadedGetValueAndDerivative(ThreadIdType threadID) const override
ITK_DISALLOW_COPY_AND_MOVE(AdvancedKappaStatisticImageToImageMetric)
void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const override
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
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)
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 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo