HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_TextureOpticalFlow.proto.h
Go to the documentation of this file.
1 /* Automagically Generated by generate_proto.py
2  * Do not Edit
3  */
4 #pragma once
5 
6 #include <SOP/SOP_API.h>
7 #include <SOP/SOP_NodeVerb.h>
8 #include <SOP/SOP_GraphProxy.h>
9 
10 #include <OP/OP_Utils.h>
11 #include <PRM/PRM_Parm.h>
12 #include <UT/UT_IStream.h>
13 #include <UT/UT_NTStreamUtil.h>
14 #include <UT/UT_Ramp.h>
15 #include <UT/UT_SharedPtr.h>
16 #include <UT/UT_StringHolder.h>
17 #include <UT/UT_StringStream.h>
18 #include <UT/UT_VectorTypes.h>
19 #include <UT/UT_EnvControl.h>
20 #include <SYS/SYS_Types.h>
21 
22 class DEP_MicroNode;
23 namespace SOP_TextureOpticalFlowEnums
24 {
25  enum class Method
26  {
27  FARNEBACK = 0,
28  DIS
29  };
30 
32  getToken(Method enum_value)
33  {
34  using namespace UT::Literal;
35  switch (enum_value) {
36  case Method::FARNEBACK: return "farneback"_sh;
37  case Method::DIS: return "dis"_sh;
38  default: UT_ASSERT(false); return ""_sh;
39  }
40  }
41 
42 }
43 
44 
46 {
47 public:
48  static int version() { return 1; }
49 
51  {
52  mySourceGroup = ""_UTsh;
53  myGoalGroup = ""_UTsh;
54  myOutputName = "flow"_UTsh;
55  myMethod = 0;
56  myBlurringWindowRadius = 7;
57  myUseGaussianFilter = false;
58  myPyramidLevels = 3;
59  myPyramidScale = 0.5;
60  myIterations = 3;
61  myApproximationWindowRadius = 2;
62  mySmoothnessDegree = 3;
63  myPatchSize = 8;
64  myPatchStride = 3;
65  myFinestScale = 1;
66  myGradientDescentIterations = 25;
67  mySmoothnessWeight = 20;
68  myColorConstancyWeight = 5;
69  myGradientConstancyWeight = 10;
70  myVariationalRefinementIterations = 5;
71  myUseMeanNormalization = true;
72  myUseSpatialPropagation = true;
73 
74  }
75 
76  explicit SOP_TextureOpticalFlowParms(const SOP_TextureOpticalFlowParms &) = default;
79  SOP_TextureOpticalFlowParms &operator=(SOP_TextureOpticalFlowParms &&) noexcept = default;
80 
82 
84  {
85  if (mySourceGroup != src.mySourceGroup) return false;
86  if (myGoalGroup != src.myGoalGroup) return false;
87  if (myOutputName != src.myOutputName) return false;
88  if (myMethod != src.myMethod) return false;
89  if (myBlurringWindowRadius != src.myBlurringWindowRadius) return false;
90  if (myUseGaussianFilter != src.myUseGaussianFilter) return false;
91  if (myPyramidLevels != src.myPyramidLevels) return false;
92  if (myPyramidScale != src.myPyramidScale) return false;
93  if (myIterations != src.myIterations) return false;
94  if (myApproximationWindowRadius != src.myApproximationWindowRadius) return false;
95  if (mySmoothnessDegree != src.mySmoothnessDegree) return false;
96  if (myPatchSize != src.myPatchSize) return false;
97  if (myPatchStride != src.myPatchStride) return false;
98  if (myFinestScale != src.myFinestScale) return false;
99  if (myGradientDescentIterations != src.myGradientDescentIterations) return false;
100  if (mySmoothnessWeight != src.mySmoothnessWeight) return false;
101  if (myColorConstancyWeight != src.myColorConstancyWeight) return false;
102  if (myGradientConstancyWeight != src.myGradientConstancyWeight) return false;
103  if (myVariationalRefinementIterations != src.myVariationalRefinementIterations) return false;
104  if (myUseMeanNormalization != src.myUseMeanNormalization) return false;
105  if (myUseSpatialPropagation != src.myUseSpatialPropagation) return false;
106 
107  return true;
108  }
110  {
111  return !operator==(src);
112  }
114 
115 
116 
117  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
118  {
119  mySourceGroup = ""_UTsh;
120  if (true)
121  graph->evalOpParm(mySourceGroup, nodeidx, "sourcegroup", time, 0);
122  myGoalGroup = ""_UTsh;
123  if (true)
124  graph->evalOpParm(myGoalGroup, nodeidx, "goalgroup", time, 0);
125  myOutputName = "flow"_UTsh;
126  if (true)
127  graph->evalOpParm(myOutputName, nodeidx, "outputname", time, 0);
128  myMethod = 0;
129  if (true)
130  graph->evalOpParm(myMethod, nodeidx, "method", time, 0);
131  myBlurringWindowRadius = 7;
132  if (true && ( (true&&!(((int64(getMethod())!=0)))) ) )
133  graph->evalOpParm(myBlurringWindowRadius, nodeidx, "blurringwindowradius", time, 0);
134  myUseGaussianFilter = false;
135  if (true && ( (true&&!(((int64(getMethod())!=0)))) ) )
136  graph->evalOpParm(myUseGaussianFilter, nodeidx, "usegaussianfilter", time, 0);
137  myPyramidLevels = 3;
138  if (true && ( (true&&!(((int64(getMethod())!=0)))) ) )
139  graph->evalOpParm(myPyramidLevels, nodeidx, "pyramidlevels", time, 0);
140  myPyramidScale = 0.5;
141  if (true && ( (true&&!(((int64(getMethod())!=0)))) ) )
142  graph->evalOpParm(myPyramidScale, nodeidx, "pyramidscale", time, 0);
143  myIterations = 3;
144  if (true && ( (true&&!(((int64(getMethod())!=0)))) ) )
145  graph->evalOpParm(myIterations, nodeidx, "iterations", time, 0);
146  myApproximationWindowRadius = 2;
147  if (true && ( (true&&!(((int64(getMethod())!=0)))) ) )
148  graph->evalOpParm(myApproximationWindowRadius, nodeidx, "approximationwindowradius", time, 0);
149  mySmoothnessDegree = 3;
150  if (true && ( (true&&!(((int64(getMethod())!=0)))) ) )
151  graph->evalOpParm(mySmoothnessDegree, nodeidx, "smoothnessdegree", time, 0);
152  myPatchSize = 8;
153  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
154  graph->evalOpParm(myPatchSize, nodeidx, "patchsize", time, 0);
155  myPatchStride = 3;
156  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
157  graph->evalOpParm(myPatchStride, nodeidx, "patchstride", time, 0);
158  myFinestScale = 1;
159  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
160  graph->evalOpParm(myFinestScale, nodeidx, "finestscale", time, 0);
161  myGradientDescentIterations = 25;
162  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
163  graph->evalOpParm(myGradientDescentIterations, nodeidx, "gradientdescentiterations", time, 0);
164  mySmoothnessWeight = 20;
165  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
166  graph->evalOpParm(mySmoothnessWeight, nodeidx, "smoothnessweight", time, 0);
167  myColorConstancyWeight = 5;
168  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
169  graph->evalOpParm(myColorConstancyWeight, nodeidx, "colorconstancyweight", time, 0);
170  myGradientConstancyWeight = 10;
171  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
172  graph->evalOpParm(myGradientConstancyWeight, nodeidx, "gradientconstancyweight", time, 0);
173  myVariationalRefinementIterations = 5;
174  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
175  graph->evalOpParm(myVariationalRefinementIterations, nodeidx, "variationalrefinementiterations", time, 0);
176  myUseMeanNormalization = true;
177  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
178  graph->evalOpParm(myUseMeanNormalization, nodeidx, "usemeannormalization", time, 0);
179  myUseSpatialPropagation = true;
180  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
181  graph->evalOpParm(myUseSpatialPropagation, nodeidx, "usespatialpropagation", time, 0);
182 
183  }
184 
185 
186  void loadFromOpSubclass(const LoadParms &loadparms) override
187  {
188  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
189  }
190 
191 
192  void copyFrom(const OP_NodeParms *src) override
193  {
194  *this = *((const SOP_TextureOpticalFlowParms *)src);
195  }
196 
197  template <typename T>
198  void
199  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
200  {
201  if (idx.size() < 1)
202  return;
203  UT_ASSERT(idx.size() == instance.size()+1);
204  if (idx.size() != instance.size()+1)
205  return;
206  switch (idx[0])
207  {
208  case 0:
209  coerceValue(value, mySourceGroup);
210  break;
211  case 1:
212  coerceValue(value, myGoalGroup);
213  break;
214  case 2:
215  coerceValue(value, myOutputName);
216  break;
217  case 3:
218  coerceValue(value, myMethod);
219  break;
220  case 4:
221  coerceValue(value, myBlurringWindowRadius);
222  break;
223  case 5:
224  coerceValue(value, myUseGaussianFilter);
225  break;
226  case 6:
227  coerceValue(value, myPyramidLevels);
228  break;
229  case 7:
230  coerceValue(value, myPyramidScale);
231  break;
232  case 8:
233  coerceValue(value, myIterations);
234  break;
235  case 9:
236  coerceValue(value, myApproximationWindowRadius);
237  break;
238  case 10:
239  coerceValue(value, mySmoothnessDegree);
240  break;
241  case 11:
242  coerceValue(value, myPatchSize);
243  break;
244  case 12:
245  coerceValue(value, myPatchStride);
246  break;
247  case 13:
248  coerceValue(value, myFinestScale);
249  break;
250  case 14:
251  coerceValue(value, myGradientDescentIterations);
252  break;
253  case 15:
254  coerceValue(value, mySmoothnessWeight);
255  break;
256  case 16:
257  coerceValue(value, myColorConstancyWeight);
258  break;
259  case 17:
260  coerceValue(value, myGradientConstancyWeight);
261  break;
262  case 18:
263  coerceValue(value, myVariationalRefinementIterations);
264  break;
265  case 19:
266  coerceValue(value, myUseMeanNormalization);
267  break;
268  case 20:
269  coerceValue(value, myUseSpatialPropagation);
270  break;
271 
272  }
273  }
274 
275  bool isParmColorRamp(exint idx) const override
276  {
277  switch (idx)
278  {
279 
280  }
281  return false;
282  }
283 
284  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
285  { doGetParmValue(idx, instance, value); }
286  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
287  { doGetParmValue(idx, instance, value); }
288  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
289  { doGetParmValue(idx, instance, value); }
290  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
291  { doGetParmValue(idx, instance, value); }
292  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
293  { doGetParmValue(idx, instance, value); }
294  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
295  { doGetParmValue(idx, instance, value); }
296  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
297  { doGetParmValue(idx, instance, value); }
298  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
299  { doGetParmValue(idx, instance, value); }
300  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
301  { doGetParmValue(idx, instance, value); }
302  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
303  { doGetParmValue(idx, instance, value); }
304  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
305  { doGetParmValue(idx, instance, value); }
306 
307  template <typename T>
308  void
309  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
310  {
311  if (idx.size() < 1)
312  return;
313  UT_ASSERT(idx.size() == instance.size()+1);
314  if (idx.size() != instance.size()+1)
315  return;
316  switch (idx[0])
317  {
318  case 0:
319  coerceValue(mySourceGroup, ( ( value ) ));
320  break;
321  case 1:
322  coerceValue(myGoalGroup, ( ( value ) ));
323  break;
324  case 2:
325  coerceValue(myOutputName, ( ( value ) ));
326  break;
327  case 3:
328  coerceValue(myMethod, clampMinValue(0, clampMaxValue(1, value ) ));
329  break;
330  case 4:
331  coerceValue(myBlurringWindowRadius, clampMinValue(0, ( value ) ));
332  break;
333  case 5:
334  coerceValue(myUseGaussianFilter, ( ( value ) ));
335  break;
336  case 6:
337  coerceValue(myPyramidLevels, clampMinValue(1, ( value ) ));
338  break;
339  case 7:
340  coerceValue(myPyramidScale, clampMinValue(0.1, clampMaxValue(0.9, value ) ));
341  break;
342  case 8:
343  coerceValue(myIterations, clampMinValue(1, ( value ) ));
344  break;
345  case 9:
346  coerceValue(myApproximationWindowRadius, clampMinValue(0.25, ( value ) ));
347  break;
348  case 10:
349  coerceValue(mySmoothnessDegree, clampMinValue(1, ( value ) ));
350  break;
351  case 11:
352  coerceValue(myPatchSize, clampMinValue(1, ( value ) ));
353  break;
354  case 12:
355  coerceValue(myPatchStride, clampMinValue(1, ( value ) ));
356  break;
357  case 13:
358  coerceValue(myFinestScale, clampMinValue(0, ( value ) ));
359  break;
360  case 14:
361  coerceValue(myGradientDescentIterations, clampMinValue(1, ( value ) ));
362  break;
363  case 15:
364  coerceValue(mySmoothnessWeight, clampMinValue(0, ( value ) ));
365  break;
366  case 16:
367  coerceValue(myColorConstancyWeight, clampMinValue(0, ( value ) ));
368  break;
369  case 17:
370  coerceValue(myGradientConstancyWeight, clampMinValue(0, ( value ) ));
371  break;
372  case 18:
373  coerceValue(myVariationalRefinementIterations, clampMinValue(0, ( value ) ));
374  break;
375  case 19:
376  coerceValue(myUseMeanNormalization, ( ( value ) ));
377  break;
378  case 20:
379  coerceValue(myUseSpatialPropagation, ( ( value ) ));
380  break;
381 
382  }
383  }
384 
385  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
386  { doSetParmValue(idx, instance, value); }
387  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
388  { doSetParmValue(idx, instance, value); }
389  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
390  { doSetParmValue(idx, instance, value); }
391  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
392  { doSetParmValue(idx, instance, value); }
393  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
394  { doSetParmValue(idx, instance, value); }
395  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
396  { doSetParmValue(idx, instance, value); }
397  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
398  { doSetParmValue(idx, instance, value); }
399  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
400  { doSetParmValue(idx, instance, value); }
401  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
402  { doSetParmValue(idx, instance, value); }
403  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
404  { doSetParmValue(idx, instance, value); }
405  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
406  { doSetParmValue(idx, instance, value); }
407 
408  exint getNestNumParms(TempIndex idx) const override
409  {
410  if (idx.size() == 0)
411  return 21;
412  switch (idx[0])
413  {
414 
415  }
416  // Invalid
417  return 0;
418  }
419 
420  const char *getNestParmName(TempIndex fieldnum) const override
421  {
422  if (fieldnum.size() < 1)
423  return 0;
424  switch (fieldnum[0])
425  {
426  case 0:
427  return "sourcegroup";
428  case 1:
429  return "goalgroup";
430  case 2:
431  return "outputname";
432  case 3:
433  return "method";
434  case 4:
435  return "blurringwindowradius";
436  case 5:
437  return "usegaussianfilter";
438  case 6:
439  return "pyramidlevels";
440  case 7:
441  return "pyramidscale";
442  case 8:
443  return "iterations";
444  case 9:
445  return "approximationwindowradius";
446  case 10:
447  return "smoothnessdegree";
448  case 11:
449  return "patchsize";
450  case 12:
451  return "patchstride";
452  case 13:
453  return "finestscale";
454  case 14:
455  return "gradientdescentiterations";
456  case 15:
457  return "smoothnessweight";
458  case 16:
459  return "colorconstancyweight";
460  case 17:
461  return "gradientconstancyweight";
462  case 18:
463  return "variationalrefinementiterations";
464  case 19:
465  return "usemeannormalization";
466  case 20:
467  return "usespatialpropagation";
468 
469  }
470  return 0;
471  }
472 
473  ParmType getNestParmType(TempIndex fieldnum) const override
474  {
475  if (fieldnum.size() < 1)
476  return PARM_UNSUPPORTED;
477  switch (fieldnum[0])
478  {
479  case 0:
480  return PARM_STRING;
481  case 1:
482  return PARM_STRING;
483  case 2:
484  return PARM_STRING;
485  case 3:
486  return PARM_INTEGER;
487  case 4:
488  return PARM_INTEGER;
489  case 5:
490  return PARM_INTEGER;
491  case 6:
492  return PARM_INTEGER;
493  case 7:
494  return PARM_FLOAT;
495  case 8:
496  return PARM_INTEGER;
497  case 9:
498  return PARM_FLOAT;
499  case 10:
500  return PARM_INTEGER;
501  case 11:
502  return PARM_INTEGER;
503  case 12:
504  return PARM_INTEGER;
505  case 13:
506  return PARM_INTEGER;
507  case 14:
508  return PARM_INTEGER;
509  case 15:
510  return PARM_FLOAT;
511  case 16:
512  return PARM_FLOAT;
513  case 17:
514  return PARM_FLOAT;
515  case 18:
516  return PARM_INTEGER;
517  case 19:
518  return PARM_INTEGER;
519  case 20:
520  return PARM_INTEGER;
521 
522  }
523  return PARM_UNSUPPORTED;
524  }
525 
526  // Boiler plate to load individual types.
527  static void loadData(UT_IStream &is, int64 &v)
528  { is.bread(&v, 1); }
529  static void loadData(UT_IStream &is, bool &v)
530  { int64 iv; is.bread(&iv, 1); v = iv; }
531  static void loadData(UT_IStream &is, fpreal64 &v)
532  { is.bread<fpreal64>(&v, 1); }
533  static void loadData(UT_IStream &is, UT_Vector2D &v)
534  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
535  static void loadData(UT_IStream &is, UT_Vector3D &v)
536  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
537  is.bread<fpreal64>(&v.z(), 1); }
538  static void loadData(UT_IStream &is, UT_Vector4D &v)
539  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
540  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
541  static void loadData(UT_IStream &is, UT_Matrix2D &v)
542  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
543  static void loadData(UT_IStream &is, UT_Matrix3D &v)
544  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
545  static void loadData(UT_IStream &is, UT_Matrix4D &v)
546  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
547  static void loadData(UT_IStream &is, UT_Vector2I &v)
548  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
549  static void loadData(UT_IStream &is, UT_Vector3I &v)
550  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
551  is.bread<int64>(&v.z(), 1); }
552  static void loadData(UT_IStream &is, UT_Vector4I &v)
553  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
554  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
556  { is.bread(v); }
558  { UT_StringHolder rampdata;
559  loadData(is, rampdata);
560  if (rampdata.isstring())
561  {
562  v.reset(new UT_Ramp());
563  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
564  v->load(istr);
565  }
566  else v.reset();
567  }
570  loadData(is, data);
571  if (data.isstring())
572  {
573  // Find the data type.
574  const char *colon = UT_StringWrap(data).findChar(':');
575  if (colon)
576  {
577  int typelen = colon - data.buffer();
579  type.strncpy(data.buffer(), typelen);
580  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
581 
582  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
583  }
584  }
585  else v.reset();
586  }
587 
588  static void saveData(std::ostream &os, int64 v)
589  { UTwrite(os, &v); }
590  static void saveData(std::ostream &os, bool v)
591  { int64 iv = v; UTwrite(os, &iv); }
592  static void saveData(std::ostream &os, fpreal64 v)
593  { UTwrite<fpreal64>(os, &v); }
594  static void saveData(std::ostream &os, UT_Vector2D v)
595  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
596  static void saveData(std::ostream &os, UT_Vector3D v)
597  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
598  UTwrite<fpreal64>(os, &v.z()); }
599  static void saveData(std::ostream &os, UT_Vector4D v)
600  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
601  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
602  static void saveData(std::ostream &os, UT_Matrix2D v)
604  static void saveData(std::ostream &os, UT_Matrix3D v)
606  static void saveData(std::ostream &os, UT_Matrix4D v)
608  static void saveData(std::ostream &os, UT_StringHolder s)
609  { UT_StringWrap(s).saveBinary(os); }
610  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
612  UT_OStringStream ostr;
613  if (s) s->save(ostr);
614  result = ostr.str();
615  saveData(os, result);
616  }
617  static void saveData(std::ostream &os, PRM_DataItemHandle s)
619  UT_OStringStream ostr;
620  if (s)
621  {
622  ostr << s->getDataTypeToken();
623  ostr << ":";
624  s->saveBinary(ostr);
625  }
626  result = ostr.str();
627  saveData(os, result);
628  }
629 
630 
631  void save(std::ostream &os) const
632  {
633  int32 v = version();
634  UTwrite(os, &v);
635  saveData(os, mySourceGroup);
636  saveData(os, myGoalGroup);
637  saveData(os, myOutputName);
638  saveData(os, myMethod);
639  saveData(os, myBlurringWindowRadius);
640  saveData(os, myUseGaussianFilter);
641  saveData(os, myPyramidLevels);
642  saveData(os, myPyramidScale);
643  saveData(os, myIterations);
644  saveData(os, myApproximationWindowRadius);
645  saveData(os, mySmoothnessDegree);
646  saveData(os, myPatchSize);
647  saveData(os, myPatchStride);
648  saveData(os, myFinestScale);
649  saveData(os, myGradientDescentIterations);
650  saveData(os, mySmoothnessWeight);
651  saveData(os, myColorConstancyWeight);
652  saveData(os, myGradientConstancyWeight);
653  saveData(os, myVariationalRefinementIterations);
654  saveData(os, myUseMeanNormalization);
655  saveData(os, myUseSpatialPropagation);
656 
657  }
658 
659  bool load(UT_IStream &is)
660  {
661  int32 v;
662  is.bread(&v, 1);
663  if (version() != v)
664  {
665  // Fail incompatible versions
666  return false;
667  }
668  loadData(is, mySourceGroup);
669  loadData(is, myGoalGroup);
670  loadData(is, myOutputName);
671  loadData(is, myMethod);
672  loadData(is, myBlurringWindowRadius);
673  loadData(is, myUseGaussianFilter);
674  loadData(is, myPyramidLevels);
675  loadData(is, myPyramidScale);
676  loadData(is, myIterations);
677  loadData(is, myApproximationWindowRadius);
678  loadData(is, mySmoothnessDegree);
679  loadData(is, myPatchSize);
680  loadData(is, myPatchStride);
681  loadData(is, myFinestScale);
682  loadData(is, myGradientDescentIterations);
683  loadData(is, mySmoothnessWeight);
684  loadData(is, myColorConstancyWeight);
685  loadData(is, myGradientConstancyWeight);
686  loadData(is, myVariationalRefinementIterations);
687  loadData(is, myUseMeanNormalization);
688  loadData(is, myUseSpatialPropagation);
689 
690  return true;
691  }
692 
693  const UT_StringHolder & getSourceGroup() const { return mySourceGroup; }
694  void setSourceGroup(const UT_StringHolder & val) { mySourceGroup = val; }
696  {
697  SOP_Node *thissop = cookparms.getNode();
698  if (!thissop) return getSourceGroup();
700  OP_Utils::evalOpParm(result, thissop, "sourcegroup", cookparms.getCookTime(), 0);
701  return result;
702  }
703  const UT_StringHolder & getGoalGroup() const { return myGoalGroup; }
704  void setGoalGroup(const UT_StringHolder & val) { myGoalGroup = val; }
706  {
707  SOP_Node *thissop = cookparms.getNode();
708  if (!thissop) return getGoalGroup();
710  OP_Utils::evalOpParm(result, thissop, "goalgroup", cookparms.getCookTime(), 0);
711  return result;
712  }
713  const UT_StringHolder & getOutputName() const { return myOutputName; }
714  void setOutputName(const UT_StringHolder & val) { myOutputName = val; }
716  {
717  SOP_Node *thissop = cookparms.getNode();
718  if (!thissop) return getOutputName();
720  OP_Utils::evalOpParm(result, thissop, "outputname", cookparms.getCookTime(), 0);
721  return result;
722  }
723  Method getMethod() const { return Method(myMethod); }
724  void setMethod(Method val) { myMethod = int64(val); }
725  Method opMethod(const SOP_NodeVerb::CookParms &cookparms) const
726  {
727  SOP_Node *thissop = cookparms.getNode();
728  if (!thissop) return getMethod();
729  int64 result;
730  OP_Utils::evalOpParm(result, thissop, "method", cookparms.getCookTime(), 0);
731  return Method(result);
732  }
733  int64 getBlurringWindowRadius() const { return myBlurringWindowRadius; }
734  void setBlurringWindowRadius(int64 val) { myBlurringWindowRadius = val; }
736  {
737  SOP_Node *thissop = cookparms.getNode();
738  if (!thissop) return getBlurringWindowRadius();
739  int64 result;
740  OP_Utils::evalOpParm(result, thissop, "blurringwindowradius", cookparms.getCookTime(), 0);
741  return result;
742  }
743  bool getUseGaussianFilter() const { return myUseGaussianFilter; }
744  void setUseGaussianFilter(bool val) { myUseGaussianFilter = val; }
745  bool opUseGaussianFilter(const SOP_NodeVerb::CookParms &cookparms) const
746  {
747  SOP_Node *thissop = cookparms.getNode();
748  if (!thissop) return getUseGaussianFilter();
749  bool result;
750  OP_Utils::evalOpParm(result, thissop, "usegaussianfilter", cookparms.getCookTime(), 0);
751  return result;
752  }
753  int64 getPyramidLevels() const { return myPyramidLevels; }
754  void setPyramidLevels(int64 val) { myPyramidLevels = val; }
756  {
757  SOP_Node *thissop = cookparms.getNode();
758  if (!thissop) return getPyramidLevels();
759  int64 result;
760  OP_Utils::evalOpParm(result, thissop, "pyramidlevels", cookparms.getCookTime(), 0);
761  return result;
762  }
763  fpreal64 getPyramidScale() const { return myPyramidScale; }
764  void setPyramidScale(fpreal64 val) { myPyramidScale = val; }
766  {
767  SOP_Node *thissop = cookparms.getNode();
768  if (!thissop) return getPyramidScale();
770  OP_Utils::evalOpParm(result, thissop, "pyramidscale", cookparms.getCookTime(), 0);
771  return result;
772  }
773  int64 getIterations() const { return myIterations; }
774  void setIterations(int64 val) { myIterations = val; }
776  {
777  SOP_Node *thissop = cookparms.getNode();
778  if (!thissop) return getIterations();
779  int64 result;
780  OP_Utils::evalOpParm(result, thissop, "iterations", cookparms.getCookTime(), 0);
781  return result;
782  }
783  fpreal64 getApproximationWindowRadius() const { return myApproximationWindowRadius; }
784  void setApproximationWindowRadius(fpreal64 val) { myApproximationWindowRadius = val; }
786  {
787  SOP_Node *thissop = cookparms.getNode();
788  if (!thissop) return getApproximationWindowRadius();
790  OP_Utils::evalOpParm(result, thissop, "approximationwindowradius", cookparms.getCookTime(), 0);
791  return result;
792  }
793  int64 getSmoothnessDegree() const { return mySmoothnessDegree; }
794  void setSmoothnessDegree(int64 val) { mySmoothnessDegree = val; }
796  {
797  SOP_Node *thissop = cookparms.getNode();
798  if (!thissop) return getSmoothnessDegree();
799  int64 result;
800  OP_Utils::evalOpParm(result, thissop, "smoothnessdegree", cookparms.getCookTime(), 0);
801  return result;
802  }
803  int64 getPatchSize() const { return myPatchSize; }
804  void setPatchSize(int64 val) { myPatchSize = val; }
805  int64 opPatchSize(const SOP_NodeVerb::CookParms &cookparms) const
806  {
807  SOP_Node *thissop = cookparms.getNode();
808  if (!thissop) return getPatchSize();
809  int64 result;
810  OP_Utils::evalOpParm(result, thissop, "patchsize", cookparms.getCookTime(), 0);
811  return result;
812  }
813  int64 getPatchStride() const { return myPatchStride; }
814  void setPatchStride(int64 val) { myPatchStride = val; }
816  {
817  SOP_Node *thissop = cookparms.getNode();
818  if (!thissop) return getPatchStride();
819  int64 result;
820  OP_Utils::evalOpParm(result, thissop, "patchstride", cookparms.getCookTime(), 0);
821  return result;
822  }
823  int64 getFinestScale() const { return myFinestScale; }
824  void setFinestScale(int64 val) { myFinestScale = val; }
826  {
827  SOP_Node *thissop = cookparms.getNode();
828  if (!thissop) return getFinestScale();
829  int64 result;
830  OP_Utils::evalOpParm(result, thissop, "finestscale", cookparms.getCookTime(), 0);
831  return result;
832  }
833  int64 getGradientDescentIterations() const { return myGradientDescentIterations; }
834  void setGradientDescentIterations(int64 val) { myGradientDescentIterations = val; }
836  {
837  SOP_Node *thissop = cookparms.getNode();
838  if (!thissop) return getGradientDescentIterations();
839  int64 result;
840  OP_Utils::evalOpParm(result, thissop, "gradientdescentiterations", cookparms.getCookTime(), 0);
841  return result;
842  }
843  fpreal64 getSmoothnessWeight() const { return mySmoothnessWeight; }
844  void setSmoothnessWeight(fpreal64 val) { mySmoothnessWeight = val; }
846  {
847  SOP_Node *thissop = cookparms.getNode();
848  if (!thissop) return getSmoothnessWeight();
850  OP_Utils::evalOpParm(result, thissop, "smoothnessweight", cookparms.getCookTime(), 0);
851  return result;
852  }
853  fpreal64 getColorConstancyWeight() const { return myColorConstancyWeight; }
854  void setColorConstancyWeight(fpreal64 val) { myColorConstancyWeight = val; }
856  {
857  SOP_Node *thissop = cookparms.getNode();
858  if (!thissop) return getColorConstancyWeight();
860  OP_Utils::evalOpParm(result, thissop, "colorconstancyweight", cookparms.getCookTime(), 0);
861  return result;
862  }
863  fpreal64 getGradientConstancyWeight() const { return myGradientConstancyWeight; }
864  void setGradientConstancyWeight(fpreal64 val) { myGradientConstancyWeight = val; }
866  {
867  SOP_Node *thissop = cookparms.getNode();
868  if (!thissop) return getGradientConstancyWeight();
870  OP_Utils::evalOpParm(result, thissop, "gradientconstancyweight", cookparms.getCookTime(), 0);
871  return result;
872  }
873  int64 getVariationalRefinementIterations() const { return myVariationalRefinementIterations; }
874  void setVariationalRefinementIterations(int64 val) { myVariationalRefinementIterations = val; }
876  {
877  SOP_Node *thissop = cookparms.getNode();
878  if (!thissop) return getVariationalRefinementIterations();
879  int64 result;
880  OP_Utils::evalOpParm(result, thissop, "variationalrefinementiterations", cookparms.getCookTime(), 0);
881  return result;
882  }
883  bool getUseMeanNormalization() const { return myUseMeanNormalization; }
884  void setUseMeanNormalization(bool val) { myUseMeanNormalization = val; }
885  bool opUseMeanNormalization(const SOP_NodeVerb::CookParms &cookparms) const
886  {
887  SOP_Node *thissop = cookparms.getNode();
888  if (!thissop) return getUseMeanNormalization();
889  bool result;
890  OP_Utils::evalOpParm(result, thissop, "usemeannormalization", cookparms.getCookTime(), 0);
891  return result;
892  }
893  bool getUseSpatialPropagation() const { return myUseSpatialPropagation; }
894  void setUseSpatialPropagation(bool val) { myUseSpatialPropagation = val; }
896  {
897  SOP_Node *thissop = cookparms.getNode();
898  if (!thissop) return getUseSpatialPropagation();
899  bool result;
900  OP_Utils::evalOpParm(result, thissop, "usespatialpropagation", cookparms.getCookTime(), 0);
901  return result;
902  }
903 
904 private:
905  UT_StringHolder mySourceGroup;
906  UT_StringHolder myGoalGroup;
907  UT_StringHolder myOutputName;
908  int64 myMethod;
909  int64 myBlurringWindowRadius;
910  bool myUseGaussianFilter;
911  int64 myPyramidLevels;
912  fpreal64 myPyramidScale;
913  int64 myIterations;
914  fpreal64 myApproximationWindowRadius;
915  int64 mySmoothnessDegree;
916  int64 myPatchSize;
917  int64 myPatchStride;
918  int64 myFinestScale;
919  int64 myGradientDescentIterations;
920  fpreal64 mySmoothnessWeight;
921  fpreal64 myColorConstancyWeight;
922  fpreal64 myGradientConstancyWeight;
923  int64 myVariationalRefinementIterations;
924  bool myUseMeanNormalization;
925  bool myUseSpatialPropagation;
926 
927 };
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
void save(std::ostream &os) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
static void loadData(UT_IStream &is, UT_Vector2D &v)
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
UT_StringHolder opSourceGroup(const SOP_NodeVerb::CookParms &cookparms) const
fpreal64 opGradientConstancyWeight(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Vector4I &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
const UT_StringHolder & getGoalGroup() const
static void saveData(std::ostream &os, UT_Matrix2D v)
exint bread(int32 *buffer, exint asize=1)
GLboolean * data
Definition: glcorearb.h:131
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector4.h:493
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
const GLdouble * v
Definition: glcorearb.h:837
fpreal getTime() const
Definition: OP_Context.h:62
const OP_Context & context() const
Definition: OP_NodeParms.h:97
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:667
int64 exint
Definition: SYS_Types.h:125
SYS_FORCE_INLINE const char * buffer() const
GLdouble s
Definition: glad.h:3009
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
int64 opVariationalRefinementIterations(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
static void loadData(UT_IStream &is, UT_StringHolder &v)
An output stream object that owns its own string buffer storage.
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
static void loadData(UT_IStream &is, UT_Vector3D &v)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
**But if you need a result
Definition: thread.h:613
UT_StringHolder opOutputName(const SOP_NodeVerb::CookParms &cookparms) const
exint nodeIdx() const
Definition: OP_NodeParms.h:95
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
static void saveData(std::ostream &os, fpreal64 v)
UT_StringHolder opGoalGroup(const SOP_NodeVerb::CookParms &cookparms) const
void copyFrom(const OP_NodeParms *src) override
SYS_FORCE_INLINE UT_StringHolder getToken(Method enum_value)
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
static void loadData(UT_IStream &is, UT_Vector4D &v)
double fpreal64
Definition: SYS_Types.h:201
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
int64 opGradientDescentIterations(const SOP_NodeVerb::CookParms &cookparms) const
int64 opPatchSize(const SOP_NodeVerb::CookParms &cookparms) const
int64 opPyramidLevels(const SOP_NodeVerb::CookParms &cookparms) const
bool opUseMeanNormalization(const SOP_NodeVerb::CookParms &cookparms) const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
static void saveData(std::ostream &os, UT_Matrix4D v)
static void saveData(std::ostream &os, UT_Vector2D v)
bool operator!=(const SOP_TextureOpticalFlowParms &src) const
exint length() const
fpreal64 opColorConstancyWeight(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
static void loadData(UT_IStream &is, UT_Vector3I &v)
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
void setGoalGroup(const UT_StringHolder &val)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
static void saveData(std::ostream &os, UT_StringHolder s)
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
int64 opSmoothnessDegree(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Vector3D v)
static void loadData(UT_IStream &is, fpreal64 &v)
long long int64
Definition: SYS_Types.h:116
int64 opPatchStride(const SOP_NodeVerb::CookParms &cookparms) const
fpreal64 opSmoothnessWeight(const SOP_NodeVerb::CookParms &cookparms) const
void setSourceGroup(const UT_StringHolder &val)
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
static void saveData(std::ostream &os, UT_Vector4D v)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:296
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
GT_API const UT_StringHolder version
static void saveData(std::ostream &os, int64 v)
static void saveData(std::ostream &os, bool v)
int64 opBlurringWindowRadius(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void loadData(UT_IStream &is, int64 &v)
bool opUseSpatialPropagation(const SOP_NodeVerb::CookParms &cookparms) const
const char * getNestParmName(TempIndex fieldnum) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
static void loadData(UT_IStream &is, bool &v)
const UT_StringHolder & getSourceGroup() const
fpreal64 fpreal
Definition: SYS_Types.h:277
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
Definition: UT_Ramp.h:92
fpreal64 opPyramidScale(const SOP_NodeVerb::CookParms &cookparms) const
int64 opIterations(const SOP_NodeVerb::CookParms &cookparms) const
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
GLuint GLfloat * val
Definition: glcorearb.h:1608
#define SOP_API
Definition: SOP_API.h:10
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
void setOutputName(const UT_StringHolder &val)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:361
static void loadData(UT_IStream &is, UT_Matrix3D &v)
bool isParmColorRamp(exint idx) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
const char * findChar(int c) const
Definition: UT_String.h:1395
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
Definition: core.h:1131
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
bool opUseGaussianFilter(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
void loadFromOpSubclass(const LoadParms &loadparms) override
GLboolean r
Definition: glcorearb.h:1222
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
const UT_StringHolder & getOutputName() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
fpreal64 opApproximationWindowRadius(const SOP_NodeVerb::CookParms &cookparms) const
type
Definition: core.h:1059
exint getNestNumParms(TempIndex idx) const override
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
Method opMethod(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:97
static void saveData(std::ostream &os, UT_Matrix3D v)
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
SYS_FORCE_INLINE bool isstring() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
ParmType getNestParmType(TempIndex fieldnum) const override
int64 opFinestScale(const SOP_NodeVerb::CookParms &cookparms) const
bool operator==(const SOP_TextureOpticalFlowParms &src) const
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663