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