From: Eduardo DAVILA Date: Wed, 2 Aug 2017 15:18:51 +0000 (+0200) Subject: #3109 creaMaracasVisu Bug New Normal - branch vtk7itk4 compilation with vtk7 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=06b778a59d0c5109cf7626c76d2ee21e033f8c28;p=creaMaracasVisu.git #3109 creaMaracasVisu Bug New Normal - branch vtk7itk4 compilation with vtk7 --- diff --git a/lib/Kernel/VTKObjects/SurfaceRenderer/surfacerenderingimagestencilexport.cxx b/lib/Kernel/VTKObjects/SurfaceRenderer/surfacerenderingimagestencilexport.cxx index 5b74738..15d7bdb 100644 --- a/lib/Kernel/VTKObjects/SurfaceRenderer/surfacerenderingimagestencilexport.cxx +++ b/lib/Kernel/VTKObjects/SurfaceRenderer/surfacerenderingimagestencilexport.cxx @@ -50,18 +50,29 @@ void SurfaceRenderingImageStencilExport::Update(){ void SurfaceRenderingImageStencilExport::Execute(vtkImageData *data){ - vtkPolyData* polydata = (vtkPolyData*)this->GetInput(); - vtkSmartPointer polytostencil = vtkSmartPointer::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + vtkPolyData* polydata = (vtkPolyData*)this->GetInput(); polytostencil->SetInput(polydata); +#else + vtkPolyData* polydata = (vtkPolyData*)this->GetInput(); + polytostencil->SetInputData(polydata); +#endif polytostencil->Update(); double *bounds = polydata->GetBounds(); vtkSmartPointer imagein = vtkSmartPointer::New(); imagein->SetExtent(bounds[0] - 1, bounds[1] + 1, bounds[2] - 1, bounds[3] + 1, bounds[4] - 1, bounds[5] + 1); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imagein->SetScalarTypeToUnsignedShort(); imagein->AllocateScalars(); +#else + imagein->AllocateScalars(VTK_UNSIGNED_SHORT,1); +#endif int* extent = imagein->GetExtent(); @@ -76,8 +87,16 @@ void SurfaceRenderingImageStencilExport::Execute(vtkImageData *data){ } vtkSmartPointer stencil = vtkSmartPointer::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 stencil->SetInput(imagein); stencil->SetStencil(polytostencil->GetOutput()); +#else + stencil->SetInputData(imagein); + stencil->SetStencilData(polytostencil->GetOutput()); +#endif + stencil->ReverseStencilOn(); stencil->SetBackgroundValue(128); stencil->Update(); diff --git a/lib/Kernel/VTKObjects/SurfaceRenderer/surfacerenderingimagestencilexport.h b/lib/Kernel/VTKObjects/SurfaceRenderer/surfacerenderingimagestencilexport.h index 94b8ee3..86d4f7d 100644 --- a/lib/Kernel/VTKObjects/SurfaceRenderer/surfacerenderingimagestencilexport.h +++ b/lib/Kernel/VTKObjects/SurfaceRenderer/surfacerenderingimagestencilexport.h @@ -26,11 +26,18 @@ #ifndef SURFACERENDERINGIMAGESTENCILEXPORT_H #define SURFACERENDERINGIMAGESTENCILEXPORT_H -#include + +#include +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + #include +#else + // .. +#endif + #include #include #include -#include #include class SurfaceRenderingImageStencilExport : public vtkDataSetToImageFilter diff --git a/lib/Kernel/VTKObjects/SurfaceRenderer/wxMaracasSurfaceRenderingManagerData.cxx b/lib/Kernel/VTKObjects/SurfaceRenderer/wxMaracasSurfaceRenderingManagerData.cxx index 18ff1c1..8214c12 100644 --- a/lib/Kernel/VTKObjects/SurfaceRenderer/wxMaracasSurfaceRenderingManagerData.cxx +++ b/lib/Kernel/VTKObjects/SurfaceRenderer/wxMaracasSurfaceRenderingManagerData.cxx @@ -91,7 +91,13 @@ vtkProp3D* wxMaracasSurfaceRenderingManagerData::getProp3D(std::string filename) } _dataMapper = vtkPolyDataMapper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _dataMapper->SetInput(polydata); +#else + _dataMapper->SetInputData(polydata); +#endif vtkActor* dataActor = vtkActor::New(); dataActor->SetMapper(_dataMapper); @@ -195,20 +201,35 @@ void wxMaracasSurfaceRenderingManagerData::saveProp3DSTL(const char* filename){ vtkSmartPointer plywriter = vtkSmartPointer::New(); plywriter->SetFileName(filename); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 plywriter->SetInput(_dataMapper->GetInput()); +#else + plywriter->SetInputData(_dataMapper->GetInput()); +#endif plywriter->Write(); }else if(ext.compare(STL) == 0){ vtkSmartPointer stlWriter = vtkSmartPointer::New(); stlWriter->SetFileName(filename); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 stlWriter->SetInput(_dataMapper->GetInput()); +#else + stlWriter->SetInputData(_dataMapper->GetInput()); +#endif stlWriter->SetFileTypeToBinary(); stlWriter->Write(); }else if(ext.compare(VTK) == 0){ vtkSmartPointer polydataWriter = vtkSmartPointer::New(); polydataWriter->SetFileName(filename); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 polydataWriter->SetInput(_dataMapper->GetInput()); +#else + polydataWriter->SetInputData(_dataMapper->GetInput()); +#endif polydataWriter->SetFileTypeToBinary(); polydataWriter->Write(); }else{ @@ -224,13 +245,23 @@ void wxMaracasSurfaceRenderingManagerData::enableBoxWidget(bool enable){ void wxMaracasSurfaceRenderingManagerData::exportImageStencil(const char* filename){ if(_dataMapper){ vtkSmartPointer< SurfaceRenderingImageStencilExport> stencilexport = vtkSmartPointer< SurfaceRenderingImageStencilExport >::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 stencilexport->SetInput( _dataMapper->GetInput()); +#else + stencilexport->SetInputData( _dataMapper->GetInput()); +#endif stencilexport->Update(); vtkImageData* imgstencil = stencilexport->GetOutput(); vtkSmartPointer metawriter = vtkSmartPointer::New(); metawriter->SetFileName(filename); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 metawriter->SetInput(imgstencil); +#else + metawriter->SetInputData(imgstencil); +#endif metawriter->Write(); }else{ cout<<"No poly data set to data mapper."<SetInput(this->_imagedata); +#else + _tresholdFilter->SetInputData(this->_imagedata); +#endif _tresholdFilter->SetInValue(255); _tresholdFilter->SetOutValue(0); _cubesFilter = vtkMarchingCubes::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _cubesFilter->SetInput(_tresholdFilter->GetOutput()); +#else + _cubesFilter->SetInputData(_tresholdFilter->GetOutput()); +#endif //_cubesFilter->ComputeGradientsOn(); _cubesFilter->ComputeScalarsOn(); _cubesFilter->ComputeNormalsOn(); _cubesFilter->SetNumberOfContours( 1 ); _cleanFilter = vtkCleanPolyData::New(); - _cleanFilter->SetInput ( _cubesFilter->GetOutput() ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _cleanFilter->SetInput( _cubesFilter->GetOutput() ); +#else + _cleanFilter->SetInputData( _cubesFilter->GetOutput() ); +#endif _smooth = vtkSmoothPolyDataFilter::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _smooth->SetInput(_cleanFilter->GetOutput()); +#else + _smooth->SetInputData(_cleanFilter->GetOutput()); +#endif _smooth->SetNumberOfIterations(6); _smooth->SetRelaxationFactor(0.3); //_smooth->FeatureEdgeSmoothingOff(); @@ -70,16 +90,31 @@ wxMaracasSurfaceRenderingManagerDataMhd::wxMaracasSurfaceRenderingManagerDataMhd _boxWidgetS1->SetInteractor( interactor ); _boxWidgetS1->SetPlaceFactor(1.25); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _boxWidgetS1->SetInput( this->_imagedata ); +#else + _boxWidgetS1->SetInputData( this->_imagedata ); +#endif _boxWidgetS1->PlaceWidget(); boxSurfaceObserver* observer = boxSurfaceObserver::New(); vtkStripper* striper = vtkStripper::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 striper->SetInput( _smooth->GetOutput() ); +#else + striper->SetInputData( _smooth->GetOutput() ); +#endif //striper->SetInput( _cleanFilter->GetOutput() ); striper->Update(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _boxWidgetS1->SetInput(striper->GetOutput()); +#else + _boxWidgetS1->SetInputData(striper->GetOutput()); +#endif //_boxWidgetS1->PlaceWidget(); @@ -94,10 +129,20 @@ wxMaracasSurfaceRenderingManagerDataMhd::wxMaracasSurfaceRenderingManagerDataMhd _boxWidgetS1->GetPlanes( _tissuePlanes ); _tissueClipper = vtkClipPolyData::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _tissueClipper->SetInput( striper->GetOutput() ); +#else + _tissueClipper->SetInputData( striper->GetOutput() ); +#endif _tissueClipper->SetClipFunction( _tissuePlanes ); _tissueClipper->InsideOutOn( ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _dataMapper->SetInput( _tissueClipper->GetOutput() ); +#else + _dataMapper->SetInputData( _tissueClipper->GetOutput() ); +#endif observer->SetPlanes( _tissuePlanes ); observer->SetActor( dataActor ); _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent , observer ); @@ -107,7 +152,12 @@ wxMaracasSurfaceRenderingManagerDataMhd::wxMaracasSurfaceRenderingManagerDataMhd _boxWidgetS1->EnabledOff(); }else{ //_dataMapper->SetInput(_cleanFilter->GetOutput()); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _dataMapper->SetInput(_smooth->GetOutput()); +#else + _dataMapper->SetInputData(_smooth->GetOutput()); +#endif } dataActor->SetMapper(_dataMapper); diff --git a/lib/maracasVisuLib/src/CutModule/interface/vtkInteractorStyleCutter.cxx b/lib/maracasVisuLib/src/CutModule/interface/vtkInteractorStyleCutter.cxx index 10b680f..b118ce0 100644 --- a/lib/maracasVisuLib/src/CutModule/interface/vtkInteractorStyleCutter.cxx +++ b/lib/maracasVisuLib/src/CutModule/interface/vtkInteractorStyleCutter.cxx @@ -53,7 +53,12 @@ #include #include +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 vtkCxxRevisionMacro(vtkInteractorStyleCutter, "$Revision: 1.2 $"); +#else +// .. +#endif vtkStandardNewMacro(vtkInteractorStyleCutter); //---------------------------------------------------------------------------- @@ -72,7 +77,12 @@ vtkInteractorStyleCutter::vtkInteractorStyleCutter() pd->SetLines( Lines ); vtkPolyDataMapper2D *bboxMapper = vtkPolyDataMapper2D::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 bboxMapper->SetInput( pd ); +#else + bboxMapper->SetInputData( pd ); +#endif this->BboxActor = vtkActor2D::New(); this->BboxActor->SetMapper( bboxMapper ); diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx index 95e1234..ccd3698 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx @@ -168,12 +168,29 @@ void CutModelData::ShowViewBox(bool check)throw( CutModelException){ void CutModelData::ChangeShape(int selection)throw( CutModelException){ checkInvariant(); - if(selection == 0){ + if(selection == 0) + { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _Mapper->SetInput(_spherefigure->getPolyData()); +#else + _Mapper->SetInputData(_spherefigure->getPolyData()); +#endif }else if(selection == 1){ + +#if VTK_MAJOR_VERSION <= 5 _Mapper->SetInput(_cylinderfigure->getPolyData()); +#else + _Mapper->SetInputData(_cylinderfigure->getPolyData()); +#endif + }else if(selection == 2){ +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _Mapper->SetInput(_cubefigure->getPolyData()); +#else + _Mapper->SetInputData(_cubefigure->getPolyData()); +#endif }else{ throw CutModelException("Shape type not found"); } diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.cxx index 17c633a..05e92d8 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.cxx +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.cxx @@ -84,8 +84,12 @@ void CutModelManager::setImageData(vtkImageData* img){ _img2 = vtkImageData::New(); _img2->SetExtent(_img->GetExtent()); _img2->SetSpacing(_img->GetSpacing()); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _img2->AllocateScalars(); - +#else + //... +#endif _img2->DeepCopy(_img); } else @@ -98,7 +102,12 @@ void CutModelManager::setImageData(vtkImageData* img){ _img = vtkImageData::New(); _img->SetExtent(_img2->GetExtent()); _img->SetSpacing(_img2->GetSpacing()); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _img->AllocateScalars(); +#else + //... +#endif _img->DeepCopy(_img2); } @@ -401,13 +410,23 @@ void CutModelManager::UpdatePolygon(bool mode) sample->CappingOn(); contour = vtkContourFilter::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 contour->SetInput((vtkDataObject *)sample->GetOutput()); +#else + contour->SetInputData((vtkDataObject *)sample->GetOutput()); +#endif contour->SetValue(0,1); actor = contour->GetOutput(); actor3D = vtkActor::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 mapper->SetInput(actor); +#else + mapper->SetInputData(actor); +#endif mapper->SetScalarModeToUseCellData(); actor3D->SetMapper( mapper); _render->AddActor(actor3D); diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelPolygon.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelPolygon.cxx index 4908c72..1f7482f 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelPolygon.cxx +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelPolygon.cxx @@ -115,7 +115,12 @@ void CutModelPolygon::cutInputImage(std::vector vectorOutX,std::vectorGetWholeExtent(ext); +#else + _inImage->GetExtent(ext); +#endif int dimX=ext[1]-ext[0]+1; int dimY=ext[3]-ext[2]+1; int dimZ=ext[5]-ext[4]+1; @@ -183,7 +188,12 @@ void CutModelPolygon::cutInputImage(std::vector vectorOutX,std::vectorModified(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _inImage->Update(); +#else + // .. +#endif } diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelSaveBinInfo.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelSaveBinInfo.cxx index 46b6fe6..06c9eea 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelSaveBinInfo.cxx +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelSaveBinInfo.cxx @@ -67,7 +67,14 @@ CutModelSaveBinInfo::~CutModelSaveBinInfo(){ void CutModelSaveBinInfo::savePolyData(vtkPolyData* polydata){ vtkPolyDataWriter * writer = vtkPolyDataWriter ::New(); writer->SetFileName(_stdFilename.c_str()); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 writer->SetInput(polydata); +#else + writer->SetInputData(polydata); +#endif + writer->SetFileTypeToBinary(); writer->Write(); writer->Delete(); @@ -80,7 +87,12 @@ vtkTransform* CutModelSaveBinInfo::getPolyDataTransform()throw( CutModelExceptio vtkPolyData* poly = reader->GetOutput(); vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 mapper->SetInput(poly); +#else + mapper->SetInputData(poly); +#endif vtkActor* actor = vtkActor::New(); actor->SetMapper(mapper); vtkMatrix4x4* actmatrix = actor->GetMatrix(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx index 1945d31..3e39e53 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx @@ -91,13 +91,30 @@ void ImageInfoUR::LoadImagesToMemory(const StringType& gPath) { VTKMetaImageReaderPointerType::New(); readerUndo->SetFileName(undoImagePath.c_str()); this->m_UndoImage = readerUndo->GetOutput(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 this->m_UndoImage->Update(); +#else + // .. +#endif //Loading Redo Image VTKMetaImageReaderPointerType readerRedo = VTKMetaImageReaderPointerType::New(); readerRedo->SetFileName(redoImagePath.c_str()); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + // .. +#else + readerRedo->Update(); +#endif + this->m_RedoImage = readerRedo->GetOutput(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 this->m_RedoImage->Update(); +#else + // ... +#endif //Updating status this->m_OnMemory = true; } @@ -135,7 +152,12 @@ void ImageInfoUR::RemoveImagesFromDisk(const StringType& gPath) { void ImageInfoUR::SaveImageAsMHD(const StringType& filename, VTKImageDataPointerType image) { VTKMetaImageWriterPointerType w = VTKMetaImageWriterPointerType::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 w->SetInput(image); +#else + w->SetInputData(image); +#endif w->SetCompression(false); w->SetFileDimensionality(image->GetDataDimension()); w->SetFileName(filename.c_str()); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx index ab2219e..4e981c4 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx @@ -70,7 +70,14 @@ void ImageUndoRedo::Redo( ) void ImageUndoRedo::SetImage( VTKImageDataPointerType image ) { this->m_CurrentImage = image; + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 this->m_CurrentImage->Update( ); +#else + // .. +#endif + this->UpdateUndoImage( ); } // ---------------------------------------------------------------------------------- @@ -97,10 +104,20 @@ void ImageUndoRedo::SetURImages( ImageMManagerType* imMManager ) // ---------------------------------------------------------------------------------- void ImageUndoRedo::UpdateUndoImage( ) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 this->m_CurrentImage->Update( ); +#else + // ... +#endif this->m_UndoImage = VTKImageDataPointerType::New( ); this->m_UndoImage->DeepCopy( m_CurrentImage ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 this->m_UndoImage->Update( ); +#else + // .. +#endif } // ---------------------------------------------------------------------------------- ImageUndoRedo::VTKImageDataPointerType ImageUndoRedo::GetImageRegion( @@ -110,9 +127,21 @@ ImageUndoRedo::VTKImageDataPointerType ImageUndoRedo::GetImageRegion( extract->SetVOI( region.minX, region.maxX, region.minY, region.maxY, region.minZ, region.maxZ ); extract->SetSampleRate( 1, 1, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 extract->SetInput( img ); +#else + extract->SetInputData( img ); +#endif VTKImageDataPointerType imgResult = extract->GetOutput( ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imgResult->Update( ); +#else + // .. +#endif + return ( imgResult ); } // ---------------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/kernel/marDynData.cpp b/lib/maracasVisuLib/src/kernel/marDynData.cpp index 8ef4b5f..6630360 100644 --- a/lib/maracasVisuLib/src/kernel/marDynData.cpp +++ b/lib/maracasVisuLib/src/kernel/marDynData.cpp @@ -69,7 +69,12 @@ void marDynData::loadData( kVolume* vol, int* voi ) reset( ); vtkExtractVOI *crop = vtkExtractVOI::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 crop->SetInput( vol->castVtk( ) ); +#else + crop->SetInputData( vol->castVtk( ) ); +#endif crop->SetVOI( voi ); //crop->SetSampleRate( getParameters( )->getVoxelSize( ), getParameters( )->getVoxelSize( ), getParameters( )->getVoxelSize( )); @@ -82,13 +87,23 @@ void marDynData::loadData( kVolume* vol, int* voi ) // RescalaIntercept = 0; vtkImageShiftScale *scale = vtkImageShiftScale::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 scale->SetInput( crop->GetOutput( ) ); +#else + scale->SetInputData( crop->GetOutput( ) ); +#endif scale->SetScale(RescalaSlope); scale->SetShift(0); scale->SetOutputScalarTypeToShort(); scale->Update(); vtkImageShiftScale *shift = vtkImageShiftScale::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 shift->SetInput( scale->GetOutput( ) ); +#else + shift->SetInputData( scale->GetOutput( ) ); +#endif shift->SetScale(1); shift->SetShift(RescalaIntercept); shift->SetOutputScalarTypeToShort(); @@ -96,7 +111,12 @@ void marDynData::loadData( kVolume* vol, int* voi ) vtkImageThreshold *threshold = vtkImageThreshold::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 threshold->SetInput( shift->GetOutput( ) ); +#else + threshold->SetInputData( shift->GetOutput( ) ); +#endif threshold->ThresholdByUpper (-10000); threshold->ThresholdByLower (-1); threshold->SetInValue(0); @@ -105,7 +125,12 @@ void marDynData::loadData( kVolume* vol, int* voi ) threshold->SetOutputScalarTypeToUnsignedShort(); vtkImageResample* ir = vtkImageResample::New( ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 ir->SetInput( threshold->GetOutput( ) ); +#else + ir->SetInputData( threshold->GetOutput( ) ); +#endif ir->SetDimensionality( 3 ); double voxelSize= getParameters( )->getVoxelSize( ); ir->SetAxisOutputSpacing( 0, voxelSize ); @@ -127,7 +152,13 @@ void marDynData::loadData( kVolume* vol, int* voi ) * Before we were using kgfoCrop which assume extent start at 0,0,0 */ vtkImageChangeInformation* change = vtkImageChangeInformation::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 change->SetInput( ir->GetOutput() ); +#else + change->SetInputData( ir->GetOutput() ); +#endif + change->SetExtentTranslation( -ext[0], -ext[2], -ext[4] ); change->SetOutputSpacing ( voxelSize , voxelSize , voxelSize ); change->Update(); //important diff --git a/lib/maracasVisuLib/src/kernel/vtkSTLExtractor.cpp b/lib/maracasVisuLib/src/kernel/vtkSTLExtractor.cpp index 586a801..4b3981c 100644 --- a/lib/maracasVisuLib/src/kernel/vtkSTLExtractor.cpp +++ b/lib/maracasVisuLib/src/kernel/vtkSTLExtractor.cpp @@ -84,12 +84,22 @@ void vtkSTLExtractor::calculate(){ // 1. CALCULATING THE INNER SURFACE // ------------------------------------------------------------------------ vtkImageGaussianSmooth *gaussFilter = vtkImageGaussianSmooth::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 gaussFilter->SetInput(volume); +#else + gaussFilter->SetInputData(volume); +#endif gaussFilter->SetDimensionality(3); gaussFilter->SetStandardDeviation(sigmaLevel); vtkMarchingCubes *cubesFilter = vtkMarchingCubes::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 cubesFilter->SetInput(gaussFilter->GetOutput()); +#else + cubesFilter->SetInputData(gaussFilter->GetOutput()); +#endif cubesFilter->SetValue(0,marchingCubesLevel); cubesFilter->ComputeGradientsOn (); cubesFilter->ComputeScalarsOn (); @@ -97,11 +107,21 @@ void vtkSTLExtractor::calculate(){ // Unir puntos duplicados y remover primitivas degeneradas vtkCleanPolyData *cleanFilter = vtkCleanPolyData::New(); - cleanFilter->SetInput ( cubesFilter->GetOutput() ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + cleanFilter->SetInput( cubesFilter->GetOutput() ); +#else + cleanFilter->SetInputData( cubesFilter->GetOutput() ); +#endif // crea poligonos triangulares vtkTriangleFilter *triangleFilter = vtkTriangleFilter::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 triangleFilter->SetInput( cleanFilter->GetOutput() ); +#else + triangleFilter->SetInputData( cleanFilter->GetOutput() ); +#endif triangleFilter->Update(); innerSurface->DeepCopy(triangleFilter->GetOutput()); @@ -111,9 +131,19 @@ void vtkSTLExtractor::calculate(){ // 2. CALCULATING THE OUTER SURFACE // ------------------------------------------------------------------------ vtkImageContinuousDilate3D *dilateFilter = vtkImageContinuousDilate3D ::New(); - dilateFilter->SetInput (volume); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + dilateFilter->SetInput(volume); +#else + dilateFilter->SetInputData(volume); +#endif dilateFilter->SetKernelSize (3, 3, 3); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 gaussFilter->SetInput( dilateFilter->GetOutput()); +#else + gaussFilter->SetInputData( dilateFilter->GetOutput()); +#endif triangleFilter->Update(); outerSurface->DeepCopy(triangleFilter->GetOutput());