Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMP: Support VTK_RENDERING_BACKEND set to None #16

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ set(_target_freetypeopengl)
if(TARGET vtkRenderingFreeType${VTK_RENDERING_BACKEND})
set(_target_freetypeopengl vtkRenderingFreeType${VTK_RENDERING_BACKEND})
endif()
set(_rendering_modules )
if(NOT VTK_RENDERING_BACKEND STREQUAL "None")
set(_rendering_modules
vtkRendering${VTK_RENDERING_BACKEND}
vtkInteractionStyle
vtkInteractionWidgets
)
endif()

if (${VTK_VERSION} VERSION_LESS ${VERSION_MIN})
message(ERROR " VtkGlue requires VTK version ${VERSION_MIN} or newer but the current version is ${VTK_VERSION}")
Expand All @@ -47,11 +55,9 @@ else()
set(_wrap_module vtkWrappingPythonCore)
endif()
vtk_module_config(ITKVtkGlue_VTK
vtkRendering${VTK_RENDERING_BACKEND}
vtkRenderingFreeType
${_target_freetypeopengl}
vtkInteractionStyle
vtkInteractionWidgets
${_rendering_modules}
vtkIOImage
vtkIOLegacy
vtkImagingSources
Expand Down Expand Up @@ -103,6 +109,13 @@ set(_target_freetypeopengl)
if(TARGET vtkRenderingFreeType${VTK_RENDERING_BACKEND})
set(_target_freetypeopengl vtkRenderingFreeType${VTK_RENDERING_BACKEND})
endif()
if(NOT VTK_RENDERING_BACKEND STREQUAL \"None\")
set(_rendering_modules
vtkRendering${VTK_RENDERING_BACKEND}
vtkInteractionStyle
vtkInteractionWidgets
)
endif()

if( ${VTK_VERSION} VERSION_LESS 6.0.0 )
set(ITKVtkGlue_VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS})
Expand All @@ -113,11 +126,9 @@ else()
set(_wrap_module vtkWrappingPythonCore)
endif()
vtk_module_config(ITKVtkGlue_VTK
vtkRendering${VTK_RENDERING_BACKEND}
vtkRenderingFreeType
${_target_freetypeopengl}
vtkInteractionStyle
vtkInteractionWidgets
${_rendering_modules}
vtkIOImage
vtkIOLegacy
vtkImagingSources
Expand Down Expand Up @@ -146,6 +157,13 @@ if(NOT ITK_BINARY_DIR)
if(TARGET vtkRenderingFreeType${VTK_RENDERING_BACKEND})
set(_target_freetypeopengl vtkRenderingFreeType${VTK_RENDERING_BACKEND})
endif()
if(NOT VTK_RENDERING_BACKEND STREQUAL \"None\")
set(_rendering_modules
vtkRendering${VTK_RENDERING_BACKEND}
vtkInteractionStyle
vtkInteractionWidgets
)
endif()

if( ${VTK_VERSION} VERSION_LESS 6.0.0 )
set(ITKVtkGlue_VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS})
Expand All @@ -156,11 +174,9 @@ if(NOT ITK_BINARY_DIR)
set(_wrap_module vtkWrappingPythonCore)
endif()
vtk_module_config(ITKVtkGlue_VTK
vtkRendering${VTK_RENDERING_BACKEND}
vtkRenderingFreeType
${_target_freetypeopengl}
vtkInteractionStyle
vtkInteractionWidgets
${_rendering_modules}
vtkIOImage
vtkIOLegacy
vtkImagingSources
Expand Down
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
set(ITKVtkGlue_SRCS
itkVTKImageExportBase.cxx
QuickView.cxx
)
if(NOT VTK_RENDERING_BACKEND STREQUAL "None")
list(APPEND ITKVtkGlue_SRCS QuickView.cxx)
endif()


itk_module_add_library(ITKVtkGlue ${ITKVtkGlue_SRCS})
target_link_libraries_with_dynamic_lookup(ITKVtkGlue ${ITKVtkGlue_VTK_LIBRARIES})
58 changes: 32 additions & 26 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
itk_module_test()

set(ITKVtkGlueTests
itkVtkConnectedComponentImageFilterTest
itkVtkMedianFilterTest.cxx
itkImageToVTKImageFilterTest.cxx
itkImageToVTKImageFilterRGBTest.cxx
itkVTKImageToImageFilterTest.cxx
itkMeshToVTKUnstructuredGridFilterTest.cxx
QuickViewTest.cxx
)
if(NOT VTK_RENDERING_BACKEND STREQUAL "None")
# ### runViewImage ###
# No test generated. Use it for view images (2D or 3D) with:
# ITKVtkGlueTestDriver runViewImage image_file
# or with a string to change title window, and change size of window
# ITKVtkGlueTestDriver runViewImage image_file "MyImage"
runViewImage.cxx
)
list(APPEND ITKVtkGlueTests
runViewImage.cxx
QuickViewTest.cxx
itkVtkConnectedComponentImageFilterTest.cxx
itkVtkMedianFilterTest.cxx
)
endif()

CreateTestDriver(ITKVtkGlue "${ITKVtkGlue-Test_LIBRARIES}" "${ITKVtkGlueTests}")
target_link_libraries_with_dynamic_lookup(ITKVtkGlueTestDriver ${ITKVtkGlue_VTK_LIBRARIES})

itk_add_test(NAME itkVtkMedianImageFilterTest
COMMAND ITKVtkGlueTestDriver
itkVtkMedianFilterTest DATA{Input/cthead1.png} 2
)
set_property(TEST itkVtkMedianImageFilterTest APPEND PROPERTY LABELS REQUIRES_DISPLAY)

itk_add_test(NAME itkImageToVTKImageFilterTest
COMMAND ITKVtkGlueTestDriver
itkImageToVTKImageFilterTest
Expand All @@ -40,22 +38,30 @@ itk_add_test(NAME itkVTKImageToImageFilterTest
itkVTKImageToImageFilterTest
)

itk_add_test(NAME QuickViewTest
COMMAND ITKVtkGlueTestDriver
--compare DATA{Baseline/QuickViewTest.png,:}
${ITK_TEST_OUTPUT_DIR}/QuickViewTest0.png
--compareNumberOfPixelsTolerance 1500
QuickViewTest DATA{Input/peppers.png} ${ITK_TEST_OUTPUT_DIR}
)
set_property(TEST QuickViewTest APPEND PROPERTY LABELS REQUIRES_DISPLAY)

itk_add_test(NAME itkVtkConnectedComponentImageFilterTest
COMMAND ITKVtkGlueTestDriver
itkVtkConnectedComponentImageFilterTest DATA{Input/cthead1.png}
)
set_property(TEST itkVtkConnectedComponentImageFilterTest APPEND PROPERTY LABELS REQUIRES_DISPLAY)

itk_add_test(NAME itkMeshToVTKUnstructuredGridFilterTest
COMMAND ITKVtkGlueTestDriver
itkMeshToVTKUnstructuredGridFilterTest DATA{Input/cow.vtk} ${ITK_TEST_OUTPUT_DIR}/cow_converted.vtk DATA{Input/cow.vtk}
)

if(NOT VTK_RENDERING_BACKEND STREQUAL "None")
itk_add_test(NAME itkVtkMedianImageFilterTest
COMMAND ITKVtkGlueTestDriver
itkVtkMedianFilterTest DATA{Input/cthead1.png} 2
)
set_property(TEST itkVtkMedianImageFilterTest APPEND PROPERTY LABELS REQUIRES_DISPLAY)

itk_add_test(NAME QuickViewTest
COMMAND ITKVtkGlueTestDriver
--compare DATA{Baseline/QuickViewTest.png,:}
${ITK_TEST_OUTPUT_DIR}/QuickViewTest0.png
--compareNumberOfPixelsTolerance 1500
QuickViewTest DATA{Input/peppers.png} ${ITK_TEST_OUTPUT_DIR}
)
set_property(TEST QuickViewTest APPEND PROPERTY LABELS REQUIRES_DISPLAY)

itk_add_test(NAME itkVtkConnectedComponentImageFilterTest
COMMAND ITKVtkGlueTestDriver
itkVtkConnectedComponentImageFilterTest DATA{Input/cthead1.png}
)
set_property(TEST itkVtkConnectedComponentImageFilterTest APPEND PROPERTY LABELS REQUIRES_DISPLAY)
endif()