ITK  4.4.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<class TMeasurementVector, class 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
153