From 088ed2b7bdbe14eb85a7245afaa693ddb7a53a97 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Thu, 20 Jul 2017 18:59:11 +0200 Subject: [PATCH] #3107 BBTK Bug New Normal - branch vtk7itk4 compilation with vtk7 --- packages/vtk/src/bbtkSimpleUtilities.h | 11 +- packages/vtk/src/bbvtkAutoCrop.cxx | 25 ++++- packages/vtk/src/bbvtkBinaryOperations.cxx | 16 ++- packages/vtk/src/bbvtkCSVReader.cxx | 10 +- packages/vtk/src/bbvtkCleanExternalPlane.cxx | 37 ++++++- packages/vtk/src/bbvtkConcatImages.cxx | 64 ++++++----- packages/vtk/src/bbvtkCreateImage.cxx | 67 +++++++----- .../vtk/src/bbvtkExtractVtkImageFilter.cxx | 7 ++ packages/vtk/src/bbvtkFlip.cxx | 17 ++- packages/vtk/src/bbvtkImageBoundaries.cxx | 7 ++ packages/vtk/src/bbvtkImageCastToUShort.cxx | 8 ++ packages/vtk/src/bbvtkImagePlanes.cxx | 101 ++++++++++++++++++ packages/vtk/src/bbvtkImageVtkProperties.cxx | 9 +- 13 files changed, 307 insertions(+), 72 deletions(-) diff --git a/packages/vtk/src/bbtkSimpleUtilities.h b/packages/vtk/src/bbtkSimpleUtilities.h index 067af42..f0b0372 100755 --- a/packages/vtk/src/bbtkSimpleUtilities.h +++ b/packages/vtk/src/bbtkSimpleUtilities.h @@ -68,11 +68,20 @@ public: //Se pregunta al OS el tamanio de la palabra de un apuntador int palabra = sizeof(T); db = vtkImageData::New(); - db->SetScalarType(Memcache::darTipo(palabra)); db->SetDimensions(x,y,z); db->SetOrigin(0, 0, 0); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) + db->SetScalarType(Memcache::darTipo(palabra)); db->AllocateScalars(); db->Update(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + db->AllocateScalars(Memcache::darTipo(palabra),1); +#endif + + } void* get(int x, int y, int z) { diff --git a/packages/vtk/src/bbvtkAutoCrop.cxx b/packages/vtk/src/bbvtkAutoCrop.cxx index 00635e9..26d928e 100644 --- a/packages/vtk/src/bbvtkAutoCrop.cxx +++ b/packages/vtk/src/bbvtkAutoCrop.cxx @@ -58,9 +58,17 @@ void AutoCrop::Process() int sizeX,sizeY,sizeZ; if (bbGetInputIn()!=NULL){ - bbGetInputIn()->Update(); int ext[6]; + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) + bbGetInputIn()->Update(); bbGetInputIn()->GetWholeExtent(ext); +#endif +#if (VTK_MAJOR_VERSION >= 6) + bbGetInputIn()->GetExtent(ext); +#endif + sizeX=ext[1]-ext[0]+1; sizeY=ext[3]-ext[2]+1; sizeZ=ext[5]-ext[4]+1; @@ -71,12 +79,23 @@ void AutoCrop::Process() // { _newImage = vtkImageData::New(); _newImage->Initialize(); - _newImage->SetScalarType( bbGetInputIn()->GetScalarType() ); _newImage->SetSpacing( bbGetInputIn()->GetSpacing() ); - _newImage->SetNumberOfScalarComponents( bbGetInputIn()->GetNumberOfScalarComponents() ); _newImage->SetDimensions( sizeX,sizeY,sizeZ ); + + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) _newImage->SetWholeExtent(0,sizeX-1,0,sizeY-1,0,sizeZ-1); + _newImage->SetNumberOfScalarComponents( bbGetInputIn()->GetNumberOfScalarComponents() ); + _newImage->SetScalarType( bbGetInputIn()->GetScalarType() ); _newImage->AllocateScalars(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + _newImage->SetExtent(0,sizeX-1,0,sizeY-1,0,sizeZ-1); + _newImage->AllocateScalars(bbGetInputIn()->GetScalarType(),1); +#endif + + // } diff --git a/packages/vtk/src/bbvtkBinaryOperations.cxx b/packages/vtk/src/bbvtkBinaryOperations.cxx index f58c6ec..106ceb2 100644 --- a/packages/vtk/src/bbvtkBinaryOperations.cxx +++ b/packages/vtk/src/bbvtkBinaryOperations.cxx @@ -54,15 +54,25 @@ void BinaryOperations::Process() return; } +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) ope->SetInput1((vtkDataObject*)bbGetInputIn1()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + ope->SetInput1Data((vtkDataObject*)bbGetInputIn1()); +#endif if (bbGetInputIn2() != NULL) { +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) ope->SetInput2((vtkDataObject*)bbGetInputIn2()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + ope->SetInput2Data((vtkDataObject*)bbGetInputIn2()); +#endif - } - else - { + } else { std::cout << "Set In2" << std::endl; return; } diff --git a/packages/vtk/src/bbvtkCSVReader.cxx b/packages/vtk/src/bbvtkCSVReader.cxx index 6db94bb..e7db21e 100755 --- a/packages/vtk/src/bbvtkCSVReader.cxx +++ b/packages/vtk/src/bbvtkCSVReader.cxx @@ -121,7 +121,6 @@ vtkImageData* CSVReader::createImage(std::vector< std::vector > info, in //original->GetOrigin(origin); //original->GetDimensions(newDim); - final->SetScalarType(scalar_type); //final->SetSpacing(space); newDim[0] = x; @@ -133,8 +132,17 @@ vtkImageData* CSVReader::createImage(std::vector< std::vector > info, in origin[2] = 0; final->SetOrigin(origin); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) + final->SetScalarType(scalar_type); final->AllocateScalars(); final->Update(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + final->AllocateScalars(scalar_type,1); +#endif + for (int i=0; iGetWholeExtent(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; @@ -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(); } diff --git a/packages/vtk/src/bbvtkConcatImages.cxx b/packages/vtk/src/bbvtkConcatImages.cxx index 1367ec7..cac0843 100644 --- a/packages/vtk/src/bbvtkConcatImages.cxx +++ b/packages/vtk/src/bbvtkConcatImages.cxx @@ -89,17 +89,17 @@ namespace bbvtk /// - supposes *all* the images are consistent (same type, same number of components, same pixel type) /// - if images in the vector are already 3D, exports only the first one. ?!? // JPR /// - void ConcatImages::Process() - { - int dim[3]; - int curDim[3]; +void ConcatImages::Process() +{ + int dim[3]; + int curDim[3]; int nbComponents; int scalarType; int nb = (unsigned int)bbGetInputIn().size(); // int consistentNb(nb); int newSizeZ; - if (nb == 0) { + if (nb == 0) { // ??? JPR } @@ -111,40 +111,36 @@ namespace bbvtk mConcat = bbGetInputIn()[0]; //mConcat->PrintSelf(std::cout, vtkIndent(2)); } else { - // We suppose *all* the images within the directory are consistent (same sizeS, same pixel Type?...) - vtkImageData * firstImage = bbGetInputIn()[0]; + // We suppose *all* the images within the directory are consistent (same sizeS, same pixel Type?...) + vtkImageData * firstImage = bbGetInputIn()[0]; - //std::cout << "--------PrintSelf firstImage " << std::endl; - // firstImage->PrintSelf(std::cout, vtkIndent(2)); + //std::cout << "--------PrintSelf firstImage " << std::endl; + // firstImage->PrintSelf(std::cout, vtkIndent(2)); - nbComponents = firstImage->GetNumberOfScalarComponents(); - mConcat->SetNumberOfScalarComponents(nbComponents); - - mConcat->SetScalarType(firstImage->GetScalarType( )); - scalarType = firstImage->GetScalarType( ); - mConcat->SetScalarType(scalarType); + nbComponents = firstImage->GetNumberOfScalarComponents(); + scalarType = firstImage->GetScalarType( ); - mConcat->SetSpacing(firstImage->GetSpacing()); + mConcat->SetSpacing(firstImage->GetSpacing()); - firstImage->GetDimensions(dim); - newSizeZ=0; - // brute way to perform an ultra-mini consistency check : - // First image is supposed to be the reference image, - // any unconsistent image is just discarted... - for(int i=0; iGetDimensions(dim); + newSizeZ=0; + // brute way to perform an ultra-mini consistency check : + // First image is supposed to be the reference image, + // any unconsistent image is just discarted... + for(int i=0; iGetDimensions(curDim); - newSizeZ = newSizeZ + curDim[2]; - } // if + { + bbGetInputIn()[i]->GetDimensions(curDim); + newSizeZ = newSizeZ + curDim[2]; + } // if - } // for + } // for dim[2]=newSizeZ; @@ -152,8 +148,17 @@ namespace bbvtk mConcat->SetDimensions(dim); mConcat->SetExtent(0, dim[0]-1, 0, dim[1]-1, 0, dim[2]-1); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) + mConcat->SetNumberOfScalarComponents(nbComponents); + mConcat->SetScalarType(scalarType); mConcat->AllocateScalars(); mConcat->Update(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + mConcat->AllocateScalars(scalarType,nbComponents); +#endif int index_image; @@ -195,8 +200,9 @@ namespace bbvtk // Devrait etre dans bbUserFinalizeProcessing() ? On n'y entre jamais // JPR bbSetOutputOut(mConcat); - } +} +//--------------------------------------------------- bool ConcatImages::CheckConsistency( vtkImageData *curImage, int dim[], int nbComponents, int scalarType ) { assert (curImage); diff --git a/packages/vtk/src/bbvtkCreateImage.cxx b/packages/vtk/src/bbvtkCreateImage.cxx index 074e9de..cb9d77b 100644 --- a/packages/vtk/src/bbvtkCreateImage.cxx +++ b/packages/vtk/src/bbvtkCreateImage.cxx @@ -53,13 +53,10 @@ void CreateImage::Process() // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') - - double spc[6]; int dim[3]; int outputformat = VTK_UNSIGNED_SHORT; - if (bbGetInputOutputFormat()=="VTK_BIT") outputformat = VTK_BIT; // 1 else if (bbGetInputOutputFormat()=="VTK_CHAR") outputformat = VTK_CHAR; // 2 else if (bbGetInputOutputFormat()=="MET_CHAR") outputformat = VTK_CHAR; // 2 @@ -84,7 +81,6 @@ void CreateImage::Process() else if (bbGetInputOutputFormat()=="MET_DOUBLE") outputformat = VTK_DOUBLE; // 11 - spc[0] = bbGetInputSpacing()[0]; spc[1] = bbGetInputSpacing()[1]; spc[2] = bbGetInputSpacing()[2]; @@ -94,37 +90,50 @@ void CreateImage::Process() dim[2] = bbGetInputDimensions()[2]; imageoutput->Initialize(); - imageoutput->SetScalarType( outputformat ); imageoutput->SetSpacing( spc ); imageoutput->SetDimensions( dim[0], dim[1], dim[2] ); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) + imageoutput->SetScalarType( outputformat ); imageoutput->AllocateScalars(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + imageoutput->AllocateScalars( outputformat,1 ); +#endif - int i,j,k; - long sizeBlock; - - for (i=0; iSetScalarComponentFromDouble(i,0,0, 0, bbGetInputInitialValue() ); - } - - sizeBlock= dim[0] * imageoutput->GetScalarSize(); - for (j=1; jGetScalarPointer(0,j,0), imageoutput->GetScalarPointer() , sizeBlock ); - } - - sizeBlock= dim[0] * dim[1] * imageoutput->GetScalarSize(); - for (k=0; kGetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer() , sizeBlock ); - } // for k - - imageoutput->Update(); - imageoutput->Modified(); - bbSetOutputOut(imageoutput); - + int i,j,k; + long sizeBlock; + for (i=0; iSetScalarComponentFromDouble(i,0,0, 0, bbGetInputInitialValue() ); + } // for i + + sizeBlock= dim[0] * imageoutput->GetScalarSize(); + for (j=1; jGetScalarPointer(0,j,0), imageoutput->GetScalarPointer() , sizeBlock ); + } // for j + + sizeBlock= dim[0] * dim[1] * imageoutput->GetScalarSize(); + for (k=0; kGetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer() , sizeBlock ); + } // for k + + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) + imageoutput->Update(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + // .. +#endif + + imageoutput->Modified(); + bbSetOutputOut(imageoutput); } //===== diff --git a/packages/vtk/src/bbvtkExtractVtkImageFilter.cxx b/packages/vtk/src/bbvtkExtractVtkImageFilter.cxx index efbbe22..2193423 100644 --- a/packages/vtk/src/bbvtkExtractVtkImageFilter.cxx +++ b/packages/vtk/src/bbvtkExtractVtkImageFilter.cxx @@ -49,7 +49,14 @@ void ExtractVtkImageFilter::Process() voi[4] = bbGetInputIndex()[2]; voi[5] = bbGetInputIndex()[2]+bbGetInputSize()[2]-1; +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) _extract->SetInput( bbGetInputIn() ); +#endif +#if (VTK_MAJOR_VERSION >= 6) + _extract->SetInputData( bbGetInputIn() ); +#endif + _extract->SetVOI(voi); _extract->UpdateWholeExtent(); _extract->Modified(); diff --git a/packages/vtk/src/bbvtkFlip.cxx b/packages/vtk/src/bbvtkFlip.cxx index a252888..8ec173c 100644 --- a/packages/vtk/src/bbvtkFlip.cxx +++ b/packages/vtk/src/bbvtkFlip.cxx @@ -100,16 +100,31 @@ void Flip::Process() mImageOut = vtkImageData::New(); // Alloc depends on bbGetInputIn().size() mImageOut->Initialize(); - mImageOut->SetScalarType( bbGetInputIn()->GetScalarType() ); mImageOut->SetSpacing( bbGetInputIn()->GetSpacing() ); mImageOut->SetDimensions( bbGetInputIn()->GetDimensions() ); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) + mImageOut->SetScalarType( bbGetInputIn()->GetScalarType() ); mImageOut->SetNumberOfScalarComponents( bbGetInputIn()->GetNumberOfScalarComponents() ); mImageOut->AllocateScalars(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + mImageOut->AllocateScalars(bbGetInputIn()->GetScalarType() , bbGetInputIn()->GetNumberOfScalarComponents()); +#endif int inputdims[3]; // int outputdims[3]; bbGetInputIn()->GetDimensions (inputdims); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) bbGetInputIn()->Update(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + // .. +#endif + int nbScalComp = bbGetInputIn()->GetNumberOfScalarComponents(); int scalarSize = bbGetInputIn()->GetScalarSize(); int lineSize = inputdims[0]*scalarSize*nbScalComp; diff --git a/packages/vtk/src/bbvtkImageBoundaries.cxx b/packages/vtk/src/bbvtkImageBoundaries.cxx index c74a6ec..e947bb3 100644 --- a/packages/vtk/src/bbvtkImageBoundaries.cxx +++ b/packages/vtk/src/bbvtkImageBoundaries.cxx @@ -46,7 +46,14 @@ void ImageBoundaries::Process() int ext[6]; double value; +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) bbGetInputIn()->GetWholeExtent(ext); +#endif +#if (VTK_MAJOR_VERSION >= 6) + bbGetInputIn()->GetExtent(ext); +#endif + int maxX = ext[1]-ext[0]+1; int maxY = ext[3]-ext[2]+1; int maxZ = ext[5]-ext[4]+1; diff --git a/packages/vtk/src/bbvtkImageCastToUShort.cxx b/packages/vtk/src/bbvtkImageCastToUShort.cxx index 6543e06..b27dbb6 100644 --- a/packages/vtk/src/bbvtkImageCastToUShort.cxx +++ b/packages/vtk/src/bbvtkImageCastToUShort.cxx @@ -48,7 +48,15 @@ void ImageCastToUShort::Process() // (the one provided in the attribute 'type' of the tag 'input') vtkImageData* img = bbGetInputIn(); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) cast->SetInput(img); +#endif +#if (VTK_MAJOR_VERSION >= 6) + cast->SetInputData(img); +#endif + cast->SetOutputScalarTypeToUnsignedShort(); cast->Modified(); cast->Update(); diff --git a/packages/vtk/src/bbvtkImagePlanes.cxx b/packages/vtk/src/bbvtkImagePlanes.cxx index 92476f5..ab91a12 100644 --- a/packages/vtk/src/bbvtkImagePlanes.cxx +++ b/packages/vtk/src/bbvtkImagePlanes.cxx @@ -207,24 +207,56 @@ namespace bbvtk // EED MPR view orientation correction.. vtkImageFlip *flipYFilter = vtkImageFlip::New(); flipYFilter->SetFilteredAxis(1); // flip y axis + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) flipYFilter->SetInput( planeWidgetX->GetResliceOutput() ); +#endif +#if (VTK_MAJOR_VERSION >= 6) + flipYFilter->SetInputData( planeWidgetX->GetResliceOutput() ); +#endif + flipYFilter->Update(); vtkImageChangeInformation *image = vtkImageChangeInformation::New(); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) image->SetInput( planeWidgetY->GetResliceOutput() ); +#endif +#if (VTK_MAJOR_VERSION >= 6) + image->SetInputData( planeWidgetY->GetResliceOutput() ); +#endif + image->SetOutputSpacing( 1,1,1 ); image->CenterImageOn(); image->Update(); _imageTransform = vtkTransform::New(); vtkImageReslice *slicer =vtkImageReslice::New(); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) slicer->SetInput( image->GetOutput() ); +#endif +#if (VTK_MAJOR_VERSION >= 6) + slicer->SetInputData( image->GetOutput() ); +#endif + slicer->SetInformationInput( image->GetOutput() ); slicer->SetResliceTransform( _imageTransform ); slicer->SetOutputOrigin(0 , 0 , 0 ); slicer->SetInterpolationModeToNearestNeighbor(); slicer->Update(); vtkImageChangeInformation *imageResult = vtkImageChangeInformation::New(); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) imageResult->SetInput( slicer->GetOutput() ); +#endif +#if (VTK_MAJOR_VERSION >= 6) + imageResult->SetInputData( slicer->GetOutput() ); +#endif + double spc[3]; planeWidgetY->GetResliceOutput()->GetSpacing(spc); imageResult->SetOutputSpacing( spc[1], spc[0], spc[2] ); @@ -284,7 +316,14 @@ namespace bbvtk { int dim[3]; int ext[6]; +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) bbGetOutputPlaneX()->GetResliceOutput()->GetWholeExtent(ext); +#endif +#if (VTK_MAJOR_VERSION >= 6) + bbGetOutputPlaneX()->GetResliceOutput()->GetExtent(ext); +#endif + dim[0] = ext[1]-ext[0]+1; dim[1] = ext[3]-ext[2]+1; dim[2] = ext[5]-ext[4]+1; @@ -304,7 +343,14 @@ namespace bbvtk double xSpacing, ySpacing, zSpacing; bbGetInputIn()->GetSpacing(xSpacing, ySpacing, zSpacing); +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) bbGetOutputPlaneX()->SetInput(bbGetInputIn()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + bbGetOutputPlaneX()->SetInputData(bbGetInputIn()); +#endif + bbGetOutputPlaneX()->SetPlaneOrientationToXAxes(); bbGetOutputPlaneX()->SetSlicePosition((xMax+xMin)/2.*xSpacing); @@ -312,11 +358,25 @@ namespace bbvtk // bbGetOutputPlaneX()->SetPoint1( 0*xSpacing, 146*ySpacing, 186*zSpacing); // bbGetOutputPlaneX()->SetPoint2( 126*xSpacing, 146*ySpacing, 0*zSpacing); +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) bbGetOutputPlaneY()->SetInput(bbGetInputIn()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + bbGetOutputPlaneY()->SetInputData(bbGetInputIn()); +#endif + bbGetOutputPlaneY()->SetPlaneOrientationToYAxes(); bbGetOutputPlaneY()->SetSlicePosition((yMax+yMin)/2.*ySpacing); +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) bbGetOutputPlaneZ()->SetInput(bbGetInputIn()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + bbGetOutputPlaneZ()->SetInputData(bbGetInputIn()); +#endif + bbGetOutputPlaneZ()->SetPlaneOrientationToZAxes(); bbGetOutputPlaneZ()->SetSlicePosition((zMax+zMin)/2.*zSpacing); @@ -347,9 +407,15 @@ namespace bbvtk bbGetOutputPlaneZ()->SetResliceInterpolate( bbGetInputInterpolation() ); +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) bbGetOutputPlaneX()->GetResliceOutput()->Update(); bbGetOutputPlaneY()->GetResliceOutput()->Update(); bbGetOutputPlaneZ()->GetResliceOutput()->Update(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + // ... +#endif std::vector pointsx = bbGetInputPointsX(); std::vector pointsy = bbGetInputPointsY(); @@ -390,7 +456,15 @@ namespace bbvtk //for the plane widgets vtkImagePlaneWidget* plane3pts = (vtkImagePlaneWidget*)bbGetOutputPlane3Pts(); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) plane3pts->SetInput(bbGetInputIn()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + plane3pts->SetInputData(bbGetInputIn()); +#endif + double xSpacing, ySpacing, zSpacing; bbGetInputIn()->GetSpacing(xSpacing, ySpacing, zSpacing); plane3pts->SetOrigin(pointsx[0]*xSpacing,pointsy[0]*ySpacing,pointsz[0]*zSpacing); @@ -400,7 +474,15 @@ namespace bbvtk plane3pts->SetPoint2((origin[0]+vect2[0]*factor)*xSpacing, (origin[1]+vect2[1]*factor)*ySpacing, (origin[2]+vect2[2]*factor)*zSpacing); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) plane3pts->GetResliceOutput()->Update(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + // .. +#endif + //To get the slice of image out of the selected volume if (_imageReslicer==NULL){ _imageReslicer = vtkImageReslice::New(); @@ -409,15 +491,34 @@ namespace bbvtk _matrix = vtkMatrix4x4::New(); } _imageReslicer->SetInterpolationMode( bbGetInputInterpolation() ); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) _imageReslicer->SetInput( bbGetInputIn() ); +#endif +#if (VTK_MAJOR_VERSION >= 6) + _imageReslicer->SetInputData( bbGetInputIn() ); +#endif + + _imageReslicer->SetInformationInput(bbGetInputIn()); //fill out the information with the created vectors and using the spacing of the image _imageReslicer->SetResliceAxesDirectionCosines(newx[0]*xSpacing,newx[1]*xSpacing,newx[2]*xSpacing, vect2[0]*ySpacing,vect2[1]*ySpacing,vect2[2]*ySpacing, crossp[0]*zSpacing,crossp[1]*zSpacing,crossp[2]*zSpacing); _imageReslicer->SetResliceAxesOrigin(origin[0]*xSpacing,origin[1]*ySpacing,origin[2]*zSpacing); + + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) _imageReslicer->GetOutput()->Update(); _imageReslicer->GetOutput()->UpdateInformation(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + // .. +#endif + + bbSetOutputImage3Pts(_imageReslicer->GetOutput()); diff --git a/packages/vtk/src/bbvtkImageVtkProperties.cxx b/packages/vtk/src/bbvtkImageVtkProperties.cxx index f9d8b7d..5050643 100644 --- a/packages/vtk/src/bbvtkImageVtkProperties.cxx +++ b/packages/vtk/src/bbvtkImageVtkProperties.cxx @@ -53,9 +53,16 @@ void ImageVtkProperties::Process() if ( bbGetInputIn() ) { bbGetInputIn()->Modified(); - bbGetInputIn()->Update(); +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) + bbGetInputIn()->Update(); bbGetInputIn()->GetWholeExtent(ext); +#endif +#if (VTK_MAJOR_VERSION >= 6) + bbGetInputIn()->GetExtent(ext); +#endif + vsize.push_back(ext[1]-ext[0]+1); vsize.push_back(ext[3]-ext[2]+1); vsize.push_back(ext[5]-ext[4]+1); -- 2.47.1