Image Component Library (ICL)
SOM2D.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLMath/src/ICLMath/SOM2D.h **
10 ** Module : ICLMath **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLMath/SOM.h>
35 
36 namespace icl{
37  namespace math{
38 
40 
47  class SOM2D : public SOM{
48 
50  template<class T>
51  static inline std::vector<T> vec2(const T &t1, const T &t2){
52  std::vector<T> v(2);
53  v[0] = t1;
54  v[1] = t2;
55  return v;
56  }
59  public:
61 
68  SOM2D(unsigned int dataDim,
69  unsigned int nXCells,
70  unsigned int nYCells,
71  const std::vector<utils::Range<float> >& prototypeBounds,
72  float epsilon=0.1,
73  float sigma=1):SOM(dataDim,vec2(nXCells,nYCells),prototypeBounds,epsilon,sigma){}
74 
76 
79  const Neuron &getNeuron(int x, int y) const { return m_vecNeurons[x+m_vecDimOffsets[1]*y]; }
80 
81  };
82  } // namespace math
83 }
84 
undocument this line if you encounter any issues!
Definition: Any.h:37
Simple Wrapper class of the generic SOM Implementation for 2D SOMs.
Definition: SOM2D.h:47
std::vector< Neuron > m_vecNeurons
set of neurons
Definition: SOM.h:177
const Neuron & getNeuron(int x, int y) const
Wrapper function to access a neuron at a certain grid position.
Definition: SOM2D.h:79
Generic implementation of D to K dim Self Organizing Map (SOM)
Definition: SOM.h:70
SOM2D(unsigned int dataDim, unsigned int nXCells, unsigned int nYCells, const std::vector< utils::Range< float > > &prototypeBounds, float epsilon=0.1, float sigma=1)
Wrapper constructor for 2D SOMs.
Definition: SOM2D.h:68
std::vector< unsigned int > m_vecDimOffsets
internal utility offset vector for each dimension
Definition: SOM.h:180
SOM internal Neuron struct.
Definition: SOM.h:76