From: Eduardo DAVILA Date: Wed, 3 Jul 2019 14:24:48 +0000 (+0200) Subject: #3269 creaMaracas Visu Feature New Normal - ReadCreaContourFile Box X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c759b7f356f197cac69e058fe355b2afc5daabf1;p=creaMaracasVisu.git #3269 creaMaracas Visu Feature New Normal - ReadCreaContourFile Box --- diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx index 46f8d70..0fc2242 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx @@ -76,9 +76,6 @@ void ColorLayerImageView::Process() bbSetOutputNewImage( clivp->GetColorLayerImageViewManager()->GetImageChangeInformation(0) ); bbSetOutputLookupTable( clivp->GetColorLayerImageViewManager()->GetLookupTable(0) ); -printf("EED ColorLayerImageView::Process A ptrLookupTable:%p\n",clivp->GetColorLayerImageViewManager()->GetLookupTable(0)); -printf("EED ColorLayerImageView::Process B ptrLookupTable:%p\n",bbGetOutputLookupTable() ); - if (firsttime==true) { firsttime=false; diff --git a/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx b/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx index 08a6fa7..1aa1c53 100644 --- a/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx +++ b/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx @@ -22,7 +22,7 @@ void ManualContourModel_Box::ProcessBySegment( int &iGeneral, int sizeSegment, std::vector *lstInX,std::vector *lstInY, std::vector *lstInZ, std::vector *lstOutX,std::vector *lstOutY, std::vector *lstOutZ, - std::vector *lstIndexsOut ) + std::vector *lstIndexsOut, bool open ) { creaContoursFactory f; manualContourModel *m; @@ -32,7 +32,7 @@ void ManualContourModel_Box::ProcessBySegment( m = (manualContourModel*)f.getContourModel( bbGetInputType() ); m->SetNumberOfPointsSpline( bbGetInputNbPoints() ); - m->SetCloseContour( bbGetInputOpenClose() ); + m->SetCloseContour( open ); for (i=iGeneral;iAddPoint( (*lstInX)[i] , (*lstInY)[i] , (*lstInZ)[i] ); @@ -51,6 +51,178 @@ void ManualContourModel_Box::ProcessBySegment( delete m; } + +void ManualContourModel_Box::RedistributionPoints( std::vector *lstOutX, + std::vector *lstOutY, + std::vector *lstOutZ, + std::vector *lstIndexsOut ) +{ + printf("EED Warnning! ManualContourModel_Box::RedistributionPoints Start\n"); + + std::vector lstRstX; + std::vector lstRstY; + std::vector lstRstZ; + + int iLstIndexOut,sizeLstIndexOut=lstIndexsOut->size(); + int ii, iGeneral=0; + int size; + + for (iLstIndexOut=0; iLstIndexOut2) + { + double dist=0,dist2,distSeg,delta; + double dd,dx,dy,dz; + int i,k; + for (i=iGeneral+1; i=ii*delta) + { + dd=(ii*delta-dist2)/distSeg; + if (distSeg==0) + { + dd=0; + } // if distSeg == 0 + lstRstX.push_back( (*lstOutX)[k-1] + dd*dx ); + lstRstY.push_back( (*lstOutY)[k-1] + dd*dy ); + lstRstZ.push_back( (*lstOutZ)[k-1] + dd*dz ); + k=iGeneral+size; + } else { + if (k==iGeneral+size-1) + { + dd=1; + lstRstX.push_back( (*lstOutX)[k-1] + dd*dx ); + lstRstY.push_back( (*lstOutY)[k-1] + dd*dy ); + lstRstZ.push_back( (*lstOutZ)[k-1] + dd*dz ); +// printf("EED ManualContourModel_Box::RedistributionPoints iLstIndexOut=%d i=%d k=%d dist2+distSeg=%f ii*delta=%f dif=%f \n", iLstIndexOut,i-iGeneral, k-iGeneral, dist2+distSeg , ii*delta , (dist2+distSeg) - ii*delta); + } + }// if dist2 + dist2=dist2+distSeg; + } // for k + } //for i + + + if (lstRstX.size()!=size) + { + printf("EED Warnning! ManualContourModel_Box::RedistributionPoints >> This list is not coherent iLstIndexOut=%d lstRstX.size()=%d size=%d\n",iLstIndexOut, lstRstX.size(), size); + } + + for (i=iGeneral; i2 + + iGeneral=iGeneral+size; + + }// for iLstIndexOut + + printf("EED Warnning! ManualContourModel_Box::RedistributionPoints End\n"); + +} + + + +void ManualContourModel_Box::ShiftValues( std::vector *lstInX, + std::vector *lstInY, + std::vector *lstInZ, + std::vector *lstIndexsIn ) +{ + int iLstIndexIn,sizeLstIndexIn=lstIndexsIn->size(); + int ii, iGeneral=0; + int size,size2; + double dist,distMin; + int i,iBack; + double dx,dy,dz; + + std::vector LstTmpX; + std::vector LstTmpY; + std::vector LstTmpZ; + + if (sizeLstIndexIn>=2) + { + for (iLstIndexIn=0; iLstIndexIn *lstInX, + std::vector *lstInY, + std::vector *lstOuZ, + std::vector *lstIndexsIn ); + + void ProcessBySegment( int Type, int &iGeneral, int sizeSegment, std::vector *lstInX,std::vector *lstInY, std::vector *lstInZ, std::vector *lstOutX,std::vector *lstOutY, std::vector *lstOutZ, - std::vector *lstIndexsOut ); + std::vector *lstIndexsOut, + bool open ); + +void RedistributionPoints( std::vector *lstOutX, + std::vector *lstOutY, + std::vector *lstOutZ, + std::vector *lstIndexsOut ); + //===== diff --git a/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.cxx b/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.cxx new file mode 100644 index 0000000..202e5cb --- /dev/null +++ b/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.cxx @@ -0,0 +1,169 @@ +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +#include "bbcreaMaracasVisuReadCreaContourFile.h" +#include "bbcreaMaracasVisuPackage.h" +namespace bbcreaMaracasVisu +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ReadCreaContourFile) +BBTK_BLACK_BOX_IMPLEMENTATION(ReadCreaContourFile,bbtk::AtomicBlackBox); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void ReadCreaContourFile::Process() +{ + +// THE MAIN PROCESSING METHOD BODY +// Here we simply set the input 'In' value to the output 'Out' +// And print out the output value +// INPUT/OUTPUT ACCESSORS ARE OF THE FORM : +// void bbSet{Input|Output}NAME(const TYPE&) +// const TYPE& bbGet{Input|Output}NAME() const +// Where : +// * NAME is the name of the input/output +// (the one provided in the attribute 'name' of the tag 'input') +// * TYPE is the C++ type of the input/output +// (the one provided in the attribute 'type' of the tag 'input') + +// bbSetOutputOut( bbGetInputIn() ); +// std::cout << "Output value = " < LstX; + std::vector LstY; + std::vector LstZ; + std::vector LstIndexs; + + fscanf(ff,"%s",tmp); // version + fscanf(ff,"%s",tmp); // + fscanf(ff,"%s",tmp); // ImageDimensions + fscanf(ff,"%d",&dimX); // + fscanf(ff,"%d",&dimY); // + fscanf(ff,"%d",&dimZ); // + fscanf(ff,"%s",tmp); // ImageSpacing + fscanf(ff,"%s",tmp); // + fscanf(ff,"%s",tmp); // + fscanf(ff,"%s",tmp); // + fscanf(ff,"%s",tmp); // NumberOfContours + fscanf(ff,"%d",&NumberOfContours); // + for (iContour=0 ; iContour); + BBTK_DECLARE_OUTPUT(LstY,std::vector); + BBTK_DECLARE_OUTPUT(LstZ,std::vector); + BBTK_DECLARE_OUTPUT(LstIndexs,std::vector); + BBTK_PROCESS(Process); + void Process(); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(ReadCreaContourFile,bbtk::AtomicBlackBox); + BBTK_NAME("ReadCreaContourFile"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(ReadCreaContourFile,FileNameRoi,"creaContour file (*.roi)",std::string,""); + BBTK_INPUT(ReadCreaContourFile,FromDirection,"(default 0) 0:XY 1:YZ 2:XZ",int,""); + + BBTK_OUTPUT(ReadCreaContourFile,LstX,"Vetor X",std::vector,""); + BBTK_OUTPUT(ReadCreaContourFile,LstY,"Vetor Y",std::vector,""); + BBTK_OUTPUT(ReadCreaContourFile,LstZ,"Vetor Z",std::vector,""); + BBTK_OUTPUT(ReadCreaContourFile,LstIndexs,"List of : number of elements by segments",std::vector,""); + +BBTK_END_DESCRIBE_BLACK_BOX(ReadCreaContourFile); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +} +// EO namespace bbcreaMaracasVisu + +#endif // __bbcreaMaracasVisuReadCreaContourFile_h_INCLUDED__ + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx index 1ba779e..4bc83c8 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx @@ -411,13 +411,10 @@ vtkImageData* ColorLayerImageViewManager::GetImageChangeInformation(int id) //---------------------------------------------------------------------------- vtkLookupTable* ColorLayerImageViewManager::GetLookupTable(int id) { -printf("EED ColorLayerImageViewManager::GetLookupTable 0 \n"); if (_colorLayerImageViewLst[id]!=NULL) { -printf("EED ColorLayerImageViewManager::GetLookupTable 1 \n"); return _colorLayerImageViewLst[id]->GetThresholdTable( ); } // if -printf("EED ColorLayerImageViewManager::GetLookupTable 2 \n"); return NULL; } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx index f63a57a..c295169 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx @@ -386,7 +386,6 @@ void LayerImageBase::Refresh() //---------------------------------------------------------------------------- vtkLookupTable* LayerImageBase::GetThresholdTable() { -printf("EED LayerImageBase::GetThresholdTable\n"); return _thresholdTable; }