]> Creatis software - creaVtk.git/commitdiff
#3462 Clean Code NULL data
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Sun, 16 May 2021 14:10:58 +0000 (16:10 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Sun, 16 May 2021 14:10:58 +0000 (16:10 +0200)
CMakeLists.txt
bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.cxx

index 0e5b8f180f7f4dc2858f9fbdcaa4d371cbd8da14..5308eced06a0089771d733af60a7b94da6b3b817 100644 (file)
@@ -61,6 +61,8 @@ SET(PROJECT_VERSION_DATE "11/02/2010")
 #ADD_DEFINITIONS( -DPROJECT_VERSION=${PROJECT_VERSION} )
 #ADD_DEFINITIONS( -DPROJECT_VERSION_DATE=${PROJECT_VERSION_DATE} )
 
+
+
 # JPR 4 mars 2011
 set (CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake/Module)
 
@@ -203,3 +205,6 @@ ADD_SUBDIRECTORY(install)
 # ----
 ADD_SUBDIRECTORY(bbtk_creaVtk_PKG)
 #ADD_SUBDIRECTORY(bbtk_creaVtkHeartAngles_PKG)
+
+
+
index 463ee223014c2fef4b19ff71ea3bca51abb7608f..8d346915a5c27c3a62e2b757ed69c2a52194e986 100644 (file)
@@ -45,7 +45,6 @@ void ApplyMask::Process()
                int dimXMask            = extMask[1]-extMask[0]+1;
                int dimYMask            = extMask[3]-extMask[2]+1;
                int dimZMask            = extMask[5]-extMask[4]+1;
-
                double background       = bbGetInputBackground();
                double bgToAnalice      = bbGetInputBackgroundToAnalice();
 
@@ -87,7 +86,6 @@ void ApplyMask::Process()
                                DEF_POINTER_IMAGE_VTK_CREA(vI,ssI,pI,stI, bbGetInputImage() );
                                DEF_POINTER_IMAGE_VTK_CREA(vM,ssM,pM,stM, bbGetInputMask() );
                                DEF_POINTER_IMAGE_VTK_CREA(vO,ssO,pO,stO, resultImage );
-
 long int k1omp=(double)(size-1)*0.0;
 long int k2omp=(double)(size-1)*0.2;
 long int k3omp=(double)(size-1)*0.4;
@@ -104,7 +102,6 @@ if ( (k1omp==i) || (k2omp==i) || (k3omp==i) ||
                                        double vMtmpOMP;
                                        double vOtmpOMP;
                                        GETVALUE2_VTK_CREA(vMtmpOMP,pM,stM,i);
-
                                        if (bbGetInputType()==0)  //Applay mask to new Image
                                        {               
                                                GETVALUE2_VTK_CREA(vItmpOMP,pI,stI,i);
@@ -116,7 +113,6 @@ if ( (k1omp==i) || (k2omp==i) || (k3omp==i) ||
                                                } // if vM
                                                SETVALUE2_VTK_CREA(vOtmpOMP,pO,stO,i);  
                                        } // if Type==0
-
                                        if (bbGetInputType()==1)  //Modifiy the Input image with the Label value in Mask place
                                        {               
                                                if (vMtmpOMP!=bgToAnalice)
@@ -125,7 +121,6 @@ if ( (k1omp==i) || (k2omp==i) || (k3omp==i) ||
                                                        SETVALUE2_VTK_CREA(vOtmpOMP,pO,stO,i);  
                                                }
                                        } // if Type==1
-
                                        if (bbGetInputType()==2)  //Modifiy the Input image with the Mask value
                                        {               
                                                if (vMtmpOMP!=bgToAnalice)
@@ -134,7 +129,6 @@ if ( (k1omp==i) || (k2omp==i) || (k3omp==i) ||
                                                        SETVALUE2_VTK_CREA(vOtmpOMP,pO,stO,i);  
                                                }
                                        } // if Type==2
-
                                } // for
                } //if dim
                resultImage->Modified();
index b141e0257287999a8a218992cb9262b1171750cc..3d6227fc45d9202a66d34c711c216e932bcd2969 100644 (file)
@@ -38,6 +38,7 @@ void CreateMeshFromPoints::Process()
                if ( (lstIndexs.size()<=1) || (lstX.size()==0) || (lstX.size()!=lstY.size()) || (lstY.size()!=lstZ.size()) )
                {
                        printf("Warnning! CreateMeshFromPoints::Process: List of points X Y Z  and LstIndexes is not correct\n");
+                       bbSetOutputOut(NULL);
                } else  {
                        int ii,sizeSegment1,sizeSegment2;
                        int endSegment;
index b5a495f11662c44b6352a6e2548db97ef8bfffbf..7813c429c58f61a35d42f41c9ba2ce14339d844d 100644 (file)
@@ -33,27 +33,9 @@ void PolyDataToImageData::Process()
 
        if ((bbGetInputInPolyData()!=NULL) && (bbGetInputInImage()!=NULL) )
        {
-
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
 printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .................;\n ");
-
                int ext[6];
                bbGetInputInImage()->GetExtent( ext );
-
 //             vtkCleanPolyData *clean1 = vtkCleanPolyData::New();             
                if (clean1!=NULL) clean1->Delete();
                clean1 = vtkCleanPolyData::New();
@@ -62,14 +44,12 @@ printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .........
                vtkTriangleFilter *triangle1 = vtkTriangleFilter::New();
                triangle1->SetInputData( clean1->GetOutput() );
                triangle1->Update();
-
 //             vtkPolyDataToImageStencil *dataToStencil = vtkPolyDataToImageStencil::New();
                if (dataToStencil!=NULL) dataToStencil->Delete();
                dataToStencil = vtkPolyDataToImageStencil::New();
                dataToStencil->SetInputData( triangle1->GetOutput() );
                dataToStencil->SetOutputWholeExtent( ext );
                dataToStencil->Update();
-
 //             vtkExtractVOI *extract = vtkExtractVOI::New();
                if (extract!=NULL) extract->Delete();
                extract = vtkExtractVOI::New();
@@ -78,7 +58,6 @@ printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .........
                extract->SetInputData( bbGetInputInImage() );
                extract->ReleaseDataFlagOff();
                extract->Update();      
-
 //             vtkImageStencil *stencil = vtkImageStencil::New();
                if (stencil!=NULL) stencil->Delete();
                stencil = vtkImageStencil::New();
@@ -88,32 +67,28 @@ printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .........
                stencil->ReverseStencilOn();
                stencil->SetBackgroundValue( bbGetInputBackgroundValue() );
                stencil->Update();
-
                bbSetOutputOut( stencil->GetOutput() );
        } else {
                printf("EED Warnning!  PolyDataToImageData::Process  > Missing Image or PolyData inputs\n");
+               bbSetOutputOut( NULL);
        }// if In NULL
-  
 }
 //===== 
 // 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 PolyDataToImageData::bbUserSetDefaultValues()
 {
-
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
        bbSetInputInPolyData(NULL);
        bbSetInputInImage(NULL);
        bbSetInputBackgroundValue(255);
 }
 //===== 
 // 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 PolyDataToImageData::bbUserInitializeProcessing()
 {
-
 //  THE INITIALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should allocate the internal/output pointers 
@@ -122,7 +97,6 @@ void PolyDataToImageData::bbUserInitializeProcessing()
        dataToStencil   = NULL;
        extract                 = NULL;
        stencil                 = NULL;
-
 }
 //===== 
 // 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)