]> Creatis software - creaVtk.git/blobdiff - bbtk_creaVtk_PKG/src/bbcreaVtkMultipleOperations.cxx
#3414 creaVtk Feature New Normal - openmp
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkMultipleOperations.cxx
index edd549d53153028ae98925caba04849450da240c..fe7b4fab56963e4c5a56b7a50b268c5500363205 100644 (file)
@@ -16,7 +16,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(MultipleOperations,bbtk::AtomicBlackBox);
 //===== 
 void MultipleOperations::Process()
 {
-printf("EED MultipleOperations::Process Start\n");
 // THE MAIN PROCESSING METHOD BODY
 //   Here we simply set the input 'In' value to the output 'Out'
 //   And print out the output value
@@ -37,7 +36,6 @@ printf("EED MultipleOperations::Process Start\n");
                int dimXImage   = extImage[1]-extImage[0]+1;
                int dimYImage   = extImage[3]-extImage[2]+1;
                int dimZImage   = extImage[5]-extImage[4]+1;
-               int iLst,sizeLst= bbGetInputInLst().size();
                if (bbGetOutputOut()!=NULL) 
                {
                        bbGetOutputOut()->Delete();
@@ -48,14 +46,27 @@ printf("EED MultipleOperations::Process Start\n");
                resultImage->SetDimensions(  dimXImage, dimYImage, dimZImage );
                resultImage->AllocateScalars( bbGetInputInLst()[0]->GetScalarType(),1 );
                long int index,size=dimXImage*dimYImage*dimZImage;
+               DEF_POINTER_IMAGE_VTK_CREA(vOut,ssOut,pOut,stOut,resultImage )
                if (bbGetInputType()==20)
                {
-                       DEF_POINTER_IMAGE_VTK_CREA(vIn ,ssIn ,pIn ,stIn ,bbGetInputInLst()[0] )
-                       DEF_POINTER_IMAGE_VTK_CREA(vOut,ssOut,pOut,stOut,resultImage )
-                       double vInBack,acumDiff;
-//  #pragma omp parallel for
+
+long int k1omp=(double)(size-1)*0.0;
+long int k2omp=(double)(size-1)*0.2;
+long int k3omp=(double)(size-1)*0.4;
+long int k4omp=(double)(size-1)*0.6;
+long int k5omp=(double)(size-1)*0.8;
+long int k6omp=(double)(size-1)*1.0;
+
+printf("EED MultipleOperations::Process (with openmp)\n");
+#pragma omp parallel for
                        for (index=0;index<size;index++)
                        {
+if ( (k1omp==index) || (k2omp==index) || (k3omp==index) || 
+     (k4omp==index) || (k5omp==index) || (k6omp==index) ) { printf("  %d%\n", (int)(((double)index/(double)(size-1))*100 )); }
+
+                               DEF_POINTER_IMAGE_VTK_CREA(vIn ,ssIn ,pIn ,stIn ,bbGetInputInLst()[0] )
+                               int iLst,sizeLst= bbGetInputInLst().size();
+                               double vInBack,acumDiff;
                                acumDiff=0;
                                for (iLst=0;iLst<sizeLst;iLst++) // volumes
                                {
@@ -73,8 +84,6 @@ printf("EED MultipleOperations::Process Start\n");
                } // if Type==20
                bbSetOutputOut( resultImage );
        } // if InLst size
-printf("EED MultipleOperations::Process End\n");
-
 }
 //===== 
 // 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)