From: Eduardo DAVILA Date: Fri, 4 Aug 2017 13:28:56 +0000 (+0200) Subject: #3110 creaVtk Bug New Normal - branch vtk7itk4 compilation with vtk7 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=ef9f90810fcc3800acac54a104f14ff505135fd3;p=creaVtk.git #3110 creaVtk Bug New Normal - branch vtk7itk4 compilation with vtk7 --- diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageAccumulate.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageAccumulate.cxx index 0e7ea7c..6007c18 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkImageAccumulate.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageAccumulate.cxx @@ -34,7 +34,12 @@ void ImageAccumulate::Process() acc->Delete(); } acc = vtkImageAccumulate::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 acc->SetInput( bbGetInputIn() ); +#else + acc->SetInputData( bbGetInputIn() ); +#endif acc->IgnoreZeroOn(); acc->Update(); bbSetOutputVoxelCount(acc->GetVoxelCount()); diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.cxx index 815f029..5ed81c7 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.cxx @@ -16,7 +16,12 @@ void ImageContinuousDilate3D::Process() vtkImageData* ImageContinuousDilate3D::dilateFilterRecursive(vtkImageData* image, int repetitions, double x, double y, double z) { vtkImageContinuousDilate3D *dilateFilter = vtkImageContinuousDilate3D ::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 dilateFilter->SetInput (image); +#else + dilateFilter->SetInputData(image); +#endif dilateFilter->SetKernelSize(x, y, z); dilateFilter->Modified(); dilateFilter->Update(); diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.cxx index 95fd998..ac41246 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.cxx @@ -16,7 +16,12 @@ void ImageContinuousErode3D::Process() vtkImageData* ImageContinuousErode3D::erodeFilterRecursive(vtkImageData* image, int repetitions, double x, double y, double z) { vtkImageContinuousErode3D *erodeFilter = vtkImageContinuousErode3D ::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 erodeFilter->SetInput (image); +#else + erodeFilter->SetInputData(image); +#endif erodeFilter->SetKernelSize(x, y, z); erodeFilter->Modified(); erodeFilter->Update(); diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageExtractComponents.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageExtractComponents.cxx index d899905..2769f79 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkImageExtractComponents.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageExtractComponents.cxx @@ -36,7 +36,12 @@ void ImageExtractComponents::Process() if (bbGetInputComponent0()!=-1) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 IEC0->SetInput( bbGetInputIn() ); +#else + IEC0->SetInputData( bbGetInputIn() ); +#endif IEC0->SetComponents( bbGetInputComponent0() ); IEC0->Update(); bbSetOutputOut0( IEC0->GetOutput() ); @@ -44,7 +49,12 @@ void ImageExtractComponents::Process() if (bbGetInputComponent1()!=-1) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 IEC1->SetInput( bbGetInputIn() ); +#else + IEC1->SetInputData( bbGetInputIn() ); +#endif IEC1->SetComponents( bbGetInputComponent1() ); IEC1->Update(); bbSetOutputOut1( IEC1->GetOutput() ); @@ -52,7 +62,12 @@ void ImageExtractComponents::Process() if (bbGetInputComponent2()!=-1) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 IEC2->SetInput( bbGetInputIn() ); +#else + IEC2->SetInputData( bbGetInputIn() ); +#endif IEC2->SetComponents( bbGetInputComponent2() ); IEC2->Update(); bbSetOutputOut2( IEC2->GetOutput() ); @@ -60,7 +75,13 @@ void ImageExtractComponents::Process() if (bbGetInputComponent3()!=-1) { + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 IEC3->SetInput( bbGetInputIn() ); +#else + IEC3->SetInputData( bbGetInputIn() ); +#endif IEC3->SetComponents( bbGetInputComponent2() ); IEC3->Update(); bbSetOutputOut3( IEC3->GetOutput() ); diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageSlab.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageSlab.cxx index 9b9f33d..08efca9 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkImageSlab.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageSlab.cxx @@ -40,7 +40,12 @@ void ImageSlab::Process() if (bbGetInputType()==2) { imageSlab->SetOperationToMin(); } if (bbGetInputType()==3) { imageSlab->SetOperationToMax(); } +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imageSlab->SetInput( bbGetInputIn() ); +#else + imageSlab->SetInputData( bbGetInputIn() ); +#endif imageSlab->MultiSliceOutputOff(); imageSlab->SetOutputScalarTypeToInputScalarType(); bbSetOutputOut( imageSlab->GetOutput() ); diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx index 223fe7e..020eb5f 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx @@ -42,14 +42,21 @@ vtkImageData* ReadMHDPlane::CreateDefaultImage() sizeZ = 1; vtkImageData *newImage = vtkImageData::New(); newImage->Initialize(); - newImage->SetScalarTypeToUnsignedChar(); newImage->SetSpacing( 1,1,1 ); newImage->SetDimensions( sizeX,sizeY,sizeZ ); - newImage->SetWholeExtent(0, sizeX-1,0,sizeY-1,0,sizeZ-1 ); newImage->SetExtent(0, sizeX-1,0,sizeY-1,0,sizeZ-1 ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + newImage->SetWholeExtent(0, sizeX-1,0,sizeY-1,0,sizeZ-1 ); + newImage->SetScalarTypeToUnsignedChar(); newImage->SetNumberOfScalarComponents(1); newImage->AllocateScalars(); newImage->Update(); +#else + newImage->AllocateScalars(VTK_UNSIGNED_CHAR,1); +#endif + memset ( (void*)newImage->GetScalarPointer(), 0, sizeX*sizeY*1 ); for (i=0; iSetScalarTypeToChar(); dataSize=sizeof(char); } - if (strncmp("ElementType = VTK_CHAR",mystring,22)==0) { newImage->SetScalarTypeToChar(); dataSize=sizeof(char); } - if (strncmp("ElementType = MET_UCHAR",mystring,23)==0) { newImage->SetScalarTypeToUnsignedChar(); dataSize=sizeof(unsigned char); } - if (strncmp("ElementType = VTK_UNSIGNED_CHAR",mystring,31)==0) { newImage->SetScalarTypeToUnsignedChar(); dataSize=sizeof(unsigned char); } - if (strncmp("ElementType = MET_USHORT",mystring,24)==0) { newImage->SetScalarTypeToUnsignedShort(); dataSize=sizeof(unsigned short);} - if (strncmp("ElementType = VTK_UNSIGNED_SHORT",mystring,32)==0) { newImage->SetScalarTypeToUnsignedShort(); dataSize=sizeof(unsigned short);} - if (strncmp("ElementType = MET_SHORT",mystring,23)==0) { newImage->SetScalarTypeToShort(); dataSize=sizeof(short); } - if (strncmp("ElementType = VTK_SHORT",mystring,23)==0) { newImage->SetScalarTypeToShort(); dataSize=sizeof(short); } - if (strncmp("ElementType = MET_UINT",mystring,22)==0) { newImage->SetScalarTypeToUnsignedInt(); dataSize=sizeof(unsigned int); } - if (strncmp("ElementType = VTK_UNSIGNED_INT",mystring,30)==0) { newImage->SetScalarTypeToUnsignedInt(); dataSize=sizeof(unsigned int); } - if (strncmp("ElementType = MET_INT",mystring,21)==0) { newImage->SetScalarTypeToInt(); dataSize=sizeof(int); } - if (strncmp("ElementType = VTK_INT",mystring,21)==0) { newImage->SetScalarTypeToInt(); dataSize=sizeof(int); } - if (strncmp("ElementType = MET_FLOAT",mystring,23)==0) { newImage->SetScalarTypeToFloat(); dataSize=sizeof(float); } - if (strncmp("ElementType = VTK_FLOAT",mystring,23)==0) { newImage->SetScalarTypeToFloat(); dataSize=sizeof(float); } - if (strncmp("ElementType = MET_LONG",mystring,22)==0) { newImage->SetScalarTypeToLong(); dataSize=sizeof(long); } - if (strncmp("ElementType = VTK_LONG",mystring,22)==0) { newImage->SetScalarTypeToLong(); dataSize=sizeof(long); } - if (strncmp("ElementType = MET_DOUBLE",mystring,24)==0) { newImage->SetScalarTypeToDouble(); dataSize=sizeof(double); } - if (strncmp("ElementType = VTK_DOUBLE",mystring,24)==0) { newImage->SetScalarTypeToDouble(); dataSize=sizeof(double); } + + + if (strncmp("ElementType = MET_CHAR",mystring,22)==0) { imageType =VTK_CHAR; dataSize=sizeof(char); } + if (strncmp("ElementType = VTK_CHAR",mystring,22)==0) { imageType =VTK_CHAR; dataSize=sizeof(char); } + if (strncmp("ElementType = MET_UCHAR",mystring,23)==0) { imageType =VTK_UNSIGNED_CHAR; dataSize=sizeof(unsigned char); } + if (strncmp("ElementType = VTK_UNSIGNED_CHAR",mystring,31)==0) { imageType =VTK_UNSIGNED_CHAR; dataSize=sizeof(unsigned char); } + if (strncmp("ElementType = MET_USHORT",mystring,24)==0) { imageType =VTK_UNSIGNED_SHORT; dataSize=sizeof(unsigned short);} + if (strncmp("ElementType = VTK_UNSIGNED_SHORT",mystring,32)==0) { imageType =VTK_UNSIGNED_SHORT; dataSize=sizeof(unsigned short);} + if (strncmp("ElementType = MET_SHORT",mystring,23)==0) { imageType =VTK_SHORT; dataSize=sizeof(short); } + if (strncmp("ElementType = VTK_SHORT",mystring,23)==0) { imageType =VTK_SHORT; dataSize=sizeof(short); } + if (strncmp("ElementType = MET_UINT",mystring,22)==0) { imageType =VTK_UNSIGNED_INT; dataSize=sizeof(unsigned int); } + if (strncmp("ElementType = VTK_UNSIGNED_INT",mystring,30)==0) { imageType =VTK_UNSIGNED_INT; dataSize=sizeof(unsigned int); } + if (strncmp("ElementType = MET_INT",mystring,21)==0) { imageType =VTK_INT; dataSize=sizeof(int); } + if (strncmp("ElementType = VTK_INT",mystring,21)==0) { imageType =VTK_INT; dataSize=sizeof(int); } + if (strncmp("ElementType = MET_FLOAT",mystring,23)==0) { imageType =VTK_FLOAT; dataSize=sizeof(float); } + if (strncmp("ElementType = VTK_FLOAT",mystring,23)==0) { imageType =VTK_FLOAT; dataSize=sizeof(float); } + if (strncmp("ElementType = MET_LONG",mystring,22)==0) { imageType =VTK_LONG; dataSize=sizeof(long); } + if (strncmp("ElementType = VTK_LONG",mystring,22)==0) { imageType =VTK_LONG; dataSize=sizeof(long); } + if (strncmp("ElementType = MET_DOUBLE",mystring,24)==0) { imageType =VTK_DOUBLE; dataSize=sizeof(double); } + if (strncmp("ElementType = VTK_DOUBLE",mystring,24)==0) { imageType =VTK_DOUBLE; dataSize=sizeof(double); } } // while fclose(ffIn); @@ -312,11 +322,20 @@ void ReadMHDPlane::Read64lseek() { newImage->SetSpacing( spcX,spcY,spcZ ); newImage->SetDimensions( dimX,dimY,width ); - newImage->SetWholeExtent(0, dimX-1,0,dimY-1,0,width-1 ); newImage->SetExtent(0, dimX-1,0,dimY-1,0,width-1 ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + newImage->SetWholeExtent(0, dimX-1,0,dimY-1,0,width-1 ); newImage->SetNumberOfScalarComponents(1); + newImage->SetScalarType(imageType); newImage->AllocateScalars(); newImage->Update(); +#else + newImage->AllocateScalars( imageType,1 ); +#endif + + pos = dimX*dimY*(long long)slice*dataSize; #if defined(_WIN32) if (_lseeki64( fd, pos, SEEK_SET ) < 0) @@ -340,11 +359,18 @@ void ReadMHDPlane::Read64lseek() { newImage->SetSpacing( spcX,spcZ,spcY ); newImage->SetDimensions( dimX,dimZ,width ); - newImage->SetWholeExtent(0, dimX-1,0,dimZ-1,0,width-1 ); newImage->SetExtent(0, dimX-1,0,dimZ-1,0,width-1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + newImage->SetWholeExtent(0, dimX-1,0,dimZ-1,0,width-1 ); newImage->SetNumberOfScalarComponents(1); + newImage->SetScalarType(imageType); newImage->AllocateScalars(); newImage->Update(); +#else + newImage->AllocateScalars( imageType, 1); +#endif + int iWidth; for (iWidth=0;iWidthSetSpacing( spcY,spcZ,spcX ); newImage->SetDimensions( dimY,dimZ,width ); - newImage->SetWholeExtent(0, dimY-1,0,dimZ-1,0,width-1 ); newImage->SetExtent(0, dimY-1,0,dimZ-1,0,width-1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + newImage->SetWholeExtent(0, dimY-1,0,dimZ-1,0,width-1 ); newImage->SetNumberOfScalarComponents(1); + newImage->SetScalarType(imageType); newImage->AllocateScalars(); newImage->Update(); +#else + newImage->AllocateScalars( imageType ,1 ); +#endif + int iWidth; for (iWidth=0;iWidthSetInput( GetImage() ); +#else + _vPlaneWidget->SetInputData( GetImage() ); +#endif + _vPlaneWidget->SetInteractor( GetRenderer()->GetRenderWindow()->GetInteractor() ); _vPlaneWidget->NormalToXAxisOn(); _vPlaneWidget->NormalToZAxisOn(); diff --git a/lib/creaVtk/creaVtkStreamLine.cpp b/lib/creaVtk/creaVtkStreamLine.cpp index 51685af..45ae170 100644 --- a/lib/creaVtk/creaVtkStreamLine.cpp +++ b/lib/creaVtk/creaVtkStreamLine.cpp @@ -108,27 +108,53 @@ void creaVtkStreamLine::Process() if (GetTypeForm()==0) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _tubefilter->SetInput( _polydata ); +#else + _tubefilter->SetInputData( _polydata ); +#endif _tubefilter->SetRadius( GetScaleFactor() ); _tubefilter->SetNumberOfSides(12); _tubefilter->SetVaryRadiusToVaryRadiusOff(); _tubefilter->Modified(); _tubefilter->Update(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _streamMapper2->SetInput( _tubefilter->GetOutput() ); +#else + _streamMapper2->SetInputData( _tubefilter->GetOutput() ); +#endif } if (GetTypeForm()==1) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _ribbonfilter->SetInput( _polydata ); +#else + _ribbonfilter->SetInputData( _polydata ); +#endif _ribbonfilter->SetWidth( GetScaleFactor() ); _ribbonfilter->SetWidthFactor( GetScaleFactor()*10 ); _ribbonfilter->GlobalWarningDisplayOff (); //EED this is to avoid the "BEVEL WARNING" _ribbonfilter->Modified(); _ribbonfilter->Update(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _streamMapper2->SetInput( _ribbonfilter->GetOutput() ); +#else + _streamMapper2->SetInputData( _ribbonfilter->GetOutput() ); +#endif } if (GetTypeForm()==2) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _streamMapper2->SetInput( _polydata ); +#else + _streamMapper2->SetInputData( _polydata ); +#endif } //EED _streamMapper2->SetLookupTable(vGreenToRedLut); diff --git a/lib/creaVtk/creaVtkStreamLineScalarSeg.cpp b/lib/creaVtk/creaVtkStreamLineScalarSeg.cpp index 95fd4c5..5a33531 100644 --- a/lib/creaVtk/creaVtkStreamLineScalarSeg.cpp +++ b/lib/creaVtk/creaVtkStreamLineScalarSeg.cpp @@ -126,7 +126,12 @@ void creaVtkStreamLineScalarSeg::Process() } _newvtkpolydata->GetPointData()->RemoveArray( _ScalarArrayName.c_str() ); _newvtkpolydata->GetPointData()->AddArray( newScalarArray ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _newvtkpolydata->Update(); +#else + _newvtkpolydata->Modified(); +#endif _StreamLinesOut = _newvtkpolydata; diff --git a/lib/creaVtk/creaVtkStreamTracer.cpp b/lib/creaVtk/creaVtkStreamTracer.cpp index 5c44dc0..a88192f 100644 --- a/lib/creaVtk/creaVtkStreamTracer.cpp +++ b/lib/creaVtk/creaVtkStreamTracer.cpp @@ -87,9 +87,15 @@ printf("EED creaVtkStreamTracer::Process() A\n"); // _source->SetCenter( c ); // _source->Update(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _streamer->SetInput( _dataobject ); //EED1 _streamer->SetSource( _source->GetOutput() ); _streamer->SetSource( _sourcePoints ); +#else + _streamer->SetInputData( _dataobject ); + _streamer->SetSourceData( _sourcePoints ); +#endif _streamer->SetIntegratorTypeToRungeKutta45(); _streamer->SetMaximumPropagation(500); //EED _streamer->SetMaximumPropagationUnitToTimeUnit(); diff --git a/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.cpp b/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.cpp index 3609557..2226f2d 100644 --- a/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.cpp +++ b/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.cpp @@ -82,7 +82,13 @@ vtkImageData * creaVtkUnMosaicVectorVtkImageData::unMosaic(vtkImageData *imageIn int outputdims[3]; imageIn->GetDimensions (inputdims); unsigned short *input = (unsigned short *)(imageIn->GetScalarPointer()); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imageIn->Update(); +#else + imageIn->Modified(); +#endif unsigned int div = (unsigned int)ceil(sqrt( (double)numberOfImagesInMosaic ) ); outputdims[0] = inputdims[0] / div; @@ -93,13 +99,20 @@ vtkImageData * creaVtkUnMosaicVectorVtkImageData::unMosaic(vtkImageData *imageIn vtkImageOut = vtkImageData::New(); vtkImageOut->SetDimensions( outputdims ); vtkImageOut->SetExtent(0,outputdims[0]-1,0,outputdims[1]-1,0,outputdims[2]-1); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 vtkImageOut->SetWholeExtent(0,outputdims[0]-1,0,outputdims[1]-1,0,outputdims[2]-1); vtkImageOut->SetNumberOfScalarComponents(1); //vtkImageOut->SetSpacing( blabla ); vtkImageOut->SetScalarType( VTK_UNSIGNED_SHORT ); vtkImageOut->AllocateScalars(); vtkImageOut->Update(); - +#else + vtkImageOut->AllocateScalars(VTK_UNSIGNED_SHORT,1); +#endif + + unsigned short *output =(unsigned short *)(vtkImageOut->GetScalarPointer()); unsigned short *dest = output; diff --git a/lib/creaVtk/cutImageSegmentation.cpp b/lib/creaVtk/cutImageSegmentation.cpp index 9659847..640b099 100644 --- a/lib/creaVtk/cutImageSegmentation.cpp +++ b/lib/creaVtk/cutImageSegmentation.cpp @@ -186,21 +186,37 @@ void cutImageSegmentation::Process() m_Image->SetOrigin(origin); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 extrude->SetInput(m_Mesh1); +#else + extrude->SetInputData(m_Mesh1); +#endif extrude->SetScaleFactor(1); extrude->SetExtrusionTypeToNormalExtrusion(); extrude->SetVector(0,0,1); extrude->Update(); dataToStencil->SetTolerance(0); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 dataToStencil->SetInput(extrude->GetOutput()); +#else + dataToStencil->SetInputData(extrude->GetOutput()); +#endif dataToStencil->SetOutputOrigin(origin); dataToStencil->SetOutputSpacing(spacing); dataToStencil->SetOutputWholeExtent(m_Image->GetExtent()); dataToStencil->Update(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imageStencil->SetInput(m_Image); imageStencil->SetStencil(dataToStencil->GetOutput()); +#else + imageStencil->SetInputData(m_Image); + imageStencil->SetStencilData(dataToStencil->GetOutput()); +#endif imageStencil->ReverseStencilOff(); imageStencil->SetBackgroundValue(-200); imageStencil->Update(); diff --git a/lib/creaVtk/vtkImageDataStrucPoints.cpp b/lib/creaVtk/vtkImageDataStrucPoints.cpp index 5ccc9d8..1299cdc 100644 --- a/lib/creaVtk/vtkImageDataStrucPoints.cpp +++ b/lib/creaVtk/vtkImageDataStrucPoints.cpp @@ -38,15 +38,20 @@ vtkImageDataStrucPoints::~vtkImageDataStrucPoints() } void vtkImageDataStrucPoints::joinComponents(vtkImageData* imageX, vtkImageData* imageY, vtkImageData* imageZ) { + int ext[6]; imageY->Modified(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imageY->Update(); - int ext[6]; imageY->GetWholeExtent(ext); +#else + imageY->GetExtent(ext); +#endif int dim[3]; - double spc[3];; - dim[0]=ext[1]-ext[0]+1; - dim[1]=ext[3]-ext[2]+1; - dim[2]=ext[5]-ext[4]+1; + double spc[3]; + dim[0]=ext[1]-ext[0]+1; + dim[1]=ext[3]-ext[2]+1; + dim[2]=ext[5]-ext[4]+1; std::cout<<"dim "<< dim[0] <<" "<< dim[1] <<" "<< dim[2] <GetSpacing(spc); @@ -85,12 +90,26 @@ printf("EED vtkImageDataStrucPoints::joinComponents sizeimage %d\n", sizeimage _structuredPoints = vtkStructuredPoints::New(); _structuredPoints->SetDimensions(dim[0], dim[1], dim[2]); _structuredPoints->SetSpacing(spc); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _structuredPoints->SetScalarTypeToDouble(); _structuredPoints->SetNumberOfScalarComponents(3); +#else + vtkInformation* info=_structuredPoints->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(info, VTK_DOUBLE, 3); + +#endif + _structuredPoints->GetPointData()->SetVectors(array); _structuredPoints->GetPointData()->SetNumberOfTuples(sizeimage); _structuredPoints->Modified(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _structuredPoints->Update(); +#else + //... +#endif /* _structuredPoints->Print(cout); diff --git a/lib/creaVtk/vtkStreamLineCreateColorInfo.cpp b/lib/creaVtk/vtkStreamLineCreateColorInfo.cpp index f26bf2e..9d522cb 100644 --- a/lib/creaVtk/vtkStreamLineCreateColorInfo.cpp +++ b/lib/creaVtk/vtkStreamLineCreateColorInfo.cpp @@ -69,7 +69,13 @@ void vtkStreamLineCreateColorInfo::Run() double vx,vy,vz,mag; double colorDirX,colorDirY,colorDirZ; +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _StreamLinesIn->Update(); +#else + //... +#endif + vtkCharArray *mask = vtkCharArray::New(); vtkDoubleArray *magnitud = vtkDoubleArray::New(); vtkDoubleArray *velocity = vtkDoubleArray::New(); diff --git a/lib/creaVtk/vtkTensorsVisu.cpp b/lib/creaVtk/vtkTensorsVisu.cpp index 7d451f3..f1a73ec 100644 --- a/lib/creaVtk/vtkTensorsVisu.cpp +++ b/lib/creaVtk/vtkTensorsVisu.cpp @@ -52,30 +52,50 @@ vtkTensorsVisu::~vtkTensorsVisu() //------------------------------------------------------------------------ void vtkTensorsVisu::Process() { -printf("EED vtkTensorsVisu::Process Start\n"); - if (_active==true) { if(GetTypeForm()==2) // source superquadratic { superquadratic->SetThetaResolution(20); superquadratic->SetPhiResolution(20); +#if VTK_MAJOR_VERSION <= 5 tg->SetSource(superquadratic->GetOutput()); +#else + tg->SetSourceData(superquadratic->GetOutput()); +#endif } else if(GetTypeForm()==1) { // source sphere +#if VTK_MAJOR_VERSION <= 5 tg->SetSource(ss->GetOutput()); +#else + tg->SetSourceData(ss->GetOutput()); +#endif } else { // source cube +#if VTK_MAJOR_VERSION <= 5 tg->SetSource(cs->GetOutput()); +#else + tg->SetSourceData(cs->GetOutput()); +#endif } +#if VTK_MAJOR_VERSION <= 5 tg->SetInput( GetDataObject() ); +#else + tg->SetInputData( GetDataObject() ); +#endif // tg->ScalingOn(); // tg->SetScaling(25); tg->SetScaleFactor( GetScaleFactor() ); //The normals are needed to generate the right colors and if // not used some of the glyphs are black. +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 pdn->SetInput(tg->GetOutput()); _pdm->SetInput( pdn->GetOutput() ); +#else + pdn->SetInputData(tg->GetOutput()); + _pdm->SetInputData( pdn->GetOutput() ); +#endif _actor->SetMapper( _pdm ); _actor->GetProperty()->SetOpacity( GetOpacity() ); @@ -83,8 +103,15 @@ printf("EED vtkTensorsVisu::Process Start\n"); // tg->SetColorModeToScalars(); tg->Update(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 pd = tg->GetOutput(); pd->Update(); +#else + tg->Update(); + pd = tg->GetOutput(); +#endif + pod = pd->GetPointData(); pod->Update(); @@ -121,7 +148,7 @@ printf("EED vtkTensorsVisu::Process Start\n"); int idEigen; for (iNumPts=0;iNumPtsGetTuple9(iNumPts); + normalValue = tensorsArray->GetTuple9(iNumPts); sumEigenvalue1 = sqrt (normalValue[0]*normalValue[0] + normalValue[1]*normalValue[1] + normalValue[2]*normalValue[2]); sumEigenvalue2 = sqrt (normalValue[3]*normalValue[3] + normalValue[4]*normalValue[4] + normalValue[5]*normalValue[5]); sumEigenvalue3 = sqrt (normalValue[6]*normalValue[6] + normalValue[7]*normalValue[7] + normalValue[8]*normalValue[8]); @@ -193,6 +220,5 @@ printf("EED vtkTensorsVisu::Process Start\n"); VisibilityActor(); -printf("EED vtkTensorsVisu::Process End.\n"); } diff --git a/lib/creaVtk/vtkVectorsVisu.cpp b/lib/creaVtk/vtkVectorsVisu.cpp index af6fe0d..92c3df4 100644 --- a/lib/creaVtk/vtkVectorsVisu.cpp +++ b/lib/creaVtk/vtkVectorsVisu.cpp @@ -51,16 +51,27 @@ vtkVectorsVisu::~vtkVectorsVisu() //------------------------------------------------------------------------------ void vtkVectorsVisu::Process() { -printf("EED vtkVectorsVisu::Process() start\n"); if(_active==true) { +#if VTK_MAJOR_VERSION <= 5 _vtkglyph->SetInput( GetDataObject() ); +#else + _vtkglyph->SetInputData( GetDataObject() ); +#endif if(GetTypeForm()==1) // source Arrow { +#if VTK_MAJOR_VERSION <= 5 _vtkglyph->SetSource( _vtkarrowsource->GetOutput() ); +#else + _vtkglyph->SetSourceData( _vtkarrowsource->GetOutput() ); +#endif } else { // source Line +#if VTK_MAJOR_VERSION <= 5 _vtkglyph->SetSource( _vtklinesource->GetOutput() ); +#else + _vtkglyph->SetSourceData( _vtklinesource->GetOutput() ); +#endif } _vtkglyph->SetScaleModeToScaleByVector(); @@ -68,7 +79,11 @@ printf("EED vtkVectorsVisu::Process() start\n"); _vtkglyph->SetScaleFactor( GetScaleFactor() ); _vtkglyph->Update(); +#if VTK_MAJOR_VERSION <= 5 _pdm->SetInput( _vtkglyph->GetOutput()); +#else + _pdm->SetInputData( _vtkglyph->GetOutput()); +#endif vtkPointData *data = _vtkglyph->GetOutput()->GetPointData(); //printf("EED -------------------------------------------\n"); @@ -126,7 +141,6 @@ for (i=0;i