/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: itkCombinedImageToImageMetricAdaptor.h,v $ Language: C++ Date: $Date: 2003/09/10 14:30:08 $ Version: $Revision: 1.1 $ Copyright (c) Insight Software Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __itkCombinedImageToImageMetricAdaptor_h #define __itkCombinedImageToImageMetricAdaptor_h #include "itkImageToImageMetric.h" #include namespace itk { /** \class CombinedImageToImageMetricAdaptor * \brief This class is an adaptor that combines several * metric together to behave like one metric * * \ingroup Numerics Optimizers */ template < class TFixedImage, class TMovingImage> class ITK_EXPORT CombinedImageToImageMetricAdaptor: public ImageToImageMetric< TFixedImage, TMovingImage> { public: /** Standard class typedefs. */ typedef CombinedImageToImageMetricAdaptor Self; typedef ImageToImageMetric Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; /** Method for creation through the object factory. */ itkNewMacro(Self); /** Run-time type information (and related methods). */ itkTypeMacro( CombinedImageToImageMetricAdaptor, ImageToImageMetric ); /** Underlying metric type. */ typedef Superclass MetricType; typedef typename MetricType::Pointer MetricPointer; /** Scales typedef */ typedef Array ScalesType; /** Inherit typedef from superclass. */ typedef typename Superclass::ParametersType ParametersType; typedef typename Superclass::FixedImageType FixedImageType; typedef typename Superclass::MovingImageType MovingImageType; typedef typename Superclass::FixedImageMaskType FixedImageMaskType; typedef typename Superclass::MovingImageMaskType MovingImageMaskType; typedef typename Superclass::FixedImageRegionType FixedImageRegionType; typedef typename Superclass::TransformType TransformType; typedef typename Superclass::InterpolatorType InterpolatorType; typedef typename Superclass::MeasureType MeasureType; typedef typename Superclass::DerivativeType DerivativeType; /** Set the underlying metric */ virtual void SetMetric( unsigned long idx, MetricType * metric, double weight = 0.0 ); /** Get the underlying metric */ MetricType * GetMetric( unsigned long idx ); /** Set/Get metric weight */ virtual void SetMetricWeight( unsigned long idx, double weight ); double GetMetricWeight( unsigned long idx ); /** Delegate computation of the value to the underlying Metric. */ virtual void GetDerivative( const ParametersType & parameters, DerivativeType & derivative ) const; /** Delegate computation of the gradient to the costFunction. */ virtual void GetValueAndDerivative( const ParametersType & parameters, MeasureType & value, DerivativeType & derivative ) const; /** Delegate computation of the value to the costFunction. */ virtual MeasureType GetValue( const ParametersType & parameters ) const; /** Get the number of pixels considered in the computation. */ virtual const unsigned long & GetNumberOfPixelsCounted() const; /** Initialize the Metric by making sure that all the components * are present and plugged together correctly */ virtual void Initialize(void) throw ( ExceptionObject ); protected: CombinedImageToImageMetricAdaptor(); virtual ~CombinedImageToImageMetricAdaptor() {}; private: CombinedImageToImageMetricAdaptor(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented std::vector m_InternalMetrics; std::vector m_MetricWeights; }; // end of Class CostFunction } // end namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "itkCombinedImageToImageMetricAdaptor.txx" #endif #endif