Loading...
Searching...
No Matches
elxMetricBase.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 elxMetricBase_h
#define elxMetricBase_h
#include "elxMacro.h"
#include "elxBaseComponentSE.h"
#include "itkAdvancedImageToImageMetric.h"
#include "itkImageGridSampler.h"
#include "itkPointSet.h"
namespace elastix
{
template <class TElastix>
class ITK_TEMPLATE_EXPORT MetricBase : public BaseComponentSE<TElastix>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(MetricBase);
using Self = MetricBase;
using Superclass = BaseComponentSE<TElastix>;
itkTypeMacro(MetricBase, BaseComponentSE);
using typename Superclass::ElastixType;
using typename Superclass::RegistrationType;
using FixedImageType = typename ElastixType::FixedImageType;
using FixedPointType = typename FixedImageType::PointType;
using FixedPointValueType = typename FixedPointType::ValueType;
using MovingImageType = typename ElastixType::MovingImageType;
using MovingPointType = typename MovingImageType::PointType;
using MovingPointValueType = typename MovingPointType::ValueType;
using ITKBaseType = itk::SingleValuedCostFunction;
using AdvancedMetricType = itk::AdvancedImageToImageMetric<FixedImageType, MovingImageType>;
using MovingImageDerivativeScalesType = typename AdvancedMetricType::MovingImageDerivativeScalesType;
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension);
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension);
using CoordinateRepresentationType = typename ITKBaseType::ParametersValueType;
using FixedPointSetType = itk::PointSet<CoordinateRepresentationType,
FixedImageDimension,
itk::DefaultStaticMeshTraits<CoordinateRepresentationType,
FixedImageDimension,
FixedImageDimension,
CoordinateRepresentationType,
CoordinateRepresentationType,
CoordinateRepresentationType>>;
using MovingPointSetType = itk::PointSet<CoordinateRepresentationType,
MovingImageDimension,
itk::DefaultStaticMeshTraits<CoordinateRepresentationType,
MovingImageDimension,
MovingImageDimension,
CoordinateRepresentationType,
CoordinateRepresentationType,
CoordinateRepresentationType>>;
using ImageSamplerBaseType = typename AdvancedMetricType::ImageSamplerType;
using MeasureType = typename ITKBaseType::MeasureType;
ITKBaseType *
GetAsITKBaseType()
{
return &(this->GetSelf());
}
const ITKBaseType *
GetAsITKBaseType() const
{
return &(this->GetSelf());
}
void
BeforeEachResolutionBase() override;
void
AfterEachIterationBase() override;
virtual void
SelectNewSamples();
virtual bool
GetAdvancedMetricUseImageSampler() const;
virtual void
SetAdvancedMetricImageSampler(ImageSamplerBaseType * sampler);
virtual ImageSamplerBaseType *
GetAdvancedMetricImageSampler() const;
virtual bool
GetShowExactMetricValue() const
{
return this->m_ShowExactMetricValue;
}
virtual MeasureType
GetCurrentExactMetricValue() const
{
return this->m_CurrentExactMetricValue;
}
protected:
using ParametersType = typename ITKBaseType::ParametersType;
using ExactMetricImageSamplerType = itk::ImageGridSampler<FixedImageType>;
using ExactMetricImageSamplerPointer = typename ExactMetricImageSamplerType::Pointer;
using ExactMetricSampleGridSpacingType = typename ExactMetricImageSamplerType::SampleGridSpacingType;
MetricBase() = default;
~MetricBase() override = default;
virtual MeasureType
GetExactValue(const ParametersType & parameters);
bool m_ShowExactMetricValue{ false };
ExactMetricImageSamplerPointer m_ExactMetricSampler{ nullptr };
MeasureType m_CurrentExactMetricValue{ 0.0 };
ExactMetricSampleGridSpacingType m_ExactMetricSampleGridSpacing{ itk::MakeFilled<ExactMetricSampleGridSpacingType>(
1) };
unsigned int m_ExactMetricEachXNumberOfIterations{ 1 };
private:
elxDeclarePureVirtualGetSelfMacro(ITKBaseType);
};
} // end namespace elastix
#ifndef ITK_MANUAL_INSTANTIATION
# include "elxMetricBase.hxx"
#endif
#endif // end #ifndef elxMetricBase_h
elastix::BaseComponentSE::BaseComponentSE
BaseComponentSE()=default
elastix::BaseComponentSE::RegistrationType
typename ElastixType::RegistrationBaseType RegistrationType
Definition elxBaseComponentSE.h:62
elastix::BaseComponentSE::ElastixType
TElastix ElastixType
Definition elxBaseComponentSE.h:57
elastix::BaseComponentSE::GetSelf
virtual const itk::Object & GetSelf() const =0
elastix::MetricBase::GetShowExactMetricValue
virtual bool GetShowExactMetricValue() const
Definition elxMetricBase.h:188
elastix::MetricBase< Self >::m_ExactMetricSampleGridSpacing
ExactMetricSampleGridSpacingType m_ExactMetricSampleGridSpacing
Definition elxMetricBase.h:231
elastix::MetricBase< Self >::m_ShowExactMetricValue
bool m_ShowExactMetricValue
Definition elxMetricBase.h:228
elastix::MetricBase::itkStaticConstMacro
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
elastix::MetricBase::MovingPointSetType
itk::PointSet< CoordinateRepresentationType, MovingImageDimension, itk::DefaultStaticMeshTraits< CoordinateRepresentationType, MovingImageDimension, MovingImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > MovingPointSetType
Definition elxMetricBase.h:116
elastix::MetricBase< Self >::m_ExactMetricSampler
ExactMetricImageSamplerPointer m_ExactMetricSampler
Definition elxMetricBase.h:229
elastix::MetricBase::FixedPointType
typename FixedImageType::PointType FixedPointType
Definition elxMetricBase.h:90
elastix::MetricBase::FixedPointValueType
typename FixedPointType::ValueType FixedPointValueType
Definition elxMetricBase.h:91
elastix::MetricBase::AfterEachIterationBase
void AfterEachIterationBase() override
elastix::MetricBase::FixedPointSetType
itk::PointSet< CoordinateRepresentationType, FixedImageDimension, itk::DefaultStaticMeshTraits< CoordinateRepresentationType, FixedImageDimension, FixedImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > FixedPointSetType
Definition elxMetricBase.h:108
elastix::MetricBase::SelectNewSamples
virtual void SelectNewSamples()
elastix::MetricBase::MetricBase
MetricBase()=default
elastix::MetricBase::SetAdvancedMetricImageSampler
virtual void SetAdvancedMetricImageSampler(ImageSamplerBaseType *sampler)
elastix::MetricBase::GetAdvancedMetricUseImageSampler
virtual bool GetAdvancedMetricUseImageSampler() const
elastix::MetricBase< Self >::m_ExactMetricEachXNumberOfIterations
unsigned int m_ExactMetricEachXNumberOfIterations
Definition elxMetricBase.h:233
elastix::MetricBase::ITKBaseType
itk::SingleValuedCostFunction ITKBaseType
Definition elxMetricBase.h:97
elastix::MetricBase::ExactMetricSampleGridSpacingType
typename ExactMetricImageSamplerType::SampleGridSpacingType ExactMetricSampleGridSpacingType
Definition elxMetricBase.h:207
elastix::MetricBase::FixedImageType
typename ElastixType::FixedImageType FixedImageType
Definition elxMetricBase.h:89
elastix::MetricBase::ImageSamplerBaseType
typename AdvancedMetricType::ImageSamplerType ImageSamplerBaseType
Definition elxMetricBase.h:126
elastix::MetricBase::GetAdvancedMetricImageSampler
virtual ImageSamplerBaseType * GetAdvancedMetricImageSampler() const
elastix::MetricBase::GetAsITKBaseType
ITKBaseType * GetAsITKBaseType()
Definition elxMetricBase.h:133
elastix::MetricBase::~MetricBase
~MetricBase() override=default
elastix::MetricBase::GetExactValue
virtual MeasureType GetExactValue(const ParametersType &parameters)
elastix::MetricBase::ITK_DISALLOW_COPY_AND_MOVE
ITK_DISALLOW_COPY_AND_MOVE(MetricBase)
elastix::MetricBase::elxDeclarePureVirtualGetSelfMacro
elxDeclarePureVirtualGetSelfMacro(ITKBaseType)
elastix::MetricBase::GetCurrentExactMetricValue
virtual MeasureType GetCurrentExactMetricValue() const
Definition elxMetricBase.h:195
elastix::MetricBase::GetAsITKBaseType
const ITKBaseType * GetAsITKBaseType() const
Definition elxMetricBase.h:141
elastix::MetricBase::MovingImageType
typename ElastixType::MovingImageType MovingImageType
Definition elxMetricBase.h:92
elastix::MetricBase::BeforeEachResolutionBase
void BeforeEachResolutionBase() override
elastix::MetricBase::Superclass
BaseComponentSE< TElastix > Superclass
Definition elxMetricBase.h:79
elastix::MetricBase::Self
MetricBase Self
Definition elxMetricBase.h:78
elastix::MetricBase::MovingImageDerivativeScalesType
typename AdvancedMetricType::MovingImageDerivativeScalesType MovingImageDerivativeScalesType
Definition elxMetricBase.h:99
elastix::MetricBase< Self >::m_CurrentExactMetricValue
MeasureType m_CurrentExactMetricValue
Definition elxMetricBase.h:230
elastix::MetricBase::MovingPointType
typename MovingImageType::PointType MovingPointType
Definition elxMetricBase.h:93
elastix::MetricBase::CoordinateRepresentationType
typename ITKBaseType::ParametersValueType CoordinateRepresentationType
Definition elxMetricBase.h:107
elastix::MetricBase::itkStaticConstMacro
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
elastix::MetricBase::MovingPointValueType
typename MovingPointType::ValueType MovingPointValueType
Definition elxMetricBase.h:94
elastix::MetricBase::AdvancedMetricType
itk::AdvancedImageToImageMetric< FixedImageType, MovingImageType > AdvancedMetricType
Definition elxMetricBase.h:98
elastix::MetricBase::ParametersType
typename ITKBaseType::ParametersType ParametersType
Definition elxMetricBase.h:202
elastix::MetricBase::ExactMetricImageSamplerType
itk::ImageGridSampler< FixedImageType > ExactMetricImageSamplerType
Definition elxMetricBase.h:205
elastix::MetricBase::ExactMetricImageSamplerPointer
typename ExactMetricImageSamplerType::Pointer ExactMetricImageSamplerPointer
Definition elxMetricBase.h:206
elastix::MetricBase::MeasureType
typename ITKBaseType::MeasureType MeasureType
Definition elxMetricBase.h:129
itk::AdvancedImageToImageMetric
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics.
Definition itkAdvancedImageToImageMetric.h:83
itk::AdvancedImageToImageMetric< FixedImageType, MovingImageType >::MovingImageDerivativeScalesType
FixedArray< double, Self::MovingImageDimension > MovingImageDerivativeScalesType
Definition itkAdvancedImageToImageMetric.h:139
itk::AdvancedImageToImageMetric< FixedImageType, MovingImageType >::ImageSamplerType
ImageSamplerBase< FixedImageType > ImageSamplerType
Definition itkAdvancedImageToImageMetric.h:142
itk::ImageGridSampler
Samples image voxels on a regular grid.
Definition itkImageGridSampler.h:46
itk::ImageGridSampler< FixedImageType >::SampleGridSpacingType
typename InputImageType::OffsetType SampleGridSpacingType
Definition itkImageGridSampler.h:88
itk::ImageGridSampler< FixedImageType >::Pointer
SmartPointer< Self > Pointer
Definition itkImageGridSampler.h:53
elxBaseComponentSE.h
elxMacro.h
itkAdvancedImageToImageMetric.h
itkImageGridSampler.h
elastix
Definition elxDefaultConstruct.h:25

Generated on 1768596610 for elastix by 1.15.0 |