Image Component Library (ICL)
GLImg.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 : ICLQt/src/ICLQt/GLImg.h **
10 ** Module : ICLQt **
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 <ICLUtils/Uncopyable.h>
35 #include <ICLUtils/Function.h>
36 #include <ICLUtils/Range.h>
37 #include <ICLMath/FixedVector.h>
38 #include <ICLCore/ImgBase.h>
39 #include <ICLQt/ImageStatistics.h>
40 
41 namespace icl{
42  namespace qt{
44 
82  struct Data;
83  Data *m_data;
84 
85  public:
87 
92  GLImg(const core::ImgBase *src=0, core::scalemode sm=core::interpolateNN, int maxCellSize=4096);
93 
95  ~GLImg();
96 
98 
99  void update(const core::ImgBase *src, int maxCellSize=4096);
100 
102  void setScaleMode(core::scalemode sm);
103 
105  bool isNull() const;
106 
108 
109  void draw2D(const utils::Rect &r, const utils::Size &windowSize);
110 
112 
113  void draw2D(const float a[2], const float b[2], const float c[2],const float e[2], const utils::Size &windowSize);
114 
116 
129  void draw3D(const float a[3],const float b[3],const float c[3],const float d[3],
130  const float na[3]=0, const float nb[3]=0, const float nc[3]=0, const float nd[3]=0,
131  const utils::Point32f &texCoordsA=utils::Point32f(0,0),
132  const utils::Point32f &texCoordsB=utils::Point32f(1,0),
133  const utils::Point32f &texCoordsC=utils::Point32f(0,1),
134  const utils::Point32f &texCoordsD=utils::Point32f(1,1));
135 
137 
139  void draw3DGeneric(int numPoints,
140  const float *xs, const float *ys, const float *zs, int xyzStride,
141  const utils::Point32f *texCoords, const float *nxs=0, const float *nys=0,
142  const float *nzs=0, int nxyzStride=1, bool invertNormals=false);
143 
145  inline void draw3D(const float a[3],const float b[3],const float c[3]){
146  const float d[3] = { b[0] + c[0] -a[0], b[1] + c[1] -a[1], b[2] + c[2] -a[2] };
147  draw3D(a,b,c,d);
148  }
149 
150 
152 
180  void drawToGrid(int nx, int ny, const float *xs, const float *ys, const float *zs,
181  const float *nxs=0, const float *nys=0, const float *nzs=0,
182  const int stride = 1, bool invertNormals=false);
183 
186 
189 
191 
210  void drawToGrid(int nx, int ny, grid_function gridVertices,
211  grid_function gridNormals = grid_function());
212 
213 
215  static int getMaxTextureSize();
216 
218  utils::Size getCells() const;
219 
221  void bind(int xCell=0, int yCell=0, int textureUnit=0) const;
222 
224  inline utils::Size getSize() const { return utils::Size(getWidth(), getHeight()); }
225 
227  int getWidth() const;
228 
230  int getHeight() const;
231 
233  int getChannels() const;
234 
236  core::depth getDepth() const;
237 
239  core::format getFormat() const;
240 
242  utils::Rect getROI() const;
243 
245  utils::Time getTime() const;
246 
248 
249  void setBCI(int b=-1, int c=-1, int i=-1);
250 
252  std::vector<utils::Range64f> getMinMax() const;
253 
255  std::vector<icl64f> getColor(int x, int y)const;
256 
258 
259  const core::ImgBase *extractImage() const;
260 
262  const ImageStatistics &getStats() const;
263 
265  void setDrawGrid(bool enabled, float *color=0);
266 
268  void setGridColor(float *color);
269 
271  const float *getGridColor() const;
272 
274  core::scalemode getScaleMode() const;
275 
277  void lock() const;
278 
280  void unlock() const;
281 
282 
283  };
284  } // namespace qt
285 }
286 
287 
288 
The General Function Template.
Definition: Function.h:284
undocument this line if you encounter any issues!
Definition: Any.h:37
Class interface for un-copyable classes.
Definition: Uncopyable.h:64
ICL Time class (taken from the Ice lib)
Definition: Time.h:52
format
determines the color-format, that is associated with the images channels
Definition: Types.h:70
utils::Size getSize() const
returns the image size
Definition: GLImg.h:224
OpenGL Texture Map Image class.
Definition: GLImg.h:81
Size class of the ICL.
Definition: Size.h:61
depth getDepth()
getDepth<T> returns to depth enum associated to type T
Definition: ImageStatistics.h:42
scalemode
for scaling of Img images theses functions are provided
Definition: Types.h:84
depth
determines the pixel type of an image (8Bit-int or 32Bit-float)
Definition: Types.h:60
Single precission 3D Vectors Point class of the ICL.
Definition: Point32f.h:41
#define ICLQt_API
Definition: CompatMacros.h:178
utils::Function< Vec3, int, int > grid_function
a grid function returns a 3D pos from given 2D grid position
Definition: GLImg.h:188
ICLQt_API void color(float r, float g=-1, float b=-1, float alpha=255)
sets the current color to given r,g,b,alpha value
void draw3D(const float a[3], const float b[3], const float c[3])
draws the texture to given quad that is spanned by two vectors
Definition: GLImg.h:145
Definition: Types.h:85
Rectangle class of the ICL used e.g. for the Images ROI-rect.
Definition: Rect.h:95
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131
math::FixedColVector< float, 3 > Vec3
3D vector type
Definition: GLImg.h:185
Data * m_data
internal data structure
Definition: GLImg.h:82