]> Creatis software - creaMaracasVisu.git/commitdiff
RaC Changes that includes a Polygon contour in creaMaracasVisu. It includes changes
authorRicardo Corredor <Ricardo.Corredor@creatis.insa-lyon.fr>
Thu, 26 Nov 2009 01:26:57 +0000 (01:26 +0000)
committerRicardo Corredor <Ricardo.Corredor@creatis.insa-lyon.fr>
Thu, 26 Nov 2009 01:26:57 +0000 (01:26 +0000)
 in ContourExtractData class, which evaluates the points inside a contour.

lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx
lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourBaseControler.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelPolygon.cpp [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelPolygon.h [new file with mode: 0644]

index 10e04156dc251ce1914f30ecb440173da28a4e72..5c5f0d3c1bfdea5d35f0002e4d3fc7cee62a709f 100644 (file)
@@ -4,57 +4,62 @@
 
 //----------------------------------------------------------------------
 ContourExtractData::ContourExtractData( bool okImagesResults)
-  {
-    this->imagedata                    = NULL;
+{
+       this->imagedata                 = NULL;
        imagedataValueResult    = NULL;
        imagedataMaskResult             = NULL;
        this->okImagesResults   = okImagesResults;
        _typeOperation                  = 0;
-  }
+}
 
-  // ------------------------------------------------------------------------
+// ------------------------------------------------------------------------
 
-  ContourExtractData::~ContourExtractData()
-  {
-  }
+ContourExtractData::~ContourExtractData()
+{
+}
 
 
 //----------------------------------------------------------------------
 void ContourExtractData::SetImage( vtkImageData* imagedata)
-  {
+{
        this->imagedata                 = imagedata;
-               
+
+       // RaC 20-11-09 Changes in InitLstContoursLinesYPoints
+       int ext[6];
+       this->imagedata->GetWholeExtent(ext);
+       _sizeImageY = ext[3]-ext[2]+1;
+
        // init vtk image result : valuesImage maskImage  
        if (this->okImagesResults==true){  InitVtkImagesResult(); }
-  }
+}
 //----------------------------------------------------------------------
 void ContourExtractData::SetZtoBeAnalys( int z )
-  {
+{
        this->zImage                    = z;
-  }
+}
 
 //------------------------------------------------------------------------
-  void ContourExtractData::SetLstManualContourModel( std::vector<manualBaseModel*> lstManConMod)
-  {
-         this->lstManConMod = lstManConMod;
-  }
+void ContourExtractData::SetLstManualContourModel( std::vector<manualBaseModel*> lstManConMod)
+{
+       this->lstManConMod = lstManConMod;
+}
 
 
 //------------------------------------------------------------------------
 void ContourExtractData::GetMinMaxPoint(int *minPoint, 
-                                                                                 int *maxPoint, 
-                                                                                 manualBaseModel *manualcontourmodel
-                                                                                 )
+                                                                               int *maxPoint, 
+                                                                               manualBaseModel *manualcontourmodel
+                                                                               )
 {
        int i;
        //int   np              = manualcontourmodel->GetSizeLstPoints( );  // number of control points // JPRx
-               
-// JSTG 26-02-08 ---------------------------------------------------------------------------------------
+
+       // JSTG 26-02-08 ---------------------------------------------------------------------------------------
        //int nps = manualviewbaseecontour->GetNumberOfPointsSpline(); // number of points in the spline
        int nps = manualcontourmodel->GetNumberOfPointsSpline(); // number of points in the spline
-//------------------------------------------------------------------------------------------------------
-       
-// JSTG 26-02-08 ---------------------------------------------------------------------------------------
+       //------------------------------------------------------------------------------------------------------
+
+       // JSTG 26-02-08 ---------------------------------------------------------------------------------------
        //double x,y,z,t;
        double x,y,z;
        //double delta=( double ) ( np  ) / ( double ) ( nps  );
@@ -73,13 +78,13 @@ void ContourExtractData::GetMinMaxPoint(int *minPoint,
        minPoint[1]--;
        maxPoint[0]++;
        maxPoint[1]++;
-//------------------------------------------------------------------------------------------------------
+       //------------------------------------------------------------------------------------------------------
 }
 
 //------------------------------------------------------------------------
 void ContourExtractData::GetMinMaxPoint_Of_LstManConMod(       int *minPoint, 
-                                                                                       int *maxPoint
-                                                                               )
+                                                                                                               int *maxPoint
+                                                                                                               )
 
 {
        int i,size = lstManConMod.size();
@@ -98,8 +103,10 @@ int ContourExtractData::AnalisisContourInsideV2(int x, int y, int iContour )
        int result      = 0;
        int i;
 
+       //cout<<"RaC ContourExtractData::AnalisisContourInsideV2-iContour:"<<iContour<<" y:"<<y<<endl; 
+
        int nps=_lstlstlstVecX1[iContour][y].size();
-       
+
        double x1,y1,x2,y2;
        double borderX, borderY;
        double xx1, yy1,xx2, yy2;
@@ -115,17 +122,17 @@ int ContourExtractData::AnalisisContourInsideV2(int x, int y, int iContour )
 
                borderX=x1;
                borderY=y1;
-               
+
                if (y1<y2) 
                { 
                        xx1=x1; yy1=y1; xx2=x2; yy2=y2;
                } else {
                        xx1=x2; yy1=y2; xx2=x1; yy2=y1; 
                } 
-               
+
                double difxx2xx1=fabs(xx2-xx1);
                if (difxx2xx1==0) difxx2xx1=0.0000000001;
-               
+
                // Finding border looking in vertical direction  AND  verifing if pixel is at right of the line 
                if  ( (yy>=yy1)&&(yy<=yy2) ) 
                {
@@ -133,7 +140,7 @@ int ContourExtractData::AnalisisContourInsideV2(int x, int y, int iContour )
                        d = ( fabs(xx2-xx1)*(yy-yy1) ) / (yy2-yy1) ;
                        if ( (xx1<=xx2)&&(x<(xx1+d)) )  {       result++;       }
                        if ( (xx1>xx2)&&(x<(xx1-d)) )   {       result++;       } 
-                       
+
                        if ( (yy2-yy1)/difxx2xx1 >= 1.0)
                        {
                                if (xx1<=xx2)   
@@ -146,8 +153,8 @@ int ContourExtractData::AnalisisContourInsideV2(int x, int y, int iContour )
                                } 
                        } 
                } // if point inside y 
-               
-               
+
+
                // Finding border looking in vertical direction
                if ( ((xx1<=xx2)&&(xx>=xx1)&&(xx<xx2)) || ((xx1>xx2)&&(xx>=xx2)&&(xx<xx1)) )
                {
@@ -161,26 +168,29 @@ int ContourExtractData::AnalisisContourInsideV2(int x, int y, int iContour )
                                }
                        }                       
                } // if point inside x                  
-               
-               
+
+
                //Border verification
                if (   (x==(int)borderX) && (y==(int)borderY)   )  { inBorder=true; }// if point in border
-               
+
                // Verification : border in horizontal line 
                if ( ((int)y1==(int)y2)  &&  ((int)y1==y) && (x1<x2) && (x>=x1) && (x<=x2))             { inBorder=true;        }
                if ( ((int)y1==(int)y2)  &&  ((int)y1==y) && (x2<x1) && (x>=x2) && (x<=x1))             { inBorder=true;        }
-               
+
                if (inBorder==true){ i=nps; }           
        } // for i
-       
+
        if (inBorder==true)     { result=1;     }
-       
+
        return result;
 }
 
 
 
 //------------------------------------------------------------------------
+// typeOperation=0 AND
+// typeOperation=1 OR
+// typeOperation=2 XOR
 bool ContourExtractData::isInside(int x, int y, int typeOperation)
 {
        bool result                             = false;
@@ -188,88 +198,90 @@ bool ContourExtractData::isInside(int x, int y, int typeOperation)
        int i,size                              = this->lstManConMod.size();
        int numberInside        = 0;
 
+       /* RaC 20-11-09 (C1) Changes to use the method without the image.
        int ext[6];
        imagedata->GetExtent(ext);
 
        if ((x>=0) && (x<=ext[1]) && (y>=0) && (y<=ext[3]))
        {
+       */
 
-               if (typeOperation==0)  // AND  Intersection
+       if (typeOperation==0)  // AND  Intersection
+       {
+               for (i=0;i<size;i++)
                {
-                       for (i=0;i<size;i++)
+                       // To process the statistics of the Points contour the procedure is different
+                       // RaC 19-09-09
+                       manualBaseModel *mbm = lstManConMod[i];
+                       if(mbm->GetTypeModel()==7)
                        {
-                               // To process the statistics of the Points contour the procedure is different
-                               // RaC 19-09-09
-                               manualBaseModel *mbm = lstManConMod[i];
-                               if(mbm->GetTypeModel()==7)
-                               {
-                                       if(mbm->IsPoint(x,y)==true)
-                                       {
-                                               numberLeft=1;
-                                       }
-                               }//if
-                               else
+                               if(mbm->IsPoint(x,y)==true)
                                {
-                                       numberLeft =  AnalisisContourInsideV2(x,y, i );
-                               }//else
+                                       numberLeft=1;
+                               }
+                       }//if
+                       else
+                       {
+                               numberLeft =  AnalisisContourInsideV2(x,y, i );
+                       }//else
 
-                               if ( (numberLeft % 2) ==1){         numberInside++;  }
-                       }
-                       if ( numberInside == (size) ){ result=true; }
-               } // AND  Intersection
+                       if ( (numberLeft % 2) ==1){         numberInside++;  }
+               }
+               if ( numberInside == (size) ){ result=true; }
+       } // AND  Intersection
 
-               numberLeft=0;
+       numberLeft=0;
 
-               if (typeOperation==1)  // OR  All
+       if (typeOperation==1)  // OR  All
+       {
+               for (i=0;i<size;i++)
                {
-                       for (i=0;i<size;i++)
+                       // To process the statistics of the Points contour the procedure is different
+                       // RaC 19-09-09
+                       manualBaseModel *mbm = lstManConMod[i];
+                       if(mbm->GetTypeModel()==7)
                        {
-                               // To process the statistics of the Points contour the procedure is different
-                               // RaC 19-09-09
-                               manualBaseModel *mbm = lstManConMod[i];
-                               if(mbm->GetTypeModel()==7)
-                               {
-                                       if(mbm->IsPoint(x,y)==true)
-                                       {
-                                               numberLeft=1;
-                                       }
-                               }//if
-                               else
+                               if(mbm->IsPoint(x,y)==true)
                                {
-                                       numberLeft =  AnalisisContourInsideV2(x,y, i );
-                               }//else
-                               if ( (numberLeft % 2) ==1){ result=true;  }
-                       }
-               } // OR  All
+                                       numberLeft=1;
+                               }
+                       }//if
+                       else
+                       {
+                               numberLeft =  AnalisisContourInsideV2(x,y, i );
+                       }//else
+                       if ( (numberLeft % 2) ==1){ result=true;  }
+               }
+       } // OR  All
 
-               numberLeft=0;
+       numberLeft=0;
 
-               if (typeOperation==2)  // XOR  crown
+       if (typeOperation==2)  // XOR  crown
+       {
+               for (i=0;i<size;i++)
                {
-                       for (i=0;i<size;i++)
+                       // To process the statistics of the Points contour the procedure is different
+                       // RaC 19-09-09
+                       manualBaseModel *mbm = lstManConMod[i];
+                       if(mbm->GetTypeModel()==7)
                        {
-                               // To process the statistics of the Points contour the procedure is different
-                               // RaC 19-09-09
-                               manualBaseModel *mbm = lstManConMod[i];
-                               if(mbm->GetTypeModel()==7)
+                               if(mbm->IsPoint(x,y)==true)
                                {
-                                       if(mbm->IsPoint(x,y)==true)
-                                       {
-                                               numberLeft=1;
-                                       }
-                               }//if
-                               else
-                               {
-                                       numberLeft =  numberLeft + AnalisisContourInsideV2(x,y, i );
-                               }//else
-                               
-                       }
-                       if ( numberLeft % 2 ==1){       result = true;  } 
-               }// XOR  crown
+                                       numberLeft=1;
+                               }
+                       }//if
+                       else
+                       {
+                               numberLeft =  numberLeft + AnalisisContourInsideV2(x,y, i );
+                       }//else
 
+               }
+               if ( numberLeft % 2 ==1){       result = true;  } 
+       }// XOR  crown
 
 
-       }
+
+       //RaC }
 
        return result;
 }
@@ -278,10 +290,10 @@ bool ContourExtractData::isInside(int x, int y, int typeOperation)
 
 double ContourExtractData::GetDataValue(int x, int y, int z)
 {
-//     wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)wxvtkbaseview;
-//     int z = (int)wxvtk2dbaseview->GetVtkBaseData()->GetZ();
+       //      wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)wxvtkbaseview;
+       //      int z = (int)wxvtk2dbaseview->GetVtkBaseData()->GetZ();
        //JSTG 13-03-08-----
-//EED OJO avec JS      _zz = z;
+       //EED OJO avec JS       _zz = z;
        //------------------
        double result;
        void *p;
@@ -367,7 +379,7 @@ void ContourExtractData::ResetImageResult(int z)
                unsigned short *pMask;
                pValue  = (unsigned short *)imagedataValueResult->GetScalarPointer(0,0,z);
                pMask   = (unsigned short *)imagedataMaskResult->GetScalarPointer(0,0,z);
-               
+
                int ext[6];
                imagedataValueResult->GetExtent(ext);
 
@@ -397,16 +409,26 @@ void ContourExtractData::CalculateImageResult()
 
                GetMinMaxPoint_Of_LstManConMod(minPoint,maxPoint);
                InitLstContoursLinesYPoints();
-               
+
                for (j=minPoint[1]; j<=maxPoint[1]; j++)
                {
                        for (i=minPoint[0]; i<=maxPoint[0]; i++)
                        {
-                               if (isInside(i,j,_typeOperation)==true)
+
+                               //RaC 20-11-09 Changes specified in isInside (C1)
+                               int ext[6];
+                               imagedata->GetExtent(ext);
+
+                               if ((i>=0) && (i<=ext[1]) && (j>=0) && (j<=ext[3]))
                                {
-                                       value = GetDataValue(i,j,zImage);
-                                       PutVtkImageDataResultValue(i,j,zImage,  value );
-                               } // if
+                                       if (isInside(i,j,_typeOperation)==true)
+                                       {
+                                               value = GetDataValue(i,j,zImage);
+                                               PutVtkImageDataResultValue(i,j,zImage,  value );
+                                       } // if
+
+                               }//if
+
                        } // for i
                } // for j
 
@@ -421,19 +443,19 @@ void ContourExtractData::CalculateImageResult()
 
 //------------------------------------------------------------------------
 void ContourExtractData::GetValuesInsideCrown(std::vector<double> *pLstValue,
-                                                                                               std::vector<double> *pLstValuePosX,
-                                                                                               std::vector<double> *pLstValuePosY,
-                                                                                               std::vector<double> *pLstValuePosZ)
+                                                                                         std::vector<double> *pLstValuePosX,
+                                                                                         std::vector<double> *pLstValuePosY,
+                                                                                         std::vector<double> *pLstValuePosZ)
 {
        pLstValue->clear();
        pLstValuePosX->clear();
        pLstValuePosY->clear();
        pLstValuePosZ->clear();
 
-//     if (okImagesResults==true)
-//     {
-//             ResetImageResult(zImage);
-//     }
+       //      if (okImagesResults==true)
+       //      {
+       //              ResetImageResult(zImage);
+       //      }
 
        int minPoint[2];
        int maxPoint[2];
@@ -447,34 +469,44 @@ void ContourExtractData::GetValuesInsideCrown(std::vector<double> *pLstValue,
        maxPoint[1] = -999999;
 
        GetMinMaxPoint_Of_LstManConMod(minPoint,maxPoint);
-    InitLstContoursLinesYPoints();
+       InitLstContoursLinesYPoints();
 
        for (j=minPoint[1]; j<=maxPoint[1]; j++)
        {
                for (i=minPoint[0]; i<=maxPoint[0]; i++)
                {
-                       if (isInside(i,j,_typeOperation)==true)
+                       //RaC 20-11-09 Changes specified in isInside (C1)
+                       int ext[6];
+                       imagedata->GetExtent(ext);
+
+                       if ((i>=0) && (i<=ext[1]) && (j>=0) && (j<=ext[3]))
                        {
-                               value = GetDataValue(i,j,zImage);
-
-// Borrame
-//                             if (okImagesResults==true){
-//                                     PutVtkImageDataResultValue(i,j,zImage,  value );
-//                             }
-
-                               pLstValue               -> push_back( value );
-                               pLstValuePosX   -> push_back( i );
-                               pLstValuePosY   -> push_back( j );
-                               pLstValuePosZ   -> push_back( -1 );
-                       } // if
+
+                               if (isInside(i,j,_typeOperation)==true)
+                               {
+                                       value = GetDataValue(i,j,zImage);
+
+                                       // Borrame
+                                       //                              if (okImagesResults==true){
+                                       //                                      PutVtkImageDataResultValue(i,j,zImage,  value );
+                                       //                              }
+
+                                       pLstValue               -> push_back( value );
+                                       pLstValuePosX   -> push_back( i );
+                                       pLstValuePosY   -> push_back( j );
+                                       pLstValuePosZ   -> push_back( -1 );
+                               } // if
+
+                       } //if
+
                } // for
        } // for
 
-// Borrame
-//     if (this->okImagesResults==true){
-//             imagedataValueResult->Modified();
-//             imagedataMaskResult->Modified();
-//     }
+       // Borrame
+       //      if (this->okImagesResults==true){
+       //              imagedataValueResult->Modified();
+       //              imagedataMaskResult->Modified();
+       //      }
 
 
 }
@@ -493,39 +525,39 @@ vtkImageData *ContourExtractData::GetVtkImageMaskResult()
 // ------------------------------------------------------------------------
 void ContourExtractData::InitVtkImagesResult()
 {
-         int ext[6];
-         int newDim[3];
-         double spc[3];
-         int scalartype;
-
-         imagedata->GetSpacing(spc);
-         imagedata->GetExtent(ext);
-         newDim[0]=ext[1]-ext[0]+1;
-         newDim[1]=ext[3]-ext[2]+1;
-         newDim[2]=ext[5]-ext[4]+1;
-         scalartype = imagedata->GetScalarType();
-
-         if (imagedataValueResult!=NULL)
-         {
-                 imagedataValueResult->Delete();
-         }
-         imagedataValueResult = vtkImageData::New();
-//       imagedataValueResult->SetScalarType(scalartype);
-         imagedataValueResult->SetScalarTypeToUnsignedShort();
-         imagedataValueResult->SetSpacing(spc);
-         imagedataValueResult->SetDimensions( newDim );
-         imagedataValueResult->AllocateScalars();
-
-         if (imagedataMaskResult!=NULL)
-         {
-                 imagedataMaskResult->Delete();
-         }
-         imagedataMaskResult  = vtkImageData::New();
-//       imagedataMaskResult->SetScalarType(scalartype);
-         imagedataMaskResult->SetScalarTypeToUnsignedShort();
-         imagedataMaskResult->SetSpacing(spc);
-         imagedataMaskResult->SetDimensions( newDim );
-         imagedataMaskResult->AllocateScalars();
+       int ext[6];
+       int newDim[3];
+       double spc[3];
+       int scalartype;
+
+       imagedata->GetSpacing(spc);
+       imagedata->GetExtent(ext);
+       newDim[0]=ext[1]-ext[0]+1;
+       newDim[1]=ext[3]-ext[2]+1;
+       newDim[2]=ext[5]-ext[4]+1;
+       scalartype = imagedata->GetScalarType();
+
+       if (imagedataValueResult!=NULL)
+       {
+               imagedataValueResult->Delete();
+       }
+       imagedataValueResult = vtkImageData::New();
+       //        imagedataValueResult->SetScalarType(scalartype);
+       imagedataValueResult->SetScalarTypeToUnsignedShort();
+       imagedataValueResult->SetSpacing(spc);
+       imagedataValueResult->SetDimensions( newDim );
+       imagedataValueResult->AllocateScalars();
+
+       if (imagedataMaskResult!=NULL)
+       {
+               imagedataMaskResult->Delete();
+       }
+       imagedataMaskResult  = vtkImageData::New();
+       //        imagedataMaskResult->SetScalarType(scalartype);
+       imagedataMaskResult->SetScalarTypeToUnsignedShort();
+       imagedataMaskResult->SetSpacing(spc);
+       imagedataMaskResult->SetDimensions( newDim );
+       imagedataMaskResult->AllocateScalars();
 }
 
 
@@ -542,18 +574,18 @@ void ContourExtractData::InitVolumeStatistics()
 
 //------------------------------------------------------------------------
 void ContourExtractData::SetVolumeStatistics(int rCountRange, 
-                                                                                       int rsize,
-                                                                                       double minValue,
-                                                                                       double maxValue,
-                                                                                       double acum_average,
-                                                                                       double acum_standardeviation)
+                                                                                        int rsize,
+                                                                                        double minValue,
+                                                                                        double maxValue,
+                                                                                        double acum_average,
+                                                                                        double acum_standardeviation)
 {
        vol_rCountRange                         = vol_rCountRange + rCountRange; 
        vol_rsize                                       = vol_rsize + rsize; 
-       
+
        if (minValue<vol_minValue){ vol_minValue = minValue;  }
        if (maxValue>vol_maxValue){ vol_maxValue = maxValue;  }
-       
+
        vol_acum_average                        = vol_acum_average + acum_average; 
        vol_acum_standardeviation       = vol_acum_standardeviation + acum_standardeviation; 
 }
@@ -585,25 +617,25 @@ void ContourExtractData::Statistics( std::vector<double> *inputLstValue,
                                                                        double  *rmax,
                                                                        double  *raverage,
                                                                        double  *rstandardeviation
-                                                                               )
+                                                                       )
 {
-         double min                                            = 0;
-         double max                                            = 0;
-         double average                                        = 0;
-         double standardeviation                       = 0;
-         double acum_average                           = 0;
-         double acum_standardeviation          = 0;
-         int    size                                           = 0;
-         int    countRange                                     = 0;
-         double ng;
-
-         if (inputLstValue!=NULL)
-         {
+       double min                                              = 0;
+       double max                                              = 0;
+       double average                                  = 0;
+       double standardeviation                 = 0;
+       double acum_average                             = 0;
+       double acum_standardeviation            = 0;
+       int      size                                           = 0;
+       int      countRange                                     = 0;
+       double ng;
+
+       if (inputLstValue!=NULL)
+       {
                size=inputLstValue->size();
                if (size>0){
-              max=(*inputLstValue)[0];
-                  min=(*inputLstValue)[0];
-     // Average , countRange
+                       max=(*inputLstValue)[0];
+                       min=(*inputLstValue)[0];
+                       // Average , countRange
                        int i;
                        for ( i=0; i<size; i++ )
                        {
@@ -615,28 +647,28 @@ void ContourExtractData::Statistics( std::vector<double> *inputLstValue,
                        } // for average
                        average = acum_average / size;
 
-         // Standar Deviation
+                       // Standar Deviation
                        acum_standardeviation=0;
                        double tmp;
-                       for ( i=0; i<size; i++ )
+                       for ( i=0; i<size; i++ )
                        {
-                tmp = (*inputLstValue)[i] - average;
+                               tmp = (*inputLstValue)[i] - average;
                                acum_standardeviation = acum_standardeviation + tmp*tmp;
                        } // for standar deviation
                        standardeviation = sqrt(acum_standardeviation/size);
                        SetVolumeStatistics(countRange, size,
-                                                               min,max,
-                                                           acum_average,acum_standardeviation);
+                               min,max,
+                               acum_average,acum_standardeviation);
                } // if size
-         } // if NULL
-
-         // OUTPUT
-               *rsize                          = size; 
-               *rCountRange            = countRange;
-               *rmin                           = min; 
-               *rmax                           = max;
-               *raverage                       = average;
-               *rstandardeviation      = standardeviation;
+       } // if NULL
+
+       // OUTPUT
+       *rsize                          = size; 
+       *rCountRange            = countRange;
+       *rmin                           = min; 
+       *rmax                           = max;
+       *raverage                       = average;
+       *rstandardeviation      = standardeviation;
 }
 
 //------------------------------------------------------------------------
@@ -654,7 +686,7 @@ void ContourExtractData::Fill_lstlstlstVecXY(int iContour, int sizeY)
        int nps = manualcontourmodel->GetNumberOfPointsSpline(); // number of points in the spline
        manualcontourmodel->UpdateSpline();
        //------------------------------------------------------------------------------------------------------
-       
+
        for (y=0;y<sizeY;y++)
        {
                manualcontourmodel->GetSpline_i_Point(0,&x1,&y1,&z1);
@@ -680,22 +712,24 @@ void ContourExtractData::InitLstContoursLinesYPoints()
 {
        // init InInside Optimisation  
        int i;
-       
+
        _lstlstlstVecX1.clear();
        _lstlstlstVecY1.clear();
        _lstlstlstVecX2.clear();
        _lstlstlstVecY2.clear();
-       
+
+       /* RaC 20-11-09
        int ext[6];
        this->imagedata->GetWholeExtent(ext);
        int sizeY = ext[3]-ext[2]+1;
+       */
        std::vector<double> vecDouble;
        std::vector< std::vector<double> > vecVecDouble;
-       for ( i=0 ; i<sizeY ; i++ )
+       for ( i=0 ; i<_sizeImageY ; i++ )
        {
                vecVecDouble.push_back( vecDouble );
        }
-       
+
        //Fill structure with points
        int sizeContours = lstManConMod.size();
        for( i=0 ; i<sizeContours ; i++ )
@@ -704,9 +738,12 @@ void ContourExtractData::InitLstContoursLinesYPoints()
                _lstlstlstVecY1.push_back( vecVecDouble );
                _lstlstlstVecX2.push_back( vecVecDouble );
                _lstlstlstVecY2.push_back( vecVecDouble );
-               Fill_lstlstlstVecXY(i,sizeY);
+               Fill_lstlstlstVecXY(i,_sizeImageY);
        }
-       
-}
 
+}
 
+void ContourExtractData::SetSizeImageY(int pSizeImageY)
+{
+       _sizeImageY=pSizeImageY;
+}
index b463709d2c5cb94ce79d37f1587e5f424a065475..6123e66b95c40b54b8481e4978c55e8ac90acd2b 100644 (file)
                                                                double *vol_average, double *vol_standardeviation);
          
          void ResetImageResult(int z);
-         
+         void InitLstContoursLinesYPoints();
+         bool isInside(int x, int y, int typeOperation );
+       
+         //
+         // Asigns the sizeImageY.
+         // @param pSizeImageY - int
+         void SetSizeImageY(int pSizeImageY);
          
   private:
        bool                                                            okImagesResults;
@@ -65,8 +71,9 @@
        vtkImageData                                            *imagedataValueResult;
        vtkImageData                                            *imagedataMaskResult;
 
-       bool isInside(int x, int y, int typeOperation );
-
+       //Size Y
+       int _sizeImageY;
+       
        //
        // Asigns the minimum and maximum points of the contour model in parameter.
        // @param *minPoint - int
          std::vector< std::vector< std::vector<double> > >             _lstlstlstVecX2;
          std::vector< std::vector< std::vector<double> > >             _lstlstlstVecY2;
          void Fill_lstlstlstVecXY(int iContour, int sizeY);
-         void InitLstContoursLinesYPoints();
+         
+
 
   };
 
index 0639b0c611e012aecb665b68f660aeae0fcafe3a..7ed909728ec9f4f950dc1ad61876926a787f487f 100644 (file)
@@ -226,6 +226,7 @@ bool manualContourBaseControler::OnRightButtonDown()
 
                SetCompleteCreation( true );
                SetKeyBoardMoving( false );
+               cout<<"RaC manualContourBaseControler::OnRightButtonDown"<<endl;
                this->GetManualContourModel()->SetCloseContour(true);
                MouseClickRight(X,Y);
        }
index a4cccb9cada1d56008ff1d387f5600d51e3898ab..16514a42ebe5397f2369b92254b44c47c2d0f9c8 100644 (file)
@@ -127,7 +127,7 @@ public:
        void OpenData(FILE *ff);
 //--------------------------------------------------------------------------------
 
-private:
+//public:
        //int                                                   _sizePointsContour;
        //std::vector<manualPoint*>     _lstPoints;
        bool                                            _closeContour;
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelPolygon.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelPolygon.cpp
new file mode 100644 (file)
index 0000000..6019ffb
--- /dev/null
@@ -0,0 +1,69 @@
+#include "manualContourModelPolygon.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualContourModelPolygon::manualContourModelPolygon()
+: manualContourModel()
+{
+}
+
+manualContourModelPolygon::~manualContourModelPolygon()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualContourModelPolygon* manualContourModelPolygon :: Clone()  // virtual 
+{
+       manualContourModelPolygon * clone = new manualContourModelPolygon();
+       CopyAttributesTo(clone);
+       return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualContourModelPolygon::CopyAttributesTo( manualContourModelPolygon * cloneObject)
+{
+       manualContourModel::CopyAttributesTo(cloneObject);
+}
+
+//----------------------------------------------------------------
+int manualContourModelPolygon::GetTypeModel() //virtual 
+{
+       return 10;
+}
+
+
+//----------------------------------------------------------------
+void manualContourModelPolygon::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtual
+{
+       //cout<<"RaC manualContourModelPolygon::GetSpline_i_Point lstPoints:"<<_lstPoints.size()<<" pointsSpline:"<<GetNumberOfPointsSpline()<<endl;
+       if(i>=_lstPoints.size())
+       {
+               i=0;
+       }
+
+       if (_lstPoints.size()==0)
+       {
+               *x      = 0;
+               *y      = 0;
+               *z      = 0;
+       }
+       else
+       {
+               manualPoint     *mp;
+               mp      = GetManualPoint(i);
+               *x      = mp->GetX();
+               *y      = mp->GetY();
+               *z      = mp->GetZ();
+       }
+
+}
+
+
+void manualContourModelPolygon::UpdateSpline() // virtual
+{
+       //SetNumberOfPointsSpline(_lstPoints.size()+1);
+}
\ No newline at end of file
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelPolygon.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelPolygon.h
new file mode 100644 (file)
index 0000000..5ac6ba1
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef manualContourModelPolygon_h
+#define manualContourModelPolygon_h
+
+#include "manualContourModel.h"
+
+//--------------------------------------------------------
+
+class creaMaracasVisu_EXPORT manualContourModelPolygon : public manualContourModel
+{
+public:
+       manualContourModelPolygon();
+       virtual ~manualContourModelPolygon();
+       virtual manualContourModelPolygon *Clone();
+       void CopyAttributesTo( manualContourModelPolygon *cloneObject);
+       virtual void GetSpline_i_Point(int i, double *x, double *y, double *z);
+       virtual int             GetTypeModel();  
+       virtual void UpdateSpline();
+};
+
+#endif // manualContourModelPolygon_h