]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx
10e04156dc251ce1914f30ecb440173da28a4e72
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / Contour / ContourExtractData.cxx
1
2 #include "ContourExtractData.h"
3
4
5 //----------------------------------------------------------------------
6 ContourExtractData::ContourExtractData( bool okImagesResults)
7   {
8     this->imagedata                     = NULL;
9         imagedataValueResult    = NULL;
10         imagedataMaskResult             = NULL;
11         this->okImagesResults   = okImagesResults;
12         _typeOperation                  = 0;
13   }
14
15   // ------------------------------------------------------------------------
16
17   ContourExtractData::~ContourExtractData()
18   {
19   }
20
21
22 //----------------------------------------------------------------------
23 void ContourExtractData::SetImage( vtkImageData* imagedata)
24   {
25         this->imagedata                 = imagedata;
26                 
27         // init vtk image result : valuesImage maskImage  
28         if (this->okImagesResults==true){  InitVtkImagesResult(); }
29   }
30 //----------------------------------------------------------------------
31 void ContourExtractData::SetZtoBeAnalys( int z )
32   {
33         this->zImage                    = z;
34   }
35
36 //------------------------------------------------------------------------
37   void ContourExtractData::SetLstManualContourModel( std::vector<manualBaseModel*> lstManConMod)
38   {
39           this->lstManConMod = lstManConMod;
40   }
41
42
43 //------------------------------------------------------------------------
44 void ContourExtractData::GetMinMaxPoint(int *minPoint, 
45                                                                                   int *maxPoint, 
46                                                                                   manualBaseModel *manualcontourmodel
47                                                                                   )
48 {
49         int i;
50         //int   np              = manualcontourmodel->GetSizeLstPoints( );  // number of control points // JPRx
51                 
52 // JSTG 26-02-08 ---------------------------------------------------------------------------------------
53         //int nps = manualviewbaseecontour->GetNumberOfPointsSpline(); // number of points in the spline
54         int nps = manualcontourmodel->GetNumberOfPointsSpline(); // number of points in the spline
55 //------------------------------------------------------------------------------------------------------
56         
57 // JSTG 26-02-08 ---------------------------------------------------------------------------------------
58         //double x,y,z,t;
59         double x,y,z;
60         //double delta=( double ) ( np  ) / ( double ) ( nps  );
61         manualcontourmodel->UpdateSpline();
62         for (i=0; i<nps; i++)
63         {
64                 //t= delta * (double)i;
65                 //manualcontourmodel->GetSplinePoint(t,x,y,z);
66                 manualcontourmodel->GetSpline_i_Point(i,&x,&y,&z);
67                 if (x<minPoint[0]){ minPoint[0]=(int)x; }
68                 if (y<minPoint[1]){ minPoint[1]=(int)y; }
69                 if (x>maxPoint[0]){ maxPoint[0]=(int)x; }
70                 if (y>maxPoint[1]){ maxPoint[1]=(int)y; }
71         }
72         minPoint[0]--;
73         minPoint[1]--;
74         maxPoint[0]++;
75         maxPoint[1]++;
76 //------------------------------------------------------------------------------------------------------
77 }
78
79 //------------------------------------------------------------------------
80 void ContourExtractData::GetMinMaxPoint_Of_LstManConMod(        int *minPoint, 
81                                                                                         int *maxPoint
82                                                                                 )
83
84 {
85         int i,size = lstManConMod.size();
86
87         for(i=0 ; i<size ; i++)
88         {
89                 GetMinMaxPoint(minPoint,maxPoint,lstManConMod[i]);
90         }
91 }
92
93
94 //------------------------------------------------------------------------
95 int ContourExtractData::AnalisisContourInsideV2(int x, int y, int iContour )
96 {
97         bool inBorder=false;
98         int result      = 0;
99         int i;
100
101         int nps=_lstlstlstVecX1[iContour][y].size();
102         
103         double x1,y1,x2,y2;
104         double borderX, borderY;
105         double xx1, yy1,xx2, yy2;
106         double xx=x, yy=y;
107         double d;
108
109         for (i=0; i<nps; i++)
110         {
111                 x1=_lstlstlstVecX1[iContour][y][i];
112                 y1=_lstlstlstVecY1[iContour][y][i];
113                 x2=_lstlstlstVecX2[iContour][y][i];
114                 y2=_lstlstlstVecY2[iContour][y][i];
115
116                 borderX=x1;
117                 borderY=y1;
118                 
119                 if (y1<y2) 
120                 { 
121                         xx1=x1; yy1=y1; xx2=x2; yy2=y2;
122                 } else {
123                         xx1=x2; yy1=y2; xx2=x1; yy2=y1; 
124                 } 
125                 
126                 double difxx2xx1=fabs(xx2-xx1);
127                 if (difxx2xx1==0) difxx2xx1=0.0000000001;
128                 
129                 // Finding border looking in vertical direction  AND  verifing if pixel is at right of the line 
130                 if  ( (yy>=yy1)&&(yy<=yy2) ) 
131                 {
132                         //by triangle similarity
133                         d = ( fabs(xx2-xx1)*(yy-yy1) ) / (yy2-yy1) ;
134                         if ( (xx1<=xx2)&&(x<(xx1+d)) )  {       result++;       }
135                         if ( (xx1>xx2)&&(x<(xx1-d)) )   {       result++;       } 
136                         
137                         if ( (yy2-yy1)/difxx2xx1 >= 1.0)
138                         {
139                                 if (xx1<=xx2)   
140                                 { 
141                                         borderX = xx1+d;
142                                         borderY = y;
143                                 } else { 
144                                         borderX = xx1-d;
145                                         borderY = y;
146                                 } 
147                         } 
148                 } // if point inside y 
149                 
150                 
151                 // Finding border looking in vertical direction
152                 if ( ((xx1<=xx2)&&(xx>=xx1)&&(xx<xx2)) || ((xx1>xx2)&&(xx>=xx2)&&(xx<xx1)) )
153                 {
154                         if ( (yy2-yy1)/difxx2xx1 <= 1.0)
155                         {
156                                 //by triangle similarity
157                                 d = ( fabs(xx1-xx)*(yy2-yy1) ) / difxx2xx1;
158                                 if (yy1+d<=yy2) {
159                                         borderX=x;
160                                         borderY=yy1+d;
161                                 }
162                         }                       
163                 } // if point inside x                  
164                 
165                 
166                 //Border verification
167                 if (   (x==(int)borderX) && (y==(int)borderY)   )  { inBorder=true; }// if point in border
168                 
169                 // Verification : border in horizontal line 
170                 if ( ((int)y1==(int)y2)  &&  ((int)y1==y) && (x1<x2) && (x>=x1) && (x<=x2))             { inBorder=true;        }
171                 if ( ((int)y1==(int)y2)  &&  ((int)y1==y) && (x2<x1) && (x>=x2) && (x<=x1))             { inBorder=true;        }
172                 
173                 if (inBorder==true){ i=nps; }           
174         } // for i
175         
176         if (inBorder==true)     { result=1;     }
177         
178         return result;
179 }
180
181
182
183 //------------------------------------------------------------------------
184 bool ContourExtractData::isInside(int x, int y, int typeOperation)
185 {
186         bool result                             = false;
187         int numberLeft                  = 0;
188         int i,size                              = this->lstManConMod.size();
189         int numberInside        = 0;
190
191         int ext[6];
192         imagedata->GetExtent(ext);
193
194         if ((x>=0) && (x<=ext[1]) && (y>=0) && (y<=ext[3]))
195         {
196
197                 if (typeOperation==0)  // AND  Intersection
198                 {
199                         for (i=0;i<size;i++)
200                         {
201                                 // To process the statistics of the Points contour the procedure is different
202                                 // RaC 19-09-09
203                                 manualBaseModel *mbm = lstManConMod[i];
204                                 if(mbm->GetTypeModel()==7)
205                                 {
206                                         if(mbm->IsPoint(x,y)==true)
207                                         {
208                                                 numberLeft=1;
209                                         }
210                                 }//if
211                                 else
212                                 {
213                                         numberLeft =  AnalisisContourInsideV2(x,y, i );
214                                 }//else
215
216                                 if ( (numberLeft % 2) ==1){         numberInside++;  }
217                         }
218                         if ( numberInside == (size) ){ result=true; }
219                 } // AND  Intersection
220
221                 numberLeft=0;
222
223                 if (typeOperation==1)  // OR  All
224                 {
225                         for (i=0;i<size;i++)
226                         {
227                                 // To process the statistics of the Points contour the procedure is different
228                                 // RaC 19-09-09
229                                 manualBaseModel *mbm = lstManConMod[i];
230                                 if(mbm->GetTypeModel()==7)
231                                 {
232                                         if(mbm->IsPoint(x,y)==true)
233                                         {
234                                                 numberLeft=1;
235                                         }
236                                 }//if
237                                 else
238                                 {
239                                         numberLeft =  AnalisisContourInsideV2(x,y, i );
240                                 }//else
241                                 if ( (numberLeft % 2) ==1){ result=true;  }
242                         }
243                 } // OR  All
244
245                 numberLeft=0;
246
247                 if (typeOperation==2)  // XOR  crown
248                 {
249                         for (i=0;i<size;i++)
250                         {
251                                 // To process the statistics of the Points contour the procedure is different
252                                 // RaC 19-09-09
253                                 manualBaseModel *mbm = lstManConMod[i];
254                                 if(mbm->GetTypeModel()==7)
255                                 {
256                                         if(mbm->IsPoint(x,y)==true)
257                                         {
258                                                 numberLeft=1;
259                                         }
260                                 }//if
261                                 else
262                                 {
263                                         numberLeft =  numberLeft + AnalisisContourInsideV2(x,y, i );
264                                 }//else
265                                 
266                         }
267                         if ( numberLeft % 2 ==1){       result = true;  } 
268                 }// XOR  crown
269
270
271
272         }
273
274         return result;
275 }
276
277 //------------------------------------------------------------------------
278
279 double ContourExtractData::GetDataValue(int x, int y, int z)
280 {
281 //      wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)wxvtkbaseview;
282 //      int z = (int)wxvtk2dbaseview->GetVtkBaseData()->GetZ();
283         //JSTG 13-03-08-----
284 //EED OJO avec JS       _zz = z;
285         //------------------
286         double result;
287         void *p;
288         p = imagedata->GetScalarPointer(x,y,z);
289
290         if (imagedata->GetScalarType()==VTK_CHAR)
291         {
292                 char *pp = (char*)p;
293                 result = (double)(*pp);
294         }
295         else if (imagedata->GetScalarType()==VTK_SIGNED_CHAR)
296         {
297                 signed char *pp = (signed char*)p;
298                 result = (double)(*pp);
299         }
300         else if (imagedata->GetScalarType()==VTK_UNSIGNED_CHAR)
301         {
302                 unsigned char *pp = (unsigned char*)p;
303                 result = (double)(*pp);
304         }
305         else if (imagedata->GetScalarType()==VTK_SHORT)
306         {
307                 short *pp = (short*)p;
308                 result = (double)(*pp);
309         }
310         else if (imagedata->GetScalarType()==VTK_UNSIGNED_SHORT)
311         {
312                 unsigned short *pp = (unsigned short*)p;
313                 result = (double)(*pp);
314         }
315         else if (imagedata->GetScalarType()==VTK_INT)
316         {
317                 int *pp = (int*)p;
318                 result = (double)(*pp);
319         }
320         else if (imagedata->GetScalarType()==VTK_UNSIGNED_INT)
321         {
322                 unsigned int *pp = (unsigned int*)p;
323                 result = (double)(*pp);
324         }
325         else if (imagedata->GetScalarType()==VTK_LONG)
326         {
327                 long *pp = (long*)p;
328                 result = (double)(*pp);
329         }
330         else if (imagedata->GetScalarType()==VTK_UNSIGNED_LONG)
331         {
332                 unsigned long *pp = (unsigned long*)p;
333                 result = (double)(*pp);
334         }
335         else if (imagedata->GetScalarType()==VTK_FLOAT)
336         {       
337                 float *pp = (float*)p;
338                 result = (double)(*pp);
339         }
340         else if (imagedata->GetScalarType()==VTK_DOUBLE)
341         {
342                 double *pp = (double*)p;
343                 result = (double)(*pp);
344         }
345
346         return result;
347 }
348
349 //------------------------------------------------------------------------
350
351 void ContourExtractData::PutVtkImageDataResultValue( int x, int y, int z, double value )
352 {
353         unsigned short *pValue;
354         unsigned short *pMask;
355         pValue  = (unsigned short *)imagedataValueResult->GetScalarPointer(x,y,z);
356         pMask   = (unsigned short *)imagedataMaskResult->GetScalarPointer(x,y,z);
357         *pMask  = 255;
358         *pValue = (unsigned short)value;
359 }
360
361 //------------------------------------------------------------------------
362 void ContourExtractData::ResetImageResult(int z)
363 {
364         if (okImagesResults==true)
365         {
366                 unsigned short *pValue;
367                 unsigned short *pMask;
368                 pValue  = (unsigned short *)imagedataValueResult->GetScalarPointer(0,0,z);
369                 pMask   = (unsigned short *)imagedataMaskResult->GetScalarPointer(0,0,z);
370                 
371                 int ext[6];
372                 imagedataValueResult->GetExtent(ext);
373
374                 int size = (ext[1]-ext[0]+1) * (ext[3]-ext[2]+1); 
375                 memset(pValue,0,size*2);
376                 memset(pMask,0,size*2);
377         } // if
378 }
379
380
381 //------------------------------------------------------------------------
382 void ContourExtractData::CalculateImageResult()
383 {
384         if (okImagesResults==true)
385         {
386                 ResetImageResult(zImage);
387
388                 int minPoint[2];
389                 int maxPoint[2];
390                 int i,j;
391                 double value;
392
393                 minPoint[0] = 999999;
394                 minPoint[1] = 999999;
395                 maxPoint[0] = -999999;
396                 maxPoint[1] = -999999;
397
398                 GetMinMaxPoint_Of_LstManConMod(minPoint,maxPoint);
399                 InitLstContoursLinesYPoints();
400                 
401                 for (j=minPoint[1]; j<=maxPoint[1]; j++)
402                 {
403                         for (i=minPoint[0]; i<=maxPoint[0]; i++)
404                         {
405                                 if (isInside(i,j,_typeOperation)==true)
406                                 {
407                                         value = GetDataValue(i,j,zImage);
408                                         PutVtkImageDataResultValue(i,j,zImage,  value );
409                                 } // if
410                         } // for i
411                 } // for j
412
413
414                 imagedataValueResult->Modified();
415                 imagedataMaskResult->Modified();
416                 imagedataValueResult->Update();
417                 imagedataMaskResult->Update();
418         } // if
419
420 }
421
422 //------------------------------------------------------------------------
423 void ContourExtractData::GetValuesInsideCrown(std::vector<double> *pLstValue,
424                                                                                                 std::vector<double> *pLstValuePosX,
425                                                                                                 std::vector<double> *pLstValuePosY,
426                                                                                                 std::vector<double> *pLstValuePosZ)
427 {
428         pLstValue->clear();
429         pLstValuePosX->clear();
430         pLstValuePosY->clear();
431         pLstValuePosZ->clear();
432
433 //      if (okImagesResults==true)
434 //      {
435 //              ResetImageResult(zImage);
436 //      }
437
438         int minPoint[2];
439         int maxPoint[2];
440         int i,j;
441         double value;
442
443
444         minPoint[0] = 999999;
445         minPoint[1] = 999999;
446         maxPoint[0] = -999999;
447         maxPoint[1] = -999999;
448
449         GetMinMaxPoint_Of_LstManConMod(minPoint,maxPoint);
450     InitLstContoursLinesYPoints();
451
452         for (j=minPoint[1]; j<=maxPoint[1]; j++)
453         {
454                 for (i=minPoint[0]; i<=maxPoint[0]; i++)
455                 {
456                         if (isInside(i,j,_typeOperation)==true)
457                         {
458                                 value = GetDataValue(i,j,zImage);
459
460 // Borrame
461 //                              if (okImagesResults==true){
462 //                                      PutVtkImageDataResultValue(i,j,zImage,  value );
463 //                              }
464
465                                 pLstValue               -> push_back( value );
466                                 pLstValuePosX   -> push_back( i );
467                                 pLstValuePosY   -> push_back( j );
468                                 pLstValuePosZ   -> push_back( -1 );
469                         } // if
470                 } // for
471         } // for
472
473 // Borrame
474 //      if (this->okImagesResults==true){
475 //              imagedataValueResult->Modified();
476 //              imagedataMaskResult->Modified();
477 //      }
478
479
480 }
481
482 //------------------------------------------------------------------------
483
484 vtkImageData *ContourExtractData::GetVtkImageValueResult()
485 {
486         return imagedataValueResult;
487 }
488 //------------------------------------------------------------------------
489 vtkImageData *ContourExtractData::GetVtkImageMaskResult()
490 {
491         return imagedataMaskResult;
492 }
493 // ------------------------------------------------------------------------
494 void ContourExtractData::InitVtkImagesResult()
495 {
496           int ext[6];
497           int newDim[3];
498           double spc[3];
499           int scalartype;
500
501           imagedata->GetSpacing(spc);
502           imagedata->GetExtent(ext);
503           newDim[0]=ext[1]-ext[0]+1;
504           newDim[1]=ext[3]-ext[2]+1;
505           newDim[2]=ext[5]-ext[4]+1;
506           scalartype = imagedata->GetScalarType();
507
508           if (imagedataValueResult!=NULL)
509           {
510                   imagedataValueResult->Delete();
511           }
512           imagedataValueResult = vtkImageData::New();
513 //        imagedataValueResult->SetScalarType(scalartype);
514           imagedataValueResult->SetScalarTypeToUnsignedShort();
515           imagedataValueResult->SetSpacing(spc);
516           imagedataValueResult->SetDimensions( newDim );
517           imagedataValueResult->AllocateScalars();
518
519           if (imagedataMaskResult!=NULL)
520           {
521                   imagedataMaskResult->Delete();
522           }
523           imagedataMaskResult  = vtkImageData::New();
524 //        imagedataMaskResult->SetScalarType(scalartype);
525           imagedataMaskResult->SetScalarTypeToUnsignedShort();
526           imagedataMaskResult->SetSpacing(spc);
527           imagedataMaskResult->SetDimensions( newDim );
528           imagedataMaskResult->AllocateScalars();
529 }
530
531
532 //------------------------------------------------------------------------
533 void ContourExtractData::InitVolumeStatistics()
534 {
535         vol_rCountRange                         = 0;
536         vol_rsize                                       = 0;
537         vol_minValue                            = 9999999;
538         vol_maxValue                            =-9999999;
539         vol_acum_average                        = 0;
540         vol_acum_standardeviation       = 0;
541 }
542
543 //------------------------------------------------------------------------
544 void ContourExtractData::SetVolumeStatistics(int rCountRange, 
545                                                                                         int rsize,
546                                                                                         double minValue,
547                                                                                         double maxValue,
548                                                                                         double acum_average,
549                                                                                         double acum_standardeviation)
550 {
551         vol_rCountRange                         = vol_rCountRange + rCountRange; 
552         vol_rsize                                       = vol_rsize + rsize; 
553         
554         if (minValue<vol_minValue){ vol_minValue = minValue;  }
555         if (maxValue>vol_maxValue){ vol_maxValue = maxValue;  }
556         
557         vol_acum_average                        = vol_acum_average + acum_average; 
558         vol_acum_standardeviation       = vol_acum_standardeviation + acum_standardeviation; 
559 }
560
561 //------------------------------------------------------------------------
562 void ContourExtractData::GetVolumeStatistics(int *vol_rCountRange, 
563                                                                                          int *vol_rsize,
564                                                                                          double *vol_minValue,
565                                                                                          double *vol_maxValue,
566                                                                                          double *vol_average,
567                                                                                          double *vol_standardeviation)
568 {
569         *vol_rCountRange                = this->vol_rCountRange; 
570         *vol_rsize                              = this->vol_rsize; 
571         *vol_minValue                   = this->vol_minValue; 
572         *vol_maxValue                   = this->vol_maxValue; 
573         *vol_average                    = this->vol_acum_average / this->vol_rsize;
574         *vol_standardeviation   = sqrt(this->vol_acum_standardeviation / this->vol_rsize);
575 }
576
577
578 //------------------------------------------------------------------------
579 void ContourExtractData::Statistics( std::vector<double> *inputLstValue, 
580                                                                         int     grayRangeMin,
581                                                                         int     grayRangeMax,
582                                                                         int             *rCountRange, 
583                                                                         int             *rsize, 
584                                                                         double  *rmin, 
585                                                                         double  *rmax,
586                                                                         double  *raverage,
587                                                                         double  *rstandardeviation
588                                                                                 )
589 {
590           double min                                            = 0;
591           double max                                            = 0;
592           double average                                        = 0;
593           double standardeviation                       = 0;
594           double acum_average                           = 0;
595           double acum_standardeviation          = 0;
596           int    size                                           = 0;
597           int    countRange                                     = 0;
598           double ng;
599
600           if (inputLstValue!=NULL)
601           {
602                 size=inputLstValue->size();
603                 if (size>0){
604                max=(*inputLstValue)[0];
605                    min=(*inputLstValue)[0];
606      // Average , countRange
607                         int i;
608                         for ( i=0; i<size; i++ )
609                         {
610                                 ng=(*inputLstValue)[i];
611                                 acum_average = acum_average + ng;
612                                 if (max<ng) max=ng;             // Max
613                                 if (min>ng) min=ng;     // Min
614                                 if ((ng>=grayRangeMin) && (ng<=grayRangeMax)) countRange++;  // countRange
615                         } // for average
616                         average = acum_average / size;
617
618           // Standar Deviation
619                         acum_standardeviation=0;
620                         double tmp;
621                         for ( i=0; i<size; i++ )
622                         {
623                 tmp = (*inputLstValue)[i] - average;
624                                 acum_standardeviation = acum_standardeviation + tmp*tmp;
625                         } // for standar deviation
626                         standardeviation = sqrt(acum_standardeviation/size);
627                         SetVolumeStatistics(countRange, size,
628                                                                 min,max,
629                                                             acum_average,acum_standardeviation);
630                 } // if size
631           } // if NULL
632
633           // OUTPUT
634                 *rsize                          = size; 
635                 *rCountRange            = countRange;
636                 *rmin                           = min; 
637                 *rmax                           = max;
638                 *raverage                       = average;
639                 *rstandardeviation      = standardeviation;
640 }
641
642 //------------------------------------------------------------------------
643 void ContourExtractData::SetTypeOperation(int type)
644 {
645         _typeOperation=type;
646 }
647
648 //------------------------------------------------------------------------
649 void ContourExtractData::Fill_lstlstlstVecXY(int iContour, int sizeY)
650 {
651         int i,y;
652         double x1,y1,z1,x2,y2,z2;
653         manualBaseModel *manualcontourmodel= lstManConMod[iContour];    
654         int nps = manualcontourmodel->GetNumberOfPointsSpline(); // number of points in the spline
655         manualcontourmodel->UpdateSpline();
656         //------------------------------------------------------------------------------------------------------
657         
658         for (y=0;y<sizeY;y++)
659         {
660                 manualcontourmodel->GetSpline_i_Point(0,&x1,&y1,&z1);
661                 x1=x1+0.5; y1=y1+0.5;
662                 for (i=1; i<nps; i++)
663                 {
664                         manualcontourmodel->GetSpline_i_Point(i,&x2,&y2,&z2);
665                         x2=x2+0.5; y2=y2+0.5;
666                         if ( ((y1<y2)&&(y>=y1)&&(y<=y2)) || ((y1>y2)&&(y>=y2)&&(y<=y1)) || ((int)y1==y) || ((int)y2==y)  )
667                         {
668                                 _lstlstlstVecX1[iContour][y].push_back(x1);
669                                 _lstlstlstVecY1[iContour][y].push_back(y1);
670                                 _lstlstlstVecX2[iContour][y].push_back(x2);
671                                 _lstlstlstVecY2[iContour][y].push_back(y2);
672                         } 
673                         x1=x2; y1=y2; z1=z2;
674                 } // for i  Points in spline
675         } // y
676
677 }
678
679 void ContourExtractData::InitLstContoursLinesYPoints()
680 {
681         // init InInside Optimisation  
682         int i;
683         
684         _lstlstlstVecX1.clear();
685         _lstlstlstVecY1.clear();
686         _lstlstlstVecX2.clear();
687         _lstlstlstVecY2.clear();
688         
689         int ext[6];
690         this->imagedata->GetWholeExtent(ext);
691         int sizeY = ext[3]-ext[2]+1;
692         std::vector<double> vecDouble;
693         std::vector< std::vector<double> > vecVecDouble;
694         for ( i=0 ; i<sizeY ; i++ )
695         {
696                 vecVecDouble.push_back( vecDouble );
697         }
698         
699         //Fill structure with points
700         int sizeContours = lstManConMod.size();
701         for( i=0 ; i<sizeContours ; i++ )
702         {
703                 _lstlstlstVecX1.push_back( vecVecDouble );
704                 _lstlstlstVecY1.push_back( vecVecDouble );
705                 _lstlstlstVecX2.push_back( vecVecDouble );
706                 _lstlstlstVecY2.push_back( vecVecDouble );
707                 Fill_lstlstlstVecXY(i,sizeY);
708         }
709         
710 }
711
712