ITK  4.2.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;
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  itkGetObjectMacro( DistanceMetric, DistanceMetricType );
113  itkGetConstObjectMacro( DistanceMetric, DistanceMetricType );
114 
115  itkSetMacro(NumClasses,unsigned int);
116  itkGetConstReferenceMacro(NumClasses,unsigned int);
117 
118  void SetRBF(RBFType* f);
119  itkGetObjectMacro(RBF, RBFType);
120  itkGetConstObjectMacro(RBF, RBFType);
121 
122 protected:
123 
124  RBFLayer();
125  virtual ~RBFLayer();
126 
128  virtual void PrintSelf( std::ostream& os, Indent indent ) const;
129 
130 private:
131 
136 
138 
139  std::vector<InternalVectorType> m_Centers; // ui....uc
141  unsigned int m_NumClasses;
143  unsigned int m_RBF_Dim;
145 };
146 
147 } // end namespace Statistics
148 } // end namespace itk
149 
150 #ifndef ITK_MANUAL_INSTANTIATION
151 #include "itkRBFLayer.hxx"
152 #endif
153 
154 #endif
155