00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __freDifferenceHistogramMetricControllerBase_txx
00023 #define __freDifferenceHistogramMetricControllerBase_txx
00024
00025 #include "freDifferenceHistogramMetricControllerBase.h"
00026 #include "freExceptions.h"
00027
00028 namespace FREE
00029 {
00030
00031 template <class TMetric>
00032 const char* const DifferenceHistogramMetricControllerBase<TMetric> :: cParam_UseMask = "UseMask";
00033 template <class TMetric>
00034 const char* const DifferenceHistogramMetricControllerBase<TMetric> :: cParamDsc_UseMask = "Skip all pixels (of moving/fixed image) with values between masked minimum and maximum for the calculation of the metric measure.";
00035 template <class TMetric>
00036 const char* const DifferenceHistogramMetricControllerBase< TMetric > :: cParam_MaskedMinimum = "MaskedMinimum";
00037 template <class TMetric>
00038 const char* const DifferenceHistogramMetricControllerBase< TMetric > :: cParamDsc_MaskedMinimum = "";
00039 template <class TMetric>
00040 const char* const DifferenceHistogramMetricControllerBase< TMetric > :: cParam_MaskedMaximum = "MaskedMaximum";
00041 template <class TMetric>
00042 const char* const DifferenceHistogramMetricControllerBase< TMetric > :: cParamDsc_MaskedMaximum = "";
00043 template <class TMetric>
00044 const char* const DifferenceHistogramMetricControllerBase< TMetric > :: cParam_UpperBoundIncreaseFactor = "UpperBoundIncreaseFactor";
00045 template <class TMetric>
00046 const char* const DifferenceHistogramMetricControllerBase< TMetric > :: cParamDsc_UpperBoundIncreaseFactor = "Increase factor for the estimation of the upper of the histogram";
00047 template <class TMetric>
00048 const char* const DifferenceHistogramMetricControllerBase< TMetric > :: cParam_DerivativeStepLength = "DerivativeStepLength";
00049 template <class TMetric>
00050 const char* const DifferenceHistogramMetricControllerBase< TMetric > :: cParamDsc_DerivativeStepLength = "Step length for the calculation/estimation of the parameter derivates.";
00051 template <class TMetric>
00052 const char* const DifferenceHistogramMetricControllerBase< TMetric > :: cParam_HistogramSize = "HistogramSize";
00053 template <class TMetric>
00054 const char* const DifferenceHistogramMetricControllerBase< TMetric > :: cParamDsc_HistogramSize = "Size of the histogram; number of bins to use.";
00055
00056 template <class TMetric>
00057 DifferenceHistogramMetricControllerBase< TMetric >::
00058 DifferenceHistogramMetricControllerBase()
00059 {
00060
00061 this->UpdateControllerID(ControllerID::DifferenceHistogramMetricControllerBase);
00062 this->m_Description = "Basic controller for difference histogram metrics.";
00063 };
00064
00065 template <class TMetric>
00066 void
00067 DifferenceHistogramMetricControllerBase< TMetric >::
00068 GenerateProfile(CtrlProfile::ControllerProfile& profile,
00069 const SessionComponentCache* pComponentCache,
00070 bool bRegardOldSetup) const
00071 {
00072 Superclass::GenerateProfile(profile,pComponentCache,bRegardOldSetup);
00073
00074
00075 profile.Parameters().AddParameter(cParam_HistogramSize,Parameter::PVTLong,cParamDsc_HistogramSize,1,"512");
00076 profile.Parameters().AddParameter(cParam_MaskedMinimum,Parameter::PVTDouble,cParamDsc_MaskedMinimum,1,"0.0");
00077 profile.Parameters().AddParameter(cParam_MaskedMaximum,Parameter::PVTDouble,cParamDsc_MaskedMaximum,1,"0.0");
00078 profile.Parameters().AddParameter(cParam_UseMask,Parameter::PVTBool,cParamDsc_MaskedMaximum,1,"false");
00079 profile.Parameters().AddParameter(cParam_UpperBoundIncreaseFactor,Parameter::PVTDouble,cParamDsc_UpperBoundIncreaseFactor,1,"0.001");
00080 profile.Parameters().AddParameter(cParam_DerivativeStepLength,Parameter::PVTDouble,cParamDsc_DerivativeStepLength,1,"0.1");
00081 };
00082
00083 template <class TMetric>
00084 void
00085 DifferenceHistogramMetricControllerBase< TMetric >::
00086 ActualizeMainComponent(ComponentType* pMainComponent,
00087 SessionComponentCache* pComponentCache,
00088 SessionInfo* pSessionInfo,
00089 const unsigned int& iActLevel) const
00090 {
00091 long lHistogramSize;
00092 double dMaskedMinimum;
00093 double dMaskedMaximum;
00094 bool bUseMask;
00095 double dUpperBoundIncreaseFactor;
00096 double dDerivativeStepLength;
00097
00098 try
00099 {
00100 SessionAccessor::GetParameterValue(pComponentCache,cParam_HistogramSize,lHistogramSize,0,iActLevel,true);
00101 SessionAccessor::GetParameterValue(pComponentCache,cParam_UseMask,bUseMask,0,iActLevel,true);
00102 SessionAccessor::GetParameterValue(pComponentCache,cParam_UpperBoundIncreaseFactor,dUpperBoundIncreaseFactor,0,iActLevel,true);
00103 SessionAccessor::GetParameterValue(pComponentCache,cParam_DerivativeStepLength,dDerivativeStepLength,0,iActLevel,true);
00104 SessionAccessor::GetParameterValue(pComponentCache,cParam_MaskedMinimum,dMaskedMinimum,0,iActLevel,true);
00105 SessionAccessor::GetParameterValue(pComponentCache,cParam_MaskedMaximum,dMaskedMaximum,0,iActLevel,true);
00106 }
00107 catchAllNPassMacro("Error while retrieving parameter values.");
00108
00109 typename ComponentType::HistogramSizeType size;
00110 size.Fill(lHistogramSize);
00111
00112 pMainComponent->SetHistogramSize(size);
00113 pMainComponent->SetUseMask( bUseMask );
00114 pMainComponent->SetMaskedMinimum( dMaskedMinimum );
00115 pMainComponent->SetMaskedMaximum( dMaskedMaximum );
00116 pMainComponent->SetUpperBoundIncreaseFactor( dUpperBoundIncreaseFactor );
00117 pMainComponent->SetDerivativeStepLength( dDerivativeStepLength );
00118 };
00119
00120
00121 }
00122
00123 #endif