From 4bfbb83d7ca4e0cea7ec5d2adfa55014eec69a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 5 Mar 2024 13:01:56 +0100 Subject: [PATCH] Add more VTK readers for the VTK image example --- .../examples/Isosurfacing_3/CMakeLists.txt | 4 ++-- .../Isosurfacing_3/contouring_vtk_image.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Isosurfacing_3/examples/Isosurfacing_3/CMakeLists.txt b/Isosurfacing_3/examples/Isosurfacing_3/CMakeLists.txt index b3ffadb762d..33a03a4f38a 100644 --- a/Isosurfacing_3/examples/Isosurfacing_3/CMakeLists.txt +++ b/Isosurfacing_3/examples/Isosurfacing_3/CMakeLists.txt @@ -12,14 +12,14 @@ include(CGAL_Eigen3_support) find_package(TBB QUIET) include(CGAL_TBB_support) -find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage vtkIOXML vtkIOLegacy NO_MODULE) +find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage vtkIOXML vtkIOXML vtkIOMINC vtkIOLegacy NO_MODULE) if(VTK_FOUND) if(VTK_USE_FILE) include(${VTK_USE_FILE}) endif() if("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) message(STATUS "VTK was found") - if(TARGET VTK::ImagingGeneral AND TARGET VTK::IOImage AND TARGET VTK::IOXML AND TARGET VTK::IOLegacy) + if(TARGET VTK::ImagingGeneral AND TARGET VTK::IOImage AND TARGET VTK::IOXML AND VTK::IOMINC AND TARGET VTK::IOLegacy) set(VTK_LIBRARIES VTK::ImagingGeneral VTK::IOImage VTK::IOXML VTK::IOLegacy) endif() else() diff --git a/Isosurfacing_3/examples/Isosurfacing_3/contouring_vtk_image.cpp b/Isosurfacing_3/examples/Isosurfacing_3/contouring_vtk_image.cpp index 65138a875d9..8f766e5a181 100644 --- a/Isosurfacing_3/examples/Isosurfacing_3/contouring_vtk_image.cpp +++ b/Isosurfacing_3/examples/Isosurfacing_3/contouring_vtk_image.cpp @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include @@ -124,6 +126,20 @@ int main(int argc, char* argv[]) reader->Update(); image = CGAL::IO::read_vtk_image_data(reader->GetOutput()); } + else if(ext == "nrrd") + { + vtkNew reader; + reader->SetFileName(argv[1]); + reader->Update(); + image = CGAL::IO::read_vtk_image_data(reader->GetOutput()); + } + else if(ext == "mnc") + { + vtkNew reader; + reader->SetFileName(argv[1]); + reader->Update(); + image = CGAL::IO::read_vtk_image_data(reader->GetOutput()); + } else { std::cerr << "Error: Unsupported file format" << std::endl;