Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
GLImg.h
Go to the documentation of this file.
00001 /********************************************************************
00002 **                Image Component Library (ICL)                    **
00003 **                                                                 **
00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld          **
00005 **                         Neuroinformatics Group                  **
00006 ** Website: www.iclcv.org and                                      **
00007 **          http://opensource.cit-ec.de/projects/icl               **
00008 **                                                                 **
00009 ** File   : ICLQt/src/ICLQt/GLImg.h                                **
00010 ** Module : ICLQt                                                  **
00011 ** Authors: Christof Elbrechter                                    **
00012 **                                                                 **
00013 **                                                                 **
00014 ** GNU LESSER GENERAL PUBLIC LICENSE                               **
00015 ** This file may be used under the terms of the GNU Lesser General **
00016 ** Public License version 3.0 as published by the                  **
00017 **                                                                 **
00018 ** Free Software Foundation and appearing in the file LICENSE.GPL  **
00019 ** included in the packaging of this file.  Please review the      **
00020 ** following information to ensure the license requirements will   **
00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt                **
00022 **                                                                 **
00023 ** The development of this software was supported by the           **
00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology.    **
00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche       **
00026 ** Forschungsgemeinschaft (DFG) in the context of the German       **
00027 ** Excellence Initiative.                                          **
00028 **                                                                 **
00029 ********************************************************************/
00030 
00031 #pragma once
00032 
00033 #include <ICLCore/ImgBase.h>
00034 #include <ICLUtils/Uncopyable.h>
00035 #include <ICLMath/FixedVector.h>
00036 #include <ICLUtils/Function.h>
00037 #include <ICLUtils/Range.h>
00038 #include <ICLQt/ImageStatistics.h>
00039 
00040 namespace icl{
00041   namespace qt{
00043 
00080     class GLImg : public utils::Uncopyable{
00081       struct Data;  
00082       Data *m_data; 
00083       
00084       public:
00085       
00087 
00103       static void set_use_dirty_flag(bool useIt);
00104       
00106       static bool get_use_dirty_flag();
00107       
00109 
00114       GLImg(const core::ImgBase *src=0, core::scalemode sm=core::interpolateNN, int maxCellSize=4096);
00115       
00117       ~GLImg();
00118       
00120 
00121       void update(const core::ImgBase *src, int maxCellSize=4096);
00122       
00124       void setScaleMode(core::scalemode sm);
00125       
00127       bool isNull() const;
00128       
00130 
00131       void draw2D(const utils::Rect &r, const utils::Size &windowSize);
00132   
00134 
00135       void draw2D(const float a[2], const float b[2], const float c[2],const float e[2], const utils::Size &windowSize);
00136       
00138 
00151       void draw3D(const float a[3],const float b[3],const float c[3],const float d[3],
00152                   const float na[3]=0, const float nb[3]=0, const float nc[3]=0, const float nd[3]=0,
00153                   const utils::Point32f &texCoordsA=utils::Point32f(0,0),
00154                   const utils::Point32f &texCoordsB=utils::Point32f(1,0),
00155                   const utils::Point32f &texCoordsC=utils::Point32f(0,1),
00156                   const utils::Point32f &texCoordsD=utils::Point32f(1,1));     
00157   
00159 
00161       void draw3DGeneric(int numPoints,
00162                          const float *xs, const float *ys, const float *zs, int xyzStride,
00163                          const utils::Point32f *texCoords, const float *nxs=0, const float *nys=0,
00164                          const float *nzs=0, int nxyzStride=1);
00165   
00167       inline void draw3D(const float a[3],const float b[3],const float c[3]){
00168         const float d[3] = { b[0] + c[0] -a[0], b[1] + c[1] -a[1], b[2] + c[2] -a[2]  };
00169         draw3D(a,b,c,d);
00170       }
00171   
00172   
00174 
00203       void drawToGrid(int nx, int ny, const float *xs, const float *ys, const float *zs,
00204                       const float *nxs=0, const float *nys=0, const float *nzs=0,
00205                       const int stride = 1);
00206       
00208       typedef math::FixedColVector<float,3> Vec3;
00209       
00211       typedef utils::Function<Vec3,int,int> grid_function; 
00212       
00214 
00233       void drawToGrid(int nx, int ny, grid_function gridVertices, 
00234                       grid_function gridNormals = grid_function());
00235       
00236   
00238       static int getMaxTextureSize();
00239       
00241       utils::Size getCells() const;
00242       
00244       void bind(int xCell=0, int yCell=0);
00245   
00247       inline utils::Size getSize() const { return utils::Size(getWidth(), getHeight()); }
00248   
00250       int getWidth() const;
00251   
00253       int getHeight() const;
00254   
00256       int getChannels() const;
00257       
00259       core::depth getDepth() const;
00260       
00262       core::format getFormat() const;
00263       
00265       utils::Rect getROI() const;
00266   
00268       utils::Time getTime() const;
00269   
00271 
00272       void setBCI(int b=-1, int c=-1, int i=-1);
00273   
00275       std::vector<utils::Range64f> getMinMax() const;
00276       
00278       std::vector<icl64f> getColor(int x, int y)const;
00279   
00281 
00282       const core::ImgBase *extractImage() const;
00283   
00285       const ImageStatistics &getStats() const;
00286   
00288       void setDrawGrid(bool enabled, float *color=0);
00289   
00291       void setGridColor(float *color);
00292   
00294       const float *getGridColor() const;
00295       
00297       core::scalemode getScaleMode() const;
00298       
00300       void lock() const;
00301   
00303       void unlock() const;
00304   
00305       
00306     };
00307   } // namespace qt
00308 }
00309 
00310 
00311 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines