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