Image Component Library (ICL)
CLImage2D.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 : ICLUtils/src/ICLUtils/CLImage2D.h **
10  ** Module : ICLUtils **
11  ** Authors: Viktor Losing **
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.GPL **
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 #ifdef ICL_HAVE_OPENCL
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLUtils/CLException.h>
35 #include <ICLUtils/Rect.h>
36 #include <ICLUtils/CLMemory.h>
37 #include <string>
38 
39 #include <set>
40 #include <map>
41 #include <stdint.h>
42 
44 namespace cl {
45  class Image2D;
46  class Context;
47  class CommandQueue;
48 }
51 namespace icl {
52  namespace utils {
53 
55 
57  class ICLUtils_API CLImage2D : public CLMemory {
58  struct Impl;
59  Impl *impl;
60 
62  CLImage2D(cl::Context& context, cl::CommandQueue &cmdQueue,
63  const string &accessMode, const size_t width, const size_t height,
64  int depth, int num_channel, const void *src=NULL, std::map< uint32_t, std::set<uint32_t> > const
65  &supported_formats = std::map< uint32_t, std::set<uint32_t> >()) ;
66 
68  cl::Image2D getImage2D();
69  const cl::Image2D getImage2D() const;
70 
71  public:
72 
73  friend class CLProgram;
74  friend class CLKernel;
75  friend class CLDeviceContext;
76 
78  CLImage2D();
79 
81  CLImage2D(const CLImage2D& other);
82 
84  CLImage2D& operator=(const CLImage2D& other);
85 
87  ~CLImage2D();
88 
90 
92  void read(void *dst, const utils::Rect &region=utils::Rect::null, bool block = true) ;
93 
95 
97  void write(const void *src,const utils::Rect &region=utils::Rect::null,
98  bool block = true) ;
99 
101  bool isNull() const {
102  return !impl;
103  }
104 
106  operator bool() const {
107  return impl;
108  }
109 
110  icl32s getWidth() const { return m_dimensions[0]; }
111  icl32s getHeight() const { return m_dimensions[1]; }
112  icl32s getChannelSize() const { return m_dimensions[0]*m_dimensions[1]; }
113  icl32s getNumChannels() const { return m_dimensions[2]; }
114 
115  };
116  }
117 }
118 #endif
icl32s getWidth() const
Definition: CLImage2D.h:110
icl32s getChannelSize() const
Definition: CLImage2D.h:112
undocument this line if you encounter any issues!
Definition: Any.h:37
icl32s getNumChannels() const
Definition: CLImage2D.h:113
Impl * impl
internal hidden implementation type
Definition: CLImage2D.h:58
Definition: CLDeviceContext.h:43
#define ICLUtils_API
this macros are important for creating dll's
Definition: CompatMacros.h:171
Wrapper for an OpenCL Kernel.
Definition: CLKernel.h:72
icl32s getHeight() const
Definition: CLImage2D.h:111
static const Rect null
null Rect is w=0, h=0, x=0, y=0
Definition: Rect.h:99
Ipp32s icl32s
32bit signed integer type for the ICL
Definition: BasicTypes.h:58
bool isNull() const
checks whether image is null
Definition: CLImage2D.h:101
depth
determines the pixel type of an image (8Bit-int or 32Bit-float)
Definition: Types.h:60
The CLDeviceContext class allows preparation of the device used for CLPrograms.
Definition: CLDeviceContext.h:61
Wrapper for an OpenCL Image2D.
Definition: CLImage2D.h:57
The CLMemory class is a base class for CLBuffer and CLImage2D.
Definition: CLMemory.h:48
Rectangle class of the ICL used e.g. for the Images ROI-rect.
Definition: Rect.h:95
Main class for OpenCL based accelleration.
Definition: CLProgram.h:259