From 228dd2fe51b414e56427b93a1d99a35e568c7033 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Thu, 18 Jan 2018 15:53:00 +0100 Subject: [PATCH] #3171 creaMaracasVisu Feature New Normal - creaVTK_MACROS --- .../bbcreaMaracasVisuManualPaint_Model.cxx | 113 ++---------------- .../widgets/manualPaint/FillFilter.cpp | 13 +- .../manualPaint/baseFilterManualPaint.h | 49 -------- 3 files changed, 15 insertions(+), 160 deletions(-) diff --git a/bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx b/bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx index 0320735..e31a64d 100644 --- a/bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx +++ b/bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx @@ -1,8 +1,12 @@ //===== // 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 "creaVtk_MACROS.h" #include "bbcreaMaracasVisuManualPaint_Model.h" #include "bbcreaMaracasVisuPackage.h" + + namespace bbcreaMaracasVisu { @@ -13,107 +17,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint_Model,bbtk::AtomicBlackBox); //===== -/* -void ManualPaint_Model::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 = " <SetActive( bbGetInputActive() ); - manualpaintmodel->SetTool( bbGetInputTool() ); - manualpaintmodel->Set2D3D( bbGetInput2D3D() ); - manualpaintmodel->SetImages( bbGetInputImage(),bbGetInputImage2() ); - manualpaintmodel->SetGrayLevel( bbGetInputGrayLevel() ); - manualpaintmodel->SetDirection( bbGetInputDirection() ); - manualpaintmodel->SetBrushSize( bbGetInputBrushSize() ); - manualpaintmodel->SetBrushForm( bbGetInputBrushForm() ); - manualpaintmodel->SetToleranceFill( bbGetInputToleranceFill() ); - manualpaintmodel->SetDistanceFill( bbGetInputDistanceFill() ); - manualpaintmodel->SetRangeMin( bbGetInputRange()[0] ); - manualpaintmodel->SetRangeMax( bbGetInputRange()[1] ); - if (bbGetInputPoint().size()==3) - { - manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] ); - } // if Points - - if ( bbGetInputByLstPointsX().size()!=0 ) - { - int i,size = bbGetInputByLstPointsX().size(); - for (i=0;iPaintImage( bbGetInputByLstPointsX()[i] , bbGetInputByLstPointsY()[i] , bbGetInputByLstPointsZ()[i] ); - } // for - }// if ByLstPointsX - - if (bbGetInputByImagePoints()!=NULL) - { - int i,ii=0; -// int i,j,k; -// int ia,ja,ka; -// int ii,jj,kk; - int ext[6]; - bbGetInputByImagePoints()->GetWholeExtent(ext); - int dimX=ext[1]-ext[0]+1; - int dimY=ext[3]-ext[2]+1; - int dimZ=ext[5]-ext[4]+1; -// char *pByImagePoints = bbGetInputByImagePoints->GetScalarComponent(i,j,k,0); -// int sizeData; -//#pragma omp parallel for - for (i=0;iGetScalarComponentAsDouble(i,j,k, 0)>0) - { - if (bbGetInputImage2()->GetScalarComponentAsDouble(i,j,k, 0)==0) - { - manualpaintmodel->PaintImage(i,j,k); - } // bbGetInputImage2 - } // GetScalarComponentAsDouble - }// for k - }// for j - }// for i - printf("ManualPaint_Model %d%\n", 100 ); - } // if ByImagePoints - } else { - printf("EED Warning: Image not set. Box creaMaracasVisu::ManualPaint_Model (BBTK) \n"); - } // if - - if (bbGetInputImage2()!=NULL) - { - bbSetOutputOut( bbGetInputImage2() ); - } else if (bbGetInputImage()!=NULL) { - bbSetOutputOut( bbGetInputImage() ); - } else { - bbSetOutputOut( NULL ); - } -} -*/ - - - void ManualPaint_Model::Process() { @@ -169,8 +72,8 @@ void ManualPaint_Model::Process() int dimY=ext[3]-ext[2]+1; int dimZ=ext[5]-ext[4]+1; - DEFINEPOINTERIMAGE_MANUALPAINT(vBIP,sSBIP,pBIP,sTBIP,bbGetInputByImagePoints()); - DEFINEPOINTERIMAGE_MANUALPAINT(vI2,sSI2,pI2,sTI2,bbGetInputImage2()); + DEF_POINTER_IMAGE_VTK_CREA(vBIP,sSBIP,pBIP,sTBIP,bbGetInputByImagePoints()); + DEF_POINTER_IMAGE_VTK_CREA(vI2,sSI2,pI2,sTI2,bbGetInputImage2()); //#pragma omp parallel for @@ -185,10 +88,10 @@ void ManualPaint_Model::Process() { for (i=0;i0) { - GETVALUE_MANUALPAINT(vI2,pI2,sTI2) + GETVALUE_VTK_CREA(vI2,pI2,sTI2) if (vI2==0) { manualpaintmodel->PaintImage(i,j,k); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp index 3f9c7ad..8210bec 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp @@ -24,6 +24,7 @@ # ------------------------------------------------------------------------ */ #include "FillFilter.h" +#include "creaVtk_MACROS.h" FillFilter::FillFilter() { @@ -125,8 +126,8 @@ void FillFilter::Run() // virtual //--------------------------------------------------------------------------- void FillFilter::FillToolRecursive(int px, int py, int pz,long int ivi) { -DEFINEPOINTERIMAGE_MANUALPAINT(v_image,ss_image,p_image,st_image,_image) -DEFINEPOINTERIMAGE_MANUALPAINT(v_image2,ss_image2,p_image2,st_image2,_image2) +DEF_POINTER_IMAGE_VTK_CREA(v_image,ss_image,p_image,st_image,_image) +DEF_POINTER_IMAGE_VTK_CREA(v_image2,ss_image2,p_image2,st_image2,_image2) _countRecursiveFill++; _countProgressingFill++; @@ -158,13 +159,13 @@ DEFINEPOINTERIMAGE_MANUALPAINT(v_image2,ss_image2,p_image2,st_image2,_image2) //EED01 // _tmpiglfill = _image->GetScalarComponentAsDouble(px, py, pz, 0); -GETVALUE2_MANUALPAINT(_tmpiglfill,p_image,st_image,ivi) +GETVALUE2_VTK_CREA(_tmpiglfill,p_image,st_image,ivi) if (_image2!=NULL) { //EED01 // _tmpiglfill2 = _image2->GetScalarComponentAsDouble(px, py, pz, 0); -GETVALUE2_MANUALPAINT(_tmpiglfill2,p_image2,st_image2,ivi) +GETVALUE2_VTK_CREA(_tmpiglfill2,p_image2,st_image2,ivi) } else { _tmpiglfill2 = _tmpiglfill; } @@ -214,11 +215,11 @@ GETVALUE2_MANUALPAINT(_tmpiglfill2,p_image2,st_image2,ivi) { //EED01 // _image2->SetScalarComponentFromFloat(px, py, pz, 0,(float) _graylevel); -SETVALUE2_MANUALPAINT(_graylevel,p_image2,st_image2,ivi) +SETVALUE2_VTK_CREA(_graylevel,p_image2,st_image2,ivi) } else { //EED01 // _image->SetScalarComponentFromFloat(px, py, pz, 0,(float) _graylevel); -SETVALUE2_MANUALPAINT(_graylevel,p_image,st_image,ivi) +SETVALUE2_VTK_CREA(_graylevel,p_image,st_image,ivi) } if (_countRecursiveFill < _limitRecursionFill) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.h index 21d38c5..f24066a 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.h @@ -33,55 +33,6 @@ #include "imageModificationManager.h" -#define GETVALUE_MANUALPAINT(VALUE,POINTER,SCALARTYPE) \ - if (SCALARTYPE==VTK_DOUBLE) { VALUE=(double)*((double*)POINTER); } \ - else if (SCALARTYPE==VTK_FLOAT) { VALUE=(double)*((float*)POINTER); } \ - else if (SCALARTYPE==VTK_CHAR) { VALUE=(double)*((char*)POINTER); } \ - else if (SCALARTYPE==VTK_UNSIGNED_CHAR) { VALUE=(double)*((unsigned char*)POINTER); } \ - else if (SCALARTYPE==VTK_INT) { VALUE=(double)*((int*)POINTER); } \ - else if (SCALARTYPE==VTK_UNSIGNED_INT) { VALUE=(double)*((unsigned int*)POINTER); } \ - else if (SCALARTYPE==VTK_LONG) { VALUE=(double)*((long*)POINTER); } \ - else if (SCALARTYPE==VTK_UNSIGNED_LONG) { VALUE=(double)*((unsigned long*)POINTER); } \ - else if (SCALARTYPE==VTK_SHORT) { VALUE=(double)*((short*)POINTER); } \ - else if (SCALARTYPE==VTK_UNSIGNED_SHORT){ VALUE=(double)*((unsigned short*)POINTER);} \ - else { printf("EED GETVALUE_MANUALPAINT error\n"); } - -#define GETVALUE2_MANUALPAINT(VALUE,POINTER,SCALARTYPE,INDEX) \ - if (SCALARTYPE==VTK_DOUBLE) { VALUE=(double)((double*)POINTER)[INDEX]; } \ - else if (SCALARTYPE==VTK_FLOAT) { VALUE=(double)((float*)POINTER)[INDEX]; } \ - else if (SCALARTYPE==VTK_CHAR) { VALUE=(double)((char*)POINTER)[INDEX]; } \ - else if (SCALARTYPE==VTK_UNSIGNED_CHAR) { VALUE=(double)((unsigned char*)POINTER)[INDEX]; } \ - else if (SCALARTYPE==VTK_INT) { VALUE=(double)((int*)POINTER)[INDEX]; } \ - else if (SCALARTYPE==VTK_UNSIGNED_INT) { VALUE=(double)((unsigned int*)POINTER)[INDEX]; } \ - else if (SCALARTYPE==VTK_LONG) { VALUE=(double)((long*)POINTER)[INDEX]; } \ - else if (SCALARTYPE==VTK_UNSIGNED_LONG) { VALUE=(double)((unsigned long*)POINTER)[INDEX]; } \ - else if (SCALARTYPE==VTK_SHORT) { VALUE=(double)((short*)POINTER)[INDEX]; } \ - else if (SCALARTYPE==VTK_UNSIGNED_SHORT){ VALUE=(double)((unsigned short*)POINTER)[INDEX]; } \ - else { printf("EED GETVALUE2_MANUALPAINT error\n"); } - -#define SETVALUE2_MANUALPAINT(VALUE,POINTER,SCALARTYPE,INDEX) \ - if (SCALARTYPE==VTK_DOUBLE) { ((double*)POINTER)[INDEX] = (double)VALUE; } \ - else if (SCALARTYPE==VTK_FLOAT) { ((float*)POINTER)[INDEX] = (float)VALUE; } \ - else if (SCALARTYPE==VTK_CHAR) { ((char*)POINTER)[INDEX] = (char)VALUE; } \ - else if (SCALARTYPE==VTK_UNSIGNED_CHAR) { ((unsigned char*)POINTER)[INDEX] = (unsigned char)VALUE; } \ - else if (SCALARTYPE==VTK_INT) { ((int*)POINTER)[INDEX] = (int)VALUE; } \ - else if (SCALARTYPE==VTK_UNSIGNED_INT) { ((unsigned int*)POINTER)[INDEX] = (unsigned int)VALUE; } \ - else if (SCALARTYPE==VTK_LONG) { ((long*)POINTER)[INDEX] = (long)VALUE; } \ - else if (SCALARTYPE==VTK_UNSIGNED_LONG) { ((unsigned long*)POINTER)[INDEX] = (unsigned long)VALUE; } \ - else if (SCALARTYPE==VTK_SHORT) { ((short*)POINTER)[INDEX] = (short)VALUE; } \ - else if (SCALARTYPE==VTK_UNSIGNED_SHORT){ ((unsigned short*)POINTER)[INDEX] = (unsigned short)VALUE;} \ - else { printf("EED SETVALUE2_MANUALPAINT error\n"); } - - -#define DEFINEPOINTERIMAGE_MANUALPAINT(VALUE,SCALARSIZE,POINTERIMAGE,SCALARTYPE,IMAGE) \ - double VALUE = 0; \ - int SCALARSIZE = IMAGE->GetScalarSize(); \ - char *POINTERIMAGE = (char*)(IMAGE->GetScalarPointer()); \ - int SCALARTYPE = IMAGE->GetScalarType(); - - - - class baseFilterManualPaint { public: -- 2.47.1