Commit e8a2e18e authored by jcfr's avatar jcfr

STYLE: Remove VTKv5 support

As discussed during the developer hangout of 2015-03-31, this commit
removes support for VTKv5.

Most of the h/cxx files have been updated automatically using the
script "slicer_remove_vtk5_support.py" [1]. See below.

The remaining of h/cxx, python and CMake files have been updated
manually.


slicer_remove_vtk5_support.py:
cd ~/Project/Slicer
~/Download/slicer_remove_vtk5_support.py $(ack -l VTK_MAJOR_VERSION)

[1] https://gist.github.com/jcfr/91d2f5d07c2a36320e48

git-svn-id: http://svn.slicer.org/Slicer4/trunk@24801 3bd1e089-480b-0410-8dfb-8563597acbee
parent 4e30c408
......@@ -405,10 +405,7 @@ class SubjectHierarchyGenericSelfTestTest(ScriptedLoadableModuleTest):
modelNode = slicer.vtkMRMLModelNode()
modelNode.SetName(name)
modelNode = slicer.mrmlScene.AddNode(modelNode)
if vtk.VTK_MAJOR_VERSION <= 5:
modelNode.SetAndObservePolyData(sphere.GetOutput())
else:
modelNode.SetPolyDataConnection(sphere.GetOutputPort())
modelNode.SetPolyDataConnection(sphere.GetOutputPort())
modelNode.SetHideFromEditors(0)
displayNode = slicer.vtkMRMLModelDisplayNode()
......
......@@ -141,20 +141,6 @@ set(srcs ${SlicerBaseLogic_SRCS})
add_library(${lib_name} ${srcs})
if(${VTK_VERSION_MAJOR} GREATER 5)
# Minimum set of libraries already specified using components
else()
set(VTK_LIBRARIES
#vtkCommon # Provided by MRMLLogic
#vtkFiltering # Provided by MRMLLogic
#vtkGraphics # Provided by MRMLLogic
#vtkHybrid # Provided by MRMLLogic
#vtkIO # Provided by MRMLLogic
"" # Since no direct dependency to VTK libraries are required, let's explicitly set
# the variable to an empty string to avoid complaints from vtkMacroKitPythonWraps.cmake.
)
endif()
set(libs
MRMLLogic
${VTK_LIBRARIES}
......@@ -172,15 +158,9 @@ if(Slicer_BUILD_CLI_SUPPORT)
endif()
if(Slicer_USE_PYTHONQT)
if(${VTK_VERSION_MAJOR} GREATER 5)
set(VTK_COMMON_PYTHON_LIBRARY
vtkWrappingPythonCore # For vtkPythonUtil
)
else()
set(VTK_COMMON_PYTHON_LIBRARY
vtkCommonPythonD # For vtkPythonUtils
)
endif()
set(VTK_COMMON_PYTHON_LIBRARY
vtkWrappingPythonCore # For vtkPythonUtil
)
list(APPEND libs
${VTK_COMMON_PYTHON_LIBRARY}
${PYTHON_LIBRARY} # At some point, VTK should be updated to expose VTK_PYTHON_LIBRARY
......
......@@ -410,15 +410,6 @@ void vtkImageRectangularSource_GeneralExecute(vtkImageRectangularSource *self, v
//----------------------------------------------------------------------------
#if (VTK_MAJOR_VERSION <= 5)
void vtkImageRectangularSource::ExecuteData(vtkDataObject *output)
{
int *extent;
void *ptr;
vtkImageData *data = this->AllocateOutputData(output);
extent = this->GetOutput()->GetUpdateExtent();
#else
void vtkImageRectangularSource::ExecuteDataWithInformation(vtkDataObject *output, vtkInformation* outInfo)
{
int *extent;
......@@ -426,7 +417,6 @@ void vtkImageRectangularSource::ExecuteDataWithInformation(vtkDataObject *output
vtkImageData *data = this->AllocateOutputData(output, outInfo);
extent = this->GetUpdateExtent();
#endif
ptr = data->GetScalarPointerForExtent(extent);
if (this->Corners ) {
......
......@@ -94,11 +94,7 @@ protected:
int InsideGraySlopeFlag;
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
#if (VTK_MAJOR_VERSION <= 5)
virtual void ExecuteData(vtkDataObject *outData);
#else
virtual void ExecuteDataWithInformation(vtkDataObject *output, vtkInformation* outInfo);
#endif
private:
vtkImageRectangularSource(const vtkImageRectangularSource&); /// Not implemented.
void operator=(const vtkImageRectangularSource&); /// Not implemented.
......
......@@ -185,11 +185,7 @@ void vtkSlicerGlyphSource2D::TransformGlyph(vtkPoints *pts)
}
else
{
#if ( (VTK_MAJOR_VERSION >= 6) || ( VTK_MAJOR_VERSION == 5 && VTK_MINOR_VERSION >= 4 ) )
double angle = vtkMath::RadiansFromDegrees(this->RotationAngle);
#else
double angle = this->RotationAngle * vtkMath::DegreesToRadians();
#endif
double xt;
for (i=0; i<numPts; i++)
{
......
......@@ -275,11 +275,7 @@ void vtkSlicerTransformLogic::GetTransformedPointSamples(vtkPointSet* outputPoin
// Compute vector magnitude and add to the data set
vtkNew<vtkVectorNorm> norm;
#if VTK_MAJOR_VERSION <= 5
norm->SetInput(outputPointSet);
#else
norm->SetInputData(outputPointSet);
#endif
norm->Update();
vtkDataArray* vectorMagnitude = norm->GetOutput()->GetPointData()->GetScalars();
vectorMagnitude->SetName(GetVisualizationDisplacementMagnitudeScalarName());
......@@ -357,13 +353,7 @@ void vtkSlicerTransformLogic::GetTransformedPointSamplesAsMagnitudeImage(vtkImag
// The orientation of the volume cannot be set in the image
// therefore the volume will not appear in the correct position
// if the direction matrix is not identity.
#if VTK_MAJOR_VERSION <= 5
magnitudeImage->SetScalarTypeToFloat();
magnitudeImage->SetNumberOfScalarComponents(1);
magnitudeImage->AllocateScalars();
#else
magnitudeImage->AllocateScalars(VTK_FLOAT, 1);
#endif
double point_RAS[4] = {0,0,0,1};
double transformedPoint_RAS[4] = {0,0,0,1};
......@@ -513,13 +503,7 @@ void vtkSlicerTransformLogic::GetTransformedPointSamplesAsVectorImage(vtkImageDa
// The orientation of the volume cannot be set in the image
// therefore the volume will not appear in the correct position
// if the direction matrix is not identity.
#if VTK_MAJOR_VERSION <= 5
vectorImage->SetScalarTypeToFloat();
vectorImage->SetNumberOfScalarComponents(3);
vectorImage->AllocateScalars();
#else
vectorImage->AllocateScalars(VTK_FLOAT, 3);
#endif
double point_RAS[4] = {0,0,0,1};
double transformedPoint_RAS[4] = {0,0,0,1};
......@@ -603,11 +587,7 @@ void vtkSlicerTransformLogic::GetGlyphVisualization3d(vtkPolyData* output, vtkMR
glyphFilter->SetScaleFactor(displayNode->GetGlyphScalePercent()*0.01);
glyphFilter->SetColorModeToColorByScalar();
glyphFilter->OrientOn();
#if VTK_MAJOR_VERSION <= 5
glyphFilter->SetInput(pointSet.GetPointer());
#else
glyphFilter->SetInputData(pointSet.GetPointer());
#endif
glyphFilter->SetColorArray(GetVisualizationDisplacementMagnitudeScalarName());
......@@ -726,11 +706,7 @@ void vtkSlicerTransformLogic::GetGlyphVisualization2d(vtkPolyData* output, vtkMR
glyphFilter->SetColorModeToColorByScalar();
glyphFilter->SetSourceTransform(rotateArrow.GetPointer());
glyphFilter->SetSourceConnection(glyph2DSource->GetOutputPort());
#if VTK_MAJOR_VERSION <= 5
glyphFilter->SetInput(pointSet.GetPointer());
#else
glyphFilter->SetInputData(pointSet.GetPointer());
#endif
glyphFilter->SetColorArray(GetVisualizationDisplacementMagnitudeScalarName());
......@@ -810,11 +786,7 @@ void vtkSlicerTransformLogic::CreateGrid(vtkPolyData* gridPolyData, vtkMRMLTrans
if (warpedGrid)
{
vtkNew<vtkWarpVector> warp;
#if VTK_MAJOR_VERSION <= 5
warp->SetInput(gridPolyData);
#else
warp->SetInputData(gridPolyData);
#endif
warp->SetScaleFactor(displayNode->GetGridScalePercent()*0.01);
warp->Update();
vtkPolyData* polyoutput = warp->GetPolyDataOutput();
......@@ -860,13 +832,8 @@ void vtkSlicerTransformLogic::GetGridVisualization2d(vtkPolyData* output, vtkMRM
// Create the output by combining the warped and non-warped grid
vtkNew<vtkAppendPolyData> appender;
#if VTK_MAJOR_VERSION <= 5
appender->AddInput(gridPolyData.GetPointer());
appender->AddInput(warpedGridPolyData.GetPointer());
#else
appender->AddInputData(gridPolyData.GetPointer());
appender->AddInputData(warpedGridPolyData.GetPointer());
#endif
appender->Update();
output->ShallowCopy(appender->GetOutput());
output->GetPointData()->SetActiveAttribute(GetVisualizationDisplacementMagnitudeScalarName(), vtkDataSetAttributes::SCALARS);
......@@ -892,11 +859,7 @@ void vtkSlicerTransformLogic::GetGridVisualization3d(vtkPolyData* output, vtkMRM
CreateGrid(gridPolyData.GetPointer(), displayNode, numGridPoints, warpedGridPolyData.GetPointer());
vtkNew<vtkTubeFilter> tubeFilter;
#if VTK_MAJOR_VERSION <= 5
tubeFilter->SetInput(warpedGridPolyData.GetPointer());
#else
tubeFilter->SetInputData(warpedGridPolyData.GetPointer());
#endif
tubeFilter->SetRadius(displayNode->GetGridLineDiameterMm()*0.5);
tubeFilter->SetNumberOfSides(8);
tubeFilter->Update();
......@@ -939,11 +902,7 @@ void vtkSlicerTransformLogic::GetContourVisualization2d(vtkPolyData* output, vtk
{
contourFilter->SetValue(i, levels[i]);
}
#if VTK_MAJOR_VERSION <= 5
contourFilter->SetInput(magnitudeImage.GetPointer());
#else
contourFilter->SetInputData(magnitudeImage.GetPointer());
#endif
contourFilter->Update();
vtkNew<vtkTransformPolyDataFilter> transformSliceToRas;
......@@ -1007,11 +966,7 @@ void vtkSlicerTransformLogic::GetContourVisualization3d(vtkPolyData* output, vtk
{
contourFilter->SetValue(i, levels[i]);
}
#if VTK_MAJOR_VERSION <= 5
contourFilter->SetInput(magnitudeImage.GetPointer());
#else
contourFilter->SetInputData(magnitudeImage.GetPointer());
#endif
contourFilter->Update();
// Transform contours to RAS
......
......@@ -213,15 +213,9 @@ endif()
# Python wrap
if(Slicer_USE_PYTHONQT)
if(${VTK_VERSION_MAJOR} GREATER 5)
set(VTK_COMMON_PYTHON_LIBRARY
vtkWrappingPythonCore # For vtkPythonUtil
)
else()
set(VTK_COMMON_PYTHON_LIBRARY
vtkCommonPythonD # For vtkPythonUtils
)
endif()
set(VTK_COMMON_PYTHON_LIBRARY
vtkWrappingPythonCore # For vtkPythonUtil
)
list(APPEND KIT_target_libraries
CTKScriptingPythonCore
${VTK_COMMON_PYTHON_LIBRARY} # For vtkPythonUtils
......
......@@ -101,15 +101,11 @@ QStringList qSlicerCorePythonManager::pythonPaths()
if (!app->isInstalled())
{
// Add here python path specific to the BUILD tree
#if (VTK_MAJOR_VERSION <= 5)
QString vtkLibSubDir("bin");
#else
#if defined(Q_WS_WIN)
QString vtkLibSubDir("bin");
#else
QString vtkLibSubDir("lib");
#endif
#endif
#ifdef CMAKE_INTDIR
paths << VTK_DIR "/" + vtkLibSubDir + "/" CMAKE_INTDIR "/";
#else
......
......@@ -102,20 +102,12 @@ vtkMRMLSliceLogic *setupSliceDisplay(vtkMRMLScene *scene, vtkRenderWindow *rw, c
// get the output slice and put it into the render window
//
// vtkImageData *slice = 0;
#if (VTK_MAJOR_VERSION <= 5)
vtkImageData *slice = sliceLogic->GetImageData();
#else
vtkAlgorithmOutput *slicePort = sliceLogic->GetImageDataConnection();
#endif
vtkImageMapper *mapper = vtkImageMapper::New();
mapper->SetColorWindow( 255. );
mapper->SetColorLevel ( 127.5 );
#if (VTK_MAJOR_VERSION <= 5)
mapper->SetInput( slice );
#else
mapper->SetInputConnection( slicePort );
#endif
vtkActor2D *actor = vtkActor2D::New();
actor->SetMapper( mapper );
actor->GetProperty()->SetDisplayLocationToBackground();
......
# Install VTK python module
if(${VTK_VERSION_MAJOR} GREATER 5)
set(VTK_PYTHON_MODULE "${VTK_DIR}/Wrapping/Python")
else()
list(GET VTK_PYTHONPATH_DIRS 0 VTK_PYTHON_MODULE)
endif()
set(VTK_PYTHON_MODULE "${VTK_DIR}/Wrapping/Python")
install(DIRECTORY ${VTK_PYTHON_MODULE}/vtk
DESTINATION ${Slicer_INSTALL_BIN_DIR}/Python
USE_SOURCE_PERMISSIONS
COMPONENT Runtime)
# Install external python runtime libraries that we don't link to (fixupbundle won't copy them)
if(${VTK_VERSION_MAJOR} GREATER 5)
if(UNIX)
set(vtk_python_library_subdir "lib")
else()
set(vtk_python_library_subdir "bin")
endif()
if(UNIX)
set(vtk_python_library_subdir "lib")
else()
set(vtk_python_library_subdir "bin")
endif()
......
......@@ -109,9 +109,7 @@ else()
if(Slicer_BUILD_CLI_SUPPORT)
find_package(SlicerExecutionModel REQUIRED)
endif()
if(${VTK_VERSION_MAJOR} GREATER 5)
set(VTK_LIBRARY_DIRS "${VTK_DIR}/lib")
endif()
set(VTK_LIBRARY_DIRS "${VTK_DIR}/lib")
set(fixup_path @rpath)
set(slicer_cpack_bundle_fixup_directory ${Slicer_BINARY_DIR}/CMake/SlicerCPackBundleFixup)
......
......@@ -77,11 +77,7 @@ macro(vtkMacroKitPythonWrap)
list(APPEND VTK_KIT_PYTHON_LIBRARIES ${c}PythonD)
endif()
endforeach()
if(${VTK_VERSION_MAJOR} GREATER 5)
set(VTK_PYTHON_CORE vtkWrappingPythonCore)
else()
set(VTK_PYTHON_CORE vtkPythonCore)
endif()
set(VTK_PYTHON_CORE vtkWrappingPythonCore)
target_link_libraries(
${MY_KIT_NAME}PythonD
${MY_KIT_NAME}
......
......@@ -286,24 +286,6 @@ mark_as_superbuild(Slicer_USE_SimpleITK)
option(Slicer_USE_ITKPython "Build Python wrapping for ITK" OFF)
mark_as_superbuild(Slicer_USE_ITKPython)
set(default_vtk_version_major 6)
set(VTK_VERSION_MAJOR ${default_vtk_version_major} CACHE STRING "Choose the expected VTK major version to build Slicer (5 or 6).")
# Set the possible values of VTK major version for cmake-gui
set_property(CACHE VTK_VERSION_MAJOR PROPERTY STRINGS "5" "6")
if(NOT "${VTK_VERSION_MAJOR}" STREQUAL "5" AND NOT "${VTK_VERSION_MAJOR}" STREQUAL "6")
set(VTK_VERSION_MAJOR 5 CACHE STRING "Choose the expected VTK major version to build Slicer (5 or 6)." FORCE)
message(WARNING "Setting VTK_VERSION_MAJOR to '5' as an valid value was specified.")
endif()
mark_as_superbuild(VTK_VERSION_MAJOR)
set(USE_VTKv5 ON)
set(USE_VTKv6 OFF)
if(${VTK_VERSION_MAJOR} STREQUAL "6")
set(USE_VTKv5 OFF)
set(USE_VTKv6 ON)
endif()
#
# SimpleITK has large internal libraries, which take an extremely long
# time to link on windows when they are static. Creating shared
......@@ -553,55 +535,53 @@ endif()
#-----------------------------------------------------------------------------
# VTKv6 - Slicer_VTK_COMPONENTS
#-----------------------------------------------------------------------------
if(${VTK_VERSION_MAJOR} GREATER 5)
set(Slicer_VTK_RENDERING_BACKEND "OpenGL" CACHE STRING "Choose the rendering backend.")
set_property(CACHE Slicer_VTK_RENDERING_BACKEND PROPERTY STRINGS "OpenGL" "OpenGL2")
mark_as_superbuild(Slicer_VTK_RENDERING_BACKEND)
set(Slicer_VTK_RENDERING_USE_${Slicer_VTK_RENDERING_BACKEND}_BACKEND 1)
set(Slicer_VTK_COMPONENTS
vtkFiltersExtraction
vtkFiltersFlowPaths
vtkFiltersGeometry
vtkGUISupportQtOpenGL
vtkGUISupportQtWebkit
vtkGUISupportQtSQL
vtkIOImage
vtkIOLegacy
vtkIOPLY
vtkIOXML
vtkImagingMath
vtkImagingMorphological
vtkImagingStatistics
vtkImagingStencil
vtkInteractionImage
vtkRenderingContext${Slicer_VTK_RENDERING_BACKEND}
vtkRenderingQt
vtkRenderingVolume${Slicer_VTK_RENDERING_BACKEND}
vtkTestingRendering
vtkViewsQt
vtkzlib
set(Slicer_VTK_RENDERING_BACKEND "OpenGL" CACHE STRING "Choose the rendering backend.")
set_property(CACHE Slicer_VTK_RENDERING_BACKEND PROPERTY STRINGS "OpenGL" "OpenGL2")
mark_as_superbuild(Slicer_VTK_RENDERING_BACKEND)
set(Slicer_VTK_RENDERING_USE_${Slicer_VTK_RENDERING_BACKEND}_BACKEND 1)
set(Slicer_VTK_COMPONENTS
vtkFiltersExtraction
vtkFiltersFlowPaths
vtkFiltersGeometry
vtkGUISupportQtOpenGL
vtkGUISupportQtWebkit
vtkGUISupportQtSQL
vtkIOImage
vtkIOLegacy
vtkIOPLY
vtkIOXML
vtkImagingMath
vtkImagingMorphological
vtkImagingStatistics
vtkImagingStencil
vtkInteractionImage
vtkRenderingContext${Slicer_VTK_RENDERING_BACKEND}
vtkRenderingQt
vtkRenderingVolume${Slicer_VTK_RENDERING_BACKEND}
vtkTestingRendering
vtkViewsQt
vtkzlib
)
if(Slicer_USE_PYTHONQT)
list(APPEND Slicer_VTK_COMPONENTS
vtkWrappingPythonCore
)
if(Slicer_USE_PYTHONQT)
endif()
if(UNIX AND NOT APPLE)
find_package(FontConfig QUIET)
if(FONTCONFIG_FOUND)
list(APPEND Slicer_VTK_COMPONENTS
vtkWrappingPythonCore
vtkRenderingFreeTypeFontConfig
# vtkRenderingFreeTypeOpenGL # Since commit 4f7460a5 (> 6.2.0), vtkRenderingFreeTypeOpenGL
# has been removed. This mean Slicer will not compile
# against version of VTK folder than 6.3.0 having FontConfig
# capabilities.
# If this is needed, a configure test would have to
# be added to check if the module is available or not.
)
endif()
if(UNIX AND NOT APPLE)
find_package(FontConfig QUIET)
if(FONTCONFIG_FOUND)
list(APPEND Slicer_VTK_COMPONENTS
vtkRenderingFreeTypeFontConfig
# vtkRenderingFreeTypeOpenGL # Since commit 4f7460a5 (> 6.2.0), vtkRenderingFreeTypeOpenGL
# has been removed. This mean Slicer will not compile
# against version of VTK folder than 6.3.0 having FontConfig
# capabilities.
# If this is needed, a configure test would have to
# be added to check if the module is available or not.
)
if(TARGET vtkRenderingFreeTypeOpenGL)
list(APPEND VTK_LIBRARIES vtkRenderingFreeTypeOpenGL)
endif()
if(TARGET vtkRenderingFreeTypeOpenGL)
list(APPEND VTK_LIBRARIES vtkRenderingFreeTypeOpenGL)
endif()
endif()
endif()
......@@ -789,22 +769,12 @@ endif()
#-----------------------------------------------------------------------------
# VTK
#-----------------------------------------------------------------------------
if(${VTK_VERSION_MAJOR} STREQUAL "6")
find_package(VTK 6.1 COMPONENTS ${Slicer_VTK_COMPONENTS} REQUIRED NO_MODULE)
if(NOT TARGET vtkGUISupportQt)
message(FATAL_ERROR "error: VTK was not configured to use QT, you probably need "
"to recompile it with VTK_USE_GUISUPPORT ON, VTK_Group_Qt ON, "
"DESIRED_QT_VERSION 4 and QT_QMAKE_EXECUTABLE set appropriatly. "
"Note that Qt >= ${Slicer_REQUIRED_QT_VERSION} is *required*")
endif()
else()
find_package(VTK REQUIRED)
if(NOT VTK_USE_QVTK)
message(FATAL_ERROR "error: VTK was not configured to use QT, you probably need "
"to recompile it with VTK_USE_GUISUPPORT ON, VTK_USE_QVTK ON, "
"DESIRED_QT_VERSION 4 and QT_QMAKE_EXECUTABLE set appropriatly. "
"Note that Qt >= ${Slicer_REQUIRED_QT_VERSION} is *required*")
endif()
find_package(VTK 6.1 COMPONENTS ${Slicer_VTK_COMPONENTS} REQUIRED NO_MODULE)
if(NOT TARGET vtkGUISupportQt)
message(FATAL_ERROR "error: VTK was not configured to use QT, you probably need "
"to recompile it with VTK_USE_GUISUPPORT ON, VTK_Group_Qt ON, "
"DESIRED_QT_VERSION 4 and QT_QMAKE_EXECUTABLE set appropriatly. "
"Note that Qt >= ${Slicer_REQUIRED_QT_VERSION} is *required*")
endif()
include(${VTK_USE_FILE})
if(NOT DEFINED VTK_RENDERING_BACKEND)
......
......@@ -85,16 +85,6 @@ set(srcs ${FreeSurfer_SRCS})
add_library(${lib_name} ${srcs})
if(${VTK_VERSION_MAJOR} GREATER 5)
# Minimum set of libraries already specified using components
else()
set(VTK_LIBRARIES
vtkCommon
vtkFiltering
vtkIO
)
endif()
set(libs
${VTK_LIBRARIES}
${ZLIB_LIBRARIES}
......
......@@ -248,20 +248,6 @@ set(srcs ${MRMLCore_SRCS} ${MRMLCore_SRCS_HEADERS})
set(lib_name ${PROJECT_NAME})
add_library(${lib_name} ${srcs})
if(${VTK_VERSION_MAJOR} GREATER 5)
# Minimum set of libraries already specified using components
else()
set(VTK_LIBRARIES
#vtkCommon # Provided by vtkITK, FreeSurfer
#vtkFiltering # Provided by vtkITK, FreeSurfer
vtkGraphics
vtkHybrid
vtkInfovis
#vtkIO # Provided by FreeSurfer
#vtkImaging # Provided by vtkITK
)
endif()
set(libs
vtkAddon
vtkITK
......
......@@ -33,13 +33,7 @@ int vtkMRMLScalarVolumeNodeTest2(int , char * [] )
{
vtkNew<vtkImageData> imageData;
imageData->SetDimensions(256, 256, 1);
#if (VTK_MAJOR_VERSION <= 5)
imageData->SetScalarTypeToUnsignedShort();
imageData->SetNumberOfScalarComponents(1); // image holds one value intensities
imageData->AllocateScalars(); // allocate storage for image data
#else
imageData->AllocateScalars(VTK_UNSIGNED_SHORT, 1); // allocate storage for image data
#endif
// Fill every entry of the image data with "0"
int* dims = imageData->GetDimensions();
......
......@@ -36,13 +36,7 @@ void CreateBSplineVtk(vtkOrientedBSplineTransform* bsplineTransform,
bsplineCoefficients->SetOrigin(origin);
bsplineCoefficients->SetSpacing(spacing);
#if (VTK_MAJOR_VERSION <= 5)
bsplineCoefficients->SetScalarType(VTK_DOUBLE);
bsplineCoefficients->SetNumberOfScalarComponents(3);
bsplineCoefficients->AllocateScalars();
#else
bsplineCoefficients->AllocateScalars(VTK_DOUBLE, 3);
#endif
// Fill with 0
......@@ -72,11 +66,7 @@ void CreateBSplineVtk(vtkOrientedBSplineTransform* bsplineTransform,
}
bsplineTransform->SetGridDirectionMatrix(gridOrientation.GetPointer());
#if (VTK_MAJOR_VERSION <= 5)
bsplineTransform->SetCoefficients(bsplineCoefficients.GetPointer());
#else
bsplineTransform->SetCoefficientData(bsplineCoefficients.GetPointer());
#endif
bsplineTransform->SetBulkTransformMatrix(bulkTransform.GetPointer());
bsplineTransform->SetBorderModeToZero();
......@@ -86,11 +76,7 @@ void CreateBSplineVtk(vtkOrientedBSplineTransform* bsplineTransform,
//----------------------------------------------------------------------------
void SetBSplineNodeVtk(vtkOrientedBSplineTransform* bsplineTransform,int nodeIndex[3], double nodeValue[3])
{
#if (VTK_MAJOR_VERSION <= 5)
vtkImageData* bsplineCoefficients=bsplineTransform->GetCoefficients();
#else
vtkImageData* bsplineCoefficients=bsplineTransform->GetCoefficientData();
#endif
bsplineCoefficients->SetScalarComponentFromDouble(nodeIndex[0],nodeIndex[1],nodeIndex[2],0, nodeValue[0]);
bsplineCoefficients->SetScalarComponentFromDouble(nodeIndex[0],nodeIndex[1],nodeIndex[2],1, nodeValue[1]);
......
......@@ -37,13 +37,7 @@ void CreateGridTransformVtk(vtkOrientedGridTransform* gridTransform,
gridCoefficients->SetOrigin(origin);
gridCoefficients->SetSpacing(spacing);
#if (VTK_MAJOR_VERSION <= 5)
gridCoefficients->SetScalarType(VTK_DOUBLE);
gridCoefficients->SetNumberOfScalarComponents(3);
gridCoefficients->AllocateScalars();
#else
gridCoefficients->AllocateScalars(VTK_DOUBLE, 3);
#endif
// Fill with 0
for (int z = 0; z < dims[2]; z++)
......@@ -69,11 +63,7 @@ void CreateGridTransformVtk(vtkOrientedGridTransform* gridTransform,
}
gridTransform->SetGridDirectionMatrix(gridOrientation.GetPointer());
#if (VTK_MAJOR_VERSION <= 5)
gridTransform->SetDisplacementGrid(gridCoefficients.GetPointer());
#else
gridTransform->SetDisplacementGridData(gridCoefficients.GetPointer());
#endif
gridTransform->SetInterpolationModeToCubic();
}
......
<