diff --git a/Libs/Visualization/VTK/Core/CMakeLists.txt b/Libs/Visualization/VTK/Core/CMakeLists.txt index 3aeca20a71..aeb2092f5d 100644 --- a/Libs/Visualization/VTK/Core/CMakeLists.txt +++ b/Libs/Visualization/VTK/Core/CMakeLists.txt @@ -74,16 +74,34 @@ if(CTK_LIB_Scripting/Python/Core AND CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_ endif() # Set VTK_LIBRARIES variable -set(VTK_LIBRARIES - vtkCommon - vtkFiltering - vtkRendering - vtkHybrid - ) +if(${VTK_VERSION_MAJOR} GREATER 5) + set(VTK_LIBRARIES + vtkCommonCore + vtkCommonDataModel + vtkCommonSystem + vtkIOImage + vtkInteractionStyle + vtkRenderingAnnotation + vtkRenderingCore + vtkRenderingFreeTypeFontConfig + vtkRenderingFreeTypeOpenGL + vtkRenderingOpenGL + vtkTestingRendering + ) +else() + set(VTK_LIBRARIES + vtkCommon + vtkFiltering + vtkRendering + vtkHybrid + ) +endif() if(CTK_LIB_Scripting/Python/Core AND CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK) list(APPEND VTK_LIBRARIES ${PYTHON_LIBRARY} ${PYTHONQT_LIBRARIES}) - if(${VTK_VERSION_MAJOR}.${VTK_VERSION_MINOR} VERSION_GREATER 5.6) + if(${VTK_VERSION_MAJOR} GREATER 5) + list(APPEND VTK_LIBRARIES vtkWrappingPythonCore) + elseif(${VTK_VERSION_MAJOR}.${VTK_VERSION_MINOR} VERSION_GREATER 5.6) list(APPEND VTK_LIBRARIES vtkPythonCore) else() list(APPEND VTK_LIBRARIES vtkCommonPythonD) diff --git a/Libs/Visualization/VTK/Core/Testing/Cpp/vtkLightBoxRendererManagerTest1.cpp b/Libs/Visualization/VTK/Core/Testing/Cpp/vtkLightBoxRendererManagerTest1.cpp index 6778f88991..952fd05e52 100644 --- a/Libs/Visualization/VTK/Core/Testing/Cpp/vtkLightBoxRendererManagerTest1.cpp +++ b/Libs/Visualization/VTK/Core/Testing/Cpp/vtkLightBoxRendererManagerTest1.cpp @@ -63,7 +63,11 @@ int vtkLightBoxRendererManagerTest1(int argc, char* argv[]) // Read image imageReader->SetFileName(imageFilename); imageReader->Update(); +#if (VTK_MAJOR_VERSION <= 5) vtkSmartPointer image = imageReader->GetOutput(); +#else + vtkSmartPointer imagePort = imageReader->GetOutputPort(); +#endif //---------------------------------------------------------------------------- // Renderer, RenderWindow and Interactor @@ -168,10 +172,18 @@ int vtkLightBoxRendererManagerTest1(int argc, char* argv[]) return EXIT_FAILURE; } +#if (VTK_MAJOR_VERSION <= 5) lightBoxRendererManager->SetImageData(image); +#else + lightBoxRendererManager->SetImageDataPort(imagePort); +#endif if (mtime != lightBoxRendererManager->GetMTime()) { +#if (VTK_MAJOR_VERSION <= 5) std::cerr << "line " << __LINE__ << " - Problem with SetImageData()" << std::endl; +#else + std::cerr << "line " << __LINE__ << " - Problem with SetImageDataPort()" << std::endl; +#endif return EXIT_FAILURE; } diff --git a/Libs/Visualization/VTK/Core/ctkVTKPythonQtWrapperFactory.cpp b/Libs/Visualization/VTK/Core/ctkVTKPythonQtWrapperFactory.cpp index 92fe49905c..af32d69e05 100644 --- a/Libs/Visualization/VTK/Core/ctkVTKPythonQtWrapperFactory.cpp +++ b/Libs/Visualization/VTK/Core/ctkVTKPythonQtWrapperFactory.cpp @@ -5,6 +5,7 @@ /// VTK includes #include #include +#include //----------------------------------------------------------------------------- ctkVTKPythonQtWrapperFactory::ctkVTKPythonQtWrapperFactory():Superclass() diff --git a/Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.cpp b/Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.cpp index efeadd7c2a..53b3ab5225 100644 --- a/Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.cpp +++ b/Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.cpp @@ -21,6 +21,7 @@ #include "vtkLightBoxRendererManager.h" // VTK includes +#include #include #include #include @@ -38,6 +39,7 @@ #include #include #include +#include #include // STD includes @@ -45,7 +47,6 @@ #include //---------------------------------------------------------------------------- -vtkCxxRevisionMacro(vtkLightBoxRendererManager, "$Revision:$"); vtkStandardNewMacro(vtkLightBoxRendererManager); namespace @@ -99,7 +100,11 @@ RenderWindowItem::RenderWindowItem(const double rendererBackgroundColor[3], //----------------------------------------------------------------------------- RenderWindowItem::~RenderWindowItem() { +#if (VTK_MAJOR_VERSION <= 5) this->ImageMapper->SetInput(0); +#else + this->ImageMapper->SetInputConnection(0); +#endif } //----------------------------------------------------------------------------- @@ -242,7 +247,11 @@ class vtkLightBoxRendererManager::vtkInternal vtkSmartPointer CornerAnnotation; std::string CornerAnnotationText; +#if (VTK_MAJOR_VERSION <= 5) vtkWeakPointer ImageData; +#else + vtkWeakPointer ImageDataPort; +#endif double ColorWindow; double ColorLevel; double RendererBackgroundColor[3]; @@ -457,11 +466,19 @@ bool vtkLightBoxRendererManager::IsInitialized() } //---------------------------------------------------------------------------- +#if (VTK_MAJOR_VERSION <= 5) void vtkLightBoxRendererManager::SetImageData(vtkImageData* newImageData) +#else +void vtkLightBoxRendererManager::SetImageDataPort(vtkAlgorithmOutput* newImageDataPort) +#endif { if (!this->IsInitialized()) { +#if (VTK_MAJOR_VERSION <= 5) vtkErrorMacro(<< "SetImageData failed - vtkLightBoxRendererManager is NOT initialized"); +#else + vtkErrorMacro(<< "SetImageDataPort failed - vtkLightBoxRendererManager is NOT initialized"); +#endif return; } vtkInternal::RenderWindowItemListIt it; @@ -469,19 +486,27 @@ void vtkLightBoxRendererManager::SetImageData(vtkImageData* newImageData) it != this->Internal->RenderWindowItemList.end(); ++it) { -#if VTK_MAJOR_VERSION <= 5 +#if (VTK_MAJOR_VERSION <= 5) (*it)->ImageMapper->SetInput(newImageData); #else - (*it)->ImageMapper->SetInputData(newImageData); + (*it)->ImageMapper->SetInputConnection(newImageDataPort); #endif } +#if (VTK_MAJOR_VERSION <= 5) if (newImageData) +#else + if (newImageDataPort) +#endif { this->Internal->updateRenderWindowItemsZIndex(this->Internal->RenderWindowLayoutType); } +#if (VTK_MAJOR_VERSION <= 5) this->Internal->ImageData = newImageData; +#else + this->Internal->ImageDataPort = newImageDataPort; +#endif this->Modified(); } @@ -581,7 +606,11 @@ void vtkLightBoxRendererManager::SetRenderWindowLayoutType(int layoutType) return; } +#if (VTK_MAJOR_VERSION <= 5) if (this->Internal->ImageData) +#else + if (this->Internal->ImageDataPort) +#endif { this->Internal->updateRenderWindowItemsZIndex(layoutType); } @@ -635,7 +664,7 @@ void vtkLightBoxRendererManager::SetRenderWindowLayout(int rowCount, int columnC #if VTK_MAJOR_VERSION <= 5 item->ImageMapper->SetInput(this->Internal->ImageData); #else - item->ImageMapper->SetInputData(this->Internal->ImageData); + item->ImageMapper->SetInputConnection(this->Internal->ImageDataPort); #endif this->Internal->RenderWindowItemList.push_back(item); --extraItem; @@ -659,7 +688,11 @@ void vtkLightBoxRendererManager::SetRenderWindowLayout(int rowCount, int columnC this->Internal->setupRendering(); this->Internal->SetupCornerAnnotation(); +#if (VTK_MAJOR_VERSION <= 5) if (this->Internal->ImageData) +#else + if (this->Internal->ImageDataPort) +#endif { this->Internal->updateRenderWindowItemsZIndex(this->Internal->RenderWindowLayoutType); } diff --git a/Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.h b/Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.h index d772c9b829..bc7969517e 100644 --- a/Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.h +++ b/Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.h @@ -22,6 +22,7 @@ #define __vtkLightBoxRendererManager_h #include +#include #include "ctkVisualizationVTKCoreExport.h" @@ -30,11 +31,12 @@ class vtkRenderer; class vtkImageData; class vtkCamera; class vtkCornerAnnotation; +class vtkAlgorithmOutput; /// \ingroup Visualization_VTK_Core class CTK_VISUALIZATION_VTK_CORE_EXPORT vtkLightBoxRendererManager : public vtkObject { - vtkTypeRevisionMacro(vtkLightBoxRendererManager,vtkObject); + vtkTypeMacro(vtkLightBoxRendererManager,vtkObject); void PrintSelf(ostream& os, vtkIndent indent); static vtkLightBoxRendererManager *New(); @@ -51,7 +53,11 @@ class CTK_VISUALIZATION_VTK_CORE_EXPORT vtkLightBoxRendererManager : public vtkO vtkRenderWindow* GetRenderWindow(); /// Set image data +#if (VTK_MAJOR_VERSION <= 5) void SetImageData(vtkImageData* newImageData); +#else + void SetImageDataPort(vtkAlgorithmOutput* newImageDataPort); +#endif /// Get active camera /// Note that the same camera is used with all the renderWindowItem diff --git a/Libs/Visualization/VTK/Widgets/CMakeLists.txt b/Libs/Visualization/VTK/Widgets/CMakeLists.txt index 38e560208d..617f56ac46 100644 --- a/Libs/Visualization/VTK/Widgets/CMakeLists.txt +++ b/Libs/Visualization/VTK/Widgets/CMakeLists.txt @@ -94,9 +94,34 @@ set(KIT_resources ) # Set VTK_LIBRARIES variable -set(VTK_LIBRARIES - QVTK - ) +if(${VTK_VERSION_MAJOR} GREATER 5) + set(VTK_LIBRARIES + vtkChartsCore + vtkCommonCore + vtkCommonDataModel + vtkCommonMath + vtkCommonSystem + vtkFiltersSources + vtkIOImage + vtkImagingGeneral + vtkImagingStatistics + vtkInteractionStyle + vtkInteractionWidgets + vtkRenderingAnnotation + vtkRenderingContext2D + vtkRenderingCore + vtkRenderingFreeTypeFontConfig + vtkRenderingFreeTypeOpenGL + vtkRenderingOpenGL + vtkViewsContext2D + vtkWrappingPythonCore + vtkGUISupportQt + ) +else() + set(VTK_LIBRARIES + QVTK + ) +endif() if(CTK_LIB_Visualization/VTK/Widgets_USE_TRANSFER_FUNCTION_CHARTS) set(CTK_USE_CHARTS 1) @@ -123,9 +148,15 @@ IF (${CTK_USE_CHARTS}) Resources/UI/ctkVTKVolumePropertyWidget.ui Resources/UI/ctkVTKScalarsToColorsWidget.ui ${KIT_UI_FORMS}) - set(VTK_LIBRARIES + if(${VTK_VERSION_MAJOR} GREATER 5) + set(VTK_LIBRARIES + vtkChartsCore + ${VTK_LIBRARIES}) + else() + set(VTK_LIBRARIES vtkCharts ${VTK_LIBRARIES}) + endif() add_definitions(-DCTK_USE_CHARTS) endif() diff --git a/Libs/Visualization/VTK/Widgets/Testing/Cpp/CMakeLists.txt b/Libs/Visualization/VTK/Widgets/Testing/Cpp/CMakeLists.txt index 029f870e80..34ce410052 100644 --- a/Libs/Visualization/VTK/Widgets/Testing/Cpp/CMakeLists.txt +++ b/Libs/Visualization/VTK/Widgets/Testing/Cpp/CMakeLists.txt @@ -109,7 +109,13 @@ set(Tests_RESOURCES_SRCS) QT4_ADD_RESOURCES(Tests_RESOURCES_SRCS ${Tests_RESOURCES}) add_executable(${KIT}CppTests ${Tests} ${TEST_MOC_CPP} ${TEST_UI_CPP} ${Tests_RESOURCES_SRCS}) -target_link_libraries(${KIT}CppTests ${LIBRARY_NAME} vtkCharts ${CTK_BASE_LIBRARIES}) +if(${VTK_VERSION_MAJOR} GREATER 5) + set(VTK_CHARTS_LIB vtkChartsCore) +else() + set(VTK_CHARTS_LIB vtkCharts) +endif() + +target_link_libraries(${KIT}CppTests ${LIBRARY_NAME} ${VTK_CHARTS_LIB} ${CTK_BASE_LIBRARIES}) # # Add Tests diff --git a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKChartViewTest1.cpp b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKChartViewTest1.cpp index bb1820600e..f1bf095774 100644 --- a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKChartViewTest1.cpp +++ b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKChartViewTest1.cpp @@ -31,6 +31,7 @@ #include #include #include +#include // STD includes #include @@ -78,19 +79,31 @@ int ctkVTKChartViewTest1(int argc, char * argv [] ) // Add multiple line plots, setting the colors etc vtkPlotBar* bar = vtkPlotBar::New(); +#if (VTK_MAJOR_VERSION <= 5) bar->SetInput(table.GetPointer(), 0, 1); +#else + bar->SetInputData(table.GetPointer(), 0, 1); +#endif bar->SetColor(0, 255, 0, 255); view.addPlot(bar); bar->Delete(); bar = vtkPlotBar::New(); +#if (VTK_MAJOR_VERSION <= 5) bar->SetInput(table.GetPointer(), 0, 2); +#else + bar->SetInputData(table.GetPointer(), 0, 2); +#endif bar->SetColor(255, 0, 0, 255); view.addPlot(bar); bar->Delete(); bar = vtkPlotBar::New(); +#if (VTK_MAJOR_VERSION <= 5) bar->SetInput(table.GetPointer(), 0, 3); +#else + bar->SetInputData(table.GetPointer(), 0, 3); +#endif bar->SetColor(0, 0, 255, 255); view.addPlot(bar); bar->Delete(); diff --git a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKMagnifyViewTest2.cpp b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKMagnifyViewTest2.cpp index 800072039a..c896af5006 100644 --- a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKMagnifyViewTest2.cpp +++ b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKMagnifyViewTest2.cpp @@ -38,6 +38,7 @@ #include #include #include +#include // STD includes #include @@ -243,14 +244,22 @@ int ctkVTKMagnifyViewTest2(int argc, char * argv [] ) // Read image imageReader->SetFileName(imageFilename.toLatin1()); imageReader->Update(); +#if (VTK_MAJOR_VERSION <= 5) vtkSmartPointer image = imageReader->GetOutput(); +#else + vtkSmartPointer imagePort = imageReader->GetOutputPort(); +#endif // Setup the slice views for (int i = 0; i < numSliceViews; i++) { allSliceViews[i]->setRenderEnabled(true); allSliceViews[i]->setMinimumSize(350,350); +#if (VTK_MAJOR_VERSION <= 5) allSliceViews[i]->setImageData(image); +#else + allSliceViews[i]->setImageDataPort(imagePort); +#endif allSliceViews[i]->setHighlightedBoxColor(Qt::yellow); allSliceViews[i]->scheduleRender(); } @@ -373,10 +382,18 @@ int ctkVTKMagnifyViewTest2(int argc, char * argv [] ) } vtkImageGaussianSmooth * gaussian = vtkImageGaussianSmooth::New(); +#if (VTK_MAJOR_VERSION <= 5) gaussian->SetInput(image); +#else + gaussian->SetInputConnection(imagePort); +#endif gaussian->SetRadiusFactors(5,5); gaussian->Update(); +#if (VTK_MAJOR_VERSION <= 5) allSliceViews[0]->setImageData(gaussian->GetOutput()); +#else + allSliceViews[0]->setImageDataPort(gaussian->GetOutputPort()); +#endif allSliceViews[0]->scheduleRender(); if (!runBaselineTest(time, app, magnify, allSliceViews[0], true, baselineDirectory, testType, "h", @@ -396,10 +413,18 @@ int ctkVTKMagnifyViewTest2(int argc, char * argv [] ) return EXIT_FAILURE; } +#if (VTK_MAJOR_VERSION <= 5) gaussian->SetInput(image); +#else + gaussian->SetInputConnection(imageReader->GetOutputPort()); +#endif gaussian->SetRadiusFactors(0,0); gaussian->Update(); +#if (VTK_MAJOR_VERSION <= 5) allSliceViews[0]->setImageData(gaussian->GetOutput()); +#else + allSliceViews[0]->setImageDataPort(gaussian->GetOutputPort()); +#endif allSliceViews[0]->scheduleRender(); if (!runBaselineTest(time, app, magnify, allSliceViews[0], true, baselineDirectory, testType, "h", @@ -411,7 +436,11 @@ int ctkVTKMagnifyViewTest2(int argc, char * argv [] ) // Test changing the update interval magnify->setUpdateInterval(time * 2); magnify->setObserveRenderWindowEvents(true); +#if (VTK_MAJOR_VERSION <= 5) allSliceViews[0]->setImageData(image); +#else + allSliceViews[0]->setImageDataPort(imagePort); +#endif allSliceViews[0]->scheduleRender(); QCursor::setPos(insideSlice0bottomRightCorner); // It should be waiting to update here diff --git a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKScalarsToColorsViewTest2.cpp b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKScalarsToColorsViewTest2.cpp index dd5f7694a8..3b6da362f8 100644 --- a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKScalarsToColorsViewTest2.cpp +++ b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKScalarsToColorsViewTest2.cpp @@ -37,6 +37,7 @@ #include #include #include +#include // STD includes #include @@ -59,11 +60,15 @@ int ctkVTKScalarsToColorsViewTest2(int argc, char * argv [] ) vtkSmartPointer image = vtkSmartPointer::New(); image->SetDimensions(256, 256, 1); - image->SetScalarTypeToUnsignedChar(); - image->SetNumberOfScalarComponents(1); // image holds one value intensities image->SetSpacing(20000., 30., 900000000.); image->SetOrigin(-251234568., 0.00001, 40.2); +#if (VTK_MAJOR_VERSION <= 5) + image->SetScalarTypeToUnsignedChar(); + image->SetNumberOfScalarComponents(1); // image holds one value intensities image->AllocateScalars(); // allocate storage for image data +#else + image->AllocateScalars(VTK_UNSIGNED_CHAR, 1); +#endif unsigned char * ptr = static_cast(image->GetScalarPointer()); for (int i=0; i<256*256*1; ++i) { @@ -73,7 +78,11 @@ int ctkVTKScalarsToColorsViewTest2(int argc, char * argv [] ) // Histogram vtkSmartPointer histogram = vtkSmartPointer::New(); +#if (VTK_MAJOR_VERSION <= 5) histogram->SetInput(image); +#else + histogram->SetInputData(image); +#endif histogram->SetComponentExtent(0, 255, 0 , 0 , 0, 0); histogram->Update(); vtkAbstractArray* bins = @@ -98,7 +107,11 @@ int ctkVTKScalarsToColorsViewTest2(int argc, char * argv [] ) //Histogram Plot vtkSmartPointer histogramPlot = vtkSmartPointer::New(); +#if (VTK_MAJOR_VERSION <= 5) histogramPlot->SetInput(table, 0, 1); +#else + histogramPlot->SetInputData(table, 0, 1); +#endif histogramPlot->SetColor(0.078, 0.008, 0);//not exactly black...just because. histogramPlot->GetPen()->SetLineType(vtkPen::NO_PEN); diff --git a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKScalarsToColorsViewTest4.cpp b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKScalarsToColorsViewTest4.cpp index 38985c728c..02460041de 100644 --- a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKScalarsToColorsViewTest4.cpp +++ b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKScalarsToColorsViewTest4.cpp @@ -29,6 +29,7 @@ #include "vtkContextScene.h" #include #include "vtkRenderWindowInteractor.h" +#include //----------------------------------------------------------------------------- int ctkVTKScalarsToColorsViewTest4(int argc, char * argv [] ) @@ -68,15 +69,27 @@ int ctkVTKScalarsToColorsViewTest4(int argc, char * argv [] ) // Add multiple line plots, setting the colors etc vtkPlot *line = chart->AddPlot(vtkChart::LINE); +#if (VTK_MAJOR_VERSION <= 5) line->SetInput(table, 0, 1); +#else + line->SetInputData(table, 0, 1); +#endif line->SetColor(0, 255, 0, 255); line->SetWidth(1.0); line = chart->AddPlot(vtkChart::LINE); +#if (VTK_MAJOR_VERSION <= 5) line->SetInput(table, 0, 2); +#else + line->SetInputData(table, 0, 2); +#endif line->SetColor(255, 0, 0, 255); line->SetWidth(5.0); line = chart->AddPlot(vtkChart::LINE); +#if (VTK_MAJOR_VERSION <= 5) line->SetInput(table, 0, 3); +#else + line->SetInputData(table, 0, 3); +#endif line->SetColor(0, 0, 255, 255); line->SetWidth(4.0); diff --git a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKThumbnailViewTest1.cpp b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKThumbnailViewTest1.cpp index c44af20cbd..1f9da2c8e6 100644 --- a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKThumbnailViewTest1.cpp +++ b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKThumbnailViewTest1.cpp @@ -34,6 +34,7 @@ #include #include #include +#include // STD includes #include @@ -51,7 +52,11 @@ int ctkVTKThumbnailViewTest1(int argc, char * argv [] ) vtkPolyDataMapper *mapper = vtkPolyDataMapper::New(); vtkCubeSource *cube= vtkCubeSource::New(); +#if (VTK_MAJOR_VERSION <= 5) mapper->SetInput(cube->GetOutput()); +#else + mapper->SetInputConnection(cube->GetOutputPort()); +#endif cube->Delete(); vtkActor *actor = vtkActor::New(); actor->SetMapper(mapper); diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp index e2dacdab50..603efd9c1c 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp @@ -124,11 +124,19 @@ void ctkVTKSliceView::resetCamera() } //---------------------------------------------------------------------------- +#if (VTK_MAJOR_VERSION <= 5) void ctkVTKSliceView::setImageData(vtkImageData* newImageData) { Q_D(ctkVTKSliceView); d->LightBoxRendererManager->SetImageData(newImageData); } +#else +void ctkVTKSliceView::setImageDataPort(vtkAlgorithmOutput* newImageDataPort) +{ + Q_D(ctkVTKSliceView); + d->LightBoxRendererManager->SetImageDataPort(newImageDataPort); +} +#endif //---------------------------------------------------------------------------- vtkCornerAnnotation * ctkVTKSliceView::overlayCornerAnnotation()const diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h index 8760587770..10f66b346c 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h @@ -23,12 +23,14 @@ // CTK includes #include "ctkVTKAbstractView.h" +#include "vtkVersion.h" class vtkLightBoxRendererManager; class ctkVTKSliceViewPrivate; class vtkCamera; class vtkImageData; class vtkRenderer; +class vtkAlgorithmOutput; /// \ingroup Visualization_VTK_Widgets /// Specific implementation for a 2D view that supports lightbox display. @@ -99,7 +101,11 @@ public Q_SLOTS: /// Set image data /// \sa vtkLightBoxRendererManager::SetImageData +#if (VTK_MAJOR_VERSION <= 5) void setImageData(vtkImageData* newImageData); +#else + void setImageDataPort(vtkAlgorithmOutput* newImageDataPort); +#endif /// Set highlightedBox color /// \sa vtkLightBoxRendererManager::SetHighlightedBoxColor diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKThumbnailView.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKThumbnailView.cpp index ae83f655d3..ef536e62b2 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKThumbnailView.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKThumbnailView.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include //-------------------------------------------------------------------------- @@ -99,7 +100,11 @@ void ctkVTKThumbnailViewPrivate::init() this->FOVBox = vtkOutlineSource::New(); this->FOVBoxMapper = vtkPolyDataMapper::New(); +#if VTK_MAJOR_VERSION <= 5 this->FOVBoxMapper->SetInput( this->FOVBox->GetOutput() ); +#else + this->FOVBoxMapper->SetInputConnection( this->FOVBox->GetOutputPort() ); +#endif this->FOVBoxActor = vtkFollower::New(); this->FOVBoxMapper->Update(); @@ -215,7 +220,11 @@ void ctkVTKThumbnailViewPrivate::updateBounds() // ---new: create new actor, mapper, deep copy, add it. newMapper = vtkPolyDataMapper::New(); newMapper->ShallowCopy (mainActor->GetMapper() ); +#if VTK_MAJOR_VERSION <= 5 newMapper->SetInput ( vtkPolyData::SafeDownCast(mainActor->GetMapper()->GetInput()) ); +#else + newMapper->SetInputData ( vtkPolyData::SafeDownCast(mainActor->GetMapper()->GetInput()) ); +#endif newActor = vtkActor::New(); newActor->ShallowCopy (mainActor ); diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKWidgetsUtils.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKWidgetsUtils.cpp index bb4a071a8f..c91002651e 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKWidgetsUtils.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKWidgetsUtils.cpp @@ -30,6 +30,7 @@ // VTK includes #include #include +#include //---------------------------------------------------------------------------- QImage ctk::grabVTKWidget(QWidget* widget, QRect rectangle) @@ -72,7 +73,9 @@ QImage ctk::vtkImageDataToQImage(vtkImageData* imageData) { return QImage(); } +#if VTK_MAJOR_VERSION <= 5 imageData->Update(); +#endif /// \todo retrieve just the UpdateExtent int width = imageData->GetDimensions()[0]; int height = imageData->GetDimensions()[1];