X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fvtk%2Fsrc%2FbbvtkCleanExternalPlane.cxx;h=80caf30829cf4c1e742028bb48cf54ee7f9ddb0d;hb=336df2924a7a1e1a4e18412a562a93f075970d0e;hp=b6d8a6eea98b20195626935483d6cecffaf63846;hpb=6827eadc2157e47cc354282c7992fe052e6b5ca0;p=bbtk.git diff --git a/packages/vtk/src/bbvtkCleanExternalPlane.cxx b/packages/vtk/src/bbvtkCleanExternalPlane.cxx index b6d8a6e..80caf30 100644 --- a/packages/vtk/src/bbvtkCleanExternalPlane.cxx +++ b/packages/vtk/src/bbvtkCleanExternalPlane.cxx @@ -44,7 +44,14 @@ void CleanExternalPlane::CleanTypeA(vtkImageData* image) int i,j; int ext[6]; int dim[3]; + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) image->GetWholeExtent(ext); +#endif +#if (VTK_MAJOR_VERSION >= 6) + image->GetExtent(ext); +#endif dim[0]=ext[1]-ext[0]+1; dim[1]=ext[3]-ext[2]+1; @@ -55,8 +62,8 @@ void CleanExternalPlane::CleanTypeA(vtkImageData* image) { for (j=0 ; jSetScalarComponentFromDouble (i, j, 0 , 0, 0.0); - image->SetScalarComponentFromDouble (i, j, dim[2]-1, 0, 0.0); + image->SetScalarComponentFromDouble (ext[0]+i, ext[2]+j, ext[4]+0 , 0, 0.0); + image->SetScalarComponentFromDouble (ext[0]+i, ext[2]+j, ext[4]+dim[2]-1, 0, 0.0); } // for j }// for i @@ -65,8 +72,8 @@ void CleanExternalPlane::CleanTypeA(vtkImageData* image) { for (j=0 ; jSetScalarComponentFromDouble (0 , i, j, 0, 0.0); - image->SetScalarComponentFromDouble (dim[0]-1 , i, j, 0, 0.0); + image->SetScalarComponentFromDouble (ext[0]+0 , ext[2]+i, ext[4]+j, 0, 0.0); + image->SetScalarComponentFromDouble (ext[0]+dim[0]-1 , ext[2]+i, ext[4]+j, 0, 0.0); } // for j } // for i @@ -75,8 +82,8 @@ void CleanExternalPlane::CleanTypeA(vtkImageData* image) { for (j=0 ; jSetScalarComponentFromDouble (i, 0 , j, 0, 0.0); - image->SetScalarComponentFromDouble (i, dim[1]-1 , j, 0, 0.0); + image->SetScalarComponentFromDouble (ext[0]+i, ext[2]+0 , ext[4]+j, 0, 0.0); + image->SetScalarComponentFromDouble (ext[0]+i, ext[2]+dim[1]-1 , ext[4]+j, 0, 0.0); } // for j }// for i } // if In @@ -85,11 +92,17 @@ void CleanExternalPlane::CleanTypeA(vtkImageData* image) //---------------------------------------------------------------------- void CleanExternalPlane::CleanTypeB() { - int ext[6]; int dimA[3]; int dimB[3]; + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) bbGetInputIn()->GetWholeExtent(ext); +#endif +#if (VTK_MAJOR_VERSION >= 6) + bbGetInputIn()->GetExtent(ext); +#endif dimA[0] = ext[1]-ext[0]+1; dimA[1] = ext[3]-ext[2]+1; @@ -101,10 +114,17 @@ void CleanExternalPlane::CleanTypeB() imageoutput->Initialize(); - imageoutput->SetScalarType( bbGetInputIn()->GetScalarType() ); imageoutput->SetSpacing( bbGetInputIn()->GetSpacing() ); imageoutput->SetDimensions( dimB[0], dimB[1], dimB[2] ); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) + imageoutput->SetScalarType( bbGetInputIn()->GetScalarType() ); imageoutput->AllocateScalars(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + imageoutput->AllocateScalars( bbGetInputIn()->GetScalarType() , 1); +#endif int j,k; @@ -115,9 +135,18 @@ void CleanExternalPlane::CleanTypeB() for (k=0;kGetScalarPointer(1,j+1,k+1) , bbGetInputIn()->GetScalarPointer(0,j,k) , sizeBlock ); - } - } + } // for k + } // for j + + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) imageoutput->Update(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + // .. +#endif + imageoutput->Modified(); } @@ -140,12 +169,20 @@ void CleanExternalPlane::Process() // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') +// Nothing to do + if (bbGetInputType()==-1) + { + bbSetOutputOut( bbGetInputIn() ); + } + +// Clean external planes if (bbGetInputType()==0) { CleanTypeA( bbGetInputIn() ); bbSetOutputOut( bbGetInputIn() ); } +// Add new faces and clean the external planes if (bbGetInputType()==1) { CleanTypeB();