ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkRBFLayer.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkRBFLayer_h
19 #define __itkRBFLayer_h
20 
22 #include "itkLayerBase.h"
23 #include "itkObject.h"
24 #include "itkMacro.h"
27 
28 namespace itk
29 {
30 namespace Statistics
31 {
38 template<typename TMeasurementVector, typename TTargetVector>
39 class RBFLayer : public LayerBase<TMeasurementVector, TTargetVector>
40 {
41 public:
42  typedef RBFLayer Self;
46 
48  itkTypeMacro(RBFLayer, LayerBase);
49  itkNewMacro(Self);
51 
52  typedef typename Superclass::ValueType ValueType;
54  typedef vnl_vector<ValueType> NodeVectorType;
60 
64 
65  //Distance Metric
69 
70  //Member Functions
71  itkGetConstReferenceMacro(RBF_Dim, unsigned int);
72  void SetRBF_Dim(unsigned int size);
73  virtual void SetNumberOfNodes(unsigned int numNodes);
74  virtual ValueType GetInputValue(unsigned int i) const;
75  void SetInputValue(unsigned int i, ValueType value);
76 
77  virtual ValueType GetOutputValue(unsigned int) const;
78  virtual void SetOutputValue(unsigned int, ValueType);
79 
80  virtual ValueType * GetOutputVector();
81  void SetOutputVector(TMeasurementVector value);
82 
83  virtual void ForwardPropagate();
84  virtual void ForwardPropagate(TMeasurementVector input);
85 
86  virtual void BackwardPropagate();
87  virtual void BackwardPropagate(TTargetVector itkNotUsed(errors)){};
88 
89  virtual void SetOutputErrorValues(TTargetVector);
90  virtual ValueType GetOutputErrorValue(unsigned int node_id) const;
91 
92  virtual ValueType GetInputErrorValue(unsigned int node_id) const;
93  virtual ValueType * GetInputErrorVector();
94  virtual void SetInputErrorValue(ValueType, unsigned int node_id);
95 
96  //TMeasurementVector GetCenter(int i);
97  InternalVectorType GetCenter(unsigned int i) const;
98  void SetCenter(TMeasurementVector c,unsigned int i);
99 
100  ValueType GetRadii(unsigned int i) const;
101  void SetRadii(ValueType c,unsigned int i);
102 
103  virtual ValueType Activation(ValueType);
105 
107  itkSetMacro( Bias, ValueType );
108  itkGetConstReferenceMacro( Bias, ValueType );
110 
112  itkGetModifiableObjectMacro(DistanceMetric, DistanceMetricType );
113 
114  itkSetMacro(NumClasses,unsigned int);
115  itkGetConstReferenceMacro(NumClasses,unsigned int);
116 
117  void SetRBF(RBFType* f);
118  itkGetModifiableObjectMacro(RBF, RBFType);
119 
120 protected:
121 
122  RBFLayer();
123  virtual ~RBFLayer();
124 
126  virtual void PrintSelf( std::ostream& os, Indent indent ) const;
127 
128 private:
129 
134 
136 
137  std::vector<InternalVectorType> m_Centers; // ui....uc
139  unsigned int m_NumClasses;
141  unsigned int m_RBF_Dim;
143 };
144 
145 } // end namespace Statistics
146 } // end namespace itk
147 
148 #ifndef ITK_MANUAL_INSTANTIATION
149 #include "itkRBFLayer.hxx"
150 #endif
151 
152 #endif
virtual ValueType * GetOutputVector()
Array class with size defined at construction time.
Definition: itkArray.h:50
This is the itkLayerBase class.
Definition: itkLayerBase.h:38
vnl_vector< ValueType > NodeVectorType
Definition: itkRBFLayer.h:54
std::vector< InternalVectorType > m_Centers
Definition: itkRBFLayer.h:137
Light weight base class for most itk classes.
void SetInputValue(unsigned int i, ValueType value)
void SetRBF(RBFType *f)
SmartPointer< const Self > ConstPointer
Definition: itkRBFLayer.h:45
RBFType::Pointer m_RBF
Definition: itkRBFLayer.h:142
virtual ValueType GetOutputValue(unsigned int) const
This is the itkRBFLayer class.
Definition: itkRBFLayer.h:39
NodeVectorType m_InputErrorValues
Definition: itkRBFLayer.h:132
virtual void ForwardPropagate()
RadialBasisFunctionBase< ValueType > RBFType
Definition: itkRBFLayer.h:68
SmartPointer< Self > Pointer
Definition: itkRBFLayer.h:44
Superclass::InputFunctionInterfaceType InputFunctionInterfaceType
Definition: itkRBFLayer.h:62
virtual ValueType GetOutputErrorValue(unsigned int node_id) const
virtual void BackwardPropagate(TTargetVector)
Definition: itkRBFLayer.h:87
virtual void SetOutputValue(unsigned int, ValueType)
Superclass::TransferFunctionInterfaceType TransferFunctionInterfaceType
Definition: itkRBFLayer.h:63
virtual ValueType DActivation(ValueType)
EuclideanDistanceMetric< InternalVectorType > DistanceMetricType
Definition: itkRBFLayer.h:66
TTargetVector OutputVectorType
Definition: itkLayerBase.h:50
CompletelyConnectedWeightSet< TMeasurementVector, TTargetVector > WeightSetType
Definition: itkRBFLayer.h:59
NodeVectorType m_OutputErrorValues
Definition: itkRBFLayer.h:133
LayerBase< TMeasurementVector, TTargetVector > Superclass
Definition: itkRBFLayer.h:43
void SetRadii(ValueType c, unsigned int i)
TMeasurementVector::ValueType ValueType
Definition: itkLayerBase.h:52
void SetCenter(TMeasurementVector c, unsigned int i)
this class declares common interfaces for distance functions.
virtual void SetNumberOfNodes(unsigned int numNodes)
Superclass::LayerInterfaceType LayerInterfaceType
Definition: itkRBFLayer.h:57
Superclass::WeightSetInterfaceType WeightSetInterfaceType
Definition: itkRBFLayer.h:61
void SetOutputVector(TMeasurementVector value)
Superclass::ValueType ValueType
Definition: itkRBFLayer.h:49
virtual void PrintSelf(std::ostream &os, Indent indent) const
virtual ValueType * GetInputErrorVector()
InternalVectorType m_Radii
Definition: itkRBFLayer.h:138
virtual ValueType Activation(ValueType)
virtual void SetInputErrorValue(ValueType, unsigned int node_id)
DistanceMetricType::Pointer m_DistanceMetric
Definition: itkRBFLayer.h:135
virtual ValueType GetInputValue(unsigned int i) const
vnl_vector< ValueType > NodeVectorType
Definition: itkLayerBase.h:55
virtual void BackwardPropagate()
Superclass::OutputVectorType OutputVectorType
Definition: itkRBFLayer.h:56
NodeVectorType m_NodeOutputValues
Definition: itkRBFLayer.h:131
DistanceMetricType::Pointer DistanceMetricPointer
Definition: itkRBFLayer.h:67
virtual void SetOutputErrorValues(TTargetVector)
ValueType GetRadii(unsigned int i) const
NodeVectorType m_NodeInputValues
Definition: itkRBFLayer.h:130
This is the itkCompletelyConnectedWeightSet class.
InternalVectorType GetCenter(unsigned int i) const
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Array< ValueType > InternalVectorType
Definition: itkLayerBase.h:56
InputFunctionBase< ValueType *, ValueType > InputFunctionInterfaceType
Definition: itkLayerBase.h:61
WeightSetBase< TMeasurementVector, TTargetVector > WeightSetInterfaceType
Definition: itkLayerBase.h:60
void SetDistanceMetric(DistanceMetricType *f)
Superclass::ValuePointer ValuePointer
Definition: itkRBFLayer.h:53
void SetRBF_Dim(unsigned int size)
Superclass::InternalVectorType InternalVectorType
Definition: itkRBFLayer.h:55
TransferFunctionBase< ValueType > TransferFunctionInterfaceType
Definition: itkLayerBase.h:62
virtual ValueType GetInputErrorValue(unsigned int node_id) const
This is the itkRadialBasisFunctionBase class.