00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef __itkHistogramImageToImageMetric_h
00018
#define __itkHistogramImageToImageMetric_h
00019
00020
#include "itkHistogram.h"
00021
#include "itkImageToImageMetric.h"
00022
00023
namespace itk
00024 {
00035
template <
class TFixedImage,
class TMovingImage>
00036 class ITK_EXPORT HistogramImageToImageMetric :
00037
public ImageToImageMetric<TFixedImage, TMovingImage>
00038 {
00039
public:
00041 typedef HistogramImageToImageMetric
Self;
00042 typedef ImageToImageMetric<TFixedImage, TMovingImage> Superclass;
00043 typedef SmartPointer<Self> Pointer;
00044 typedef SmartPointer<const Self> ConstPointer;
00045
00047
itkNewMacro(
Self);
00048
00050
itkTypeMacro(HistogramImageToImageMetric,
ImageToImageMetric);
00051
00053 typedef typename Superclass::RealType
RealType;
00054 typedef typename Superclass::TransformType
TransformType;
00055 typedef typename Superclass::TransformPointer
TransformPointer;
00056
typedef typename Superclass::TransformParametersType
00057 TransformParametersType;
00058
typedef typename Superclass::TransformJacobianType
00059 TransformJacobianType;
00060 typedef typename Superclass::GradientPixelType
GradientPixelType;
00061 typedef typename Superclass::InputPointType
InputPointType;
00062 typedef typename Superclass::OutputPointType
OutputPointType;
00063 typedef typename Superclass::MeasureType
MeasureType;
00064 typedef typename Superclass::DerivativeType
DerivativeType;
00065 typedef typename Superclass::FixedImageType
FixedImageType;
00066 typedef typename Superclass::FixedImageType::PixelType
FixedImagePixelType;
00067 typedef typename Superclass::MovingImageType
MovingImageType;
00068 typedef typename Superclass::MovingImageType::PixelType
MovingImagePixelType;
00069
typedef typename Superclass::FixedImageConstPointer
00070 FixedImageConstPointerType;
00071
typedef typename Superclass::MovingImageConstPointer
00072 MovingImageConstPointerType;
00073
00076 typedef Statistics::Histogram<double, 2> HistogramType;
00077 typedef typename HistogramType::MeasurementVectorType
MeasurementVectorType;
00078 typedef typename HistogramType::SizeType
HistogramSizeType;
00079
00081
void Initialize() throw (ExceptionObject);
00082
00085 inline
void SetHistogramSize(const
HistogramSizeType & size)
00086 {
00087 m_HistogramSize = size;
00088 }
00089
00091 inline const HistogramSizeType & GetHistogramSize()
const
00092
{
00093
return m_HistogramSize;
00094 }
00095
00097 inline void SetPaddingValue(
FixedImagePixelType const padding)
00098 {
00099 m_PaddingValue = padding;
00100 }
00101
00103 inline FixedImagePixelType GetPaddingValue()
const
00104
{
00105
return m_PaddingValue;
00106 }
00107
00111 inline void UsePaddingValue(
bool use =
true)
00112 {
00113 m_UsePaddingValue = use;
00114 }
00115
00117 inline void SetDerivativeStepLength(
double length)
00118 {
00119 m_DerivativeStepLength = length;
00120 }
00121
00123 inline double GetDerivativeStepLength()
00124 {
00125
return m_DerivativeStepLength;
00126 }
00127
00129 typedef Array<double> ScalesType;
00130
00132 inline void SetDerivativeStepLengthScales(
ScalesType const& scales)
00133 {
00134 m_DerivativeStepLengthScales = scales;
00135 }
00136
00138
itkGetConstReferenceMacro(DerivativeStepLengthScales, ScalesType);
00139
00141 MeasureType GetValue(
const TransformParametersType& parameters)
const;
00142
00144
void GetDerivative(
const TransformParametersType & parameters,
00145 DerivativeType & derivative)
const;
00146
00148
void GetValueAndDerivative(
const TransformParametersType & parameters,
00149 MeasureType& Value,
00150 DerivativeType& Derivative)
const;
00151
00152
protected:
00155 HistogramImageToImageMetric();
00156 virtual ~HistogramImageToImageMetric() {};
00157
00159 HistogramSizeType m_HistogramSize;
00161
mutable MeasurementVectorType m_LowerBound;
00163 mutable MeasurementVectorType m_UpperBound;
00164
00167
void ComputeHistogram(
const TransformParametersType & parameters,
00168
HistogramType& histogram)
const;
00171
void ComputeHistogram(
const TransformParametersType & parameters,
00172
unsigned int parameter,
00173
double step,
00174
HistogramType& histogram)
const;
00178
void CopyHistogram(
HistogramType& target,
HistogramType& source)
const;
00179
00182
virtual MeasureType EvaluateMeasure(
HistogramType& histogram)
const = 0;
00183
00185
void PrintSelf(std::ostream& os,
Indent indent)
const;
00186
00187
private:
00188 HistogramImageToImageMetric(
const Self&);
00189
void operator=(
const Self&);
00190
00192
FixedImagePixelType m_PaddingValue;
00193
00197
bool m_UsePaddingValue;
00198
00200
double m_DerivativeStepLength;
00201
00203
ScalesType m_DerivativeStepLengthScales;
00204 };
00205
00206 }
00207
00208
#ifndef ITK_MANUAL_INSTANTIATION
00209
#include "itkHistogramImageToImageMetric.txx"
00210
#endif
00211
00212
#endif // __itkHistogramImageToImageMetric_h