From: Eduardo DAVILA Date: Sun, 16 May 2021 14:10:58 +0000 (+0200) Subject: #3462 Clean Code NULL data X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=95ad6b166169711fa0fe3c1fd984d86430a6c603;p=creaVtk.git #3462 Clean Code NULL data --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e5b8f1..5308ece 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) + + + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx index 463ee22..8d34691 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx @@ -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(); diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx index b141e02..3d6227f 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx @@ -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; diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.cxx index b5a495f..7813c42 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.cxx @@ -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)