Loading...
Searching...
No Matches
itkAdvancedKappaStatisticImageToImageMetric.h
Go to the documentation of this file.
/*=========================================================================
*
* Copyright UMC Utrecht and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkAdvancedKappaStatisticImageToImageMetric_h
#define itkAdvancedKappaStatisticImageToImageMetric_h
#include "itkAdvancedImageToImageMetric.h"
#include <vector>
namespace itk
{
template <class TFixedImage, class TMovingImage>
class ITK_TEMPLATE_EXPORT AdvancedKappaStatisticImageToImageMetric
: public AdvancedImageToImageMetric<TFixedImage, TMovingImage>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(AdvancedKappaStatisticImageToImageMetric);
using Self = AdvancedKappaStatisticImageToImageMetric;
using Superclass = AdvancedImageToImageMetric<TFixedImage, TMovingImage>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
itkNewMacro(Self);
itkTypeMacro(AdvancedKappaStatisticImageToImageMetric, AdvancedImageToImageMetric);
using typename Superclass::CoordinateRepresentationType;
using typename Superclass::MovingImageType;
using typename Superclass::MovingImagePixelType;
using typename Superclass::MovingImageConstPointer;
using typename Superclass::FixedImageType;
using typename Superclass::FixedImageConstPointer;
using typename Superclass::FixedImageRegionType;
using typename Superclass::TransformType;
using typename Superclass::TransformPointer;
using typename Superclass::InputPointType;
using typename Superclass::OutputPointType;
using typename Superclass::TransformParametersType;
using typename Superclass::TransformJacobianType;
using typename Superclass::NumberOfParametersType;
using typename Superclass::InterpolatorType;
using typename Superclass::InterpolatorPointer;
using typename Superclass::RealType;
using typename Superclass::GradientPixelType;
using typename Superclass::GradientImageType;
using typename Superclass::GradientImagePointer;
using typename Superclass::FixedImageMaskType;
using typename Superclass::FixedImageMaskPointer;
using typename Superclass::MovingImageMaskType;
using typename Superclass::MovingImageMaskPointer;
using typename Superclass::MeasureType;
using typename Superclass::DerivativeType;
using typename Superclass::DerivativeValueType;
using typename Superclass::ParametersType;
using typename Superclass::FixedImagePixelType;
using typename Superclass::MovingImageRegionType;
using typename Superclass::ImageSamplerType;
using typename Superclass::ImageSamplerPointer;
using typename Superclass::ImageSampleContainerType;
using typename Superclass::ImageSampleContainerPointer;
using typename Superclass::FixedImageLimiterType;
using typename Superclass::MovingImageLimiterType;
using typename Superclass::FixedImageLimiterOutputType;
using typename Superclass::MovingImageLimiterOutputType;
using typename Superclass::MovingImageDerivativeScalesType;
using typename Superclass::ThreadInfoType;
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension);
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension);
MeasureType
GetValue(const TransformParametersType & parameters) const override;
void
GetDerivative(const TransformParametersType & parameters, DerivativeType & derivative) const override;
virtual void
GetValueAndDerivativeSingleThreaded(const TransformParametersType & parameters,
MeasureType & Value,
DerivativeType & Derivative) const;
void
GetValueAndDerivative(const TransformParametersType & parameters,
MeasureType & Value,
DerivativeType & Derivative) const override;
void
ComputeGradient() override;
itkSetMacro(ForegroundValue, RealType);
itkGetConstReferenceMacro(ForegroundValue, RealType);
itkSetMacro(UseForegroundValue, bool);
itkSetMacro(Complement, bool);
itkGetConstReferenceMacro(Complement, bool);
itkBooleanMacro(Complement);
itkSetMacro(Epsilon, RealType);
itkGetConstReferenceMacro(Epsilon, RealType);
protected:
AdvancedKappaStatisticImageToImageMetric();
~AdvancedKappaStatisticImageToImageMetric() override = default;
void
PrintSelf(std::ostream & os, Indent indent) const override;
using typename Superclass::FixedImageIndexType;
using typename Superclass::FixedImageIndexValueType;
using typename Superclass::MovingImageIndexType;
using typename Superclass::FixedImagePointType;
using typename Superclass::MovingImagePointType;
using typename Superclass::MovingImageContinuousIndexType;
using typename Superclass::BSplineInterpolatorType;
using typename Superclass::MovingImageDerivativeType;
using typename Superclass::NonZeroJacobianIndicesType;
void
UpdateValueAndDerivativeTerms(const RealType fixedImageValue,
const RealType movingImageValue,
std::size_t & fixedForegroundArea,
std::size_t & movingForegroundArea,
std::size_t & intersection,
const DerivativeType & imageJacobian,
const NonZeroJacobianIndicesType & nzji,
DerivativeType & sum1,
DerivativeType & sum2) const;
void
InitializeThreadingParameters() const override;
void
ThreadedGetValueAndDerivative(ThreadIdType threadID) const override;
void
AfterThreadedGetValueAndDerivative(MeasureType & value, DerivativeType & derivative) const override;
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
AccumulateDerivativesThreaderCallback(void * arg);
private:
bool m_UseForegroundValue{ true }; // for backwards compatibility
RealType m_ForegroundValue{ 1.0 };
RealType m_Epsilon{ 1e-3 };
bool m_Complement{ true };
struct MultiThreaderAccumulateDerivativeType
{
AdvancedKappaStatisticImageToImageMetric * st_Metric;
MeasureType st_Coefficient1;
MeasureType st_Coefficient2;
DerivativeValueType * st_DerivativePointer;
};
struct KappaGetValueAndDerivativePerThreadStruct
{
SizeValueType st_NumberOfPixelsCounted;
SizeValueType st_AreaSum;
SizeValueType st_AreaIntersection;
DerivativeType st_DerivativeSum1;
DerivativeType st_DerivativeSum2;
};
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT,
KappaGetValueAndDerivativePerThreadStruct,
PaddedKappaGetValueAndDerivativePerThreadStruct);
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT,
PaddedKappaGetValueAndDerivativePerThreadStruct,
AlignedKappaGetValueAndDerivativePerThreadStruct);
mutable std::vector<AlignedKappaGetValueAndDerivativePerThreadStruct>
m_KappaGetValueAndDerivativePerThreadVariables{};
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
# include "itkAdvancedKappaStatisticImageToImageMetric.hxx"
#endif
#endif // end #ifndef itkAdvancedKappaStatisticImageToImageMetric_h
itk::AdvancedImageToImageMetric::MovingImagePointType
typename TransformType::OutputPointType MovingImagePointType
Definition itkAdvancedImageToImageMetric.h:338
itk::AdvancedImageToImageMetric::ImageSampleContainerPointer
typename ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
Definition itkAdvancedImageToImageMetric.h:145
itk::AdvancedImageToImageMetric::MovingImageRegionType
typename MovingImageType::RegionType MovingImageRegionType
Definition itkAdvancedImageToImageMetric.h:138
itk::AdvancedImageToImageMetric::NonZeroJacobianIndicesType
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
Definition itkAdvancedImageToImageMetric.h:356
itk::AdvancedImageToImageMetric::MovingImageDerivativeScalesType
FixedArray< double, Self::MovingImageDimension > MovingImageDerivativeScalesType
Definition itkAdvancedImageToImageMetric.h:139
itk::AdvancedImageToImageMetric::FixedImagePixelType
typename FixedImageType::PixelType FixedImagePixelType
Definition itkAdvancedImageToImageMetric.h:137
itk::AdvancedImageToImageMetric::DerivativeValueType
typename DerivativeType::ValueType DerivativeValueType
Definition itkAdvancedImageToImageMetric.h:133
itk::AdvancedImageToImageMetric::FixedImageIndexValueType
typename FixedImageIndexType::IndexValueType FixedImageIndexValueType
Definition itkAdvancedImageToImageMetric.h:335
itk::AdvancedImageToImageMetric::MovingImageIndexType
typename MovingImageType::IndexType MovingImageIndexType
Definition itkAdvancedImageToImageMetric.h:336
itk::AdvancedImageToImageMetric::ImageSampleContainerType
typename ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
Definition itkAdvancedImageToImageMetric.h:144
itk::AdvancedImageToImageMetric::FixedImageMaskType
ImageMaskSpatialObject< Self::FixedImageDimension > FixedImageMaskType
Definition itkAdvancedImageToImageMetric.h:124
itk::AdvancedImageToImageMetric::FixedImageIndexType
typename FixedImageType::IndexType FixedImageIndexType
Definition itkAdvancedImageToImageMetric.h:334
itk::AdvancedImageToImageMetric::MovingImageMaskPointer
SmartPointer< MovingImageMaskType > MovingImageMaskPointer
Definition itkAdvancedImageToImageMetric.h:128
itk::AdvancedImageToImageMetric::FixedImageLimiterType
LimiterFunctionBase< RealType, FixedImageDimension > FixedImageLimiterType
Definition itkAdvancedImageToImageMetric.h:148
itk::AdvancedImageToImageMetric::AdvancedImageToImageMetric
AdvancedImageToImageMetric()
itk::AdvancedImageToImageMetric::ImageSamplerType
ImageSamplerBase< FixedImageType > ImageSamplerType
Definition itkAdvancedImageToImageMetric.h:142
itk::AdvancedImageToImageMetric::ThreadInfoType
MultiThreaderBase::WorkUnitInfo ThreadInfoType
Definition itkAdvancedImageToImageMetric.h:170
itk::AdvancedImageToImageMetric::MovingImageDerivativeType
typename BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
Definition itkAdvancedImageToImageMetric.h:353
itk::AdvancedImageToImageMetric::MovingImageLimiterType
LimiterFunctionBase< RealType, MovingImageDimension > MovingImageLimiterType
Definition itkAdvancedImageToImageMetric.h:151
itk::AdvancedImageToImageMetric::MovingImageLimiterOutputType
typename MovingImageLimiterType::OutputType MovingImageLimiterOutputType
Definition itkAdvancedImageToImageMetric.h:153
itk::AdvancedImageToImageMetric::FixedImagePointType
typename TransformType::InputPointType FixedImagePointType
Definition itkAdvancedImageToImageMetric.h:337
itk::AdvancedImageToImageMetric::FixedImageLimiterOutputType
typename FixedImageLimiterType::OutputType FixedImageLimiterOutputType
Definition itkAdvancedImageToImageMetric.h:150
itk::AdvancedImageToImageMetric::FixedImageMaskPointer
SmartPointer< FixedImageMaskType > FixedImageMaskPointer
Definition itkAdvancedImageToImageMetric.h:125
itk::AdvancedImageToImageMetric::BSplineInterpolatorType
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
Definition itkAdvancedImageToImageMetric.h:342
itk::AdvancedImageToImageMetric::ImageSamplerPointer
typename ImageSamplerType::Pointer ImageSamplerPointer
Definition itkAdvancedImageToImageMetric.h:143
itk::AdvancedImageToImageMetric::MovingImageContinuousIndexType
typename InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
Definition itkAdvancedImageToImageMetric.h:339
itk::AdvancedImageToImageMetric::NumberOfParametersType
typename AdvancedTransformType::NumberOfParametersType NumberOfParametersType
Definition itkAdvancedImageToImageMetric.h:158
itk::AdvancedImageToImageMetric::MovingImageMaskType
ImageMaskSpatialObject< Self::MovingImageDimension > MovingImageMaskType
Definition itkAdvancedImageToImageMetric.h:127
itk::AdvancedKappaStatisticImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::m_UseForegroundValue
bool m_UseForegroundValue
Definition itkAdvancedKappaStatisticImageToImageMetric.h:224
itk::AdvancedKappaStatisticImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::NonZeroJacobianIndicesType
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
itk::AdvancedKappaStatisticImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::m_ForegroundValue
RealType m_ForegroundValue
Definition itkAdvancedKappaStatisticImageToImageMetric.h:225
itk::AdvancedKappaStatisticImageToImageMetric::itkPadStruct
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, KappaGetValueAndDerivativePerThreadStruct, PaddedKappaGetValueAndDerivativePerThreadStruct)
itk::AdvancedKappaStatisticImageToImageMetric::itkStaticConstMacro
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
itk::AdvancedKappaStatisticImageToImageMetric::DerivativeValueType
typename DerivativeType::ValueType DerivativeValueType
Definition itkAdvancedImageToImageMetric.h:133
itk::AdvancedKappaStatisticImageToImageMetric::AfterThreadedGetValueAndDerivative
void AfterThreadedGetValueAndDerivative(MeasureType &value, DerivativeType &derivative) const override
itk::AdvancedKappaStatisticImageToImageMetric::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
itk::AdvancedKappaStatisticImageToImageMetric::AccumulateDerivativesThreaderCallback
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION AccumulateDerivativesThreaderCallback(void *arg)
itk::AdvancedKappaStatisticImageToImageMetric::ThreadedGetValueAndDerivative
void ThreadedGetValueAndDerivative(ThreadIdType threadID) const override
itk::AdvancedKappaStatisticImageToImageMetric::ITK_DISALLOW_COPY_AND_MOVE
ITK_DISALLOW_COPY_AND_MOVE(AdvancedKappaStatisticImageToImageMetric)
itk::AdvancedKappaStatisticImageToImageMetric::ComputeGradient
void ComputeGradient() override
itk::AdvancedKappaStatisticImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::ConstPointer
SmartPointer< const Self > ConstPointer
Definition itkAdvancedKappaStatisticImageToImageMetric.h:67
itk::AdvancedKappaStatisticImageToImageMetric::AdvancedKappaStatisticImageToImageMetric
AdvancedKappaStatisticImageToImageMetric()
itk::AdvancedKappaStatisticImageToImageMetric::GetDerivative
void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const override
itk::AdvancedKappaStatisticImageToImageMetric::UpdateValueAndDerivativeTerms
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
itk::AdvancedKappaStatisticImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::Self
AdvancedKappaStatisticImageToImageMetric Self
Definition itkAdvancedKappaStatisticImageToImageMetric.h:64
itk::AdvancedKappaStatisticImageToImageMetric::itkStaticConstMacro
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
itk::AdvancedKappaStatisticImageToImageMetric::GetValueAndDerivativeSingleThreaded
virtual void GetValueAndDerivativeSingleThreaded(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const
itk::AdvancedKappaStatisticImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::m_Epsilon
RealType m_Epsilon
Definition itkAdvancedKappaStatisticImageToImageMetric.h:226
itk::AdvancedKappaStatisticImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::Superclass
AdvancedImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType > Superclass
Definition itkAdvancedKappaStatisticImageToImageMetric.h:65
itk::AdvancedKappaStatisticImageToImageMetric::InitializeThreadingParameters
void InitializeThreadingParameters() const override
itk::AdvancedKappaStatisticImageToImageMetric::GetValueAndDerivative
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const override
itk::AdvancedKappaStatisticImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::m_Complement
bool m_Complement
Definition itkAdvancedKappaStatisticImageToImageMetric.h:227
itk::AdvancedKappaStatisticImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::Pointer
SmartPointer< Self > Pointer
Definition itkAdvancedKappaStatisticImageToImageMetric.h:66
itk::AdvancedKappaStatisticImageToImageMetric::~AdvancedKappaStatisticImageToImageMetric
~AdvancedKappaStatisticImageToImageMetric() override=default
itk::AdvancedKappaStatisticImageToImageMetric::itkAlignedTypedef
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedKappaGetValueAndDerivativePerThreadStruct, AlignedKappaGetValueAndDerivativePerThreadStruct)
itk::AdvancedKappaStatisticImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::m_KappaGetValueAndDerivativePerThreadVariables
std::vector< AlignedKappaGetValueAndDerivativePerThreadStruct > m_KappaGetValueAndDerivativePerThreadVariables
Definition itkAdvancedKappaStatisticImageToImageMetric.h:258
itk::AdvancedKappaStatisticImageToImageMetric::GetValue
MeasureType GetValue(const TransformParametersType &parameters) const override
itkAdvancedImageToImageMetric.h
itk
Definition itkAdvancedImageToImageMetric.h:43
itk::AdvancedKappaStatisticImageToImageMetric::KappaGetValueAndDerivativePerThreadStruct
Definition itkAdvancedKappaStatisticImageToImageMetric.h:244
itk::AdvancedKappaStatisticImageToImageMetric::KappaGetValueAndDerivativePerThreadStruct::st_NumberOfPixelsCounted
SizeValueType st_NumberOfPixelsCounted
Definition itkAdvancedKappaStatisticImageToImageMetric.h:245
itk::AdvancedKappaStatisticImageToImageMetric::KappaGetValueAndDerivativePerThreadStruct::st_DerivativeSum1
DerivativeType st_DerivativeSum1
Definition itkAdvancedKappaStatisticImageToImageMetric.h:248
itk::AdvancedKappaStatisticImageToImageMetric::KappaGetValueAndDerivativePerThreadStruct::st_AreaIntersection
SizeValueType st_AreaIntersection
Definition itkAdvancedKappaStatisticImageToImageMetric.h:247
itk::AdvancedKappaStatisticImageToImageMetric::KappaGetValueAndDerivativePerThreadStruct::st_AreaSum
SizeValueType st_AreaSum
Definition itkAdvancedKappaStatisticImageToImageMetric.h:246
itk::AdvancedKappaStatisticImageToImageMetric::KappaGetValueAndDerivativePerThreadStruct::st_DerivativeSum2
DerivativeType st_DerivativeSum2
Definition itkAdvancedKappaStatisticImageToImageMetric.h:249
itk::AdvancedKappaStatisticImageToImageMetric::MultiThreaderAccumulateDerivativeType
Definition itkAdvancedKappaStatisticImageToImageMetric.h:235
itk::AdvancedKappaStatisticImageToImageMetric::MultiThreaderAccumulateDerivativeType::st_Metric
AdvancedKappaStatisticImageToImageMetric * st_Metric
Definition itkAdvancedKappaStatisticImageToImageMetric.h:236
itk::AdvancedKappaStatisticImageToImageMetric::MultiThreaderAccumulateDerivativeType::st_Coefficient1
MeasureType st_Coefficient1
Definition itkAdvancedKappaStatisticImageToImageMetric.h:238
itk::AdvancedKappaStatisticImageToImageMetric::MultiThreaderAccumulateDerivativeType::st_Coefficient2
MeasureType st_Coefficient2
Definition itkAdvancedKappaStatisticImageToImageMetric.h:239
itk::AdvancedKappaStatisticImageToImageMetric::MultiThreaderAccumulateDerivativeType::st_DerivativePointer
DerivativeValueType * st_DerivativePointer
Definition itkAdvancedKappaStatisticImageToImageMetric.h:240

Generated on 1768596610 for elastix by 1.15.0 |