ContourExtractData Class Reference

#include <ContourExtractData.h>

List of all members.

Public Member Functions

 ContourExtractData (bool imagesResults=false)
 ~ContourExtractData ()
void SetImage (vtkImageData *imagedata)
void SetZtoBeAnalys (int z)
void SetLstManualContourModel (std::vector< manualBaseModel * > lstManConMod)
void GetValuesInsideCrown (int *numberOfPixels, std::vector< double > *pLstValue, std::vector< double > *pLstValuePosX, std::vector< double > *pLstValuePosY, std::vector< double > *pLstValuePosZ)
void CalculateImageResult ()
vtkImageData * GetVtkImageValueResult ()
vtkImageData * GetVtkImageMaskResult ()
void Statistics (std::vector< double > *inputLstValue, int grayRangeMin, int grayRangeMax, int *rCountRange, int *rsize, double *rmin, double *rmax, double *raverage, double *rstandardeviation)
void SetTypeOperation (int type)
void InitVolumeStatistics ()
void GetVolumeStatistics (int *vol_rCountRange, int *vol_rsize, double *vol_minValue, double *vol_maxValue, double *vol_average, double *vol_standardeviation)
void ResetImageResult (int z)
void SetScalarRange (double min, double max)
void InitLstContoursLinesYPoints ()
bool isInside (int x, int y, int typeOperation)
void SetSizeImageY (int pSizeImageY)

Private Member Functions

void GetMinMaxPoint (int *minPoint, int *maxPoint, manualBaseModel *manualcontourmodel)
void GetMinMaxPoint_Of_LstManConMod (int *minPoint, int *maxPoint)
int AnalisisContourInsideV2 (int x, int y, int iContour)
double GetDataValue (int x, int y, int z)
void PutVtkImageDataResultValue (int x, int y, int z, double value)
void InitVtkImagesResult ()
void SetVolumeStatistics (int rCountRange, int rsize, double minValue, double maxValue, double acum_average, double acum_standardeviation)
void Fill_lstlstlstVecXY (int iContour, int sizeY)

Private Attributes

double scalarRange [2]
bool okImagesResults
std::vector< manualBaseModel * > lstManConMod
int _typeOperation
int zImage
vtkImageData * imagedata
vtkImageData * imagedataValueResult
vtkImageData * imagedataMaskResult
int _sizeImageY
int vol_rCountRange
int vol_rsize
double vol_minValue
double vol_maxValue
double vol_acum_average
double vol_acum_standardeviation
std::vector< std::vector
< std::vector< double > > > 
_lstlstlstVecX1
std::vector< std::vector
< std::vector< double > > > 
_lstlstlstVecY1
std::vector< std::vector
< std::vector< double > > > 
_lstlstlstVecX2
std::vector< std::vector
< std::vector< double > > > 
_lstlstlstVecY2

Detailed Description

Definition at line 11 of file ContourExtractData.h.


Constructor & Destructor Documentation

ContourExtractData::ContourExtractData ( bool  imagesResults = false  ) 

Definition at line 6 of file ContourExtractData.cxx.

References _typeOperation, imagedata, imagedataMaskResult, and imagedataValueResult.

00007 {
00008         this->imagedata                 = NULL;
00009         imagedataValueResult    = NULL;
00010         imagedataMaskResult             = NULL;
00011         this->okImagesResults   = okImagesResults;
00012         _typeOperation                  = 0;
00013 }

ContourExtractData::~ContourExtractData (  ) 

Definition at line 17 of file ContourExtractData.cxx.

00018 {
00019 }


Member Function Documentation

int ContourExtractData::AnalisisContourInsideV2 ( int  x,
int  y,
int  iContour 
) [private]

Definition at line 101 of file ContourExtractData.cxx.

References _lstlstlstVecX1, _lstlstlstVecX2, _lstlstlstVecY1, and _lstlstlstVecY2.

Referenced by isInside().

00102 {
00103         bool inBorder=false;
00104         int result      = 0;
00105         int i;
00106 
00107         int nps=_lstlstlstVecX1[iContour][y].size();
00108 
00109         double x1,y1,x2,y2;
00110         double borderX, borderY;
00111         double xx1, yy1,xx2, yy2;
00112         double xx=x, yy=y;
00113         double d;
00114 
00115         for (i=0; i<nps; i++)
00116         {
00117                 x1=_lstlstlstVecX1[iContour][y][i];
00118                 y1=_lstlstlstVecY1[iContour][y][i];
00119                 x2=_lstlstlstVecX2[iContour][y][i];
00120                 y2=_lstlstlstVecY2[iContour][y][i];
00121 
00122                 borderX=x1;
00123                 borderY=y1;
00124 
00125                 if (y1<y2) 
00126                 { 
00127                         xx1=x1; yy1=y1; xx2=x2; yy2=y2;
00128                 } else {
00129                         xx1=x2; yy1=y2; xx2=x1; yy2=y1; 
00130                 } 
00131 
00132                 double difxx2xx1=fabs(xx2-xx1);
00133                 if (difxx2xx1==0) difxx2xx1=0.0000000001;
00134 
00135                 // Finding border looking in vertical direction  AND  verifing if pixel is at right of the line 
00136                 if  ( (yy>=yy1)&&(yy<=yy2) ) 
00137                 {
00138                         //by triangle similarity
00139                         d = ( fabs(xx2-xx1)*(yy-yy1) ) / (yy2-yy1) ;
00140                         if ( (xx1<=xx2)&&(x<(xx1+d)) )  {       result++;       }
00141                         if ( (xx1>xx2)&&(x<(xx1-d)) )   {       result++;       } 
00142 
00143                         if ( (yy2-yy1)/difxx2xx1 >= 1.0)
00144                         {
00145                                 if (xx1<=xx2)   
00146                                 { 
00147                                         borderX = xx1+d;
00148                                         borderY = y;
00149                                 } else { 
00150                                         borderX = xx1-d;
00151                                         borderY = y;
00152                                 } 
00153                         } 
00154                 } // if point inside y 
00155 
00156 
00157                 // Finding border looking in vertical direction
00158                 if ( ((xx1<=xx2)&&(xx>=xx1)&&(xx<xx2)) || ((xx1>xx2)&&(xx>=xx2)&&(xx<xx1)) )
00159                 {
00160                         if ( (yy2-yy1)/difxx2xx1 <= 1.0)
00161                         {
00162                                 //by triangle similarity
00163                                 d = ( fabs(xx1-xx)*(yy2-yy1) ) / difxx2xx1;
00164                                 if (yy1+d<=yy2) {
00165                                         borderX=x;
00166                                         borderY=yy1+d;
00167                                 }
00168                         }                       
00169                 } // if point inside x                  
00170 
00171 
00172                 //Border verification
00173                 if (   (x==(int)borderX) && (y==(int)borderY)   )  { inBorder=true; }// if point in border
00174 
00175                 // Verification : border in horizontal line 
00176                 if ( ((int)y1==(int)y2)  &&  ((int)y1==y) && (x1<x2) && (x>=x1) && (x<=x2))             { inBorder=true;        }
00177                 if ( ((int)y1==(int)y2)  &&  ((int)y1==y) && (x2<x1) && (x>=x2) && (x<=x1))             { inBorder=true;        }
00178 
00179                 if (inBorder==true){ i=nps; }           
00180         } // for i
00181 
00182         if (inBorder==true)     { result=1;     }
00183 
00184         return result;
00185 }

Here is the caller graph for this function:

void ContourExtractData::CalculateImageResult (  ) 

Definition at line 393 of file ContourExtractData.cxx.

References _typeOperation, GetDataValue(), GetMinMaxPoint_Of_LstManConMod(), imagedata, imagedataMaskResult, imagedataValueResult, InitLstContoursLinesYPoints(), isInside(), okImagesResults, PutVtkImageDataResultValue(), ResetImageResult(), scalarRange, and zImage.

00394 {
00395         if (okImagesResults==true)
00396         {
00397                 ResetImageResult(zImage);
00398 
00399                 int minPoint[2];
00400                 int maxPoint[2];
00401                 int i,j;
00402                 double value;
00403 
00404                 minPoint[0] = 999999;
00405                 minPoint[1] = 999999;
00406                 maxPoint[0] = -999999;
00407                 maxPoint[1] = -999999;
00408 
00409                 GetMinMaxPoint_Of_LstManConMod(minPoint,maxPoint);
00410                 InitLstContoursLinesYPoints();
00411 
00412                 for (j=minPoint[1]; j<=maxPoint[1]; j++)
00413                 {
00414                         for (i=minPoint[0]; i<=maxPoint[0]; i++)
00415                         {
00416 
00417                                 //RaC 20-11-09 Changes specified in isInside (C1)
00418                                 int ext[6];
00419                                 imagedata->GetExtent(ext);
00420 
00421                                 if ((i>=0) && (i<=ext[1]) && (j>=0) && (j<=ext[3]))
00422                                 {
00423                   if (isInside(i,j,_typeOperation)==true)
00424                                         {
00425                                           value = GetDataValue(i,j,zImage);
00426                                           if ( (value>=scalarRange[0]) && (value<=scalarRange[1]) )
00427                                           {
00428                                                 PutVtkImageDataResultValue(i,j,zImage,  value );
00429                                           } // scalarRange
00430                                         } // if isInside
00431 
00432                                 } // if ext
00433                         } // for i
00434                 } // for j
00435 
00436 
00437                 imagedataValueResult->Modified();
00438                 imagedataMaskResult->Modified();
00439                 imagedataValueResult->Update();
00440                 imagedataMaskResult->Update();
00441         } // if
00442 
00443 }

Here is the call graph for this function:

void ContourExtractData::Fill_lstlstlstVecXY ( int  iContour,
int  sizeY 
) [private]

Definition at line 673 of file ContourExtractData.cxx.

References _lstlstlstVecX1, _lstlstlstVecX2, _lstlstlstVecY1, _lstlstlstVecY2, manualBaseModel::GetNumberOfPointsSpline(), manualBaseModel::GetSpline_i_Point(), lstManConMod, and manualBaseModel::UpdateSpline().

Referenced by InitLstContoursLinesYPoints().

00674 {
00675         int i,y;
00676         double x1,y1,z1,x2,y2,z2;
00677         manualBaseModel *manualcontourmodel= lstManConMod[iContour];    
00678         int nps = manualcontourmodel->GetNumberOfPointsSpline(); // number of points in the spline
00679         manualcontourmodel->UpdateSpline();
00680         //------------------------------------------------------------------------------------------------------
00681 
00682         for (y=0;y<sizeY;y++)
00683         {
00684                 manualcontourmodel->GetSpline_i_Point(0,&x1,&y1,&z1);
00685                 x1=x1+0.5; y1=y1+0.5;
00686                 for (i=1; i<nps; i++)
00687                 {
00688                         manualcontourmodel->GetSpline_i_Point(i,&x2,&y2,&z2);
00689                         x2=x2+0.5; y2=y2+0.5;
00690                         if ( ((y1<y2)&&(y>=y1)&&(y<=y2)) || ((y1>y2)&&(y>=y2)&&(y<=y1)) || ((int)y1==y) || ((int)y2==y)  )
00691                         {
00692                                 _lstlstlstVecX1[iContour][y].push_back(x1);
00693                                 _lstlstlstVecY1[iContour][y].push_back(y1);
00694                                 _lstlstlstVecX2[iContour][y].push_back(x2);
00695                                 _lstlstlstVecY2[iContour][y].push_back(y2);
00696                         } 
00697                         x1=x2; y1=y2; z1=z2;
00698                 } // for i  Points in spline
00699         } // y
00700 
00701 }

Here is the call graph for this function:

Here is the caller graph for this function:

double ContourExtractData::GetDataValue ( int  x,
int  y,
int  z 
) [private]

Definition at line 290 of file ContourExtractData.cxx.

References imagedata.

Referenced by CalculateImageResult(), and GetValuesInsideCrown().

00291 {
00292         //      wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)wxvtkbaseview;
00293         //      int z = (int)wxvtk2dbaseview->GetVtkBaseData()->GetZ();
00294         //JSTG 13-03-08-----
00295         //EED OJO avec JS       _zz = z;
00296         //------------------
00297         double result;
00298         void *p;
00299         p = imagedata->GetScalarPointer(x,y,z);
00300 
00301         if (imagedata->GetScalarType()==VTK_CHAR)
00302         {
00303                 char *pp = (char*)p;
00304                 result = (double)(*pp);
00305         }
00306         else if (imagedata->GetScalarType()==VTK_SIGNED_CHAR)
00307         {
00308                 signed char *pp = (signed char*)p;
00309                 result = (double)(*pp);
00310         }
00311         else if (imagedata->GetScalarType()==VTK_UNSIGNED_CHAR)
00312         {
00313                 unsigned char *pp = (unsigned char*)p;
00314                 result = (double)(*pp);
00315         }
00316         else if (imagedata->GetScalarType()==VTK_SHORT)
00317         {
00318                 short *pp = (short*)p;
00319                 result = (double)(*pp);
00320         }
00321         else if (imagedata->GetScalarType()==VTK_UNSIGNED_SHORT)
00322         {
00323                 unsigned short *pp = (unsigned short*)p;
00324                 result = (double)(*pp);
00325         }
00326         else if (imagedata->GetScalarType()==VTK_INT)
00327         {
00328                 int *pp = (int*)p;
00329                 result = (double)(*pp);
00330         }
00331         else if (imagedata->GetScalarType()==VTK_UNSIGNED_INT)
00332         {
00333                 unsigned int *pp = (unsigned int*)p;
00334                 result = (double)(*pp);
00335         }
00336         else if (imagedata->GetScalarType()==VTK_LONG)
00337         {
00338                 long *pp = (long*)p;
00339                 result = (double)(*pp);
00340         }
00341         else if (imagedata->GetScalarType()==VTK_UNSIGNED_LONG)
00342         {
00343                 unsigned long *pp = (unsigned long*)p;
00344                 result = (double)(*pp);
00345         }
00346         else if (imagedata->GetScalarType()==VTK_FLOAT)
00347         {       
00348                 float *pp = (float*)p;
00349                 result = (double)(*pp);
00350         }
00351         else if (imagedata->GetScalarType()==VTK_DOUBLE)
00352         {
00353                 double *pp = (double*)p;
00354                 result = (double)(*pp);
00355         }
00356 
00357         return result;
00358 }

Here is the caller graph for this function:

void ContourExtractData::GetMinMaxPoint ( int *  minPoint,
int *  maxPoint,
manualBaseModel manualcontourmodel 
) [private]

Definition at line 50 of file ContourExtractData.cxx.

References manualBaseModel::GetNumberOfPointsSpline(), manualBaseModel::GetSpline_i_Point(), and manualBaseModel::UpdateSpline().

Referenced by GetMinMaxPoint_Of_LstManConMod().

00054 {
00055         int i;
00056         //int   np              = manualcontourmodel->GetSizeLstPoints( );  // number of control points // JPRx
00057 
00058         // JSTG 26-02-08 ---------------------------------------------------------------------------------------
00059         //int nps = manualviewbaseecontour->GetNumberOfPointsSpline(); // number of points in the spline
00060         int nps = manualcontourmodel->GetNumberOfPointsSpline(); // number of points in the spline
00061         //------------------------------------------------------------------------------------------------------
00062 
00063         // JSTG 26-02-08 ---------------------------------------------------------------------------------------
00064         //double x,y,z,t;
00065         double x,y,z;
00066         //double delta=( double ) ( np  ) / ( double ) ( nps  );
00067         manualcontourmodel->UpdateSpline();
00068         for (i=0; i<nps; i++)
00069         {
00070                 //t= delta * (double)i;
00071                 //manualcontourmodel->GetSplinePoint(t,x,y,z);
00072                 manualcontourmodel->GetSpline_i_Point(i,&x,&y,&z);
00073                 if (x<minPoint[0]){ minPoint[0]=(int)x; }
00074                 if (y<minPoint[1]){ minPoint[1]=(int)y; }
00075                 if (x>maxPoint[0]){ maxPoint[0]=(int)x; }
00076                 if (y>maxPoint[1]){ maxPoint[1]=(int)y; }
00077         }
00078         minPoint[0]--;
00079         minPoint[1]--;
00080         maxPoint[0]++;
00081         maxPoint[1]++;
00082         //------------------------------------------------------------------------------------------------------
00083 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ContourExtractData::GetMinMaxPoint_Of_LstManConMod ( int *  minPoint,
int *  maxPoint 
) [private]

Definition at line 86 of file ContourExtractData.cxx.

References GetMinMaxPoint(), and lstManConMod.

Referenced by CalculateImageResult(), and GetValuesInsideCrown().

00090 {
00091         int i,size = lstManConMod.size();
00092 
00093         for(i=0 ; i<size ; i++)
00094         {
00095                 GetMinMaxPoint(minPoint,maxPoint,lstManConMod[i]);
00096         }
00097 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ContourExtractData::GetValuesInsideCrown ( int *  numberOfPixels,
std::vector< double > *  pLstValue,
std::vector< double > *  pLstValuePosX,
std::vector< double > *  pLstValuePosY,
std::vector< double > *  pLstValuePosZ 
)

Definition at line 446 of file ContourExtractData.cxx.

References _typeOperation, GetDataValue(), GetMinMaxPoint_Of_LstManConMod(), imagedata, InitLstContoursLinesYPoints(), isInside(), scalarRange, and zImage.

00451 {
00452         pLstValue->clear();
00453         pLstValuePosX->clear();
00454         pLstValuePosY->clear();
00455         pLstValuePosZ->clear();
00456 
00457         //      if (okImagesResults==true)
00458         //      {
00459         //              ResetImageResult(zImage);
00460         //      }
00461 
00462         int minPoint[2];
00463         int maxPoint[2];
00464         int i,j;
00465         double value;
00466         int acum=0;
00467 
00468         minPoint[0] = 999999;
00469         minPoint[1] = 999999;
00470         maxPoint[0] = -999999;
00471         maxPoint[1] = -999999;
00472 
00473         GetMinMaxPoint_Of_LstManConMod(minPoint,maxPoint);
00474         InitLstContoursLinesYPoints();
00475 
00476         for (j=minPoint[1]; j<=maxPoint[1]; j++)
00477         {
00478                 for (i=minPoint[0]; i<=maxPoint[0]; i++)
00479                 {
00480                         //RaC 20-11-09 Changes specified in isInside (C1)
00481                         int ext[6];
00482                         imagedata->GetExtent(ext);
00483 
00484                         if ((i>=0) && (i<=ext[1]) && (j>=0) && (j<=ext[3]))
00485                         {
00486                     if (isInside(i,j,_typeOperation)==true)
00487                                 {
00488 
00489                                         acum++;
00490                                         value = GetDataValue(i,j,zImage);
00491                                         if ( (value>=scalarRange[0]) && (value<=scalarRange[1]) )
00492                                         {
00493                                                 pLstValue               -> push_back( value );
00494                                                 pLstValuePosX   -> push_back( i );
00495                                                 pLstValuePosY   -> push_back( j );
00496                                                 pLstValuePosZ   -> push_back( -1 );
00497                                         } // scalarRange
00498                                 } // if isInside
00499                         } // if ext
00500                 } // for
00501         } // for
00502 
00503         *numberOfPixels = acum;
00504 }

Here is the call graph for this function:

void ContourExtractData::GetVolumeStatistics ( int *  vol_rCountRange,
int *  vol_rsize,
double *  vol_minValue,
double *  vol_maxValue,
double *  vol_average,
double *  vol_standardeviation 
)

Definition at line 586 of file ContourExtractData.cxx.

References vol_acum_average, and vol_acum_standardeviation.

00592 {
00593         *vol_rCountRange                = this->vol_rCountRange; 
00594         *vol_rsize                              = this->vol_rsize; 
00595         *vol_minValue                   = this->vol_minValue; 
00596         *vol_maxValue                   = this->vol_maxValue; 
00597         *vol_average                    = this->vol_acum_average / this->vol_rsize;
00598         *vol_standardeviation   = sqrt(this->vol_acum_standardeviation / this->vol_rsize);
00599 }

vtkImageData * ContourExtractData::GetVtkImageMaskResult (  ) 

Definition at line 513 of file ContourExtractData.cxx.

References imagedataMaskResult.

00514 {
00515         return imagedataMaskResult;
00516 }

vtkImageData * ContourExtractData::GetVtkImageValueResult (  ) 

Definition at line 508 of file ContourExtractData.cxx.

References imagedataValueResult.

00509 {
00510         return imagedataValueResult;
00511 }

void ContourExtractData::InitLstContoursLinesYPoints (  ) 

Definition at line 703 of file ContourExtractData.cxx.

References _lstlstlstVecX1, _lstlstlstVecX2, _lstlstlstVecY1, _lstlstlstVecY2, _sizeImageY, Fill_lstlstlstVecXY(), and lstManConMod.

Referenced by CalculateImageResult(), CutModelPolygon::cutInputImage(), and GetValuesInsideCrown().

00704 {
00705         // init InInside Optimisation  
00706         int i;
00707 
00708         _lstlstlstVecX1.clear();
00709         _lstlstlstVecY1.clear();
00710         _lstlstlstVecX2.clear();
00711         _lstlstlstVecY2.clear();
00712 
00713         /* RaC 20-11-09
00714         int ext[6];
00715         this->imagedata->GetWholeExtent(ext);
00716         int sizeY = ext[3]-ext[2]+1;
00717         */
00718         std::vector<double> vecDouble;
00719         std::vector< std::vector<double> > vecVecDouble;
00720         for ( i=0 ; i<_sizeImageY ; i++ )
00721         {
00722                 vecVecDouble.push_back( vecDouble );
00723         }
00724 
00725         //Fill structure with points
00726         int sizeContours = lstManConMod.size();
00727         for( i=0 ; i<sizeContours ; i++ )
00728         {
00729                 _lstlstlstVecX1.push_back( vecVecDouble );
00730                 _lstlstlstVecY1.push_back( vecVecDouble );
00731                 _lstlstlstVecX2.push_back( vecVecDouble );
00732                 _lstlstlstVecY2.push_back( vecVecDouble );
00733                 Fill_lstlstlstVecXY(i,_sizeImageY);
00734         }
00735 
00736 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ContourExtractData::InitVolumeStatistics (  ) 

Definition at line 557 of file ContourExtractData.cxx.

References vol_acum_average, vol_acum_standardeviation, vol_maxValue, vol_minValue, vol_rCountRange, and vol_rsize.

00558 {
00559         vol_rCountRange                         = 0;
00560         vol_rsize                                       = 0;
00561         vol_minValue                            = 9999999;
00562         vol_maxValue                            =-9999999;
00563         vol_acum_average                        = 0;
00564         vol_acum_standardeviation       = 0;
00565 }

void ContourExtractData::InitVtkImagesResult (  )  [private]

Definition at line 518 of file ContourExtractData.cxx.

References imagedata, imagedataMaskResult, and imagedataValueResult.

Referenced by SetImage().

00519 {
00520         int ext[6];
00521         int newDim[3];
00522         double spc[3];
00523         int scalartype;
00524 
00525         imagedata->GetSpacing(spc);
00526         imagedata->GetExtent(ext);
00527         newDim[0]=ext[1]-ext[0]+1;
00528         newDim[1]=ext[3]-ext[2]+1;
00529         newDim[2]=ext[5]-ext[4]+1;
00530         scalartype = imagedata->GetScalarType();
00531 
00532         if (imagedataValueResult!=NULL)
00533         {
00534                 imagedataValueResult->Delete();
00535         }
00536         imagedataValueResult = vtkImageData::New();
00537         //        imagedataValueResult->SetScalarType(scalartype);
00538         imagedataValueResult->SetScalarTypeToUnsignedShort();
00539         imagedataValueResult->SetSpacing(spc);
00540         imagedataValueResult->SetDimensions( newDim );
00541         imagedataValueResult->AllocateScalars();
00542 
00543         if (imagedataMaskResult!=NULL)
00544         {
00545                 imagedataMaskResult->Delete();
00546         }
00547         imagedataMaskResult  = vtkImageData::New();
00548         //        imagedataMaskResult->SetScalarType(scalartype);
00549         imagedataMaskResult->SetScalarTypeToUnsignedShort();
00550         imagedataMaskResult->SetSpacing(spc);
00551         imagedataMaskResult->SetDimensions( newDim );
00552         imagedataMaskResult->AllocateScalars();
00553 }

Here is the caller graph for this function:

bool ContourExtractData::isInside ( int  x,
int  y,
int  typeOperation 
)

Definition at line 193 of file ContourExtractData.cxx.

References AnalisisContourInsideV2(), manualBaseModel::GetTypeModel(), manualBaseModel::IsPoint(), and lstManConMod.

Referenced by CalculateImageResult(), CutModelPolygon::cutInputImage(), and GetValuesInsideCrown().

00194 {
00195         bool result                             = false;
00196         int numberLeft                  = 0;
00197         int i,size                              = this->lstManConMod.size();
00198         int numberInside        = 0;
00199 
00200         /* RaC 20-11-09 (C1) Changes to use the method without the image.
00201         int ext[6];
00202         imagedata->GetExtent(ext);
00203 
00204         if ((x>=0) && (x<=ext[1]) && (y>=0) && (y<=ext[3]))
00205         {
00206         */
00207 
00208         if (typeOperation==0)  // AND  Intersection
00209         {
00210                 for (i=0;i<size;i++)
00211                 {
00212                         // To process the statistics of the Points contour the procedure is different
00213                         // RaC 19-09-09
00214                         manualBaseModel *mbm = lstManConMod[i];
00215                         if(mbm->GetTypeModel()==7)
00216                         {
00217                                 if(mbm->IsPoint(x,y)==true)
00218                                 {
00219                                         numberLeft=1;
00220                                 }
00221                         }//if
00222                         else
00223                         {
00224                                 numberLeft =  AnalisisContourInsideV2(x,y, i );
00225                         }//else
00226 
00227                         if ( (numberLeft % 2) ==1){         numberInside++;  }
00228                 }
00229                 if ( numberInside == (size) ){ result=true; }
00230         } // AND  Intersection
00231 
00232         numberLeft=0;
00233 
00234         if (typeOperation==1)  // OR  All
00235         {
00236                 for (i=0;i<size;i++)
00237                 {
00238                         // To process the statistics of the Points contour the procedure is different
00239                         // RaC 19-09-09
00240                         manualBaseModel *mbm = lstManConMod[i];
00241                         if(mbm->GetTypeModel()==7)
00242                         {
00243                                 if(mbm->IsPoint(x,y)==true)
00244                                 {
00245                                         numberLeft=1;
00246                                 }
00247                         }//if
00248                         else
00249                         {
00250                                 numberLeft =  AnalisisContourInsideV2(x,y, i );
00251                         }//else
00252                         if ( (numberLeft % 2) ==1){ result=true;  }
00253                 }
00254         } // OR  All
00255 
00256         numberLeft=0;
00257 
00258         if (typeOperation==2)  // XOR  crown
00259         {
00260                 for (i=0;i<size;i++)
00261                 {
00262                         // To process the statistics of the Points contour the procedure is different
00263                         // RaC 19-09-09
00264                         manualBaseModel *mbm = lstManConMod[i];
00265                         if(mbm->GetTypeModel()==7)
00266                         {
00267                                 if(mbm->IsPoint(x,y)==true)
00268                                 {
00269                                         numberLeft=1;
00270                                 }
00271                         }//if
00272                         else
00273                         {
00274                                 numberLeft =  numberLeft + AnalisisContourInsideV2(x,y, i );
00275                         }//else
00276 
00277                 }
00278                 if ( numberLeft % 2 ==1){       result = true;  } 
00279         }// XOR  crown
00280 
00281 
00282 
00283         //RaC }
00284 
00285         return result;
00286 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ContourExtractData::PutVtkImageDataResultValue ( int  x,
int  y,
int  z,
double  value 
) [private]

Definition at line 362 of file ContourExtractData.cxx.

References imagedataMaskResult, and imagedataValueResult.

Referenced by CalculateImageResult().

00363 {
00364         unsigned short *pValue;
00365         unsigned short *pMask;
00366         pValue  = (unsigned short *)imagedataValueResult->GetScalarPointer(x,y,z);
00367         pMask   = (unsigned short *)imagedataMaskResult->GetScalarPointer(x,y,z);
00368         *pMask  = 255;
00369         *pValue = (unsigned short)value;
00370 }

Here is the caller graph for this function:

void ContourExtractData::ResetImageResult ( int  z  ) 

Definition at line 373 of file ContourExtractData.cxx.

References imagedataMaskResult, imagedataValueResult, and okImagesResults.

Referenced by CalculateImageResult().

00374 {
00375         if (okImagesResults==true)
00376         {
00377                 unsigned short *pValue;
00378                 unsigned short *pMask;
00379                 pValue  = (unsigned short *)imagedataValueResult->GetScalarPointer(0,0,z);
00380                 pMask   = (unsigned short *)imagedataMaskResult->GetScalarPointer(0,0,z);
00381 
00382                 int ext[6];
00383                 imagedataValueResult->GetExtent(ext);
00384 
00385                 int size = (ext[1]-ext[0]+1) * (ext[3]-ext[2]+1); 
00386                 memset(pValue,0,size*2);
00387                 memset(pMask,0,size*2);
00388         } // if
00389 }

Here is the caller graph for this function:

void ContourExtractData::SetImage ( vtkImageData *  imagedata  ) 

Definition at line 23 of file ContourExtractData.cxx.

References _sizeImageY, InitVtkImagesResult(), okImagesResults, and scalarRange.

00024 {
00025         this->imagedata                 = imagedata;
00026         this->imagedata->GetScalarRange(scalarRange);
00027 
00028         // RaC 20-11-09 Changes in InitLstContoursLinesYPoints
00029         int ext[6];
00030         this->imagedata->GetWholeExtent(ext);
00031         _sizeImageY = ext[3]-ext[2]+1;
00032 
00033         // init vtk image result : valuesImage maskImage  
00034         if (this->okImagesResults==true){  InitVtkImagesResult(); }
00035 }

Here is the call graph for this function:

void ContourExtractData::SetLstManualContourModel ( std::vector< manualBaseModel * >  lstManConMod  ) 

Definition at line 43 of file ContourExtractData.cxx.

Referenced by CutModelPolygon::cutInputImage().

00044 {
00045         this->lstManConMod = lstManConMod;
00046 }

Here is the caller graph for this function:

void ContourExtractData::SetScalarRange ( double  min,
double  max 
)

Definition at line 738 of file ContourExtractData.cxx.

References scalarRange.

00739 {
00740         scalarRange[0]=min;
00741         scalarRange[1]=max;
00742 }

void ContourExtractData::SetSizeImageY ( int  pSizeImageY  ) 

Definition at line 744 of file ContourExtractData.cxx.

References _sizeImageY.

Referenced by CutModelPolygon::cutInputImage().

00745 {
00746         _sizeImageY=pSizeImageY;
00747 }

Here is the caller graph for this function:

void ContourExtractData::SetTypeOperation ( int  type  ) 

Definition at line 667 of file ContourExtractData.cxx.

References _typeOperation.

00668 {
00669         _typeOperation=type;
00670 }

void ContourExtractData::SetVolumeStatistics ( int  rCountRange,
int  rsize,
double  minValue,
double  maxValue,
double  acum_average,
double  acum_standardeviation 
) [private]

Definition at line 568 of file ContourExtractData.cxx.

References vol_acum_average, vol_acum_standardeviation, vol_maxValue, vol_minValue, vol_rCountRange, and vol_rsize.

Referenced by Statistics().

00574 {
00575         vol_rCountRange                         = vol_rCountRange + rCountRange; 
00576         vol_rsize                                       = vol_rsize + rsize; 
00577 
00578         if (minValue<vol_minValue){ vol_minValue = minValue;  }
00579         if (maxValue>vol_maxValue){ vol_maxValue = maxValue;  }
00580 
00581         vol_acum_average                        = vol_acum_average + acum_average; 
00582         vol_acum_standardeviation       = vol_acum_standardeviation + acum_standardeviation; 
00583 }

Here is the caller graph for this function:

void ContourExtractData::SetZtoBeAnalys ( int  z  ) 

Definition at line 37 of file ContourExtractData.cxx.

References zImage.

00038 {
00039         this->zImage                    = z;
00040 }

void ContourExtractData::Statistics ( std::vector< double > *  inputLstValue,
int  grayRangeMin,
int  grayRangeMax,
int *  rCountRange,
int *  rsize,
double *  rmin,
double *  rmax,
double *  raverage,
double *  rstandardeviation 
)

Definition at line 603 of file ContourExtractData.cxx.

References min, and SetVolumeStatistics().

00613 {
00614         double min                                              = 0;
00615         double max                                              = 0;
00616         double average                                  = 0;
00617         double standardeviation                 = 0;
00618         double acum_average                             = 0;
00619         double acum_standardeviation            = 0;
00620         int      size                                           = 0;
00621         int      countRange                                     = 0;
00622         double ng;
00623 
00624         if (inputLstValue!=NULL)
00625         {
00626                 size=inputLstValue->size();
00627                 if (size>0){
00628                         max=(*inputLstValue)[0];
00629                         min=(*inputLstValue)[0];
00630                         // Average , countRange
00631                         int i;
00632                         for ( i=0; i<size; i++ )
00633                         {
00634                                 ng=(*inputLstValue)[i];
00635                                 acum_average = acum_average + ng;
00636                                 if (max<ng) max=ng;             // Max
00637                                 if (min>ng) min=ng;     // Min
00638                                 if ((ng>=grayRangeMin) && (ng<=grayRangeMax)) countRange++;  // countRange
00639                         } // for average
00640                         average = acum_average / size;
00641 
00642                         // Standar Deviation
00643                         acum_standardeviation=0;
00644                         double tmp;
00645                         for ( i=0; i<size; i++ )
00646                         {
00647                                 tmp = (*inputLstValue)[i] - average;
00648                                 acum_standardeviation = acum_standardeviation + tmp*tmp;
00649                         } // for standar deviation
00650                         standardeviation = sqrt(acum_standardeviation/size);
00651                         SetVolumeStatistics(countRange, (*rsize),
00652                                                                 min,max,
00653                                                             acum_average,acum_standardeviation);
00654                 } // if size
00655         } // if NULL
00656 
00657         // OUTPUT
00658         *rsize                          = size; 
00659         *rCountRange            = countRange;
00660         *rmin                           = min; 
00661         *rmax                           = max;
00662         *raverage                       = average;
00663         *rstandardeviation      = standardeviation;
00664 }

Here is the call graph for this function:


Member Data Documentation

std::vector< std::vector< std::vector<double> > > ContourExtractData::_lstlstlstVecX1 [private]
std::vector< std::vector< std::vector<double> > > ContourExtractData::_lstlstlstVecX2 [private]
std::vector< std::vector< std::vector<double> > > ContourExtractData::_lstlstlstVecY1 [private]
std::vector< std::vector< std::vector<double> > > ContourExtractData::_lstlstlstVecY2 [private]

Definition at line 78 of file ContourExtractData.h.

Referenced by InitLstContoursLinesYPoints(), SetImage(), and SetSizeImageY().

vtkImageData* ContourExtractData::imagedata [private]
vtkImageData* ContourExtractData::imagedataMaskResult [private]

Definition at line 60 of file ContourExtractData.h.

Referenced by CalculateImageResult(), ResetImageResult(), and SetImage().

double ContourExtractData::scalarRange[2] [private]

Definition at line 108 of file ContourExtractData.h.

Referenced by InitVolumeStatistics(), and SetVolumeStatistics().

Definition at line 107 of file ContourExtractData.h.

Referenced by InitVolumeStatistics(), and SetVolumeStatistics().

Definition at line 105 of file ContourExtractData.h.

Referenced by InitVolumeStatistics(), and SetVolumeStatistics().

Definition at line 106 of file ContourExtractData.h.

Referenced by InitVolumeStatistics(), and SetVolumeStatistics().

Definition at line 72 of file ContourExtractData.h.

Referenced by CalculateImageResult(), GetValuesInsideCrown(), and SetZtoBeAnalys().


The documentation for this class was generated from the following files:

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1