freDifferenceHistogramMetricControllerBase.txx

Go to the documentation of this file.
00001 /*=========================================================================
00002  
00003   Program:   F.R.E.E. - flexible registration evaluation engine
00004   Version:   v.1.0.0
00005   Date:      $Date: 2006/09/01 12:00:00 $
00006   Module:    $RCSfile: freDifferenceHistogramMetricControllerBase.txx,v $
00007   Language:  C++
00008  
00009  
00010  
00011   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00012   Institute for Medical Biometry and Informatics, University of Heidelberg,
00013   Germany). All rights reserved.
00014   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00015   for details.
00016  
00017      This software is distributed WITHOUT ANY WARRANTY; without even 
00018      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00019      PURPOSE.  See the above copyright notices for more information.
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     //Profile settings
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   //Parameters
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 } //end of namespace free
00122 
00123 #endif

Generated at Sat Oct 13 15:47:30 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000