Loading...
Searching...
No Matches
itkAdvancedNormalizedCorrelationImageToImageMetric.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 itkAdvancedNormalizedCorrelationImageToImageMetric_h
#define itkAdvancedNormalizedCorrelationImageToImageMetric_h
#include "itkAdvancedImageToImageMetric.h"
#include <vector>
namespace itk
{
template <class TFixedImage, class TMovingImage>
class ITK_TEMPLATE_EXPORT AdvancedNormalizedCorrelationImageToImageMetric
: public AdvancedImageToImageMetric<TFixedImage, TMovingImage>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(AdvancedNormalizedCorrelationImageToImageMetric);
using Self = AdvancedNormalizedCorrelationImageToImageMetric;
using Superclass = AdvancedImageToImageMetric<TFixedImage, TMovingImage>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
itkNewMacro(Self);
itkTypeMacro(AdvancedNormalizedCorrelationImageToImageMetric, 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;
void
GetValueAndDerivativeSingleThreaded(const TransformParametersType & parameters,
MeasureType & value,
DerivativeType & derivative) const;
void
GetValueAndDerivative(const TransformParametersType & parameters,
MeasureType & value,
DerivativeType & derivative) const override;
protected:
AdvancedNormalizedCorrelationImageToImageMetric();
~AdvancedNormalizedCorrelationImageToImageMetric() override = default;
using Superclass::PrintSelf;
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
UpdateDerivativeTerms(const RealType fixedImageValue,
const RealType movingImageValue,
const DerivativeType & imageJacobian,
const NonZeroJacobianIndicesType & nzji,
DerivativeType & derivativeF,
DerivativeType & derivativeM,
DerivativeType & differential) 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:
using AccumulateType = typename NumericTraits<MeasureType>::AccumulateType;
struct MultiThreaderAccumulateDerivativeType
{
AdvancedNormalizedCorrelationImageToImageMetric * st_Metric;
AccumulateType st_sf_N;
AccumulateType st_sm_N;
AccumulateType st_sfm_smm;
RealType st_InvertedDenominator;
DerivativeValueType * st_DerivativePointer;
};
struct CorrelationGetValueAndDerivativePerThreadStruct
{
SizeValueType st_NumberOfPixelsCounted;
AccumulateType st_Sff;
AccumulateType st_Smm;
AccumulateType st_Sfm;
AccumulateType st_Sf;
AccumulateType st_Sm;
DerivativeType st_DerivativeF;
DerivativeType st_DerivativeM;
DerivativeType st_Differential;
};
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT,
CorrelationGetValueAndDerivativePerThreadStruct,
PaddedCorrelationGetValueAndDerivativePerThreadStruct);
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT,
PaddedCorrelationGetValueAndDerivativePerThreadStruct,
AlignedCorrelationGetValueAndDerivativePerThreadStruct);
mutable std::vector<AlignedCorrelationGetValueAndDerivativePerThreadStruct>
m_CorrelationGetValueAndDerivativePerThreadVariables;
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
# include "itkAdvancedNormalizedCorrelationImageToImageMetric.hxx"
#endif
#endif // end #ifndef itkAdvancedNormalizedCorrelationImageToImageMetric_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::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
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::AdvancedNormalizedCorrelationImageToImageMetric::UpdateDerivativeTerms
void UpdateDerivativeTerms(const RealType fixedImageValue, const RealType movingImageValue, const DerivativeType &imageJacobian, const NonZeroJacobianIndicesType &nzji, DerivativeType &derivativeF, DerivativeType &derivativeM, DerivativeType &differential) const
itk::AdvancedNormalizedCorrelationImageToImageMetric::AccumulateDerivativesThreaderCallback
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION AccumulateDerivativesThreaderCallback(void *arg)
itk::AdvancedNormalizedCorrelationImageToImageMetric::~AdvancedNormalizedCorrelationImageToImageMetric
~AdvancedNormalizedCorrelationImageToImageMetric() override=default
itk::AdvancedNormalizedCorrelationImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::ConstPointer
SmartPointer< const Self > ConstPointer
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:101
itk::AdvancedNormalizedCorrelationImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::NonZeroJacobianIndicesType
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
itk::AdvancedNormalizedCorrelationImageToImageMetric::AdvancedNormalizedCorrelationImageToImageMetric
AdvancedNormalizedCorrelationImageToImageMetric()
itk::AdvancedNormalizedCorrelationImageToImageMetric::itkAlignedTypedef
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedCorrelationGetValueAndDerivativePerThreadStruct, AlignedCorrelationGetValueAndDerivativePerThreadStruct)
itk::AdvancedNormalizedCorrelationImageToImageMetric::DerivativeValueType
typename DerivativeType::ValueType DerivativeValueType
Definition itkAdvancedImageToImageMetric.h:133
itk::AdvancedNormalizedCorrelationImageToImageMetric::itkStaticConstMacro
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
itk::AdvancedNormalizedCorrelationImageToImageMetric::GetValue
MeasureType GetValue(const TransformParametersType &parameters) const override
itk::AdvancedNormalizedCorrelationImageToImageMetric::GetDerivative
void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const override
itk::AdvancedNormalizedCorrelationImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::Pointer
SmartPointer< Self > Pointer
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:100
itk::AdvancedNormalizedCorrelationImageToImageMetric::itkStaticConstMacro
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
itk::AdvancedNormalizedCorrelationImageToImageMetric::itkPadStruct
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, CorrelationGetValueAndDerivativePerThreadStruct, PaddedCorrelationGetValueAndDerivativePerThreadStruct)
itk::AdvancedNormalizedCorrelationImageToImageMetric::ThreadedGetValueAndDerivative
void ThreadedGetValueAndDerivative(ThreadIdType threadID) const override
itk::AdvancedNormalizedCorrelationImageToImageMetric::GetValueAndDerivativeSingleThreaded
void GetValueAndDerivativeSingleThreaded(const TransformParametersType &parameters, MeasureType &value, DerivativeType &derivative) const
itk::AdvancedNormalizedCorrelationImageToImageMetric::GetValueAndDerivative
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &value, DerivativeType &derivative) const override
itk::AdvancedNormalizedCorrelationImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::Self
AdvancedNormalizedCorrelationImageToImageMetric Self
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:98
itk::AdvancedNormalizedCorrelationImageToImageMetric::InitializeThreadingParameters
void InitializeThreadingParameters() const override
itk::AdvancedNormalizedCorrelationImageToImageMetric::ITK_DISALLOW_COPY_AND_MOVE
ITK_DISALLOW_COPY_AND_MOVE(AdvancedNormalizedCorrelationImageToImageMetric)
itk::AdvancedNormalizedCorrelationImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::AccumulateType
typename NumericTraits< MeasureType >::AccumulateType AccumulateType
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:227
itk::AdvancedNormalizedCorrelationImageToImageMetric::AfterThreadedGetValueAndDerivative
void AfterThreadedGetValueAndDerivative(MeasureType &value, DerivativeType &derivative) const override
itk::AdvancedNormalizedCorrelationImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::Superclass
AdvancedImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType > Superclass
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:99
itk::AdvancedNormalizedCorrelationImageToImageMetric< typename MetricBase< TElastix >::FixedImageType, typename MetricBase< TElastix >::MovingImageType >::m_CorrelationGetValueAndDerivativePerThreadVariables
std::vector< AlignedCorrelationGetValueAndDerivativePerThreadStruct > m_CorrelationGetValueAndDerivativePerThreadVariables
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:262
itkAdvancedImageToImageMetric.h
itk
Definition itkAdvancedImageToImageMetric.h:43
itk::AdvancedNormalizedCorrelationImageToImageMetric::CorrelationGetValueAndDerivativePerThreadStruct
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:244
itk::AdvancedNormalizedCorrelationImageToImageMetric::CorrelationGetValueAndDerivativePerThreadStruct::st_Sfm
AccumulateType st_Sfm
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:248
itk::AdvancedNormalizedCorrelationImageToImageMetric::CorrelationGetValueAndDerivativePerThreadStruct::st_Sf
AccumulateType st_Sf
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:249
itk::AdvancedNormalizedCorrelationImageToImageMetric::CorrelationGetValueAndDerivativePerThreadStruct::st_DerivativeM
DerivativeType st_DerivativeM
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:252
itk::AdvancedNormalizedCorrelationImageToImageMetric::CorrelationGetValueAndDerivativePerThreadStruct::st_NumberOfPixelsCounted
SizeValueType st_NumberOfPixelsCounted
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:245
itk::AdvancedNormalizedCorrelationImageToImageMetric::CorrelationGetValueAndDerivativePerThreadStruct::st_DerivativeF
DerivativeType st_DerivativeF
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:251
itk::AdvancedNormalizedCorrelationImageToImageMetric::CorrelationGetValueAndDerivativePerThreadStruct::st_Smm
AccumulateType st_Smm
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:247
itk::AdvancedNormalizedCorrelationImageToImageMetric::CorrelationGetValueAndDerivativePerThreadStruct::st_Differential
DerivativeType st_Differential
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:253
itk::AdvancedNormalizedCorrelationImageToImageMetric::CorrelationGetValueAndDerivativePerThreadStruct::st_Sff
AccumulateType st_Sff
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:246
itk::AdvancedNormalizedCorrelationImageToImageMetric::CorrelationGetValueAndDerivativePerThreadStruct::st_Sm
AccumulateType st_Sm
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:250
itk::AdvancedNormalizedCorrelationImageToImageMetric::MultiThreaderAccumulateDerivativeType
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:233
itk::AdvancedNormalizedCorrelationImageToImageMetric::MultiThreaderAccumulateDerivativeType::st_Metric
AdvancedNormalizedCorrelationImageToImageMetric * st_Metric
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:234
itk::AdvancedNormalizedCorrelationImageToImageMetric::MultiThreaderAccumulateDerivativeType::st_sm_N
AccumulateType st_sm_N
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:237
itk::AdvancedNormalizedCorrelationImageToImageMetric::MultiThreaderAccumulateDerivativeType::st_DerivativePointer
DerivativeValueType * st_DerivativePointer
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:240
itk::AdvancedNormalizedCorrelationImageToImageMetric::MultiThreaderAccumulateDerivativeType::st_sf_N
AccumulateType st_sf_N
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:236
itk::AdvancedNormalizedCorrelationImageToImageMetric::MultiThreaderAccumulateDerivativeType::st_InvertedDenominator
RealType st_InvertedDenominator
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:239
itk::AdvancedNormalizedCorrelationImageToImageMetric::MultiThreaderAccumulateDerivativeType::st_sfm_smm
AccumulateType st_sfm_smm
Definition itkAdvancedNormalizedCorrelationImageToImageMetric.h:238

Generated on 1768596610 for elastix by 1.15.0 |