From 4645482ed1eae5aaabdd813b784acafd13c41179 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Mon, 24 Jul 2017 16:22:22 +0200 Subject: [PATCH] #3109 creaMaracasVisu Bug New Normal - branch vtk7itk4 compilation with vtk7 --- .../VolumeRenderer/volumerendererdata.cxx | 7 ++ .../Base/VolumeRenderer/volumerendererdata.h | 7 ++ .../ViewerWidgets/imageplanewidget.cxx | 80 ++++++++++++- .../VolumeRenderer/volumerenderermanager.cxx | 29 ++++- .../volumerenderermanagerdata.cxx | 22 ++++ .../interface/vtkInteractorStyleCutter.h | 8 ++ .../wxWindows/Contour/ContourCrownWidget.cxx | 33 ++++- .../wxWindows/Contour/ContourExtractData.cxx | 32 ++++- .../wxWindows/widgets/ContourView.cxx | 8 ++ .../interface/wxWindows/widgets/LineView.cxx | 7 +- .../interface/wxWindows/widgets/PointView.cxx | 7 ++ .../ColorLayerImageView.cxx | 9 ++ .../ThresholdImageView/LayerImageBase.cxx | 43 +++++++ .../wxWindows/widgets/WidgetShowNPoints.cxx | 7 ++ .../widgets/vtkClipping3DDataViewer.cxx | 61 ++++++++++ .../wxWindows/widgets/vtkClosePolyData.cxx | 113 +++++++++++------- .../wxWindows/widgets/vtkClosePolyData.h | 25 ++++ .../widgets/wxVTKRenderWindowInteractor.h | 8 ++ .../wxVTKRenderWindowInteractorEditContour.h | 8 ++ 19 files changed, 455 insertions(+), 59 deletions(-) diff --git a/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx b/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx index 52e7c86..74ee8a7 100644 --- a/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx +++ b/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx @@ -26,7 +26,14 @@ #include "volumerendererdata.h" #include "vtkObjectFactory.h" + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 vtkCxxRevisionMacro(VolumeRendererData, "$Revision: 1.11 $"); +#else + //... +#endif + vtkStandardNewMacro(VolumeRendererData); VolumeRendererData::VolumeRendererData() diff --git a/lib/GUI/Base/VolumeRenderer/volumerendererdata.h b/lib/GUI/Base/VolumeRenderer/volumerendererdata.h index 4d6f3e4..67194c7 100644 --- a/lib/GUI/Base/VolumeRenderer/volumerendererdata.h +++ b/lib/GUI/Base/VolumeRenderer/volumerendererdata.h @@ -37,7 +37,14 @@ class VolumeRendererData : public vtkObject { public: static VolumeRendererData *New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 vtkTypeRevisionMacro(VolumeRendererData,vtkObject); +#else + vtkTypeMacro(VolumeRendererData,vtkObject); +#endif + // vtkSetObjectMacro(ImageData, vtkImageData); diff --git a/lib/Kernel/VTKObjects/ViewerWidgets/imageplanewidget.cxx b/lib/Kernel/VTKObjects/ViewerWidgets/imageplanewidget.cxx index 3e044e9..fd7b121 100644 --- a/lib/Kernel/VTKObjects/ViewerWidgets/imageplanewidget.cxx +++ b/lib/Kernel/VTKObjects/ViewerWidgets/imageplanewidget.cxx @@ -80,21 +80,43 @@ bool ImagePlaneWidget::showImageActors(bool show){ void ImagePlaneWidget::initializeImageActors(){ - int *w_ext = _img->GetWholeExtent(); //cout<GetWholeExtent(); _imageactorx->SetInput(_img); +#else + int *w_ext = _img->GetExtent(); + _imageactorx->SetInputData(_img); +#endif + xslice = (w_ext[4] + w_ext[5])/2; _imageactorx->SetDisplayExtent(w_ext[0], w_ext[1], w_ext[2], w_ext[3], xslice, xslice); _imageactory = vtkImageActor::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _imageactory->SetInput(_img); +#else + _imageactory->SetInputData(_img); +#endif + yslice = (w_ext[2] + w_ext[3])/2; _imageactory->SetDisplayExtent(w_ext[0], w_ext[1], yslice, yslice, w_ext[4], w_ext[5]); _imageactorz = vtkImageActor::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _imageactorz->SetInput(_img); +#else + _imageactorz->SetInputData(_img); +#endif + zslice = (w_ext[0] + w_ext[1])/2; _imageactorz->SetDisplayExtent(zslice, zslice, w_ext[2], w_ext[3], w_ext[4], w_ext[5]); @@ -112,7 +134,14 @@ void ImagePlaneWidget::setImage(vtkImageData* img){ // Set input X,Y and Z plane _xwidget->Off( ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _xwidget->SetInput( _img ); +#else + _xwidget->SetInputData( _img ); +#endif + _xwidget->SetPlaneOrientationToXAxes( ); _xwidget->SetSliceIndex( sliceX ); _xwidget->TextureInterpolateOff(); @@ -122,7 +151,14 @@ void ImagePlaneWidget::setImage(vtkImageData* img){ _xwidget->GetTextProperty()->SetColor(0.3, 0.3, 0.3); _ywidget->Off( ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _ywidget->SetInput( _img ); +#else + _ywidget->SetInputData( _img ); +#endif + _ywidget->SetPlaneOrientationToYAxes( ); _ywidget->SetSliceIndex( sliceY ); _ywidget->TextureInterpolateOff(); @@ -132,7 +168,16 @@ void ImagePlaneWidget::setImage(vtkImageData* img){ _ywidget->On( ); _zwidget->Off( ); + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _zwidget->SetInput( _img ); +#else + _zwidget->SetInputData( _img ); +#endif + + _zwidget->SetPlaneOrientationToZAxes( ); _zwidget->SetSliceIndex( sliceZ ); _zwidget->TextureInterpolateOff(); @@ -167,7 +212,8 @@ void ImagePlaneWidget::showPlanes(bool show){ } -void ImagePlaneWidget::invariant(){ +void ImagePlaneWidget::invariant() +{ if(_img == NULL){ throw "Image data is not initialized"; } @@ -177,20 +223,44 @@ void ImagePlaneWidget::invariant(){ } -void ImagePlaneWidget::setSliceXImageActor(int value){ +void ImagePlaneWidget::setSliceXImageActor(int value) +{ +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 int *w_ext = _img->GetWholeExtent(); +#else + int *w_ext = _img->GetExtent(); +#endif + xslice = value; _imageactorx->SetDisplayExtent(w_ext[0], w_ext[1], w_ext[2], w_ext[3], xslice, xslice); m_Interactor->Render(); } -void ImagePlaneWidget::setSliceYImageActor(int value){ + +void ImagePlaneWidget::setSliceYImageActor(int value) +{ +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 int *w_ext = _img->GetWholeExtent(); +#else + int *w_ext = _img->GetExtent(); +#endif yslice = value; _imageactory->SetDisplayExtent(w_ext[0], w_ext[1], yslice, yslice, w_ext[4], w_ext[5]); m_Interactor->Render(); } -void ImagePlaneWidget::setSliceZImageActor(int value){ + + +void ImagePlaneWidget::setSliceZImageActor(int value) +{ + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 int *w_ext = _img->GetWholeExtent(); +#else + int *w_ext = _img->GetExtent(); +#endif + zslice = value; _imageactorz->SetDisplayExtent(zslice, zslice, w_ext[2], w_ext[3], w_ext[4], w_ext[5]); m_Interactor->Render(); diff --git a/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanager.cxx b/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanager.cxx index 27c4d2b..4931d51 100644 --- a/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanager.cxx +++ b/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanager.cxx @@ -111,12 +111,26 @@ int VolumeRendererManager::addVolume(vtkImageData* img, vtkRenderWindowInteracto vtkSmartPointer< vtkImageLuminance > luminance = vtkSmartPointer< vtkImageLuminance >::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 luminance->SetInput(img); +#else + luminance->SetInputData(img); +#endif + luminance->Update(); vtkSmartPointer< vtkImageAppendComponents > append = vtkSmartPointer< vtkImageAppendComponents >::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 append->SetInput(0, img); append->SetInput(1, luminance->GetOutput()); +#else + append->SetInputData(0, img); + append->SetInputData(1, luminance->GetOutput()); +#endif + append->Update(); @@ -301,12 +315,19 @@ void VolumeRendererManager::GetImages(vtkImageData* img, vector& for(unsigned i = 0; i < img->GetNumberOfScalarComponents(); i++){ vectimg.push_back(vtkImageData::New()); - vectimg[i]->SetNumberOfScalarComponents(1); vectimg[i]->SetExtent(img->GetExtent()); vectimg[i]->SetSpacing(img->GetSpacing()); vectimg[i]->SetOrigin(img->GetOrigin()); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + vectimg[i]->SetNumberOfScalarComponents(1); vectimg[i]->SetScalarType(img->GetScalarType()); vectimg[i]->AllocateScalars(); +#else + vectimg[i]->AllocateScalars(img->GetScalarType(),1); +#endif + } int *extent = img->GetExtent(); @@ -446,7 +467,13 @@ vtkImageData* VolumeRendererManager::getImageData(std::string filename){ vtkImageData* img = reader->GetOutput(); vtkImageCast* cast = vtkImageCast::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 cast->SetInput(img); +#else + cast->SetInputData(img); +#endif + cast->SetOutputScalarTypeToUnsignedShort(); cast->Update(); //reader->Delete(); diff --git a/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx b/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx index 00d115b..fcfd3c3 100644 --- a/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx +++ b/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx @@ -35,6 +35,14 @@ #include + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + //... +#else +#include +#endif + // EED This is code for Juan Carlos Prieto TESTES //#if VTK_MAJOR_VERSION >= 5 // #if VTK_MINOR_VERSION >= 6 @@ -164,7 +172,15 @@ void VolumeRendererManagerData::Initialize(vtkImageData* vol, std::string datana #endif VolumeMapper->SetClippingPlanes( _volumePlanes ); _newvol->SetMapper(VolumeMapper ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 VolumeMapper->SetInput( _vol ); +#else + VolumeMapper->SetInputData( _vol ); +#endif + + VolumeMapper->Update(); _newvol->Update(); } @@ -212,7 +228,13 @@ void VolumeRendererManagerData::EnableBoundingBox(vtkRenderWindowInteractor* int BoxWidget->SetInteractor( interactor ); BoxWidget->SetPlaceFactor(1.01); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 BoxWidget->SetInput( _vol ); +#else + BoxWidget->SetInputData( _vol ); +#endif + BoxWidget->InsideOutOn(); BoxWidget->PlaceWidget(); diff --git a/lib/maracasVisuLib/src/CutModule/interface/vtkInteractorStyleCutter.h b/lib/maracasVisuLib/src/CutModule/interface/vtkInteractorStyleCutter.h index 2dc81e8..18600cf 100644 --- a/lib/maracasVisuLib/src/CutModule/interface/vtkInteractorStyleCutter.h +++ b/lib/maracasVisuLib/src/CutModule/interface/vtkInteractorStyleCutter.h @@ -60,7 +60,15 @@ public: // Description: // Instantiate the object. static vtkInteractorStyleCutter *New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 vtkTypeRevisionMacro(vtkInteractorStyleCutter, vtkInteractorStyle); +#else + vtkTypeMacro(vtkInteractorStyleCutter, vtkInteractorStyle); +#endif + + void PrintSelf(ostream& os, vtkIndent indent); bool Finished(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourCrownWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourCrownWidget.cxx index 3ab512b..010ec0c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourCrownWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourCrownWidget.cxx @@ -122,11 +122,22 @@ void wxMaracasCoutourTool::Init(wxVtkBaseView *wxvtkbaseview, vtkImageData* imag table->SetRampToLinear(); table->Build(); - vtkImageMapToColors *mapperImage = vtkImageMapToColors::New(); + vtkImageMapToColors *mapperImage = vtkImageMapToColors::New(); + vtkImageActor *actorImage = vtkImageActor::New(); + mapperImage->SetLookupTable(table); + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 mapperImage->SetInput( imagedataMaskResult ); - vtkImageActor *actorImage = vtkImageActor::New(); actorImage->SetInput( mapperImage->GetOutput() ); +#else + mapperImage->SetInputData( imagedataMaskResult ); + actorImage->SetInputData( mapperImage->GetOutput() ); +#endif + + actorImage->SetOpacity(1); wxvtkbaseview->GetRenderer()->AddActor(actorImage); @@ -488,17 +499,31 @@ void wxMaracasCoutourTool::InitVtkImagesResult() imagedataValueResult = vtkImageData::New(); // imagedataValueResult->SetScalarType(scalartype); - imagedataValueResult->SetScalarTypeToUnsignedShort(); imagedataValueResult->SetSpacing(spc); imagedataValueResult->SetDimensions( newDim ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + imagedataValueResult->SetScalarTypeToUnsignedShort(); imagedataValueResult->AllocateScalars(); +#else + imagedataValueResult->AllocateScalars(VTK_UNSIGNED_SHORT,1); +#endif + imagedataMaskResult = vtkImageData::New(); // imagedataMaskResult->SetScalarType(scalartype); - imagedataMaskResult->SetScalarTypeToUnsignedShort(); imagedataMaskResult->SetSpacing(spc); imagedataMaskResult->SetDimensions( newDim ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + imagedataMaskResult->SetScalarTypeToUnsignedShort(); imagedataMaskResult->AllocateScalars(); +#else + imagedataMaskResult->AllocateScalars(VTK_UNSIGNED_SHORT,1); +#endif + } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx index a0cfd9a..2947bdc 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx @@ -51,7 +51,14 @@ void ContourExtractData::SetImage( vtkImageData* imagedata) // RaC 20-11-09 Changes in InitLstContoursLinesYPoints int ext[6]; + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 this->imagedata->GetWholeExtent(ext); +#else + this->imagedata->GetExtent(ext); +#endif + _sizeImageY = ext[3]-ext[2]+1; // init vtk image result : valuesImage maskImage @@ -460,8 +467,15 @@ void ContourExtractData::CalculateImageResult() imagedataValueResult->Modified(); imagedataMaskResult->Modified(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imagedataValueResult->Update(); imagedataMaskResult->Update(); +#else + //... +#endif + } // if } @@ -559,10 +573,17 @@ void ContourExtractData::InitVtkImagesResult() } imagedataValueResult = vtkImageData::New(); // imagedataValueResult->SetScalarType(scalartype); - imagedataValueResult->SetScalarTypeToUnsignedShort(); imagedataValueResult->SetSpacing(spc); imagedataValueResult->SetDimensions( newDim ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + imagedataValueResult->SetScalarTypeToUnsignedShort(); imagedataValueResult->AllocateScalars(); +#else + imagedataValueResult->AllocateScalars(VTK_UNSIGNED_SHORT,1); +#endif + if (imagedataMaskResult!=NULL) { @@ -570,10 +591,17 @@ void ContourExtractData::InitVtkImagesResult() } imagedataMaskResult = vtkImageData::New(); // imagedataMaskResult->SetScalarType(scalartype); - imagedataMaskResult->SetScalarTypeToUnsignedShort(); imagedataMaskResult->SetSpacing(spc); imagedataMaskResult->SetDimensions( newDim ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + imagedataMaskResult->SetScalarTypeToUnsignedShort(); imagedataMaskResult->AllocateScalars(); +#else + imagedataMaskResult->AllocateScalars(VTK_UNSIGNED_SHORT,1); +#endif + } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ContourView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ContourView.cxx index a758068..d79354e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ContourView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ContourView.cxx @@ -69,7 +69,15 @@ void ContourView::CreateNewContour(vtkPolyData *contour, int type) contour_mapped.push_back(vtkPolyDataMapper::New()); contour_mapped.back()->ImmediateModeRenderingOn(); contour_mapped.back()->ScalarVisibilityOff( ); + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 contour_mapped.back()->SetInput(contour); +#else + contour_mapped.back()->SetInputData(contour); +#endif + contour_actor.push_back(vtkActor::New()); contour_actor.back()->SetMapper(contour_mapped.back()); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/LineView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/LineView.cxx index c4fd440..253fa58 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/LineView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/LineView.cxx @@ -85,9 +85,14 @@ void LineView::CreateNewLine(double x1, double y1, double z1, double x2, double aLineGrid->Allocate(1,1); aLineGrid->InsertNextCell(aLine->GetCellType(),aLine->GetPointIds()); aLineGrid->SetPoints(pointsLine); - +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 contour_mapped.back()->SetInput(aLineGrid); +#else + contour_mapped.back()->SetInputData(aLineGrid); +#endif + contour_mapped.back()->ImmediateModeRenderingOn(); contour_actor.back()->SetMapper(contour_mapped.back()); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/PointView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/PointView.cxx index 476902d..7c17ffb 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/PointView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/PointView.cxx @@ -71,7 +71,14 @@ void PointView::CreateNewPoint(double x, double y, int type) point_mapped.push_back(vtkPolyDataMapper::New()); // point_mapped.back()->ImmediateModeRenderingOn(); //point_mapped.back()->ScalarVisibilityOff( ); + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 point_mapped.back()->SetInput(aSphere->GetOutput()); +#else + point_mapped.back()->SetInputData(aSphere->GetOutput()); +#endif point_actor.push_back(vtkActor::New()); point_actor.back()->SetMapper(point_mapped.back()); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx index 299b737..76fa42b 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx @@ -446,7 +446,16 @@ printf("EED ColorLayerImageView::ConfigLookupTable Make something with transpa //---------------------------------------------------------------------------- int ColorLayerImageView::GrayLevel_TO_colorTableIndex( double VALUE ) { + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 GetImage()->Update(); +#else + //... +#endif + + + //EED 20 oct 2015 // GetImage()->GetScalarRange(_range); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx index f625d57..1e402d3 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx @@ -191,8 +191,15 @@ void LayerImageBase::SetImage(vtkImageData* image) spcBase[5]=0; _image = image; + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _image->Update(); _image->GetWholeExtent(ext); +#else + _image->GetExtent(ext); +#endif + dimensionOriginalLayer[0] = ext[1]-ext[0]+1; dimensionOriginalLayer[1] = ext[3]-ext[2]+1; dimensionOriginalLayer[2] = ext[5]-ext[4]+1; @@ -205,7 +212,14 @@ void LayerImageBase::SetImage(vtkImageData* image) vtkImageData *imagebase = GetwxVtkBaseView()->GetVtkBaseData()->GetImageData(); if (imagebase!=NULL) { + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imagebase->GetWholeExtent(ext); +#else + imagebase->GetExtent(ext); +#endif + dimBase[0]=ext[1]-ext[0]+1; dimBase[1]=ext[3]-ext[2]+1; dimBase[2]=ext[5]-ext[4]+1; @@ -223,7 +237,14 @@ void LayerImageBase::SetImage(vtkImageData* image) _image->GetScalarRange( _range ); _thresholdTable = vtkLookupTable::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _imageChangeInformation->SetInput(_image); +#else + _imageChangeInformation->SetInputData(_image); +#endif + } //------------------------------------------------------------------------------ @@ -474,7 +495,14 @@ void LayerImageBase::onThreshold() } // !GetActorPresent() ConfigLookupTable(); // virtual method + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _imageReslicer->SetInput( GetImage() ); +#else + _imageReslicer->SetInputData( GetImage() ); +#endif + _imageReslicer->SetInformationInput( GetImage() ); if (directionViewer==0) @@ -506,9 +534,24 @@ void LayerImageBase::onThreshold() // img->UpdateInformation(); // _thresholdTable->Update(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _thresholdMapper->SetInput( img ); +#else + _thresholdMapper->SetInputData( img ); +#endif + _thresholdMapper->SetLookupTable( _thresholdTable ); + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _thresholdActor->SetInput( _thresholdMapper->GetOutput() ); +#else + _thresholdActor->SetInputData( _thresholdMapper->GetOutput() ); +#endif + _scalarbarActor->SetLookupTable( _thresholdTable ); // _scalarbarActor->SetLookupTable( _thresholdMapper->GetLookupTable() ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx index b9f8386..8f094a6 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx @@ -241,7 +241,14 @@ void WidgetShowNPoints::AddVtkPoint() //NTU: For updating points lstSourceSphere.push_back(vtksphere); vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 sphereMapper->SetInput( vtksphere->GetOutput() ); +#else + sphereMapper->SetInputData( vtksphere->GetOutput() ); +#endif + vtkActor *sphereActor = vtkActor::New(); sphereActor->SetMapper(sphereMapper); sphereActor->SetOrigin(0, 0, 0); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx index a888215..1e723a1 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx @@ -209,9 +209,19 @@ void vtkClipping3DDataViewer::SetImage() vtkImageData *imagedata=_vtkmprbasedata->GetImageData(); for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _mCubes[i]->SetInput( imagedata ); +#else + _mCubes[i]->SetInputData( imagedata ); +#endif } // for +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _volumeMapper->SetInput( imagedata ); +#else + _volumeMapper->SetInputData( imagedata ); +#endif _volumerendererdata->SetImageData( imagedata ); } @@ -226,21 +236,50 @@ void vtkClipping3DDataViewer::Configure_Tissue() { // Visualisation - original volume _mCubes[i] = vtkMarchingCubes::New( ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _mCubes[i]->SetInput( imagedata ); +#else + _mCubes[i]->SetInputData( imagedata ); +#endif + _mCubes[i]->SetValue( 0, range[1]*(4+i) / 8 ); // _mCubes[i]->SetValue( 0, 1500 ); _tissueStripper[i] = vtkStripper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _tissueStripper[i]->SetInput( _mCubes[i]->GetOutput( ) ); +#else + _tissueStripper[i]->SetInputData( _mCubes[i]->GetOutput( ) ); +#endif + _tissuePlanes[i] = vtkPlanes::New(); int x1,x2,y1,y2,z1,z2; imagedata->GetExtent(x1,x2,y1,y2,z1,z2); _tissuePlanes[i]->SetBounds (x1,x2,y1,y2,z1,z2); _tissueClipper[i] = vtkClipPolyData::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _tissueClipper[i]->SetInput( _tissueStripper[i]->GetOutput() ); +#else + _tissueClipper[i]->SetInputData( _tissueStripper[i]->GetOutput() ); +#endif + _tissueClipper[i]->SetClipFunction( _tissuePlanes[i] ); _tissueClipper[i]->InsideOutOn( ); _tissueMapper[i] = vtkPolyDataMapper::New( ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _tissueMapper[i]->SetInput( _tissueClipper[i]->GetOutput() ); +#else + _tissueMapper[i]->SetInputData( _tissueClipper[i]->GetOutput() ); +#endif + + _tissueMapper[i]->ScalarVisibilityOff( ); // _tissueMapper[i]->Update(); } // for i @@ -351,7 +390,15 @@ void vtkClipping3DDataViewer::Configure_Volume() // EED 13/03/2011 // _volumeMapper = vtkVolumeRayCastMapper::New(); + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() ); +#else + _volumeMapper->SetInputData( this->GetVtkMPRBaseData()->GetImageData() ); +#endif + _volumeMapper->SetVolumeRayCastFunction(_compositeFunction); @@ -485,7 +532,14 @@ void vtkClipping3DDataViewer::Configure() // An outline provides context around the data. // _outlineData = vtkOutlineFilter::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() ); +#else + _outlineData->SetInputData((vtkDataSet *) _vtkmprbasedata->GetImageData() ); +#endif + _mapOutline = vtkPolyDataMapper::New(); //EED 4 nov 2015 Estelle @@ -772,7 +826,14 @@ void vtkClipping3DDataViewer::ReadMeshVTK(char *namefile) vtkDataSetReader *reader = vtkDataSetReader::New(); reader->SetFileName(namefile); reader->Update(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _tissueStripper[3]->SetInput( reader->GetPolyDataOutput() ); +#else + _tissueStripper[3]->SetInputData( reader->GetPolyDataOutput() ); +#endif + } void vtkClipping3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.cxx index 4b0aef7..397295f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.cxx @@ -51,7 +51,14 @@ #include "vtkAppendPolyData.h" #include "vtkCleanPolyData.h" + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 vtkCxxRevisionMacro(vtkClosePolyData, "$Revision: 1.3 $"); +#else + //... +#endif + vtkStandardNewMacro(vtkClosePolyData); //---------------------------------------------------------------------------- @@ -64,53 +71,67 @@ vtkClosePolyData::~vtkClosePolyData() { } + //---------------------------------------------------------------------------- -// This method is much too long, and has to be broken up! -// Furthermore we are loosing the normals !!! -void vtkClosePolyData::Execute() -{ - vtkPolyData *input = this->GetInput(); - vtkPolyData *output = this->GetOutput(); - - //#closing the polydata see : close.py for details - vtkFeatureEdges *boundary = vtkFeatureEdges::New(); - boundary->SetInput( input ); - boundary->BoundaryEdgesOn (); - boundary->FeatureEdgesOff (); - boundary->NonManifoldEdgesOff (); - boundary->ManifoldEdgesOff (); - //boundary->ColoringOff (); - - vtkStripper *stripper = vtkStripper::New(); - stripper->SetInput( boundary->GetOutput() ); - stripper->Update(); //important - boundary->Delete(); - - vtkPolyData *pd = vtkPolyData::New(); - pd->SetPoints ( stripper->GetOutput()->GetPoints() ); - pd->SetPolys ( stripper->GetOutput()->GetLines() ); - stripper->Delete(); - - //vtkGLUTesselatorTriangleFilter *triangle = vtkGLUTesselatorTriangleFilter::New(); - vtkTriangleFilter *triangle = vtkTriangleFilter::New(); - triangle->SetInput( pd ); - pd->Delete(); - - vtkAppendPolyData *append = vtkAppendPolyData::New(); - append->AddInput( input ); - append->AddInput( triangle->GetOutput()); - triangle->Delete(); - - vtkCleanPolyData *clean = vtkCleanPolyData::New(); - clean->SetInput( append->GetOutput()); - append->Delete(); - - // When all optimizations are complete, this squeeze will be unecessary. - // (But it does not seem to cost much.) - clean->Update(); //important before ShallowCopy - output->ShallowCopy( clean->GetOutput() ); - clean->Delete(); -} + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + // This method is much too long, and has to be broken up! + // Furthermore we are loosing the normals !!! + void vtkClosePolyData::Execute() + { + vtkPolyData *input = this->GetInput(); + vtkPolyData *output = this->GetOutput(); + + //#closing the polydata see : close.py for details + vtkFeatureEdges *boundary = vtkFeatureEdges::New(); + boundary->SetInput( input ); + boundary->BoundaryEdgesOn (); + boundary->FeatureEdgesOff (); + boundary->NonManifoldEdgesOff (); + boundary->ManifoldEdgesOff (); + //boundary->ColoringOff (); + + vtkStripper *stripper = vtkStripper::New(); + stripper->SetInput( boundary->GetOutput() ); + stripper->Update(); //important + boundary->Delete(); + + vtkPolyData *pd = vtkPolyData::New(); + pd->SetPoints ( stripper->GetOutput()->GetPoints() ); + pd->SetPolys ( stripper->GetOutput()->GetLines() ); + stripper->Delete(); + + //vtkGLUTesselatorTriangleFilter *triangle = vtkGLUTesselatorTriangleFilter::New(); + vtkTriangleFilter *triangle = vtkTriangleFilter::New(); + triangle->SetInput( pd ); + pd->Delete(); + + vtkAppendPolyData *append = vtkAppendPolyData::New(); + append->AddInput( input ); + append->AddInput( triangle->GetOutput()); + triangle->Delete(); + + vtkCleanPolyData *clean = vtkCleanPolyData::New(); + clean->SetInput( append->GetOutput()); + append->Delete(); + + // When all optimizations are complete, this squeeze will be unecessary. + // (But it does not seem to cost much.) + clean->Update(); //important before ShallowCopy + output->ShallowCopy( clean->GetOutput() ); + clean->Delete(); + } + +#else + int vtkClosePolyData::ProcessRequest( vtkInformation *request, + vtkInformationVector **inputVector, + vtkInformationVector *outputVector) + { +printf("EED Warning ERROR ! vtkClosePolyData::ProcessRequest not implemented VTK7 migration") + } + +#endif //---------------------------------------------------------------------------- void vtkClosePolyData::PrintSelf(ostream& os, vtkIndent indent) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.h index 85e4ad0..059efc1 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.h @@ -55,22 +55,47 @@ #ifndef __vtkClosePolyData_h #define __vtkClosePolyData_h +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 #include "vtkPolyDataToPolyDataFilter.h" +#else +#include "vtkPolyDataAlgorithm.h" +#endif + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 class vtkClosePolyData : public vtkPolyDataToPolyDataFilter +#else +class vtkClosePolyData : public vtkPolyDataAlgorithm +#endif { public: static vtkClosePolyData *New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 vtkTypeRevisionMacro(vtkClosePolyData,vtkPolyDataToPolyDataFilter); +#else + vtkTypeMacro(vtkClosePolyData,vtkPolyDataToPolyDataFilter); +#endif void PrintSelf(ostream& os, vtkIndent indent); protected: vtkClosePolyData(); ~vtkClosePolyData(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 // Usual data generation method void Execute(); +#else + int ProcessRequest( vtkInformation *request, + vtkInformationVector **inputVector, + vtkInformationVector *outputVector); +#endif + private: vtkClosePolyData(const vtkClosePolyData&); // Not implemented. diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.h index 1d2279b..b8eb9ac 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.h @@ -127,7 +127,15 @@ class wxVTKRenderWindowInteractor : public wxWindow, public vtkRenderWindowInter const wxSize &size = wxDefaultSize, long style = wxWANTS_CHARS | wxNO_FULL_REPAINT_ON_RESIZE, const wxString &name = wxPanelNameStr); + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 vtkTypeRevisionMacro(wxVTKRenderWindowInteractor,vtkRenderWindowInteractor); +#else + vtkTypeMacro(wxVTKRenderWindowInteractor,vtkRenderWindowInteractor); +#endif + static wxVTKRenderWindowInteractor * New(); void PrintSelf(ostream& os, vtkIndent indent); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractorEditContour.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractorEditContour.h index 8c13f8b..d706e32 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractorEditContour.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractorEditContour.h @@ -94,10 +94,18 @@ public: if (event == vtkCommand::ResetWindowLevelEvent) { + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 this->IV->GetInput()->UpdateInformation(); this->IV->GetInput()->SetUpdateExtent (this->IV->GetInput()->GetWholeExtent()); this->IV->GetInput()->Update(); +#else + //.. +#endif + double *range = this->IV->GetInput()->GetScalarRange(); this->IV->SetColorWindow(range[1] - range[0]); this->IV->SetColorLevel(0.5 * (range[1] + range[0])); -- 2.47.1