]> Creatis software - creaMaracasVisu.git/blobdiff - bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx
#3485 ShowNPionts for Multiple Groups
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuManualContourModel_Box.cxx
index a46ca99422f14de46bafdf12137b80c4f4c27996..e38abef92783b2aa9d365e538049843354774582 100644 (file)
@@ -847,15 +847,15 @@ void ManualContourModel_Box::Process()
                lstInconsistentContourID.clear();
 
                // First Step  Spline Interpolation
-               std::vector<double> lstInX=bbGetInputLstControlPointsX();
-               std::vector<double> lstInY=bbGetInputLstControlPointsY();
-               std::vector<double> lstInZ=bbGetInputLstControlPointsZ();
+               std::vector<double> lstInX = bbGetInputLstControlPointsX();
+               std::vector<double> lstInY = bbGetInputLstControlPointsY();
+               std::vector<double> lstInZ = bbGetInputLstControlPointsZ();
                if ( (lstInX.size()!=lstInY.size()) || (lstInY.size()!=lstInZ.size()) ) 
                { 
                        printf("Warnning !!  .. ManualContourModel_Box: The list X Y Z, no have the same number of elements \n");
                        return;
                }
-               std::vector<int>        lstIndexsIn=bbGetInputLstIndexsIn();
+               std::vector<int>        lstIndexsIn = bbGetInputLstIndexsIn();
                std::vector<int>        lstIndexsOut;
                std::vector<double> lstOutX;
                std::vector<double> lstOutY;
@@ -865,13 +865,23 @@ void ManualContourModel_Box::Process()
                        lstIndexsIn.push_back( lstInX.size() );
                }
                
+    // Step 0. Clean lstIndexIn
+        int i,size    = lstIndexsIn.size();
+        for (i=size-1 ; i>=0; i--)
+        {
+            if (lstIndexsIn[i]==0)
+            {
+                lstIndexsIn.erase( lstIndexsIn.begin()+i );
+            } // if
+        } // for i
+        
        // Step 1.  All contours the same clockwise direction (Control Points)
                if (bbGetInputDoubleContour()==1)
                {
                        ClockwisePoints( &lstInX , &lstInY , &lstInZ , &lstIndexsIn );
        //              ShiftValues( &lstInX , &lstInY , &lstInZ , &lstIndexsIn );
                } // DoubleContour
-               int i,size      = lstIndexsIn.size();
+               size    = lstIndexsIn.size();
                int iGeneral= 0;
                
        // Step 2.  Spline interpolation of control points      
@@ -897,16 +907,22 @@ void ManualContourModel_Box::Process()
        // Step 3.1 Linear Normalice points around contours     
                        RedistributionPoints(&lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
        //EED 01/2021           
-       // Step 3.2 Shift points to find minimun acumulate distance     
-                       ShiftValues( &lstOutX, &lstOutY, &lstOutZ, &lstIndexsOut );
+       // Step 3.2 Shift points to find minimun acumulate distance
+            if (bbGetInputOpenClose()==true)
+            {
+                ShiftValues( &lstOutX, &lstOutY, &lstOutZ, &lstIndexsOut );
+            } // if OpenClose
        // Step 3.3. SIN Normalice points around contours       
-                       if (bbGetInputParam().size()>=1)
+                       if (bbGetInputParam().size()==2)
                        {
-                               if (bbGetInputParam()[0]==1)
+                               if (bbGetInputParam()[0]==1) // type param 1
                                {
-                                               RedistributionPointsAllContours_SIN( &lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
-                                               ShiftValues( &lstOutX, &lstOutY, &lstOutZ, &lstIndexsOut );
-                               } // if 1
+                    if (bbGetInputOpenClose()==true)
+                    {
+                        RedistributionPointsAllContours_SIN( &lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
+                        ShiftValues( &lstOutX, &lstOutY, &lstOutZ, &lstIndexsOut );
+                    } // if OpenClose
+                } // if type param =  1
                        } // if size
        // Step 3.4 Transpose the vectors   
                        lstInX.clear();