IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
PythonImage.h
1 // PythonImage.h:
3 // --------------
4 //
14 
15 #ifndef __PYIPSDKBASE_PYTHONIMAGE_H__
16 #define __PYIPSDKBASE_PYTHONIMAGE_H__
17 
18 // suppression warnings
19 // warning C4251: 'ipsdk::python::PythonImage::_pBuffer' : class 'boost::shared_ptr<ipsdk::HybridBuffer>' needs to have dll-interface to be used by clients of class 'ipsdk::python::PythonImage'
20 #pragma warning (push)
21 #pragma warning (disable : 4251)
22 
25 #include <IPSDKImage/Image/BaseCompleteImage.h>
28 #include <boost/python/numpy.hpp>
29 #include <boost/scoped_ptr.hpp>
30 
31 namespace ipsdk {
32 namespace python {
33 
36 
38 {
39  // declare serial class
41 
42  // friend class for protected members access
43  friend boost::shared_ptr<PythonImage> boost::make_shared<PythonImage>();
44 
45 // predefined public types
46 public:
48  static const image::eImageType::domain g_imageType = image::eImageType::eIT_Custom;
49 
50 protected:
52  PythonImage();
53 
54 public:
56  ~PythonImage();
57 
58 // methods
59 public:
63  static void setContiguousStyle(const bool bCContiguous);
64 
66  image::eImageType getImageType() const;
67 
71  virtual BoolResult init(const image::BaseImageGeometry& geometry);
72 
78  const boost::python::numpy::ndarray& pythonArray);
79 
83  BoolResult init(const PythonImageAccessorPtr& pImageAccessor);
84 
89  BoolResult init(const PythonImageAccessorPtr& pImageAccessor,
90  const boost::python::numpy::ndarray& pythonArray);
91 
94  image::eImageAccessMode getAccessMode() const;
95 
101 
104  bool isBufferOwn() const;
105 
109  boost::python::numpy::ndarray getArray() const;
110 
112  ipBool isGpuImage() const;
113 
115  ipBool isDiskImage() const;
116 
118  void toGPU(PythonCudaImagePtr pOutImg) const;
119 
121  PythonCudaImagePtr toGPU() const;
122 
123 protected:
125  void createImagePlans(const image::BaseImageGeometry& geometry,
126  image::PlanStorageColl3d& imagePlans);
127 
130  void updateInternalArray(const image::BaseImageGeometry& geometry,
131  void* pData) const;
132 
134  void clearDerived();
135 
136 // attributes
137 public:
140 
142  typedef boost::python::numpy::ndarray PythonArray;
143 
145  mutable boost::shared_ptr<PythonArray> _pArray;
146 
149  static bool g_bCContiguous;
150 
153  PythonImageAccessorPtr _pImageAccessor;
154 
155 };
156 
159 
160 inline image::eImageType
162 {
163  return g_imageType;
164 }
165 
168 
169 } // end of namespace python
170 } // end of namespace ipsdk
171 
172 #pragma warning (pop)
173 
174 #endif // __PYIPSDKBASE_PYTHONIMAGE_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
PythonImageAccessorPtr _pImageAccessor
Definition: PythonImage.h:153
Base class for IPSDK image used through python.
Definition: PythonImage.h:37
specific images for dedicated tasks
Definition: ImageTypes.h:70
boost::python::numpy::ndarray PythonArray
underlying python array type
Definition: PythonImage.h:142
Predefined types for python image management.
#define PYIPSDKBASE_API
Import/Export macro for library PyIPSDKBase.
Definition: PyIPSDKBaseExports.h:25
boost::shared_ptr< PythonCudaImage > PythonCudaImagePtr
Definition: PythonImageTypes.h:44
Predefined types for buffer manipulations.
Base class for image geometry.
Definition: BaseImageGeometry.h:38
HybridBufferPtr _pBuffer
buffer associated to image
Definition: PythonImage.h:139
static const image::eImageType::domain g_imageType
type associated to attribute
Definition: PythonImage.h:48
IPSDKIMAGE_API ImageGeometryPtr geometry(const eImageBufferType &imageBufferType, const ipUInt64 sizeX, const ipUInt64 sizeY, const VolumeGeometry &volumeGeometry, const ColorGeometry &colorGeometry, const TemporalGeometry &temporalGeometry)
create an image geometry
#define IPSDK_DECLARE_SERIAL_WITHOUT_COPY(libraryName, className)
macro enabling serialization on class
Definition: SerializationHdrMacro.h:79
image::eImageType getImageType() const
retrieve image type
Definition: PythonImage.h:161
eImageType
Enumerate describing image type.
Definition: ImageTypes.h:58
std::vector< PlanStorageColl2d > PlanStorageColl3d
Definition: ImageTypes.h:196
bool ipBool
Base types definition.
Definition: BaseTypes.h:47
static bool g_bCContiguous
Definition: PythonImage.h:149
Definition of import/export macro for library.
boost::shared_ptr< HybridBuffer > HybridBufferPtr
shared pointer to HybridBuffer
Definition: BufferTypes.h:64
Base class for complete images.
Definition: BaseCompleteImage.h:34
boost::shared_ptr< PythonArray > _pArray
underlying python array
Definition: PythonImage.h:145
eImageAccessMode
Image access mode.
Definition: ImageTypes.h:110