]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx
b7cea8edd47ed328ec6d06ed6a48c2c62c2c569f
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuManualContourModel_Box.cxx
1 //===== 
2 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
3 //===== 
4 #include "bbcreaMaracasVisuManualContourModel_Box.h"
5 #include "bbcreaMaracasVisuPackage.h"
6
7 #include <creaContoursFactory.h>
8
9
10 namespace bbcreaMaracasVisu
11 {
12
13 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualContourModel_Box)
14 BBTK_BLACK_BOX_IMPLEMENTATION(ManualContourModel_Box,bbtk::AtomicBlackBox);
15 //===== 
16 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
17 //===== 
18
19
20 void ManualContourModel_Box::ProcessBySegment(  
21                         int Type, 
22                         int &iGeneral, int sizeSegment,
23                         std::vector<double> *lstInX,std::vector<double> *lstInY, std::vector<double> *lstInZ,
24                         std::vector<double> *lstOutX,std::vector<double> *lstOutY, std::vector<double> *lstOutZ,
25                         std::vector<int>        *lstIndexsOut, bool open )
26 {
27         creaContoursFactory f;
28         manualContourModel      *m;
29         int i,size=iGeneral+sizeSegment;
30         double x,y,z;
31         m = (manualContourModel*)f.getContourModel( bbGetInputType() );
32         m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
33         m->SetCloseContour( open );
34         for (i=iGeneral;i<size;i++)
35         {
36                 m->AddPoint( (*lstInX)[i] , (*lstInY)[i] , (*lstInZ)[i] );
37         } // for
38         m->UpdateSpline();
39         int sizeContour = bbGetInputNbPoints();
40         for (i=0;i<sizeContour;i++)
41         {
42                 m->GetSpline_i_Point(i,&x,&y,&z);
43                 lstOutX->push_back(x);
44                 lstOutY->push_back(y);
45                 lstOutZ->push_back(z);
46         } // for
47         iGeneral=iGeneral+sizeSegment;
48         lstIndexsOut->push_back( sizeContour );
49         delete m;
50 }
51
52
53 void ManualContourModel_Box::RedistributionPoints(      std::vector<double> *lstOutX,
54                                                                                                         std::vector<double> *lstOutY, 
55                                                                                                         std::vector<double> *lstOutZ,
56                                                                                                         std::vector<int> *lstIndexsOut )
57 {
58         std::vector<double> lstRstX;
59         std::vector<double> lstRstY;
60         std::vector<double> lstRstZ;
61         int iLstIndexOut,sizeLstIndexOut = lstIndexsOut->size();
62         int ii, iGeneral=0;
63         int size;
64         for (iLstIndexOut=0;  iLstIndexOut<sizeLstIndexOut; iLstIndexOut++)
65         {
66                 lstRstX.clear();
67                 lstRstY.clear();
68                 lstRstZ.clear();
69                 size=(*lstIndexsOut)[iLstIndexOut];
70                 if (size>2)
71                 {
72                         double dist=0,dist2,distSeg,delta;
73                         double dd,dx,dy,dz;
74                         int i,k;
75                         for ( i=iGeneral+1 ; i<iGeneral+size ; i++ )
76                         {
77                                 dx      = (*lstOutX)[i]-(*lstOutX)[i-1];
78                                 dy      = (*lstOutY)[i]-(*lstOutY)[i-1];
79                                 dz      = (*lstOutZ)[i]-(*lstOutZ)[i-1];
80                                 dist= dist+sqrt( dx*dx + dy*dy + dz*dz );
81                         } //for
82                         delta = dist/(size-1);
83                         lstRstX.push_back( (*lstOutX)[iGeneral] );
84                         lstRstY.push_back( (*lstOutY)[iGeneral] );
85                         lstRstZ.push_back( (*lstOutZ)[iGeneral] );
86                         for (i=iGeneral+1; i<iGeneral+size;i++)
87                         {
88                                 dist2 = 0;
89                                 for (k=iGeneral+1; k<iGeneral+size;k++)
90                                 {
91                                         dx = (*lstOutX)[k]-(*lstOutX)[k-1];
92                                         dy = (*lstOutY)[k]-(*lstOutY)[k-1];
93                                         dz = (*lstOutZ)[k]-(*lstOutZ)[k-1];
94                                         distSeg = sqrt( dx*dx + dy*dy + dz*dz );
95                                         ii = i-iGeneral;
96                                         if ( dist2+distSeg >= ii*delta )
97                                         {
98                                                 dd=(ii*delta-dist2)/distSeg;
99                                                 if (distSeg==0)
100                                                 {
101                                                         dd = 0;
102                                                 } // if distSeg == 0
103                                                 lstRstX.push_back( (*lstOutX)[k-1] + dd*dx );
104                                                 lstRstY.push_back( (*lstOutY)[k-1] + dd*dy );
105                                                 lstRstZ.push_back( (*lstOutZ)[k-1] + dd*dz );
106                                                 k=iGeneral+size;
107                                         } else {
108                                                 if ( k==iGeneral+size-1 )
109                                                 {
110                                                         dd = 1;
111                                                         lstRstX.push_back( (*lstOutX)[k-1] + dd*dx );
112                                                         lstRstY.push_back( (*lstOutY)[k-1] + dd*dy );
113                                                         lstRstZ.push_back( (*lstOutZ)[k-1] + dd*dz );
114                                                 }
115                                         }// if dist2 
116                                         dist2 = dist2+distSeg;
117                                 } // for k
118                         } //for i   
119                         if (lstRstX.size()!=size) 
120                         {
121                                 printf("EED Warnning!   ManualContourModel_Box::RedistributionPoints  >> This list is not coherent  iLstIndexOut=%d  lstRstX.size()=%d  size=%d\n",iLstIndexOut, lstRstX.size(), size);
122                         }
123                         for (i=iGeneral; i<iGeneral+size;i++)
124                         {
125                                 ii=i-iGeneral;
126                                 (*lstOutX)[i] = lstRstX[ii];
127                                 (*lstOutY)[i] = lstRstY[ii];
128                                 (*lstOutZ)[i] = lstRstZ[ii];
129                         } // for i
130                 } // if size>2
131                 iGeneral=iGeneral+size;
132         }// for iLstIndexOut
133 }
134
135
136 //-------------------------------------------------------------------------------------------------------------
137
138
139 void ManualContourModel_Box::ExtractContour(    std::vector<double> *lstX,
140                                                                                                 std::vector<double> *lstY, 
141                                                                                                 std::vector<double> *lstZ,
142                                                                                                 std::vector<int>        *lstIndexs,
143                                                                                                 int contour,
144                                                                                                 std::vector<double> *lstOutX,
145                                                                                                 std::vector<double> *lstOutY, 
146                                                                                                 std::vector<double> *lstOutZ )
147 {
148         int     i;
149 //      int     iLstIndex;
150         int     iContour;
151         int     sizeLstIndexslstIndexs;
152         int     iGeneral;
153         int     iGeneralPlusSize;
154         if ( (lstX!=NULL) &&  (lstY!=NULL) && (lstZ!=NULL) && (lstIndexs!=NULL) && (lstOutX!=NULL) && (lstOutY!=NULL) && (lstOutZ!=NULL) )
155         {
156                 sizeLstIndexslstIndexs  = (*lstIndexs).size();
157                 if  ( sizeLstIndexslstIndexs!=0 ) 
158                 {
159                         (*lstOutX).clear();
160                         (*lstOutY).clear();
161                         (*lstOutZ).clear();
162                         iGeneral                                = 0;
163                         iGeneralPlusSize                = (*lstIndexs)[0];
164                         for ( iContour=1 ; iContour<=contour ; iContour++ )
165                         {
166                                 iGeneral                        = iGeneral+(*lstIndexs)[iContour-1];
167                                 iGeneralPlusSize        = iGeneral+(*lstIndexs)[iContour];
168                         } // for iContour
169                         for ( i=iGeneral ; i<iGeneralPlusSize ; i++ )
170                         {
171                                 (*lstOutX).push_back( (*lstX)[i] );
172                                 (*lstOutY).push_back( (*lstY)[i] );
173                                 (*lstOutZ).push_back( (*lstZ)[i] );                             
174                         } //for
175                 } // size
176         } // NULL
177 }
178
179 void ManualContourModel_Box::PutPointsInContour(std::vector<double> *lstTmpX,
180                                                                                                 std::vector<double> *lstTmpY, 
181                                                                                                 std::vector<double> *lstTmpZ,
182                                                                                                 int contour,
183                                                                                                 std::vector<double> *lstOutX,
184                                                                                                 std::vector<double> *lstOutY, 
185                                                                                                 std::vector<double> *lstOutZ,
186                                                                                                 std::vector<int>        *lstOutIndexs )
187 {
188         int     i;
189 //      int     iLstIndex;
190         int     iContour;
191         int     sizeLstIndexslstIndexs;
192         int     iGeneral;
193         int     iGeneralPlusSize;
194         int     iSize;
195         int     SizeContour;
196         if ( (lstTmpX!=NULL) &&  (lstTmpY!=NULL) && (lstTmpZ!=NULL)  && (lstOutX!=NULL) && (lstOutY!=NULL) && (lstOutZ!=NULL) && (lstOutIndexs!=NULL) )
197         {
198                 sizeLstIndexslstIndexs  = (*lstOutIndexs).size();
199                 if  ( sizeLstIndexslstIndexs!=0 ) 
200                 {
201                         iGeneral                                = 0;
202                         SizeContour                             = (*lstOutIndexs)[0];
203                         iGeneralPlusSize                = iGeneral + SizeContour;
204                         for ( iContour=1 ; iContour<=contour ; iContour++ )
205                         {
206                                 iGeneral                        = iGeneral + (*lstOutIndexs)[iContour-1];
207                                 SizeContour             = (*lstOutIndexs)[iContour];
208                                 iGeneralPlusSize        = iGeneral + SizeContour;
209                         } // for iContour
210                         
211                         if(SizeContour==(*lstTmpX).size() )
212                         {
213                                 int iSize=0;
214 printf("\n ManualContourModel_Box::PutPointsInContour y=%f\n", (*lstTmpY)[0] );
215                                 for ( i=iGeneral ; i<iGeneralPlusSize ; i++ )
216                                 {
217 printf("x=%f  %f   y=%f %f  z=%f %f\n", (*lstOutX)[i], (*lstTmpX)[iSize],(*lstOutY)[i], (*lstTmpY)[iSize],(*lstOutZ)[i], (*lstTmpZ)[iSize]  );
218                                         (*lstOutX)[i] = (*lstTmpX)[iSize] ;
219                                         (*lstOutY)[i] = (*lstTmpY)[iSize] ;
220                                         (*lstOutZ)[i] = (*lstTmpZ)[iSize] ;
221                                         iSize++;                                        
222                                 } //for                 
223                         } else {
224                                 printf("EED Warnning!! ManualContourModel_Box::PutPointsInContour  the lstTmp vector is not of the correct size. SizeContour=%d  lstTmp.size=%d\n"
225                                                                                                                                                                                                                 ,SizeContour, (*lstTmpX).size() );
226                                 for ( i=iGeneral ; i<iGeneralPlusSize ; i++ )
227                                 {
228                                         (*lstOutX)[i] = -9999 ;
229                                         (*lstOutY)[i] = -9999 ;
230                                         (*lstOutZ)[i] = -9999 ;
231                                 } //for                 
232                         }
233                 } // size
234         } // NULL
235 }
236
237
238 void ManualContourModel_Box::Redistribution_SIN(        double alpha,
239                                                                                                         double beta,
240                                                                                                         std::vector<double> *lstC1X,
241                                                                                                         std::vector<double> *lstC1Y, 
242                                                                                                         std::vector<double> *lstC1Z,
243                                                                                                         double sizeOfContour,
244                                                                                                         std::vector<double> *lstC2X,
245                                                                                                         std::vector<double> *lstC2Y, 
246                                                                                                         std::vector<double> *lstC2Z  )
247 {
248         std::vector<double> lstRstX;
249         std::vector<double> lstRstY;
250         std::vector<double> lstRstZ;
251         int     ii,iGeneral;
252         int     size,iGeneralPlusSize;
253         int     i,k;
254         int     firstK;
255         double  iiByDelta;
256         double  dist2,distSeg;
257         double  dd,dx,dy,dz;
258         double  t,tt, PI;
259         double  TwoPI;
260         double  dist;
261         dist            = sizeOfContour;
262         PI                      = 3.14159265;
263         TwoPI           = 2*PI;
264         iGeneral        = 0;
265
266         size = (*lstC1X).size();
267         iGeneralPlusSize        = iGeneral+size;
268         if (size>2)
269         {
270                 firstK  = 0;                    
271                 for (i=iGeneral; i<iGeneralPlusSize;i++)                                //  For each point of one contour
272                 {
273                         ii              = i-iGeneral;
274                         dist2   = 0;
275
276                         t               = ((double)ii) / ((double)(size-1));
277                         tt              = t + 0.70710678182*sin(t*TwoPI)*beta + alpha;
278                         if (tt>=1) { tt=tt-1; }
279                         if (tt<0) { tt=tt+1; }
280                         iiByDelta = tt * dist;
281
282
283                         for (k=iGeneral; k<iGeneralPlusSize-1;k++)                      // Search inside
284                         {
285                                 dx              = (*lstC1X)[k+1]-(*lstC1X)[k];
286                                 dy              = (*lstC1Y)[k+1]-(*lstC1Y)[k];
287                                 dz              = (*lstC1Z)[k+1]-(*lstC1Z)[k];
288                                 distSeg = sqrt( dx*dx + dy*dy + dz*dz );
289                                 if ( dist2+distSeg >= iiByDelta )
290                                 {
291                                         if (distSeg==0)
292                                         {
293                                                 dd = 0;
294                                         } else {
295                                                 dd=(iiByDelta-dist2)/distSeg;
296                                         }// if distSeg == 0
297                                         lstRstX.push_back( (*lstC1X)[k] + dd*dx );
298                                         lstRstY.push_back( (*lstC1Y)[k] + dd*dy );
299                                         lstRstZ.push_back( (*lstC1Z)[k] + dd*dz );
300                                         if (ii==0) { firstK=k; }
301                                         k = iGeneralPlusSize-1;
302                                 } else {
303                                         if ( k==iGeneralPlusSize-1-1 )
304                                         {
305                                                 dd = 1;
306                                                 lstRstX.push_back( (*lstC1X)[k] + dd*dx );
307                                                 lstRstY.push_back( (*lstC1Y)[k] + dd*dy );
308                                                 lstRstZ.push_back( (*lstC1Z)[k] + dd*dz );
309                                         } // if k
310                                 }// if dist2 
311                                 dist2 = dist2 + distSeg;
312                         } // for k
313                 } //for i                       
314                 if (lstRstX.size()!=size) 
315                 {
316                         printf("EED Warnning!   ManualContourModel_Box::Redistribution_SIN  >> This list is not coherent lstRstX.size()=%d  size=%d\n", lstRstX.size(), size);
317                 }
318                 (*lstC2X).clear();
319                 (*lstC2Y).clear();
320                 (*lstC2Z).clear();
321                 for (i=iGeneral; i<iGeneralPlusSize;i++)
322                 {
323                         (*lstC2X).push_back(-1);        
324                         (*lstC2Y).push_back(-1);        
325                         (*lstC2Z).push_back(-1);        
326                 } // for i
327                 int iii;
328                 for (i=iGeneral; i<iGeneralPlusSize;i++)
329                 {
330                         ii                              = i-iGeneral;
331                         iii                             = iGeneral+ ( (i-iGeneral) + firstK) % size ;
332                         (*lstC2X)[iii]  = lstRstX[ii];
333                         (*lstC2Y)[iii]  = lstRstY[ii];
334                         (*lstC2Z)[iii]  = lstRstZ[ii];
335                 } // for i
336                 (*lstC2X)[iGeneralPlusSize-1]=(*lstC2X)[iGeneral];
337                 (*lstC2Y)[iGeneralPlusSize-1]=(*lstC2Y)[iGeneral];
338                 (*lstC2Z)[iGeneralPlusSize-1]=(*lstC2Z)[iGeneral];
339         } else {
340                 for (i=0; i<size ; i++)
341                 {
342                         (*lstC2X)[i] = (*lstC1X)[i];
343                         (*lstC2Y)[i] = (*lstC1Y)[i];
344                         (*lstC2Z)[i] = (*lstC1Z)[i];
345                 } // for i
346         }// if size>2
347 }
348
349 void ManualContourModel_Box::CopyContour2InContour1(
350                                                                                                         std::vector<double> *lstInX,
351                                                                                                         std::vector<double> *lstInY, 
352                                                                                                         std::vector<double> *lstInZ,
353                                                                                                         std::vector<double> *lstOutX,
354                                                                                                         std::vector<double> *lstOutY, 
355                                                                                                         std::vector<double> *lstOutZ )
356 {
357         int i,sizeLstInX=(*lstInX).size();
358         (*lstOutX).clear();     
359         (*lstOutY).clear();     
360         (*lstOutZ).clear();     
361         for ( i=0 ; i<sizeLstInX ; i++ )
362         {
363                 (*lstOutX).push_back( (*lstInX)[i] );
364                 (*lstOutY).push_back( (*lstInY)[i] );
365                 (*lstOutZ).push_back( (*lstInZ)[i] );
366         } // for i
367 }
368
369 double ManualContourModel_Box::IntegralDistanceTwoContours(std::vector<double> *lstTmpAX,
370                                                                                                                         std::vector<double> *lstTmpAY, 
371                                                                                                                         std::vector<double> *lstTmpAZ,
372                                                                                                                         std::vector<double> *lstTmpBX,
373                                                                                                                         std::vector<double> *lstTmpBY, 
374                                                                                                                         std::vector<double> *lstTmpBZ )
375 {
376         int     i;
377         double  dx;
378         double  dy;
379         double  dz;
380         double  dist            = 0;
381         int     iSize           = (*lstTmpAX).size();
382         for ( i=0 ; i<iSize ; i++ )
383         {
384                 dx              = (*lstTmpAX)[i]-(*lstTmpBX)[i];
385                 dy              = (*lstTmpAY)[i]-(*lstTmpBY)[i];
386                 dz              = (*lstTmpAZ)[i]-(*lstTmpBZ)[i];
387 //              dist    = dist + sqrt( dx*dx + dy*dy + dz*dz );
388                 dist    = dist +  (dx*dx + dy*dy + dz*dz) ;
389         } //for i
390         return dist;
391 }
392
393 void ManualContourModel_Box::findAlphaBetaSinDistribution(      std::vector<double> *ptrLstTmp2X,
394                                                                                                                         std::vector<double> *ptrLstTmp2Y,
395                                                                                                                         std::vector<double> *ptrLstTmp2Z ,
396                                                                                                                         int sizeContour,
397                                                                                                                         std::vector<double> *ptrLstTmp1X,
398                                                                                                                         std::vector<double> *ptrLstTmp1Y,
399                                                                                                                         std::vector<double> *ptrLstTmp1Z,  
400                                                                                                                         double *alphaOut,
401                                                                                                                         double *betaOut) 
402 {
403         std::vector<double> lstTmp2aX;
404         std::vector<double> lstTmp2aY;
405         std::vector<double> lstTmp2aZ;
406         double  alpha,iAlpha,deltaAlpha;
407         double  beta,iBeta,deltaBeta;
408         double  distAcum;
409         double  minDistAcum;
410         deltaAlpha      = 0.1 / 2;      
411         deltaBeta       = 0.01 / 2;     
412         beta            = 0.05;
413         alpha           = 0;
414         minDistAcum = 999999999999;
415         for (iAlpha=0 ; iAlpha<1; iAlpha=iAlpha+deltaAlpha ) 
416         {
417                 Redistribution_SIN( iAlpha,beta, ptrLstTmp2X,ptrLstTmp2Y,ptrLstTmp2Z ,sizeContour, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
418                 distAcum = IntegralDistanceTwoContours( ptrLstTmp1X,ptrLstTmp1Y,ptrLstTmp1Z , &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
419                 if (distAcum<minDistAcum) 
420                 {
421                         alpha           = iAlpha;
422                         minDistAcum     = distAcum;
423                 } // if integerDist
424         } // for alpha
425 // find Beta
426         minDistAcum = 999999999999;
427         for (iBeta=0.0 ; iBeta<0.2; iBeta=iBeta+deltaBeta) 
428         {
429                 Redistribution_SIN( alpha,iBeta, ptrLstTmp2X,ptrLstTmp2Y,ptrLstTmp2Z ,sizeContour, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
430                 distAcum = IntegralDistanceTwoContours( ptrLstTmp1X,ptrLstTmp1Y,ptrLstTmp1Z , &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
431                 if (distAcum<minDistAcum) 
432                 {
433                         beta            = iBeta;
434                         minDistAcum     = distAcum;
435                 } // if integerDist
436         } // for iBeta                  
437         *alphaOut       = alpha;
438         *betaOut        = beta;
439 }
440
441
442
443 double ManualContourModel_Box::SizeContour(     std::vector<double> *lstX,
444                                                                                         std::vector<double> *lstY, 
445                                                                                         std::vector<double> *lstZ)
446 {
447         int     i;
448         double  dx;
449         double  dy;
450         double  dz;
451         double  dist            = 0;
452         int     iSize           = (*lstX).size()  - 1;
453         for ( i=0 ; i<iSize ; i++ )
454         {
455                 dx      = (*lstX)[i+1]-(*lstX)[i];
456                 dy      = (*lstY)[i+1]-(*lstY)[i];
457                 dz      = (*lstZ)[i+1]-(*lstZ)[i];
458                 dist= dist+sqrt( dx*dx + dy*dy + dz*dz );
459         } //for i
460         return dist;
461 }
462
463
464
465 void ManualContourModel_Box::CalculeLstSizeContours(    std::vector<double> *lstOutX,
466                                                                                                                 std::vector<double> *lstOutY,
467                                                                                                                 std::vector<double> *lstOutZ,
468                                                                                                                 std::vector<int>        *lstIndexsOut,
469                                                                                                                 std::vector<double> *lstSizeContours    )
470 {
471         int     i;
472 //      int     iLstIndex;
473         int     iContour;
474         int     sizeLstIndexs;
475         int     iGeneral;
476         int     iGeneralPlusSize;
477         double  dx,dy,dz;
478         double  dist;
479         (*lstSizeContours).clear();
480         if ( (lstOutX!=NULL) &&  (lstOutY!=NULL) && (lstOutZ!=NULL) && (lstIndexsOut!=NULL)  )
481         {
482                 sizeLstIndexs   = (*lstIndexsOut).size();
483                 if  ( sizeLstIndexs!=0 ) 
484                 {       
485                         iGeneral                                = 0;
486                         for ( iContour=0 ; iContour<sizeLstIndexs ; iContour++ )
487                         {
488                                 dist                            = 0;
489                                 iGeneralPlusSize        = iGeneral + (*lstIndexsOut)[iContour];
490                                 for ( i=iGeneral+1 ; i<iGeneralPlusSize ; i++ )
491                                 {
492                                         dx      = (*lstOutX)[i]-(*lstOutX)[i-1] ;
493                                         dy      = (*lstOutY)[i]-(*lstOutY)[i-1] ;
494                                         dz      = (*lstOutZ)[i]-(*lstOutZ)[i-1] ;
495                                         dist= dist + sqrt( dx*dx +dy*dy + dz*dz );
496                                 } // for iGeneral
497                                 (*lstSizeContours).push_back( dist );
498                                 iGeneral = iGeneralPlusSize;
499                         } // for iContour
500                 } // sizeLstIndexs 
501         } // if lst NULL
502 }
503
504
505 void ManualContourModel_Box::RedistributionPointsAllContours_SIN(       std::vector<double> *lstOutX,
506                                                                                                                                         std::vector<double> *lstOutY, 
507                                                                                                                                         std::vector<double> *lstOutZ,
508                                                                                                                                         std::vector<int>        *lstIndexsOut )
509 {
510         std::vector<double> lstTmp1X;
511         std::vector<double> lstTmp1Y;
512         std::vector<double> lstTmp1Z;
513         std::vector<double> lstTmp2X;
514         std::vector<double> lstTmp2Y;
515         std::vector<double> lstTmp2Z;
516         std::vector<double> lstTmp2aX;
517         std::vector<double> lstTmp2aY;
518         std::vector<double> lstTmp2aZ;
519         std::vector<double> lstTmp3X;
520         std::vector<double> lstTmp3Y;
521         std::vector<double> lstTmp3Z;
522         std::vector<int>        lstContourExeption;
523         std::vector<double>     lstSizeContours;
524         int     iContour;
525         double  nbContours              = (*lstIndexsOut).size();
526         double  alpha,beta;
527         double  sizeContour1;
528         double  sizeContour2;
529         double  sizeContour3;
530         
531         CalculeLstSizeContours(lstOutX,lstOutY,lstOutZ,lstIndexsOut, &lstSizeContours);
532         
533 // ------------ Wave 1    Back to Fordward (redistribution for the little one)----------------- 
534         ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut,0,&lstTmp1X,&lstTmp1Y,&lstTmp1Z);
535 //      sizeContour1    = SizeContour( &lstTmp1X, &lstTmp1Y, &lstTmp1Z );
536         sizeContour1 = lstSizeContours[0];
537         
538 // Increment    
539         for ( iContour=0; iContour<nbContours-1 ; iContour++ )   // Back to Fordward
540         {
541                 ExtractContour( lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour+1 ,&lstTmp2X,&lstTmp2Y,&lstTmp2Z );              
542 //              sizeContour2    = SizeContour( &lstTmp2X, &lstTmp2Y, &lstTmp2Z );
543                 sizeContour2 = lstSizeContours[ iContour+1 ];
544                 
545                 if (iContour+2<nbContours)
546                 {
547 //                      ExtractContour( lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour+2 ,&lstTmp3X,&lstTmp3Y,&lstTmp3Z );              
548 //                      sizeContour3    = SizeContour( &lstTmp3X, &lstTmp3Y, &lstTmp3Z );
549                         sizeContour3 = lstSizeContours[ iContour+2 ];
550                 } else {
551                         sizeContour3=-1;
552                 }
553                 if ( (sizeContour1>sizeContour2) && (sizeContour2>sizeContour3) )
554                 {
555                         findAlphaBetaSinDistribution( &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2,  &lstTmp1X,&lstTmp1Y,&lstTmp1Z,  &alpha,&beta);
556                         Redistribution_SIN( alpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
557                           sizeContour2                                  = SizeContour( &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
558                           lstSizeContours[ iContour+1 ] = sizeContour2;
559                         PutPointsInContour(&lstTmp2aX,&lstTmp2aY,&lstTmp2aZ, iContour+1 ,lstOutX,lstOutY,lstOutZ,lstIndexsOut);                         
560                         CopyContour2InContour1( &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ , &lstTmp1X,&lstTmp1Y,&lstTmp1Z );
561                 } else {
562                         if ( (sizeContour1>sizeContour2) && (sizeContour2<sizeContour3) )  // Warning for a minimum local
563                         {
564                                 lstContourExeption.push_back( iContour-1 );
565                         } // if minimum local
566                         if ( (sizeContour1<sizeContour2) && (sizeContour2>sizeContour3) )  // Warning for a maximum local
567                         {
568                                 lstInconsistentContourY.push_back( lstTmp2Y[0] );
569                                 lstInconsistentContourID.push_back( iContour+1 );
570                         } // if maximum local
571                         CopyContour2InContour1( &lstTmp2aX,&lstTmp2Y,&lstTmp2Z , &lstTmp1X,&lstTmp1Y,&lstTmp1Z );
572                  } //if sizeContour1>sizeContour2>sizeContour3           
573                 sizeContour1 = sizeContour2;
574         } // for iContour 
575
576         
577 // ------------ Wave 2  fordward  to back  (redistribute the litle one)-----------------
578         ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut,nbContours-1,&lstTmp1X,&lstTmp1Y,&lstTmp1Z);
579 //      sizeContour1    = SizeContour( &lstTmp1X, &lstTmp1Y, &lstTmp1Z );
580         sizeContour1    = lstSizeContours[ nbContours-1 ];
581
582 // Increment    
583         for ( iContour=nbContours-1; iContour>0 ; iContour-- )  // Fordward to Back
584         {
585                 ExtractContour( lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour-1 ,&lstTmp2X,&lstTmp2Y,&lstTmp2Z );              
586 //              sizeContour2    = SizeContour( &lstTmp2X, &lstTmp2Y, &lstTmp2Z );
587                 sizeContour2    = lstSizeContours[ iContour-1 ];
588                 if (iContour-2>=0)
589                 {
590 //                      ExtractContour( lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour-2 ,&lstTmp3X,&lstTmp3Y,&lstTmp3Z );              
591 //                      sizeContour3    = SizeContour( &lstTmp3X, &lstTmp3Y, &lstTmp3Z );
592                         sizeContour3    = lstSizeContours[ iContour-2 ];
593                 } else {
594                         sizeContour3=-1;
595                 }
596                 if ( (sizeContour1>sizeContour2) && (sizeContour2>sizeContour3) )
597                 {
598                         findAlphaBetaSinDistribution( &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2,  &lstTmp1X,&lstTmp1Y,&lstTmp1Z,  &alpha,&beta);
599                         Redistribution_SIN( alpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
600                           sizeContour2                                  = SizeContour( &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
601                           lstSizeContours[ iContour-1 ] = sizeContour2;
602                         PutPointsInContour(&lstTmp2aX,&lstTmp2aY,&lstTmp2aZ, iContour-1 ,lstOutX,lstOutY,lstOutZ,lstIndexsOut);                 
603                         CopyContour2InContour1( &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ , &lstTmp1X,&lstTmp1Y,&lstTmp1Z );
604                 } else {
605                         if ( (sizeContour1>sizeContour2) && (sizeContour2<sizeContour3) )  // Warning for a minim local
606                         {
607                                 lstContourExeption.push_back( iContour-1 );
608                         } // if minimum local
609                         if ( (sizeContour1<sizeContour2) && (sizeContour2>sizeContour3) )  // Warning for a maximum local
610                         {
611                                 lstInconsistentContourY.push_back( lstTmp2Y[0] );
612                                 lstInconsistentContourID.push_back( iContour-1 );
613                         } // if Maximum local
614                         CopyContour2InContour1( &lstTmp2X,&lstTmp2Y,&lstTmp2Z , &lstTmp1X,&lstTmp1Y,&lstTmp1Z );
615                 } //if  sizeContour1>sizeContour2>sizeContour3
616                 sizeContour1 = sizeContour2;
617         } // for iContour 
618
619 // ------------ Wave 3  redistribution for the minimun detected in Wave 1 -----------------
620         double alpha1,alpha2;
621         double beta1,beta2;
622         double iExtra,sizeExtra=lstContourExeption.size();
623         for ( iExtra=0 ; iExtra<sizeExtra ; iExtra++ )
624         {        
625                 iContour = lstContourExeption[iExtra];
626                 ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour-1 , &lstTmp1X,&lstTmp1Y,&lstTmp1Z);
627                 ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour   , &lstTmp2X,&lstTmp2Y,&lstTmp2Z);
628                 ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour+1 , &lstTmp3X,&lstTmp3Y,&lstTmp3Z);
629 //              sizeContour2    = SizeContour( &lstTmp2X, &lstTmp2Y, &lstTmp2Z );
630                 sizeContour2    = lstSizeContours[ iContour  ];
631                 printf("EED Warnning!  ManualContourModel_Box::RedistributionPointsAllContours_SIN  wave3 posible inconsistent contour y=%f  iContour=%d\n", lstTmp2Y[0], iContour );
632                 lstInconsistentContourY.push_back( lstTmp2Y[0] );
633                 lstInconsistentContourID.push_back( iContour );
634                 findAlphaBetaSinDistribution( &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2,  &lstTmp1X,&lstTmp1Y,&lstTmp1Z,  &alpha1,&beta1);
635                 findAlphaBetaSinDistribution( &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2,  &lstTmp3X,&lstTmp3Y,&lstTmp3Z,  &alpha2,&beta2);
636                 if (beta2>beta1)
637                 {
638                         alpha   = alpha2;
639                 } else {
640                         alpha   = alpha1;
641                 }
642                 beta = ( beta1 + beta2 ) / 2;
643                 Redistribution_SIN( alpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
644                           sizeContour2                                  = SizeContour( &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
645                           lstSizeContours[ iContour ]   = sizeContour2;
646                 PutPointsInContour(&lstTmp2aX,&lstTmp2aY,&lstTmp2aZ,  iContour  ,lstOutX,lstOutY,lstOutZ,lstIndexsOut);
647         } // for iExtra
648
649
650 }
651  
652 void ManualContourModel_Box::ClockwisePoints(   std::vector<double> *lstInX,
653                                                                                         std::vector<double> *lstInY, 
654                                                                                         std::vector<double> *lstInZ,
655                                                                                         std::vector<int> *lstIndexsIn )
656 {
657         int     iLstIndexIn,sizeLstIndexIn=lstIndexsIn->size();
658         int     i,iGeneral=0;
659         int     size,size2;
660         double  cx,cy,cz;
661         double  px,py,pz;
662         double  backpx,backpy,backpz;
663         double  ang;
664         char    dir=-1;
665         bool    dirx,diry,dirz;
666         int     flagAng=0;
667         float   backang;
668         double  tmp;
669
670         // For each contour
671         for (iLstIndexIn=0;  iLstIndexIn<sizeLstIndexIn; iLstIndexIn++)
672         {
673                 // Step 1. Find gravity center and direction
674                 size    = (*lstIndexsIn)[iLstIndexIn];
675                 if (size>2)  // for contour with more than 2 points
676                 {
677                         cx              = 0;
678                         cy              = 0;
679                         cz              = 0;
680                         dirx    = true;
681                         diry    = true;
682                         dirz    = true;
683                         for ( i=0 ; i<size ; i++ )
684                         {
685                                 px=(*lstInX)[iGeneral+i];
686                                 py=(*lstInY)[iGeneral+i];
687                                 pz=(*lstInZ)[iGeneral+i];
688                                 cx      = px + cx;
689                                 cy      = py + cy;
690                                 cz      = pz + cz;
691                                 if (i!=0) 
692                                 { 
693                                         if (backpx!=px) { dirx=false; } 
694                                         if (backpy!=py) { diry=false; } 
695                                         if (backpz!=pz) { dirz=false; } 
696                                         backpx=px;
697                                         backpy=py;
698                                         backpz=pz;
699                                 } // if i!=0
700                                 backpx=px; 
701                                 backpy=py; 
702                                 backpz=pz; 
703                         } // for i 
704                         cx=cx/size;
705                         cy=cy/size;
706                         cz=cz/size;
707                         if (dirx==true) { dir=1; }  // YZ 
708                         if (diry==true) { dir=2; }  // XZ 
709                         if (dirz==true) { dir=0; }  // XZ 
710                         // Step 2. Find angle diference find 
711                         flagAng=0;
712                         for ( i=0 ; i<size ; i++ )
713                         {
714                                 px = (*lstInX)[iGeneral+i]-cx;
715                                 py = (*lstInY)[iGeneral+i]-cy;
716                                 pz = (*lstInZ)[iGeneral+i]-cz;
717                                 if (dir==0) { ang=atan2( py , px ); } // XY
718                                 if (dir==1) { ang=atan2( pz , py ); } // YZ
719                                 if (dir==2) { ang=atan2( pz , px ); } // XZ
720                                 if (i>0) 
721                                 { 
722                                         if (backang<ang) 
723                                         {
724                                                 flagAng++;
725                                         } else {
726                                                 flagAng--;
727                                         }// if backang<ang
728                                 } // if i
729                                 backang=ang; 
730                         } // for i 
731
732
733                         // Step 3. Invert order of points
734                         if (flagAng<0)
735                         {
736                                 size2 = size/2;
737                                 for ( i=0 ; i<size2 ; i++ )
738                                 {
739                                         tmp                                                     = (*lstInX)[iGeneral+i];
740                                         (*lstInX)[iGeneral+i]                   = (*lstInX)[iGeneral+size-1-i];
741                                         (*lstInX)[iGeneral+size-1-i]    = tmp;
742                                         tmp                                                     = (*lstInY)[iGeneral+i];
743                                         (*lstInY)[iGeneral+i]                   = (*lstInY)[iGeneral+size-1-i];
744                                         (*lstInY)[iGeneral+size-1-i]    = tmp;
745                                         tmp                                                     = (*lstInZ)[iGeneral+i];
746                                         (*lstInZ)[iGeneral+i]                   = (*lstInZ)[iGeneral+size-1-i];
747                                         (*lstInZ)[iGeneral+size-1-i]    = tmp;
748                                 } // for i
749                         } // flagAng
750                 } // size>2
751                 iGeneral = iGeneral+size;
752         } // for iLstIndexIn
753 }
754
755
756 void ManualContourModel_Box::ShiftValues(       std::vector<double> *lstInX,
757                                                                                         std::vector<double> *lstInY, 
758                                                                                         std::vector<double> *lstInZ,
759                                                                                         std::vector<int> *lstIndexsIn )
760 {
761         int iLstIndexIn,sizeLstIndexIn=lstIndexsIn->size();
762         int ii, iGeneral=0;
763         int size,size2;
764         double dist,distMin;
765         int i,iBack;
766         int ig;
767         double dx,dy,dz;
768         std::vector<double> LstTmpX;
769         std::vector<double> LstTmpY;
770         std::vector<double> LstTmpZ;
771         if (sizeLstIndexIn>=2)
772         {        
773                 for (iLstIndexIn=0;  iLstIndexIn<sizeLstIndexIn-1; iLstIndexIn++)
774                 {
775                         size  = (*lstIndexsIn)[iLstIndexIn];
776                         size2 = (*lstIndexsIn)[iLstIndexIn+1];
777                         //find min distance and  iBack
778                         distMin = 10000000;
779                         iBack   = 0;
780                     // Comparing distance between two contours  
781                     // Both contours need the same size 
782                         for (ig=0; ig<size; ig++)
783                         {
784                                 dist=0;
785                                 for ( i=0 ; i<size2 ; i++ )
786                                 {
787                                         dx      = (*lstInX)[iGeneral+i]-(*lstInX)[iGeneral+size+(i+ig)%size];
788                                         dy      = (*lstInY)[iGeneral+i]-(*lstInY)[iGeneral+size+(i+ig)%size];
789                                         dz      = (*lstInZ)[iGeneral+i]-(*lstInZ)[iGeneral+size+(i+ig)%size];
790                                         dist= dist + sqrt( dx*dx + dy*dy + dz*dz );
791                                 } // for i size2
792                                 if ( dist<distMin ) 
793                                 {
794                                         iBack   = ig+size;
795                                         distMin = dist;
796                                 }                       
797                         } // for ig size                        
798                         if (iBack!=0)
799                         {
800                                 LstTmpX.clear();
801                                 LstTmpY.clear();
802                                 LstTmpZ.clear();
803                                 for (i=0 ; i<size2 ; i++) 
804                                 {
805                                         ii = (i+iBack)%size2;
806                                         if (ii<(size2-1)) // Skip the last item
807                                         {
808                                                 LstTmpX.push_back( (*lstInX)[iGeneral+size+ii] );
809                                                 LstTmpY.push_back( (*lstInY)[iGeneral+size+ii] );
810                                                 LstTmpZ.push_back( (*lstInZ)[iGeneral+size+ii] );
811                                         }
812                                 } // for i
813                                 //Repeat the first item at the end to close the contour
814                                 LstTmpX.push_back( LstTmpX[0] );
815                                 LstTmpY.push_back( LstTmpY[0] );
816                                 LstTmpZ.push_back( LstTmpZ[0] );
817                                 for (i=0 ; i<size2 ; i++) 
818                                 {
819                                         (*lstInX)[iGeneral+size+i] = LstTmpX[i];
820                                         (*lstInY)[iGeneral+size+i] = LstTmpY[i];
821                                         (*lstInZ)[iGeneral+size+i] = LstTmpZ[i];
822                                 } // for i                              
823                         }
824                         iGeneral=iGeneral+size;
825                 } // for iLstIndexIn
826         } // if sizeLstIndexIn
827 }
828
829
830
831 void ManualContourModel_Box::Process()
832 {
833 // THE MAIN PROCESSING METHOD BODY
834 //   Here we simply set the input 'In' value to the output 'Out'
835 //   And print out the output value
836 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
837 //    void bbSet{Input|Output}NAME(const TYPE&)
838 //    const TYPE& bbGet{Input|Output}NAME() const 
839 //    Where :
840 //    * NAME is the name of the input/output
841 //      (the one provided in the attribute 'name' of the tag 'input')
842 //    * TYPE is the C++ type of the input/output
843 //      (the one provided in the attribute 'type' of the tag 'input')
844
845 //    bbSetOutputOut( bbGetInputIn() );
846 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
847
848         if (bbGetInputActive()==true)
849         {
850                 lstInconsistentContourY.clear();
851                 lstInconsistentContourID.clear();
852
853                 // First Step  Spline Interpolation
854                 std::vector<double> lstInX=bbGetInputLstControlPointsX();
855                 std::vector<double> lstInY=bbGetInputLstControlPointsY();
856                 std::vector<double> lstInZ=bbGetInputLstControlPointsZ();
857                 if ( (lstInX.size()!=lstInY.size()) || (lstInY.size()!=lstInZ.size()) ) 
858                 { 
859                         printf("Warnning !!  .. ManualContourModel_Box: The list X Y Z, no have the same number of elements \n");
860                         return;
861                 }
862                 std::vector<int>        lstIndexsIn=bbGetInputLstIndexsIn();
863                 std::vector<int>        lstIndexsOut;
864                 std::vector<double> lstOutX;
865                 std::vector<double> lstOutY;
866                 std::vector<double> lstOutZ;
867                 if (bbGetInputLstIndexsIn().size()==0)
868                 {
869                         lstIndexsIn.push_back( lstInX.size() );
870                 }
871                 
872         // Step 1.  All contours the same clockwise direction (Control Points)
873                 if (bbGetInputDoubleContour()==1)
874                 {
875                         ClockwisePoints( &lstInX , &lstInY , &lstInZ , &lstIndexsIn );
876         //              ShiftValues( &lstInX , &lstInY , &lstInZ , &lstIndexsIn );
877                 } // DoubleContour
878                 int i,size      = lstIndexsIn.size();
879                 int iGeneral= 0;
880                 
881         // Step 2.  Spline interpolation of control points      
882                 for (i=0;i<size;i++)
883                 {
884                         ProcessBySegment(       bbGetInputType() , 
885                                                                 iGeneral,  lstIndexsIn[i] ,
886                                                                 &lstInX ,  &lstInY  , &lstInZ,
887                                                                 &lstOutX , &lstOutY , &lstOutZ,
888                                                                 &lstIndexsOut,bbGetInputOpenClose() );
889                 } // for
890
891                 if (bbGetInputDoubleContour()==0)
892                 {
893         // Finish if Simple contours
894                         //////////////////// Set Out   DoubleContour = 0
895                         bbSetOutputLstContourPointsX(lstOutX);  
896                         bbSetOutputLstContourPointsY(lstOutY);  
897                         bbSetOutputLstContourPointsZ(lstOutZ);
898                         bbSetOutputLstIndexsOut(lstIndexsOut);  
899                 } else {
900         // Step 3. Interpolation in the other direction
901         // Step 3.1 Linear Normalice points around contours     
902                         RedistributionPoints(&lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
903         //EED 01/2021           
904         // Step 3.2 Shift points to find minimun acumulate distance     
905                         ShiftValues( &lstOutX, &lstOutY, &lstOutZ, &lstIndexsOut );
906         // Step 3.3. SIN Normalice points around contours       
907                         if (bbGetInputParam().size()>=1)
908                         {
909                                 if (bbGetInputParam()[0]==1)
910                                 {
911                                                 RedistributionPointsAllContours_SIN( &lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
912                                                 ShiftValues( &lstOutX, &lstOutY, &lstOutZ, &lstIndexsOut );
913                                 } // if 1
914                         } // if size
915         // Step 3.4 Transpose the vectors   
916                         lstInX.clear();
917                         lstInY.clear();
918                         lstInZ.clear();
919                         lstIndexsIn.clear();
920                         size  = bbGetInputNbPoints();
921                         int j,size2 = lstIndexsOut.size();
922                         for (i=0;i<size;i++)
923                         {
924                                 for (j=0;j<size2;j++)
925                                 {
926                                         lstInX.push_back( lstOutX[ j*lstIndexsOut[j] + i ] );
927                                         lstInY.push_back( lstOutY[ j*lstIndexsOut[j] + i ] );
928                                         lstInZ.push_back( lstOutZ[ j*lstIndexsOut[j] + i ] );
929                                 } // for j
930                                 lstIndexsIn.push_back( size2 );
931                         } // for i
932                         lstOutX.clear();
933                         lstOutY.clear();
934                         lstOutZ.clear();
935                         lstIndexsOut.clear();
936         // Step 3.5 Interponation 2
937                         size=lstIndexsIn.size();
938                         iGeneral=0;
939                         for (i=0;i<size;i++)
940                         {
941                                 ProcessBySegment(       bbGetInputType() , 
942                                                                         iGeneral, lstIndexsIn[i] ,
943                                                                         &lstInX,&lstInY,&lstInZ,
944                                                                         &lstOutX,&lstOutY,&lstOutZ,
945                                                                         &lstIndexsOut,bbGetInputOpenClose2());
946                         } // for
947                         RedistributionPoints(&lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
948         // Step 3.6 Transpose the vectors   
949                         lstInX.clear();
950                         lstInY.clear();
951                         lstInZ.clear();
952                         lstIndexsIn.clear();
953                         size  = bbGetInputNbPoints();
954                         size2 = lstIndexsOut.size();
955                         for (i=0;i<size;i++)
956                         {
957                                 for (j=0;j<size2;j++)
958                                 {
959                                         lstInX.push_back( lstOutX[ j*lstIndexsOut[j] + i ] );
960                                         lstInY.push_back( lstOutY[ j*lstIndexsOut[j] + i ] );
961                                         lstInZ.push_back( lstOutZ[ j*lstIndexsOut[j] + i ] );
962                                 } // for j
963                                 lstIndexsIn.push_back( size2 );
964                         } // for i
965                         lstOutX.clear();
966                         lstOutY.clear();
967                         lstOutZ.clear();
968                         lstIndexsOut.clear();
969                         //////////////////// Set Out   DoubleContour = 1
970                         bbSetOutputLstContourPointsX( lstInX ); 
971                         bbSetOutputLstContourPointsY( lstInY ); 
972                         bbSetOutputLstContourPointsZ( lstInZ );
973                         bbSetOutputLstIndexsOut( lstIndexsIn ); 
974                         bbSetOutputLstPssblIncnsnstntCntrY( lstInconsistentContourY );
975                         bbSetOutputLstPssblIncnsnstntCntrID( lstInconsistentContourID );
976                 } // if DoubleContour 
977         } // if Active
978 }
979 //===== 
980 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
981 //===== 
982 void ManualContourModel_Box::bbUserSetDefaultValues()
983 {
984 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
985 //    Here we initialize the input 'In' to 0
986    bbSetInputActive(true);
987    bbSetInputType(1);   
988    bbSetInputDoubleContour(0);
989    bbSetInputOpenClose(false);
990    bbSetInputOpenClose2(false);
991    bbSetInputNbPoints(100); 
992 }
993 //===== 
994 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
995 //===== 
996 void ManualContourModel_Box::bbUserInitializeProcessing()
997 {
998 //  THE INITIALIZATION METHOD BODY :
999 //    Here does nothing 
1000 //    but this is where you should allocate the internal/output pointers 
1001 //    if any 
1002 }
1003 //===== 
1004 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
1005 //===== 
1006 void ManualContourModel_Box::bbUserFinalizeProcessing()
1007 {
1008 //  THE FINALIZATION METHOD BODY :
1009 //    Here does nothing 
1010 //    but this is where you should desallocate the internal/output pointers 
1011 //    if any 
1012 }
1013 } // EO namespace bbcreaMaracasVisu
1014
1015