Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkRBFLayer.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003 Program:   Insight Segmentation & Registration Toolkit
00004 Module:    $RCSfile: itkRBFLayer.h,v $
00005 Language:  C++
00006 Date:      $Date: 2007/08/17 13:10:57 $
00007 Version:   $Revision: 1.10 $
00008 
00009 Copyright (c) Insight Software Consortium. All rights reserved.
00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012 This software is distributed WITHOUT ANY WARRANTY; without even
00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00014 PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkRBFLayerBase_h
00018 #define __itkRBFLayerBase_h
00019 
00020 #include "itkCompletelyConnectedWeightSet.h"
00021 #include "itkLayerBase.h"
00022 #include "itkObject.h"
00023 #include "itkMacro.h"
00024 #include "itkRadialBasisFunctionBase.h"
00025 #include "itkEuclideanDistance.h"
00026 
00027 namespace itk
00028 {
00029   namespace Statistics
00030     {
00031     template<class TMeasurementVector, class TTargetVector>
00032       class RBFLayer : public LayerBase<TMeasurementVector, TTargetVector>
00033         {
00034       public:
00035         typedef RBFLayer Self;
00036         typedef LayerBase<TMeasurementVector, TTargetVector> Superclass;
00037         typedef SmartPointer<Self> Pointer;
00038         typedef SmartPointer<const Self> ConstPointer;
00039 
00041         itkTypeMacro(RBFLayer, LayerBase);
00042         itkNewMacro(Self);
00044 
00045         typedef typename Superclass::ValueType ValueType;typedef typename Superclass::ValuePointer ValuePointer;
00046         typedef vnl_vector<ValueType> NodeVectorType;
00047         typedef typename Superclass::InternalVectorType InternalVectorType;
00048         typedef typename Superclass::OutputVectorType OutputVectorType;
00049         typedef typename Superclass::LayerInterfaceType LayerInterfaceType;
00050         typedef CompletelyConnectedWeightSet<TMeasurementVector,TTargetVector> WeightSetType;
00051 
00052         typedef typename Superclass::WeightSetInterfaceType WeightSetInterfaceType;
00053         typedef typename Superclass::InputFunctionInterfaceType InputFunctionInterfaceType;
00054         typedef typename Superclass::TransferFunctionInterfaceType TransferFunctionInterfaceType;
00055         //Distance Metric
00056         typedef EuclideanDistance<InternalVectorType> DistanceMetricType;
00057         typedef typename DistanceMetricType::Pointer DistanceMetricPointer;
00058         typedef RadialBasisFunctionBase<ValueType> RBFType;
00059 
00060         //Member Functions
00061         itkGetConstReferenceMacro(RBF_Dim, unsigned int);
00062         void SetRBF_Dim(unsigned int size);
00063         virtual void SetNumberOfNodes(unsigned int numNodes);
00064         virtual ValueType GetInputValue(unsigned int i) const;
00065         void SetInputValue(unsigned int i, ValueType value);
00066 
00067         virtual ValueType GetOutputValue(unsigned int) const;
00068         virtual void SetOutputValue(unsigned int, ValueType);
00069 
00070         virtual ValueType * GetOutputVector();
00071         void SetOutputVector(TMeasurementVector value);
00072 
00073         virtual void ForwardPropagate();
00074         virtual void ForwardPropagate(TMeasurementVector input);
00075 
00076         virtual void BackwardPropagate();
00077         virtual void BackwardPropagate(TTargetVector itkNotUsed(errors)){};
00078 
00079         virtual void SetOutputErrorValues(TTargetVector);
00080         virtual ValueType GetOutputErrorValue(unsigned int node_id) const;
00081 
00082         virtual ValueType GetInputErrorValue(unsigned int node_id) const;
00083         virtual ValueType * GetInputErrorVector();
00084         virtual void SetInputErrorValue(ValueType, unsigned int node_id);
00085 
00086         //TMeasurementVector GetCenter(int i);
00087         InternalVectorType GetCenter(unsigned int i) const;
00088         void SetCenter(TMeasurementVector c,unsigned int i);
00089 
00090         ValueType GetRadii(unsigned int i) const;
00091         void SetRadii(ValueType c,unsigned int i);
00092 
00093         virtual ValueType Activation(ValueType);
00094         virtual ValueType DActivation(ValueType);
00095 
00097         itkSetMacro( Bias, ValueType );
00098         itkGetConstReferenceMacro( Bias, ValueType );
00100 
00101         void SetDistanceMetric(DistanceMetricType* f);
00102         itkGetObjectMacro( DistanceMetric, DistanceMetricType );
00103         itkGetConstObjectMacro( DistanceMetric, DistanceMetricType );
00104 
00105         itkSetMacro(NumClasses,unsigned int);
00106         itkGetConstReferenceMacro(NumClasses,unsigned int);
00107 
00108         void SetRBF(RBFType* f);
00109         itkGetObjectMacro(RBF, RBFType);
00110         itkGetConstObjectMacro(RBF, RBFType);
00111 
00112       protected:
00113 
00114         RBFLayer();
00115         virtual ~RBFLayer();
00116 
00118         virtual void PrintSelf( std::ostream& os, Indent indent ) const;
00119 
00120       private:
00121 
00122         NodeVectorType   m_NodeInputValues;
00123         NodeVectorType   m_NodeOutputValues;
00124         NodeVectorType   m_InputErrorValues;
00125         NodeVectorType   m_OutputErrorValues;
00126         typename DistanceMetricType::Pointer  m_DistanceMetric;
00127         //std::vector<TMeasurementVector>                  m_Centers;  // ui....uc
00128         std::vector<InternalVectorType>       m_Centers;  // ui....uc
00129         InternalVectorType                    m_Radii;
00130         unsigned int                          m_NumClasses;
00131         ValueType                             m_Bias;
00132         unsigned int                          m_RBF_Dim;
00133         typename RBFType::Pointer             m_RBF;
00134         };
00135 
00136     } // end namespace Statistics
00137 } // end namespace itk
00138 
00139 #ifndef ITK_MANUAL_INSTANTIATION
00140 #include "itkRBFLayer.txx"
00141 #endif
00142 
00143 #endif
00144 

Generated at Tue Jul 29 21:56:12 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000