Image Component Library (ICL)
LUT2D.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 : ICLFilter/src/ICLFilter/LUT2D.h **
10 ** Module : ICLFilter **
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 namespace icl{
34  namespace filter{
35 
37 
62  template<class RESULT_T=float,class IDX_T=int>
63  class LUT2D{
64  // RESULT_T *lutOrig;
65  RESULT_T *lut;
66  int minVal;
67  int range;
68 
69  public:
71  LUT2D(RESULT_T (*generator_func)(IDX_T v1, IDX_T v2),IDX_T minVal, IDX_T maxVal):
72  minVal(minVal),range(maxVal-minVal){
73 
74  lut = (new RESULT_T[range*range])-(range+1)*minVal;
75 
76  for(int i=minVal;i<maxVal;i++){
77  for(int j=minVal;j<maxVal;j++){
78  lut[i+range*j] = generator_func(i,j);
79  }
80  }
81  }
83  ~LUT2D(){
84  delete [] (lut + (range+1)*minVal);
85  }
87  inline RESULT_T operator()(IDX_T v1, IDX_T v2) const{
88  return lut[v1+range*v2];
89  }
90 
91  };
92  } // namespace filter
93 }
94 
undocument this line if you encounter any issues!
Definition: Any.h:37
int range
Definition: LUT2D.h:67
LUT2D(RESULT_T(*generator_func)(IDX_T v1, IDX_T v2), IDX_T minVal, IDX_T maxVal)
creating a new LUT2D object with given element creation function
Definition: LUT2D.h:71
int minVal
Definition: LUT2D.h:66
ICLQt_API core::Img< T > filter(const core::Img< T > &image, const std::string &filter)
applies a filter operation on the source image (affinity for float)
RESULT_T operator()(IDX_T v1, IDX_T v2) const
inline access in constant time of data element at (v1,v2)
Definition: LUT2D.h:87
Simple 2D indexed LUT Implementation.
Definition: LUT2D.h:63
~LUT2D()
destructor
Definition: LUT2D.h:83
RESULT_T * lut
Definition: LUT2D.h:65