]> Creatis software - bbtk.git/commitdiff
Clean code
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Wed, 19 Jan 2022 07:30:52 +0000 (08:30 +0100)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Wed, 19 Jan 2022 07:30:52 +0000 (08:30 +0100)
kernel/src/bbtkBlackBox.cxx
packages/vtk/src/bbtkStaticLecture.cxx
packages/vtk/src/bbtkStaticLecture.h
packages/vtk/src/bbvtkBinaryOperations.cxx
packages/vtk/src/bbvtkSegmentationConnectivity.cxx

index 8e233d6ae997c9fede454c1599c81cf3442c5991..ed57b5a6709cff088e79191c6d0fb6aee531a79d 100644 (file)
@@ -748,9 +748,9 @@ namespace bbtk
                           ( (bbBoxProcessModeIsManual()==true)&&(bbLetRecursiveExecuteManualMode==true) ) 
                         )
                        {
-// printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() );
+ printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() );
                                this->bbProcess();              
-// printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() );
+ printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() );
                    } // Manual analysis
                  
 //EED ups                      if ((bbBoxProcessModeIsManual()==true) && (bbLetRecursiveExecuteManualMode==false))
index fc1f9af7dd468b35ef8e0356f093ade9510f5bb3..583edb3e4e6c583ac6656373b57870a43966e9a3 100755 (executable)
 
 int bbtkStaticLecture::GetTypeFormat( std::string formatStr , vtkImageData* image )
 {
+    printf("EED bbtkStaticLecture::GetTypeFormat Start \n");
        int outputformat = VTK_UNSIGNED_CHAR;
        if (formatStr=="SAME")
-       {                                               
+       {
+        printf("EED bbtkStaticLecture::GetTypeFormat 1  image=%p\n",image);
                if (image!=NULL) outputformat = image->GetScalarType();
+        printf("EED bbtkStaticLecture::GetTypeFormat 2 \n");
        }
        else if (formatStr=="VTK_BIT")                          outputformat = VTK_BIT;                         // 1
        else if (formatStr=="VTK_CHAR")                         outputformat = VTK_CHAR;                        // 2
@@ -56,6 +59,8 @@ int bbtkStaticLecture::GetTypeFormat( std::string formatStr , vtkImageData* imag
        else if (formatStr=="MET_FLOAT")                        outputformat = VTK_FLOAT;               // 10
        else if (formatStr=="MET_DOUBLE")                       outputformat = VTK_DOUBLE;              // 11  
 
+    printf("EED bbtkStaticLecture::GetTypeFormat outputformat=%d End\n", outputformat);
+
     return outputformat;
 }
 
index 35b0624ce39624478f11917ca43b8d703eee4bd9..57e2aebe5adf688c7b7c5536bdcc91f94700e1ba 100755 (executable)
@@ -35,8 +35,8 @@ class bbtkStaticLecture
 {
 public:
        static int      GetTypeFormat( std::string formatStr , vtkImageData* image );
-       void    setPixelValue(int i, int j, int k, vtkImageData* img, double value);
-       double  getPixelValue(int i, int j, int k, vtkImageData* img);
+       void        setPixelValue(int i, int j, int k, vtkImageData* img, double value);
+       double      getPixelValue(int i, int j, int k, vtkImageData* img);
 };
 
 #endif
index 0e2a523f2b5b4d4193843cb410395b7f8193b10f..e65289adea8929978a0afb1413f4b4124c909384 100644 (file)
@@ -49,7 +49,7 @@ void BinaryOperations::Process()
 
        if (bbGetInputIn1() == NULL)
        {
-               std::cout << "EED BinaryOperations::Process  Set In1 at least" << std::endl;
+               printf( "EED Warning!!!  (%s)  BinaryOperations::Process  Set In1 at least", bbGetFullName().c_str() );
                return;
        }
 
@@ -72,7 +72,7 @@ void BinaryOperations::Process()
 #endif
 
        } else {
-           std::cout << "EED BinaryOperations::Process  Set In2" << std::endl;
+        printf( "EED Warning!!!  (%s)  BinaryOperations::Process  Set In2 at least", bbGetFullName().c_str() );
         return;
        }
        switch (bbGetInputOperation())
index 1f2758ead003fea3faa4a506297d3f0e9a154968..b5b028da31e1434bfc0f9c142af3c3ba245b4626 100644 (file)
@@ -67,7 +67,7 @@ namespace bbvtk
          bbSetInputPositionXYZ(position);
          std::vector<int> threshold;
          threshold.push_back(0);
-         threshold.push_back(0);
+         threshold.push_back(1);
          bbSetInputThresholdMinMax(threshold);
          bbSetOutputOut(NULL);
          bbSetInputOutputFormat("SAME");
@@ -128,12 +128,20 @@ namespace bbvtk
 // --------------------------------------------------------------
   void SegmentationConnectivity::DoProcess()
   {
+      
+      printf("EED (%s) SegmentationConnectivity::DoProcess Start \n", bbGetFullName().c_str() );
        int x,y,z;
        int i,numPoints = bbGetInputPositionXYZ().size()/3;
        int verif = (bbGetInputPositionXYZ().size()-1) % 3;
        if (( numPoints>=1) && (verif==2) && (bbGetInputIn()!=NULL)) 
        {
+        printf("EED  SegmentationConnectivity::DoProcess 1 format=%s %p\n", bbGetInputOutputFormat().c_str() , bbGetInputIn()  );
+        printf("EED  SegmentationConnectivity::DoProcess 1.1 \n" );
+
+//EED 2020-01-18
                int outputformat = bbtkStaticLecture::GetTypeFormat( bbGetInputOutputFormat() , bbGetInputIn() );
+//        int outputformat=4;
+        printf("EED  SegmentationConnectivity::DoProcess 2 \n" );
                vtkImageData *imagedata = bbGetInputIn();
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
@@ -145,6 +153,7 @@ namespace bbvtk
 //             imagedata->SetExtent(imagedata->GetExtent());
                thresh2->SetInputData(imagedata);
 #endif
+        printf("EED SegmentationConnectivity::DoProcess 3  Threshold= %f %f\n", bbGetInputThresholdMinMax()[0], bbGetInputThresholdMinMax()[1] );
                thresh2->ThresholdBetween(bbGetInputThresholdMinMax()[0], bbGetInputThresholdMinMax()[1]);
                thresh2->Update();
                connect2->RemoveAllSeeds ();
@@ -158,28 +167,38 @@ namespace bbvtk
                int maxX = ext[1]-ext[0]+1;
                int maxY = ext[3]-ext[2]+1;
                int maxZ = ext[5]-ext[4]+1;
+        printf("EED SegmentationConnectivity::DoProcess 4 numPoints=%d\n",numPoints );
                for (i=0;i<numPoints;i++)
                {
-                       x=bbGetInputPositionXYZ()[i*3+0];
-                       y=bbGetInputPositionXYZ()[i*3+1];
-                       z=bbGetInputPositionXYZ()[i*3+2];
+                       x = bbGetInputPositionXYZ()[i*3+0];
+                       y = bbGetInputPositionXYZ()[i*3+1];
+                       z = bbGetInputPositionXYZ()[i*3+2];
                        if ( (x>=0) || (x<maxX) || (y>=0) || (y<maxY) || (z>=0) || (z<maxZ) )
                        {
+                printf("EED  SegmentationConnectivity::DoProcess 4.1 xyz=%d %d %d\n",x,y,z );
                                connect2->AddSeed( x,y,z );
                        } else {
                                printf("EED WARNNIG! In box: SegmentationConnectivity points list out of range \n");
                        } // if point inside image 
                } // for i
+        printf("EED  SegmentationConnectivity::DoProcess 4.2 \n" );
                connect2->SetOutputConnectedValue( bbGetInputValue() );
+        printf("EED  SegmentationConnectivity::DoProcess 4.3 \n" );
                cast4->SetOutputScalarType( outputformat );
+        printf("EED  SegmentationConnectivity::DoProcess 4.5 \n" );
                connect2->Modified();
+        printf("EED  SegmentationConnectivity::DoProcess 5 \n" );
                connect2->Update();
                cast4->Update();                        
+        printf("EED SegmentationConnectivity::DoProcess 6 \n" );
                bbSetOutputOut(cast4->GetOutput() );
        }  else {
                printf("EED WARNNIG! In box: SegmentationConnectivity List of points are not coherent. \n");
                bbSetOutputOut( NULL );
        }// if numPoints verif
+      
+      printf("EED SegmentationConnectivity::DoProcess End \n" );
+
 }
   
 }// EO namespace bbvtk