From: Eduardo DAVILA Date: Tue, 11 May 2021 16:40:19 +0000 (+0200) Subject: Redistribution SIN in ManualContourModel_Box X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4f2775cba74ebb23b180dce3a551d41ed322a927;p=creaMaracasVisu.git Redistribution SIN in ManualContourModel_Box --- diff --git a/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx b/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx index c8db827..11806ac 100644 --- a/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx +++ b/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx @@ -199,7 +199,8 @@ void ManualContourModel_Box::PutPointsInContour(std::vector *lstTmpX, if ( sizeLstIndexslstIndexs!=0 ) { iGeneral = 0; - iGeneralPlusSize = (*lstOutIndexs)[0]; + SizeContour = (*lstOutIndexs)[0]; + iGeneralPlusSize = iGeneral + SizeContour; for ( iContour=1 ; iContour<=contour ; iContour++ ) { iGeneral = iGeneral + (*lstOutIndexs)[iContour-1]; @@ -218,7 +219,8 @@ void ManualContourModel_Box::PutPointsInContour(std::vector *lstTmpX, iSize++; } //for } else { - printf("EED Warnning!! ManualContourModel_Box::PutPointsInContour the lstTmp vector is not of the correct size. \n"); + printf("EED Warnning!! ManualContourModel_Box::PutPointsInContour the lstTmp vector is not of the correct size. SizeContour=%d lstTmp.size=%d\n" + ,SizeContour, (*lstTmpX).size() ); for ( i=iGeneral ; i *lstC2Y, std::vector *lstC2Z ) { -printf("EED ManualContourModel_Box::Redistribution_SIN Start \n"); std::vector lstRstX; std::vector lstRstY; std::vector lstRstZ; - int ii,iGeneral; - double iiByDelta; - int size,iGeneralPlusSize; - double Alpha,Beta,t,tt, PI=3.14159265; - double TwoPI=2*PI; - double dist=sizeOfContour; - double dist2,distSeg,delta; - double dd,dx,dy,dz; - int i,k; - int firstK; - double tmpX,tmpY,tmpZ; - iGeneral=0; + int ii,iGeneral; + int size,iGeneralPlusSize; + int i,k; + int firstK; + double iiByDelta; + double dist2,distSeg; +// double delta; + double dd,dx,dy,dz; + double t,tt, PI; + double TwoPI; + double dist; + dist = sizeOfContour; + PI = 3.14159265; + TwoPI = 2*PI; + iGeneral = 0; // for (iLstIndexOut=0; iLstIndexOut2) { @@ -295,14 +299,15 @@ printf("EED ManualContourModel_Box::Redistribution_SIN Start \n"); // dz = (*lstOutZ)[i]-(*lstOutZ)[i+1]; // dist= dist+sqrt( dx*dx + dy*dy + dz*dz ); // } //for - delta = dist/(size-1); + +// delta = dist/(size-1); firstK = 0; for (i=iGeneral; i> This list is not coherent iLstIndexOut=%d lstRstX.size()=%d size=%d\n",iLstIndexOut, lstRstX.size(), size); - tmpX = lstRstX[iGeneral]; - tmpY = lstRstY[iGeneral]; - tmpZ = lstRstZ[iGeneral]; - lstRstX.push_back( tmpX ); - lstRstY.push_back( tmpY ); - lstRstZ.push_back( tmpZ ); + printf("EED Warnning! ManualContourModel_Box::Redistribution_SIN >> This list is not coherent lstRstX.size()=%d size=%d\n", lstRstX.size(), size); } + (*lstC2X).clear(); + (*lstC2Y).clear(); + (*lstC2Z).clear(); for (i=iGeneral; i2 + } else { + for (i=0; i2 // iGeneral=iGeneral+size; // }// for iLstIndexOut -printf("EED ManualContourModel_Box::Redistribution_SIN End \n"); } - void ManualContourModel_Box::CopyContour2InContour1( std::vector *lstInX, std::vector *lstInY, @@ -437,41 +442,69 @@ void ManualContourModel_Box::RedistributionPointsAllContours_SIN( std::vector *lstOutZ, std::vector *lstIndexsOut ) { +printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN start\n"); std::vector lstTmp1X; std::vector lstTmp1Y; std::vector lstTmp1Z; std::vector lstTmp2X; std::vector lstTmp2Y; std::vector lstTmp2Z; - std::vector lstTmp1aX; - std::vector lstTmp1aY; - std::vector lstTmp1aZ; + std::vector lstTmp2aX; + std::vector lstTmp2aY; + std::vector lstTmp2aZ; + std::vector lstTmp2bX; + std::vector lstTmp2bY; + std::vector lstTmp2bZ; + std::vector lstTmp2cX; + std::vector lstTmp2cY; + std::vector lstTmp2cZ; + std::vector lstTmp3X; + std::vector lstTmp3Y; + std::vector lstTmp3Z; + std::vector lstContourExeption; int iContour; - double nbContours = (*lstIndexsOut).size()-1; + double nbContours = (*lstIndexsOut).size(); double alpha,iAlpha; double beta,iBeta; double sizeContour1; double sizeContour2; + double sizeContour3; double distAcum; double minDistAcum; + + // ------------ Wave 1 ----------------- + ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut,0,&lstTmp1X,&lstTmp1Y,&lstTmp1Z); sizeContour1 = SizeContour( &lstTmp1X, &lstTmp1Y, &lstTmp1Z ); // Increment - for ( iContour=0; iContoursizeContour2) && (sizeContour2>sizeContour3) ) + { + beta = 0.05; alpha = 0; - minDistAcum=-999999999; - for (iAlpha=0.1 ; iAlpha<1; iAlpha=iAlpha+0.1) + minDistAcum = 999999999; + for (iAlpha=0 ; iAlpha<1; iAlpha=iAlpha+0.1 ) { - Redistribution_SIN( alpha,beta, &lstTmp1X,&lstTmp1Y,&lstTmp1Z ,sizeContour1, &lstTmp1aX,&lstTmp1aY,&lstTmp1aZ ); - distAcum = IntegralDistanceTwoContours( &lstTmp1aX,&lstTmp1aY,&lstTmp1aZ , &lstTmp2X,&lstTmp2Y,&lstTmp2Z ); + Redistribution_SIN( iAlpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ ); + distAcum = IntegralDistanceTwoContours( &lstTmp1X,&lstTmp1Y,&lstTmp1Z , &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ ); if (distAcumsizeContour2>sizeContour3 + else { + if ( (sizeContour1>sizeContour2) && (sizeContour2=0 ; iContour-- ) + { +printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN iContour=%d\n",iContour); + beta = 0; + alpha = 0; +// find Alpha + ExtractContour( lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour-1 ,&lstTmp2X,&lstTmp2Y,&lstTmp2Z ); + sizeContour2 = SizeContour( &lstTmp2X, &lstTmp2Y, &lstTmp2Z ); + + + if (iContour-2<=0) + { + ExtractContour( lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour-2 ,&lstTmp3X,&lstTmp3Y,&lstTmp3Z ); + sizeContour3 = SizeContour( &lstTmp3X, &lstTmp3Y, &lstTmp3Z ); + } else { + sizeContour3=-1; + } + + if ( (sizeContour1>sizeContour2) && (sizeContour2>sizeContour3) ){ + beta = 0.05; + alpha = 0; + minDistAcum = 999999999; + for (iAlpha=0 ; iAlpha<1; iAlpha=iAlpha+0.1 ) + { + Redistribution_SIN( iAlpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ ); + distAcum = IntegralDistanceTwoContours( &lstTmp1X,&lstTmp1Y,&lstTmp1Z , &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ ); + if (distAcumsizeContour2>sizeContour3 +// Set Alpha y Beta + + + Redistribution_SIN( alpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ ); + +// if(lstTmp2Y[0]==385) { alpha=bbGetInputParam()[1]; beta=bbGetInputParam()[2]; printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN ---385-- \n"); } +printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN wave 2 alpha=%f beta=%f z=%f sc1=%f sc2=%f\n",alpha,beta,lstTmp2Y[0], sizeContour1,sizeContour2 ); + + PutPointsInContour(&lstTmp2aX,&lstTmp2aY,&lstTmp2aZ, iContour-1 ,lstOutX,lstOutY,lstOutZ,lstIndexsOut); + sizeContour1 = sizeContour2; + CopyContour2InContour1( &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ , &lstTmp1X,&lstTmp1Y,&lstTmp1Z ); + + } // for iContour + + + + // ------------ Wave 3 ----------------- + + printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN wave3 los que faltan"); + double iExtra,sizeExtra=lstContourExeption.size(); + for ( iExtra=0 ; iExtra