HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_ImageLayer.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef __HOM_ImageLayer_h__
10 #define __HOM_ImageLayer_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_BinaryString.h"
14 #include "HOM_BoundingRect.h"
15 #include "HOM_Defines.h"
16 #include "HOM_Errors.h"
17 #include "HOM_IterableList.h"
18 #include "HOM_EnumModules.h"
19 #include "HOM_Matrix4.h"
20 #include <UT/UT_Tuple.h>
21 #include <vector>
22 #include <string>
23 #include <hboost/any.hpp>
24 
25 SWIGOUT(%rename(ImageLayer) HOM_ImageLayer;)
26 // Force SWIG to output an __init__ method even though it determines this
27 // class is abstract.
28 SWIGOUT(%feature("notabstract") HOM_ImageLayer;)
29 
31 {
32 public:
33 #ifdef SWIG
34 %extend
35 {
37  { return HOM().newImageLayer(layer); }
38 }
39 #else
41  { HOM_CONSTRUCT_OBJECT(this) }
43  { HOM_CONSTRUCT_OBJECT(this) }
44 #endif
45  virtual ~HOM_ImageLayer()
46  { HOM_DESTRUCT_OBJECT(this) }
47 
48  virtual std::string __repr__() = 0;
49 
50  virtual HOM_ImageLayer *__enter__() { return this; }
51 
52 #ifdef SWIG
53 %extend
54 {
55  // We can ignore the type, value, and traceback Python objects.
56  SWIGOUT(virtual void __exit__(
57  InterpreterObject type, InterpreterObject value,
58  InterpreterObject traceback)
59  { self->close(); };)
60 }
61 #endif
62 
63  virtual void close() = 0;
64 
65  virtual HOM_EnumValue &storageType() const = 0;
66  virtual HOM_EnumValue &border() const = 0;
67  virtual HOM_EnumValue &typeInfo() const = 0;
68 
69  virtual void setStorageType(HOM_EnumValue &storagetype) = 0;
70  virtual void setBorder(HOM_EnumValue &storagetype) = 0;
71  virtual void setTypeInfo(HOM_EnumValue &storagetype) = 0;
72 
73  virtual int channelCount() const = 0;
74  virtual void setChannelCount(int chan) = 0;
75 
76  virtual std::vector<int> bufferResolution() const = 0;
77 
78  virtual bool onCPU() const = 0;
79  virtual bool onGPU() const = 0;
80  virtual bool isConstant() const = 0;
81  virtual bool storesIntegers() const = 0;
82  virtual bool isMetadataOnly() const = 0;
83  virtual void setIsMetadataOnly(bool v) = 0;
84 
85  virtual void makeConstant(std::vector<double> val) = 0;
86  virtual void expandConstant() = 0;
87 
88  virtual HOM_BoundingRect dataWindow() const = 0;
89  virtual HOM_BoundingRect displayWindow() const = 0;
90  virtual double pixelAspectRatio() const = 0;
91  virtual std::vector<double> pixelScale() const = 0;
92 
93  virtual void setDataWindow(int x, int y, int w, int h) = 0;
94  virtual void setDisplayWindow(double x, double y, double w, double h) = 0;
95  virtual void setPixelAspectRatio(double aspect) = 0;
96  virtual void setPixelScale(std::vector<double> scale) = 0;
97 
98  virtual HOM_Vector3 voxelSize() const = 0;
99 
100  /// Camera parameters
101  virtual HOM_EnumValue &projection() const = 0;
102  virtual double aperture() const = 0;
103  virtual double focalLength() const = 0;
104  virtual std::vector<double> cameraPosition() const = 0;
105  virtual double fStop() const = 0;
106  virtual std::vector<double> clippingRange() const = 0;
107  virtual double focusDistance() const = 0;
108  virtual double imagingDistance() const = 0;
109  virtual std::vector<double> shutter() const = 0;
110  virtual double guideScale() const = 0;
111 
112  virtual void setProjection(HOM_EnumValue &projection) = 0;
113  virtual void setAperture(double aperture) = 0;
114  virtual void setFocalLength(double focal) = 0;
115  virtual void setCameraPosition(std::vector<double> pos) = 0;
116  virtual void setFStop(double fstop) = 0;
117  virtual void setClippingRange(std::vector<double> range) = 0;
118  virtual void setFocusDistance(double focus) = 0;
119  virtual void setImagingDistance(double imagingdist) = 0;
120  virtual void setShutter(std::vector<double> shutter) = 0;
121  virtual void setGuideScale(double scale) = 0;
122 
123  virtual void setImageToWorldTransform(const HOM_Matrix4&) = 0;
124  virtual void transform(const HOM_Matrix4&) = 0;
125 
126  virtual HOM_Matrix4 projectionTransform() const = 0;
127  virtual HOM_Matrix4 imageToWorldTransform() const = 0;
128 
129  virtual std::vector<double> imageToPixelScale() const = 0;
130  virtual std::vector<double> imageToPixelTranslate() const = 0;
131  virtual std::vector<double> imageToBufferScale() const = 0;
132  virtual std::vector<double> imageToBufferTranslate() const = 0;
133 
134  virtual std::vector<double> bufferToPixelScale() const = 0;
135  virtual std::vector<double> bufferToPixelTranslate() const = 0;
136 
137  virtual std::vector<double> textureToBufferScale() const = 0;
138  // Zero:
139  //virtual std::vector<double> textureToBufferTranslate() const = 0;
140 
141  // Space conversions
142  virtual std::vector<double> imageToPixel(std::vector<double> p) const = 0;
143  virtual std::vector<double> imageToBuffer(std::vector<double> p) const = 0;
144  virtual std::vector<double> imageToTexture(std::vector<double> p) const = 0;
145  virtual std::vector<double> imageToWorld(std::vector<double> p) const = 0;
146  virtual std::vector<double> image3ToWorld(std::vector<double> p) const = 0;
147  virtual std::vector<double> imageToLocal(std::vector<double> p) const = 0;
148  virtual std::vector<double> image3ToLocal(std::vector<double> p) const = 0;
149  virtual std::vector<double> pixelToImage(std::vector<double> p) const = 0;
150  virtual std::vector<double> pixelToBuffer(std::vector<double> p) const = 0;
151  virtual std::vector<double> pixelToTexture(std::vector<double> p) const = 0;
152  virtual std::vector<double> bufferToPixel(std::vector<double> p) const = 0;
153  virtual std::vector<double> bufferToImage(std::vector<double> p) const = 0;
154  virtual std::vector<double> bufferToTexture(std::vector<double> p) const = 0;
155  virtual std::vector<double> textureToPixel(std::vector<double> p) const = 0;
156  virtual std::vector<double> textureToImage(std::vector<double> p) const = 0;
157  virtual std::vector<double> textureToBuffer(std::vector<double> p) const = 0;
158  virtual std::vector<double> worldToBuffer(std::vector<double> p) const = 0;
159  virtual std::vector<double> worldToImage(std::vector<double> p) const = 0;
160  virtual std::vector<double> worldToImage3(std::vector<double> p) const = 0;
161  virtual std::vector<double> worldToLocal(std::vector<double> p) const = 0;
162  virtual std::vector<double> localToImage(std::vector<double> p) const = 0;
163  virtual std::vector<double> localToImage3(std::vector<double> p) const = 0;
164  virtual std::vector<double> localToWorld(std::vector<double> p) const = 0;
165 
166  // retrieve pixel data
167 
168  virtual std::vector<float> bufferIndexV4(int x, int y) const = 0;
169  virtual int bufferIndexI(int x, int y) const = 0;
170  virtual hboost::any bufferIndex(int x, int y) const = 0;
171  virtual HOM_BinaryString bufferIndexRaw(int x, int y) const = 0;
172 
173  // set pixel data
174  virtual void setBufferIndex(int x, int y, hboost::any rgba) = 0;
175  virtual void setBufferIndexI(int x, int y, int id) = 0;
176  virtual void setBufferIndexV4(int x, int y, std::vector<double> rgba) = 0;
177 
178  SWIGOUT(%newobject freeze;)
179  virtual HOM_ImageLayer *freeze() const = 0;
180  virtual bool isFrozen() const = 0;
181 
182  virtual std::map<std::string, hboost::any> properties() const = 0;
183  virtual void setProperties(const std::map<std::string, hboost::any> &p) = 0;
184  virtual void updateProperties(const std::map<std::string, hboost::any> &p) = 0;
185 
186  // deprecated; attributes were renamed to properties
187  virtual std::map<std::string, hboost::any> attributes() const = 0;
188  virtual void setAttributes(const std::map<std::string, hboost::any> &p) = 0;
189  virtual void updateAttributes(const std::map<std::string, hboost::any> &p) = 0;
190 
191  virtual HOM_BinaryString allBufferElements() const = 0;
192  virtual HOM_BinaryString allBufferElements(HOM_EnumValue &storagetype, int channels) const = 0;
193 
194 #ifdef SWIG
195 %extend
196 {
197  void setAllBufferElements(InterpreterObject values)
198  {
199  HOM_PyBuffer buffer(values);
200  self->opaqueSetAllBufferElements(
201  (const char *)buffer.myData, buffer.myLength);
202  }
203 }
204 #endif
205 
206 #ifdef SWIG
207 %extend
208 {
209  void setAllBufferElements(InterpreterObject values, HOM_EnumValue &storagetype, int channels)
210  {
211  HOM_PyBuffer buffer(values);
212  self->opaqueSetAllBufferElements(
213  (const char *)buffer.myData, buffer.myLength,
214  storagetype, channels);
215  }
216 }
217 #endif
218 
219  SWIGOUT(%ignore opaqueSetAllBufferElements);
220  virtual void opaqueSetAllBufferElements(const char *values, int64 length,
221  HOM_EnumValue &storagetype, int channels) = 0;
222 
223  SWIGOUT(%ignore opaqueSetAllBufferElements);
224  virtual void opaqueSetAllBufferElements(const char *values, int64 length) = 0;
225 
226  // statistics
227  virtual hboost::any computeMin(int channel = 0) const = 0;
228  virtual hboost::any computeMax(int channel = 0) const = 0;
229  virtual hboost::any computeMinLength() const = 0;
230  virtual hboost::any computeMaxLength() const = 0;
231  virtual double computeAverage(int channel = 0) const = 0;
232 };
233 
234 #endif
virtual HOM_ImageLayer * newImageLayer(HOM_ImageLayer *layer=nullptr)=0
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1398
GLenum GLint * range
Definition: glcorearb.h:1925
const GLdouble * v
Definition: glcorearb.h:837
GLsizei const GLfloat * value
Definition: glcorearb.h:824
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:312
GLint y
Definition: glcorearb.h:103
HOM_ImageLayer(const HOM_ImageLayer &)
void close() override
GLuint buffer
Definition: glcorearb.h:660
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
GA_API const UT_StringHolder scale
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
bool any(const vbool4 &v)
Definition: simd.h:3600
#define HOM_API
Definition: HOM_API.h:13
void ignore(T const &) VULKAN_HPP_NOEXCEPT
Definition: vulkan.hpp:6508
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1397
long long int64
Definition: SYS_Types.h:116
virtual ~HOM_ImageLayer()
HUSD_API const char * pixelAspectRatio()
GA_API const UT_StringHolder transform
GLint GLenum GLint x
Definition: glcorearb.h:409
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
GLint GLint GLsizei GLint border
Definition: glcorearb.h:108
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1602
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)
GLuint GLfloat * val
Definition: glcorearb.h:1608
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
GLuint bufferIndex
Definition: glcorearb.h:2221
HOM_API HOM_Module & HOM()
virtual HOM_ImageLayer * __enter__()
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)