diff options
Diffstat (limited to 'sci-libs/itk/files')
16 files changed, 1470 insertions, 323 deletions
diff --git a/sci-libs/itk/files/0001-BUG-Wrap-TransformFileReader-TransformFileWriter.patch b/sci-libs/itk/files/0001-BUG-Wrap-TransformFileReader-TransformFileWriter.patch deleted file mode 100644 index 094ee3229..000000000 --- a/sci-libs/itk/files/0001-BUG-Wrap-TransformFileReader-TransformFileWriter.patch +++ /dev/null @@ -1,50 +0,0 @@ -From d069b7b94287dae15fcaf707775f5dd2bbebcc38 Mon Sep 17 00:00:00 2001 -From: Matt McCormick <matt.mccormick@kitware.com> -Date: Wed, 5 Feb 2014 15:52:34 -0500 -Subject: [PATCH 1/3] BUG: Wrap TransformFileReader, TransformFileWriter. - -Missing CMakeLists.txt in the wrapping directory. Need to explicitly include -the headers after "Template" was appended to the class name. - -Suggested-by: Sami Koho <sami.koho@gmail.com> - -Change-Id: I6f994bb18f37d5adf1d0f0311fa73506c41239a7 ---- - Modules/IO/TransformBase/wrapping/CMakeLists.txt | 3 +++ - Modules/IO/TransformBase/wrapping/itkTransformFileReader.wrap | 2 ++ - Modules/IO/TransformBase/wrapping/itkTransformFileWriter.wrap | 2 ++ - 3 files changed, 7 insertions(+) - create mode 100644 Modules/IO/TransformBase/wrapping/CMakeLists.txt - -diff --git a/Modules/IO/TransformBase/wrapping/CMakeLists.txt b/Modules/IO/TransformBase/wrapping/CMakeLists.txt -new file mode 100644 -index 0000000..6072567 ---- /dev/null -+++ b/Modules/IO/TransformBase/wrapping/CMakeLists.txt -@@ -0,0 +1,3 @@ -+itk_wrap_module(ITKIOTransformBase) -+itk_auto_load_submodules() -+itk_end_wrap_module() -diff --git a/Modules/IO/TransformBase/wrapping/itkTransformFileReader.wrap b/Modules/IO/TransformBase/wrapping/itkTransformFileReader.wrap -index 9b52fbc..662df9e 100644 ---- a/Modules/IO/TransformBase/wrapping/itkTransformFileReader.wrap -+++ b/Modules/IO/TransformBase/wrapping/itkTransformFileReader.wrap -@@ -1,3 +1,5 @@ -+set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) -+itk_wrap_include("itkTransformFileReader.h") - itk_wrap_class("itk::TransformFileReaderTemplate" POINTER) - foreach(t ${WRAP_ITK_REAL}) - itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") -diff --git a/Modules/IO/TransformBase/wrapping/itkTransformFileWriter.wrap b/Modules/IO/TransformBase/wrapping/itkTransformFileWriter.wrap -index 4f1ac4a..356aaf3 100644 ---- a/Modules/IO/TransformBase/wrapping/itkTransformFileWriter.wrap -+++ b/Modules/IO/TransformBase/wrapping/itkTransformFileWriter.wrap -@@ -1,3 +1,5 @@ -+set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) -+itk_wrap_include("itkTransformFileWriter.h") - itk_wrap_class("itk::TransformFileWriterTemplate" POINTER) - foreach(t ${WRAP_ITK_REAL}) - itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") --- -1.8.5.3 - diff --git a/sci-libs/itk/files/0002-COMP-Fixed-itkQuasiNewtonOptimizerv4-wrapping-warnin.patch b/sci-libs/itk/files/0002-COMP-Fixed-itkQuasiNewtonOptimizerv4-wrapping-warnin.patch deleted file mode 100644 index 4c74d5451..000000000 --- a/sci-libs/itk/files/0002-COMP-Fixed-itkQuasiNewtonOptimizerv4-wrapping-warnin.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 66d2955fbe5528d9df216c639277d1d2686447e5 Mon Sep 17 00:00:00 2001 -From: Michka Popoff <michkapopoff@gmail.com> -Date: Fri, 7 Feb 2014 19:24:49 +0100 -Subject: [PATCH 2/3] COMP: Fixed itkQuasiNewtonOptimizerv4 wrapping warnings - -The warning : -/scratch/dashboards/Linux-x86_64-gcc4.4-WrapITK/ITK-build/Wrapping/Modules/ITKOptimizersv4/itkQuasiNewtonOptimizerv4.xml: warning(5): Unknown type type: itk::QuasiNewtonOptimizerv4 [typedef] -/scratch/dashboards/Linux-x86_64-gcc4.4-WrapITK/ITK-build/Wrapping/Modules/ITKOptimizersv4/itkQuasiNewtonOptimizerv4.xml: warning(4): ITK type not wrapped, or currently not known: itk::QuasiNewtonOptimizerv4Template< double > ---- - .../Numerics/Optimizersv4/wrapping/itkQuasiNewtonOptimizerv4.wrap | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/Modules/Numerics/Optimizersv4/wrapping/itkQuasiNewtonOptimizerv4.wrap b/Modules/Numerics/Optimizersv4/wrapping/itkQuasiNewtonOptimizerv4.wrap -index 4a43dd4..7eed11c 100644 ---- a/Modules/Numerics/Optimizersv4/wrapping/itkQuasiNewtonOptimizerv4.wrap -+++ b/Modules/Numerics/Optimizersv4/wrapping/itkQuasiNewtonOptimizerv4.wrap -@@ -1 +1,7 @@ --itk_wrap_simple_class("itk::QuasiNewtonOptimizerv4" POINTER) -+set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) -+itk_wrap_include("itkQuasiNewtonOptimizerv4.h") -+itk_wrap_class("itk::QuasiNewtonOptimizerv4Template" POINTER) -+ foreach(t ${WRAP_ITK_REAL}) -+ itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") -+ endforeach(t) -+itk_end_wrap_class() --- -1.8.5.3 - diff --git a/sci-libs/itk/files/0003-COMP-Fixed-itkGradientDescentOptimizerv4-wrapping-wa.patch b/sci-libs/itk/files/0003-COMP-Fixed-itkGradientDescentOptimizerv4-wrapping-wa.patch deleted file mode 100644 index d77345edf..000000000 --- a/sci-libs/itk/files/0003-COMP-Fixed-itkGradientDescentOptimizerv4-wrapping-wa.patch +++ /dev/null @@ -1,73 +0,0 @@ -From fced46ce8769b4edc7971ea0928045390b5c3f84 Mon Sep 17 00:00:00 2001 -From: Michka Popoff <michkapopoff@gmail.com> -Date: Mon, 10 Feb 2014 09:41:42 +0100 -Subject: [PATCH 3/3] COMP: Fixed itkGradientDescentOptimizerv4 wrapping - warnings - -I splitted the 3 wrapping calls in 3 separate files and fixed the wrapping. - -The warnings : -/home/kevin/kitware/ITK_Build/Wrapping/Modules/ITKOptimizersv4/itkGradientDescentOptimizerv4.xml: warning(5): Unknown type type: itk::GradientDescentOptimizerBasev4 [typedef] -/home/kevin/kitware/ITK_Build/Wrapping/Modules/ITKOptimizersv4/itkGradientDescentOptimizerv4.xml: warning(5): Unknown type type: itk::GradientDescentOptimizerv4 [typedef] -/home/kevin/kitware/ITK_Build/Wrapping/Modules/ITKOptimizersv4/itkGradientDescentOptimizerv4.xml: warning(5): Unknown type type: itk::ObjectToObjectOptimizerBase [typedef] -/home/kevin/kitware/ITK_Build/Wrapping/Modules/ITKOptimizersv4/itkGradientDescentOptimizerv4.xml: warning(4): ITK type not wrapped, or currently not known: itk::GradientDescentOptimizerBasev4Template< double > -/home/kevin/kitware/ITK_Build/Wrapping/Modules/ITKOptimizersv4/itkGradientDescentOptimizerv4.xml: warning(4): ITK type not wrapped, or currently not known: itk::GradientDescentOptimizerv4Template< double > -/home/kevin/kitware/ITK_Build/Wrapping/Modules/ITKOptimizersv4/itkGradientDescentOptimizerv4.xml: warning(4): ITK type not wrapped, or currently not known: itk::ObjectToObjectOptimizerBaseTemplate< double > - -Should also hopefully fix the new error on the dashboard I introduced by fixing the itkQuasiNewtonOptimizerv4 warnings (http://review.source.kitware.com/#/c/14317/) -/home/kevin/kitware/ITK_Build/Wrapping/Typedefs/itkQuasiNewtonOptimizerv4.i:87: Warning 401: Nothing known about base class 'itk::GradientDescentOptimizerv4Template< float >'. Ignored. -/home/kevin/kitware/ITK_Build/Wrapping/Typedefs/itkQuasiNewtonOptimizerv4.i:87: Warning 401: Maybe you forgot to instantiate 'itk::GradientDescentOptimizerv4Template< float >' using %template. - -Change-Id: I15b6af11690ed6efeaced68f73af5212ab5dc364 ---- - .../wrapping/itkGradientDescentOptimizerBasev4.wrap | 7 +++++++ - .../Optimizersv4/wrapping/itkGradientDescentOptimizerv4.wrap | 10 +++++++--- - .../Optimizersv4/wrapping/itkObjectToObjectOptimizerBase.wrap | 7 +++++++ - 3 files changed, 21 insertions(+), 3 deletions(-) - create mode 100644 Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerBasev4.wrap - create mode 100644 Modules/Numerics/Optimizersv4/wrapping/itkObjectToObjectOptimizerBase.wrap - -diff --git a/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerBasev4.wrap b/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerBasev4.wrap -new file mode 100644 -index 0000000..74f5a6c ---- /dev/null -+++ b/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerBasev4.wrap -@@ -0,0 +1,7 @@ -+set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) -+itk_wrap_include("itkGradientDescentOptimizerBasev4.h") -+itk_wrap_class("itk::GradientDescentOptimizerBasev4Template" POINTER) -+ foreach(t ${WRAP_ITK_REAL}) -+ itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") -+ endforeach(t) -+itk_end_wrap_class() -diff --git a/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerv4.wrap b/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerv4.wrap -index d53a176..3236448 100644 ---- a/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerv4.wrap -+++ b/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerv4.wrap -@@ -1,3 +1,7 @@ --itk_wrap_simple_class("itk::ObjectToObjectOptimizerBase" POINTER) --itk_wrap_simple_class("itk::GradientDescentOptimizerBasev4" POINTER) --itk_wrap_simple_class("itk::GradientDescentOptimizerv4" POINTER) -+set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) -+itk_wrap_include("itkGradientDescentOptimizerv4.h") -+itk_wrap_class("itk::GradientDescentOptimizerv4Template" POINTER) -+ foreach(t ${WRAP_ITK_REAL}) -+ itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") -+ endforeach(t) -+itk_end_wrap_class() -diff --git a/Modules/Numerics/Optimizersv4/wrapping/itkObjectToObjectOptimizerBase.wrap b/Modules/Numerics/Optimizersv4/wrapping/itkObjectToObjectOptimizerBase.wrap -new file mode 100644 -index 0000000..61b2c44 ---- /dev/null -+++ b/Modules/Numerics/Optimizersv4/wrapping/itkObjectToObjectOptimizerBase.wrap -@@ -0,0 +1,7 @@ -+set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) -+itk_wrap_include("itkObjectToObjectOptimizerBase.h") -+itk_wrap_class("itk::ObjectToObjectOptimizerBaseTemplate" POINTER) -+ foreach(t ${WRAP_ITK_REAL}) -+ itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") -+ endforeach(t) -+itk_end_wrap_class() --- -1.8.5.3 - diff --git a/sci-libs/itk/files/0004-COMP-Warp-OptimizerParameterScalesEstimatorTemplate.patch b/sci-libs/itk/files/0004-COMP-Warp-OptimizerParameterScalesEstimatorTemplate.patch deleted file mode 100644 index 83b395626..000000000 --- a/sci-libs/itk/files/0004-COMP-Warp-OptimizerParameterScalesEstimatorTemplate.patch +++ /dev/null @@ -1,30 +0,0 @@ -Author: Matt McCormick <matt.mccormick@kitware.com> -Date: Thu Feb 6 10:26:49 2014 -0500 - - COMP: Wrap OptimizerParameterScalesEstimatorTemplate. - - The class name changed and it became templated. Fixes: - - /playpen/blowekamp/MacOSX-WrapITK/ITK-build/Wrapping/Modules/ITKOptimizersv4/itkOptimizerParameterScalesEstimator.xml: - warning(5): Unknown type type: itk::OptimizerParameterScalesEstimator - [typedef] - /playpen/blowekamp/MacOSX-WrapITK/ITK-build/Wrapping/Modules/ITKOptimizersv4/itkOptimizerParameterScalesEstimator.xml: - warning(4): ITK type not wrapped, or currently not known: - itk::OptimizerParameterScalesEstimatorTemplate< double > - - Change-Id: Ic6b4d6fba10d5d6c7b58de8d842bad6511e1ae7b - -diff --git a/Modules/Numerics/Optimizersv4/wrapping/itkOptimizerParameterScalesEstimator.wrap b/Modules/Numerics/Optimizersv4/wrapping/itkOptim -index efd6a8c..a647ee4 100644 ---- a/Modules/Numerics/Optimizersv4/wrapping/itkOptimizerParameterScalesEstimator.wrap -+++ b/Modules/Numerics/Optimizersv4/wrapping/itkOptimizerParameterScalesEstimator.wrap -@@ -1 +1,7 @@ --itk_wrap_simple_class("itk::OptimizerParameterScalesEstimator" POINTER) -+set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) -+itk_wrap_include("itkOptimizerParameterScalesEstimator.h") -+itk_wrap_class("itk::OptimizerParameterScalesEstimatorTemplate" POINTER) -+ foreach(t ${WRAP_ITK_REAL}) -+ itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") -+ endforeach(t) -+itk_end_wrap_class() - diff --git a/sci-libs/itk/files/0005-make-gdcm-helper-library-static.patch b/sci-libs/itk/files/0005-make-gdcm-helper-library-static.patch deleted file mode 100644 index d760ac7ba..000000000 --- a/sci-libs/itk/files/0005-make-gdcm-helper-library-static.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff --git a/Modules/ThirdParty/GDCM/src/CMakeLists.txt b/Modules/ThirdParty/GDCM/src/CMakeLists.txt -index e98077c..70f4286 100644 ---- a/Modules/ThirdParty/GDCM/src/CMakeLists.txt -+++ b/Modules/ThirdParty/GDCM/src/CMakeLists.txt -@@ -1,5 +1,5 @@ - if(ITK_USE_SYSTEM_GDCM) -- add_library(ITKGDCM ITK-GDCM.cxx) -+ add_library(ITKGDCM STATIC ITK-GDCM.cxx) - target_link_libraries(ITKGDCM gdcmDICT gdcmMSFF) - itk_module_target(ITKGDCM) - return() diff --git a/sci-libs/itk/files/ITKModuleRemote.patch b/sci-libs/itk/files/ITKModuleRemote.patch deleted file mode 100644 index eb130159a..000000000 --- a/sci-libs/itk/files/ITKModuleRemote.patch +++ /dev/null @@ -1,45 +0,0 @@ -Disable automatic git clone attempt for modules: -https://github.com/InsightSoftwareConsortium/ITK/issues/1157 - ---- a/CMake/ITKModuleRemote.cmake 2019-08-13 18:10:33.385472767 +0200 -+++ b/CMake/ITKModuleRemote.cmake 2019-08-13 18:12:04.020198966 +0200 -@@ -165,39 +165,4 @@ - set(Module_${_name} ON CACHE FORCE "${_description}") - endif() - -- if(Module_${_name}) -- itk_download_attempt_check(Module_${_name}) -- include(CMakeParseArguments) -- cmake_parse_arguments(_fetch_options "" "GIT_REPOSITORY;GIT_TAG" "" ${ARGN}) -- find_package(Git) -- if(NOT GIT_EXECUTABLE) -- message(FATAL_ERROR "error: could not find git for clone of ${_name}") -- endif() -- execute_process( -- COMMAND "${GIT_EXECUTABLE}" --version -- OUTPUT_VARIABLE ov -- OUTPUT_STRIP_TRAILING_WHITESPACE -- ) -- string(REGEX REPLACE "^git version (.+)$" "\\1" _version "${ov}") -- if("${_version}" VERSION_LESS 1.6.6) -- message(FATAL_ERROR "Git version 1.6.6 or later is required.") -- endif() -- -- set(REMOTE_GIT_TAG "${_fetch_options_GIT_TAG}") -- -- if( DEFINED REMOTE_GIT_TAG_${_name} AND NOT "${REMOTE_GIT_TAG_${_name}}" STREQUAL "${_fetch_options_GIT_TAG}") -- set(REMOTE_GIT_TAG "${REMOTE_GIT_TAG_${_name}}") -- message(STATUS "NOTE: Using override 'REMOTE_GIT_TAG_${_name}=${REMOTE_GIT_TAG}'\n" -- " instead of value 'GIT_TAG=${_fetch_options_GIT_TAG}'\n" -- " specified in file ${ITK_SOURCE_DIR}/Modules/Remote/${_name}.remote.cmake'") -- endif() -- set(REMOTE_GIT_TAG_${_name} "${REMOTE_GIT_TAG}" CACHE STRING "Override default GIT_TAG value for remote module ${_name}") -- mark_as_advanced(REMOTE_GIT_TAG_${_name}) -- -- _fetch_with_git("${GIT_EXECUTABLE}" -- "${_fetch_options_GIT_REPOSITORY}" -- "${REMOTE_GIT_TAG}" -- "${ITK_SOURCE_DIR}/Modules/Remote/${_name}" -- ) -- endif() - endfunction() diff --git a/sci-libs/itk/files/itk-5.1.0-downloads.patch b/sci-libs/itk/files/itk-5.1.0-downloads.patch deleted file mode 100644 index 34fdb76d1..000000000 --- a/sci-libs/itk/files/itk-5.1.0-downloads.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/CMake/ITKDownloadSetup.cmake 2020-07-30 19:03:10.330325423 -0400 -+++ b/CMake/ITKDownloadSetup.cmake 2020-07-30 19:03:10.330325423 -0400 -@@ -11,7 +11,7 @@ - - macro(itk_download_attempt_check _name) - if(ITK_FORBID_DOWNLOADS) -- message(SEND_ERROR "Attempted to download ${_name} when ITK_FORBID_DOWNLOADS is ON") -+ message(WARNING "Attempted to download ${_name} when ITK_FORBID_DOWNLOADS is ON") - endif() - endmacro() - ---- a/Modules/Remote/GenericLabelInterpolator.remote.cmake 2020-04-25 14:30:53.000000000 -0400 -+++ b/Modules/Remote/GenericLabelInterpolator.remote.cmake 2020-04-25 14:30:53.000000000 -0400 -@@ -44,6 +44,4 @@ - itk_fetch_module(GenericLabelInterpolator - "A generic interpolator for multi-label images." - MODULE_COMPLIANCE_LEVEL 2 -- GIT_REPOSITORY ${git_protocol}://github.com/InsightSoftwareConsortium/ITKGenericLabelInterpolator.git -- GIT_TAG b95fe46c7f4fe8002af67c67e6fe4e1f087bf6b7 - ) diff --git a/sci-libs/itk/files/itk-5.1.0-include_limits.patch b/sci-libs/itk/files/itk-5.1.0-include_limits.patch deleted file mode 100644 index 9a8fae820..000000000 --- a/sci-libs/itk/files/itk-5.1.0-include_limits.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/gdcmImageChangePhotometricInterpretation.h -+++ a/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/gdcmImageChangePhotometricInterpretation.h -@@ -16,6 +16,7 @@ - - #include "gdcmImageToImageFilter.h" - #include "gdcmPhotometricInterpretation.h" -+#include <limits> - - namespace gdcm - { diff --git a/sci-libs/itk/files/itk-5.2.1-fix-castxml-clang-attr-malloc.patch b/sci-libs/itk/files/itk-5.2.1-fix-castxml-clang-attr-malloc.patch new file mode 100644 index 000000000..05c9d5635 --- /dev/null +++ b/sci-libs/itk/files/itk-5.2.1-fix-castxml-clang-attr-malloc.patch @@ -0,0 +1,25 @@ +From: François-Xavier Carton <fx.carton91@gmail.com> +Date: Thu, 9 Jun 2022 14:56:22 +0200 +Subject: [PATCH] fix attr malloc error with recent glibc/gcc + +Recent GCC has support for __attribute__((__malloc__)) with arguments, but clang +does not. castxml uses clang internally. And recent glibc/gcc uses the attribute +with arguments. Mix all this, and you get: + +error: '__malloc__' attribute takes no arguments + +when compiling itk with python wrapping. + +To fix this, we add a define to castxml flags to remove the extra arguments. + +--- a/Wrapping/Generators/CastXML/CMakeLists.txt 2022-06-09 14:53:15.582352715 +0200 ++++ b/Wrapping/Generators/CastXML/CMakeLists.txt 2022-06-09 14:54:38.182351433 +0200 +@@ -237,7 +237,7 @@ + set(_castxml_cc ${_castxml_cc} "-D_HAS_TR1=0") + endif() + else() +- set(_castxml_cc --castxml-cc-gnu ( "${CMAKE_CXX_COMPILER}" ${_castxml_cc_flags} )) ++ set(_castxml_cc --castxml-cc-gnu ( "${CMAKE_CXX_COMPILER}" ${_castxml_cc_flags} -D__malloc__\(a,b\)=__malloc__ )) + endif() + set(_target) + if(CMAKE_CROSSCOMPILING) diff --git a/sci-libs/itk/files/itk-5.2.1-system-openjpeg.patch b/sci-libs/itk/files/itk-5.2.1-system-openjpeg.patch new file mode 100644 index 000000000..ad717f677 --- /dev/null +++ b/sci-libs/itk/files/itk-5.2.1-system-openjpeg.patch @@ -0,0 +1,558 @@ +--- a/Modules/ThirdParty/OpenJPEG/CMakeLists.txt ++++ b/Modules/ThirdParty/OpenJPEG/CMakeLists.txt +@@ -1,16 +1,32 @@ + project(ITKOpenJPEG) + set(ITKOpenJPEG_THIRD_PARTY 1) + +-set(ITKOpenJPEG_INCLUDE_DIRS +- ${ITKOpenJPEG_BINARY_DIR}/src/openjpeg +- ${ITKOpenJPEG_SOURCE_DIR}/src/openjpeg +- ) +-set(ITKOpenJPEG_LIBRARIES itkopenjpeg) ++option(ITK_USE_SYSTEM_OPENJPEG "Use system-installed openjpeg" ${ITK_USE_SYSTEM_LIBRARIES}) ++mark_as_advanced(ITK_USE_SYSTEM_OPENJPEG) ++ ++if(ITK_USE_SYSTEM_OPENJPEG) ++ find_package(OpenJPEG REQUIRED) ++ set(ITKOpenJPEG_INCLUDE_DIRS ++ ${ITKOpenJPEG_BINARY_DIR}/src ++ ) ++ set(ITKOpenJPEG_SYSTEM_INCLUDE_DIRS ++ ${OPENJPEG_INCLUDE_DIRS} ++ ) ++ set(ITKOpenJPEG_LIBRARIES "${OPENJPEG_LIBRARIES}") ++ set(ITKOpenJPEG_NO_SRC 1) ++else() ++ set(ITKOpenJPEG_INCLUDE_DIRS ++ ${ITKOpenJPEG_BINARY_DIR}/src/openjpeg ++ ${ITKOpenJPEG_SOURCE_DIR}/src/openjpeg ++ ) ++ set(ITKOpenJPEG_LIBRARIES itkopenjpeg) ++endif() ++ ++configure_file(src/itk_openjpeg.h.in src/itk_openjpeg.h) + set(ITK_LIBRARY_PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS FALSE) +- + itk_module_impl() + +-install(FILES ${ITKOpenJPEG_SOURCE_DIR}/src/itk_openjpeg.h ++install(FILES ${ITKOpenJPEG_BINARY_DIR}/src/itk_openjpeg.h + DESTINATION ${ITKOpenJPEG_INSTALL_INCLUDE_DIR} + COMPONENT Development + ) +diff --git a/Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h b/Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h.in +rename from Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h +rename to Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h.in +--- a/Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h ++++ b/Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h.in +@@ -25,6 +25,12 @@ + #ifndef itk_openjpeg_h + #define itk_openjpeg_h + +-#include <itkopenjpeg/openjpeg.h> ++/* Use the openjpeg library configured for ITK. */ ++#cmakedefine ITK_USE_SYSTEM_OPENJPEG ++#ifdef ITK_USE_SYSTEM_OPENJPEG ++# include <openjpeg.h> ++#else ++# include <itkopenjpeg/openjpeg.h> ++#endif + + #endif +--- a/Modules/IO/JPEG2000/src/itkJPEG2000ImageIO.cxx ++++ b/Modules/IO/JPEG2000/src/itkJPEG2000ImageIO.cxx +@@ -27,8 +27,6 @@ + extern "C" + { + #include "openjpeg.h" +-#include "j2k.h" +-#include "jp2.h" + } + + +@@ -139,11 +137,11 @@ + { + itkDebugMacro(<< "ReadImageInformation()"); + +- FILE * l_file = fopen(this->m_FileName.c_str(), "rb"); +- +- /* decompression parameters */ ++ /* set decoding parameters to default values */ ++ opj_set_default_decoder_parameters(&(this->m_Internal->m_DecompressionParameters)); + +- if (!l_file) ++ opj_stream_t * cio = opj_stream_create_default_file_stream(this->m_FileName.c_str(), true); ++ if (!cio) + { + itkExceptionMacro("JPEG2000ImageIO failed to open file for reading: " << this->GetFileName() << std::endl + << "Reason: " +@@ -151,10 +149,5 @@ + } + +- /* set decoding parameters to default values */ +- opj_set_default_decoder_parameters(&(this->m_Internal->m_DecompressionParameters)); +- +- opj_stream_t * cio = opj_stream_create_default_file_stream(l_file, true); +- + this->m_Internal->m_Dinfo = nullptr; /* handle to a decompressor */ + + opj_image_t * l_image = nullptr; +@@ -188,9 +181,8 @@ + + /* get a decoder handle */ +- this->m_Internal->m_Dinfo = opj_create_decompress(CODEC_J2K); ++ this->m_Internal->m_Dinfo = opj_create_decompress(OPJ_CODEC_J2K); + if (!this->m_Internal->m_Dinfo) + { + opj_stream_destroy(cio); +- fclose(l_file); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl +@@ -202,10 +194,9 @@ + { + /* JPEG 2000 compressed image data */ + /* get a decoder handle */ +- this->m_Internal->m_Dinfo = opj_create_decompress(CODEC_JP2); ++ this->m_Internal->m_Dinfo = opj_create_decompress(OPJ_CODEC_JP2); + if (!this->m_Internal->m_Dinfo) + { + opj_stream_destroy(cio); +- fclose(l_file); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl +@@ -217,10 +208,9 @@ + { + /* JPEG 2000, JPIP */ + /* get a decoder handle */ +- this->m_Internal->m_Dinfo = opj_create_decompress(CODEC_JPT); ++ this->m_Internal->m_Dinfo = opj_create_decompress(OPJ_CODEC_JPT); + if (!this->m_Internal->m_Dinfo) + { + opj_stream_destroy(cio); +- fclose(l_file); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl +@@ -230,7 +220,6 @@ + } + default: + opj_stream_destroy(cio); +- fclose(l_file); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl + << "Reason: " +@@ -248,26 +237,8 @@ + } + +- // Image parameters - first tile +- OPJ_INT32 l_tile_x0; +- OPJ_INT32 l_tile_y0; +- +- // Image parameters - tile width, height and number of tiles +- OPJ_UINT32 l_tile_width; +- OPJ_UINT32 l_tile_height; +- OPJ_UINT32 l_nb_tiles_x; +- OPJ_UINT32 l_nb_tiles_y; +- + itkDebugMacro(<< "Trying to read header now..."); + +- bResult = opj_read_header(this->m_Internal->m_Dinfo, +- &l_image, +- &l_tile_x0, +- &l_tile_y0, +- &l_tile_width, +- &l_tile_height, +- &l_nb_tiles_x, +- &l_nb_tiles_y, +- cio); ++ bResult = opj_read_header(cio, this->m_Internal->m_Dinfo, &l_image); + + if (!bResult) + { +@@ -284,13 +255,21 @@ + } + +- this->m_Internal->m_TileStartX = l_tile_x0; +- this->m_Internal->m_TileStartY = l_tile_y0; ++ opj_codestream_info_v2_t* cp = opj_get_cstr_info(this->m_Internal->m_Dinfo); ++ if (!cp) ++ { ++ opj_stream_destroy(cio); ++ opj_image_destroy(l_image); ++ itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl ++ << "Reason: Error while reading image header"); ++ } ++ this->m_Internal->m_TileStartX = cp->tx0; ++ this->m_Internal->m_TileStartY = cp->ty0; + +- this->m_Internal->m_TileWidth = l_tile_width; +- this->m_Internal->m_TileHeight = l_tile_height; ++ this->m_Internal->m_TileWidth = cp->tdx; ++ this->m_Internal->m_TileHeight = cp->tdy; + +- this->m_Internal->m_NumberOfTilesInX = l_nb_tiles_x; +- this->m_Internal->m_NumberOfTilesInY = l_nb_tiles_y; ++ this->m_Internal->m_NumberOfTilesInX = cp->tw; ++ this->m_Internal->m_NumberOfTilesInY = cp->th; + + + itkDebugMacro(<< "Number of Components = " << l_image->numcomps); +@@ -307,6 +286,7 @@ + else + { + opj_stream_destroy(cio); ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl + << "Reason: " + << "Unknown precision in file: " +@@ -320,6 +300,6 @@ + break; + case 3: +- if (l_image->color_space != CLRSPC_SRGB) ++ if (l_image->color_space != OPJ_CLRSPC_SRGB) + { + itkWarningMacro(<< "file does not specify color space, assuming sRGB"); + } +@@ -349,7 +329,6 @@ + + /* close the byte stream */ + opj_stream_destroy(cio); +- fclose(l_file); + + if (this->m_Internal->m_Dinfo) + { +@@ -368,16 +347,7 @@ + { + itkDebugMacro(<< "JPEG2000ImageIO::Read() Begin"); + +- FILE * l_file = fopen(this->m_FileName.c_str(), "rb"); +- +- if (!l_file) +- { +- itkExceptionMacro("JPEG2000ImageIO failed to open file for reading: " << this->GetFileName() << std::endl +- << "Reason: " +- << itksys::SystemTools::GetLastSystemError()); +- } +- +- opj_stream_t * l_stream = opj_stream_create_default_file_stream(l_file, true); ++ opj_stream_t * l_stream = opj_stream_create_default_file_stream(this->m_FileName.c_str(), true); + if (!l_stream) + { + itkExceptionMacro("JPEG2000ImageIO failed to read file: " +@@ -397,9 +367,10 @@ + { + /* JPEG-2000 codestream */ + /* get a decoder handle */ +- this->m_Internal->m_Dinfo = opj_create_decompress(CODEC_J2K); ++ this->m_Internal->m_Dinfo = opj_create_decompress(OPJ_CODEC_J2K); + if (!this->m_Internal->m_Dinfo) + { ++ opj_stream_destroy(l_stream); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl + << "Reason: opj_create_decompress(CODEC_J2K) returns nullptr"); +@@ -410,9 +381,10 @@ + { + /* JPEG 2000 compressed image data */ + /* get a decoder handle */ +- this->m_Internal->m_Dinfo = opj_create_decompress(CODEC_JP2); ++ this->m_Internal->m_Dinfo = opj_create_decompress(OPJ_CODEC_JP2); + if (!this->m_Internal->m_Dinfo) + { ++ opj_stream_destroy(l_stream); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl + << "Reason: opj_create_decompress(CODEC_JP2) returns nullptr"); +@@ -423,9 +395,10 @@ + { + /* JPEG 2000, JPIP */ + /* get a decoder handle */ +- this->m_Internal->m_Dinfo = opj_create_decompress(CODEC_JPT); ++ this->m_Internal->m_Dinfo = opj_create_decompress(OPJ_CODEC_JPT); + if (!this->m_Internal->m_Dinfo) + { ++ opj_stream_destroy(l_stream); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl + << "Reason: opj_create_decompress(CODEC_JPT) returns nullptr"); +@@ -433,7 +406,7 @@ + break; + } + default: +- fclose(l_file); ++ opj_stream_destroy(l_stream); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl + << "Reason: " +@@ -445,32 +418,17 @@ + if (!opj_setup_decoder(this->m_Internal->m_Dinfo, &(this->m_Internal->m_DecompressionParameters))) + { ++ opj_stream_destroy(l_stream); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl + << "Reason: opj_setup_decoder returns false"); + } + +- OPJ_INT32 l_tile_x0, l_tile_y0; +- +- OPJ_UINT32 l_tile_width; +- OPJ_UINT32 l_tile_height; +- OPJ_UINT32 l_nb_tiles_x; +- OPJ_UINT32 l_nb_tiles_y; +- +- bool bResult = opj_read_header(this->m_Internal->m_Dinfo, +- &l_image, +- &l_tile_x0, +- &l_tile_y0, +- &l_tile_width, +- &l_tile_height, +- &l_nb_tiles_x, +- &l_nb_tiles_y, +- l_stream); ++ bool bResult = opj_read_header(l_stream, this->m_Internal->m_Dinfo, &l_image); + + if (!bResult) + { + opj_destroy_codec(this->m_Internal->m_Dinfo); + this->m_Internal->m_Dinfo = nullptr; + opj_stream_destroy(l_stream); +- fclose(l_file); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl + << "Reason: opj_read_header returns false"); + } +@@ -499,7 +457,7 @@ + itkDebugMacro(<< "p_end_x = " << p_end_x); + itkDebugMacro(<< "p_end_y = " << p_end_y); + +- bResult = opj_set_decode_area(this->m_Internal->m_Dinfo, p_start_x, p_start_y, p_end_x, p_end_y); ++ bResult = opj_set_decode_area(this->m_Internal->m_Dinfo, l_image, p_start_x, p_start_y, p_end_x, p_end_y); + + itkDebugMacro(<< "opj_set_decode_area() after"); + +@@ -509,6 +467,5 @@ + this->m_Internal->m_Dinfo = nullptr; + opj_stream_destroy(l_stream); +- fclose(l_file); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl + << "Reason: opj_set_decode_area returns false"); + } +@@ -525,13 +482,14 @@ + + OPJ_UINT32 l_max_data_size = 1000; + +- bool l_go_on = true; ++ OPJ_BOOL l_go_on = true; + + auto * l_data = (OPJ_BYTE *)malloc(1000); + + while (l_go_on) + { + bool tileHeaderRead = opj_read_tile_header(this->m_Internal->m_Dinfo, ++ l_stream, + &l_tile_index, + &l_data_size, + &l_current_tile_x0, +@@ -540,13 +498,11 @@ + &l_current_tile_y1, + &l_nb_comps, +- &l_go_on, +- l_stream); ++ &l_go_on); + + if (!tileHeaderRead) + { + free(l_data); + opj_stream_destroy(l_stream); +- fclose(l_file); + opj_destroy_codec(this->m_Internal->m_Dinfo); + opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl +@@ -571,7 +527,6 @@ + if (!l_data) + { + opj_stream_destroy(l_stream); +- fclose(l_file); + opj_destroy_codec(this->m_Internal->m_Dinfo); + opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl +@@ -590,7 +545,6 @@ + { + free(l_data); + opj_stream_destroy(l_stream); +- fclose(l_file); + opj_destroy_codec(this->m_Internal->m_Dinfo); + opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl +@@ -654,7 +608,6 @@ + { + free(l_data); + opj_stream_destroy(l_stream); +- fclose(l_file); + opj_destroy_codec(this->m_Internal->m_Dinfo); + opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl +@@ -667,13 +620,11 @@ + this->m_Internal->m_Dinfo = nullptr; + opj_stream_destroy(l_stream); +- fclose(l_file); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl + << "Reason: error whle reading image"); + } + + /* close the byte stream */ + opj_stream_destroy(l_stream); +- fclose(l_file); + + if (this->m_Internal->m_Dinfo) + { +@@ -775,6 +726,6 @@ + } + +- for (int i = 0; i < parameters.numpocs; i++) ++ for (OPJ_UINT32 i = 0; i < parameters.numpocs; i++) + { + if (parameters.POC[i].prg == -1) + { +@@ -840,13 +791,13 @@ + + parameters.numresolution = numberOfResolutions; + +- OPJ_COLOR_SPACE color_space = CLRSPC_GRAY; ++ OPJ_COLOR_SPACE color_space = OPJ_CLRSPC_GRAY; + opj_image_cmptparm_t cmptparms[3]; + + if (this->GetNumberOfComponents() == 3) + { + +- color_space = (this->GetPixelType() == IOPixelEnum::RGB) ? CLRSPC_SRGB : CLRSPC_UNSPECIFIED; ++ color_space = (this->GetPixelType() == IOPixelEnum::RGB) ? OPJ_CLRSPC_SRGB : OPJ_CLRSPC_UNSPECIFIED; + + /* initialize image components */ + memset(&cmptparms[0], 0, 3 * sizeof(opj_image_cmptparm_t)); +@@ -864,7 +815,7 @@ + + if (this->GetNumberOfComponents() == 1) + { +- color_space = CLRSPC_GRAY; ++ color_space = OPJ_CLRSPC_GRAY; + + /* initialize image components */ + memset(&cmptparms[0], 0, sizeof(opj_image_cmptparm_t)); +@@ -941,8 +892,9 @@ + if (extension == ".j2k") + { +- cinfo = opj_create_compress(CODEC_J2K); ++ cinfo = opj_create_compress(OPJ_CODEC_J2K); + if (!cinfo) + { ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " + << this->GetFileName() << std::endl + << "Reason: opj_create_compress(CODEC_J2K) returns nullptr"); +@@ -950,9 +902,10 @@ + } + else if (extension == ".jp2") + { +- cinfo = opj_create_compress(CODEC_JP2); ++ cinfo = opj_create_compress(OPJ_CODEC_JP2); + if (!cinfo) + { ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " + << this->GetFileName() << std::endl + << "Reason: opj_create_compress(CODEC_JP2) returns nullptr"); +@@ -960,9 +913,10 @@ + } + else if (extension == ".jpt") + { +- cinfo = opj_create_compress(CODEC_JPT); ++ cinfo = opj_create_compress(OPJ_CODEC_JPT); + if (!cinfo) + { ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " + << this->GetFileName() << std::endl + << "Reason: opj_create_compress(CODEC_JPT) returns nullptr"); +@@ -970,6 +924,7 @@ + } + else + { ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " << this->GetFileName() << std::endl + << "Reason: unknown encode format: " << extension); + } +@@ -985,23 +940,19 @@ + + if (!opj_setup_encoder(cinfo, ¶meters, l_image)) + { ++ opj_destroy_codec(cinfo); ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " << this->GetFileName() << std::endl + << "Reason: opj_setup_encoder returns false"); + } + +- FILE * l_file = fopen(parameters.outfile, "wb"); +- if (!l_file) +- { +- itkExceptionMacro("JPEG2000ImageIO failed to open file for writing: " << this->GetFileName() << std::endl +- << "Reason: " +- << itksys::SystemTools::GetLastSystemError()); +- } +- + /* open a byte stream for writing */ + /* allocate memory for all tiles */ +- opj_stream_t * cio = opj_stream_create_default_file_stream(l_file, false); ++ opj_stream_t * cio = opj_stream_create_default_file_stream(parameters.outfile, false); + if (!cio) + { ++ opj_destroy_codec(cinfo); ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " + << this->GetFileName() << std::endl + << "Reason: " +@@ -1017,7 +968,8 @@ + if (!bSuccess) + { + opj_stream_destroy(cio); +- fclose(l_file); ++ opj_destroy_codec(cinfo); ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " << this->GetFileName() << std::endl + << "Reason: opj_start_compress returns false"); + } +@@ -1026,7 +978,8 @@ + if (!bSuccess) + { + opj_stream_destroy(cio); +- fclose(l_file); ++ opj_destroy_codec(cinfo); ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " << this->GetFileName() << std::endl + << "Reason: opj_encode returns false"); + } +@@ -1035,14 +988,14 @@ + if (!bSuccess) + { + opj_stream_destroy(cio); +- fclose(l_file); ++ opj_destroy_codec(cinfo); ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " << this->GetFileName() << std::endl + << "Reason: opj_end_compress returns false"); + } + + /* close and free the byte stream */ + opj_stream_destroy(cio); +- fclose(l_file); + + /* free remaining compression structures */ + opj_destroy_codec(cinfo); +--- a/Modules/Nonunit/Review/src/CMakeLists.txt ++++ b/Modules/Nonunit/Review/src/CMakeLists.txt +@@ -5,7 +5,7 @@ + + add_library(ITKReview ${ITKReview_SRC}) + itk_module_link_dependencies() +-target_link_libraries(ITKReview LINK_PUBLIC ${ITKTestKernel_LIBRARIES} ${ITKIOLSM_LIBRARIES} itkopenjpeg) ++target_link_libraries(ITKReview LINK_PUBLIC ${ITKTestKernel_LIBRARIES} ${ITKIOLSM_LIBRARIES} ${ITKOpenJPEG_LIBRARIES}) + itk_module_target(ITKReview) + + diff --git a/sci-libs/itk/files/itk-5.2.1-system-tiff-has-64.patch b/sci-libs/itk/files/itk-5.2.1-system-tiff-has-64.patch new file mode 100644 index 000000000..25c44db2c --- /dev/null +++ b/sci-libs/itk/files/itk-5.2.1-system-tiff-has-64.patch @@ -0,0 +1,18 @@ +From: François-Xavier Carton <fx.carton91@gmail.com> +Date: Wed, 8 Jun 2022 19:36:48 +0200 +Subject: [PATCH] system libtiff has INT64 + +Enabling this, otherwise using system libtiff leads to errors. In particular +tests fail because there is some IFD8 data but the itkTIFFDataSize function +returns 0 instead of 8, resulting in invalid mem access. + +--- a/Modules/ThirdParty/TIFF/src/itk_tiff.h.in.orig 2022-06-08 19:34:04.412431969 +0200 ++++ b/Modules/ThirdParty/TIFF/src/itk_tiff.h.in 2022-06-08 19:34:26.240431631 +0200 +@@ -34,6 +34,7 @@ + #cmakedefine ITK_TIFF_HAS_TIFFFieldReadCount + #cmakedefine ITK_TIFF_HAS_TIFFField + #ifdef ITK_USE_SYSTEM_TIFF ++# define TIFF_INT64_T int64_t + # include <tiffio.h> + #else + # include "itktiff/tiffio.h" diff --git a/sci-libs/itk/files/itk-5.2.1-upstream-fixes.patch b/sci-libs/itk/files/itk-5.2.1-upstream-fixes.patch new file mode 100644 index 000000000..2af8c4998 --- /dev/null +++ b/sci-libs/itk/files/itk-5.2.1-upstream-fixes.patch @@ -0,0 +1,309 @@ +https://github.com/InsightSoftwareConsortium/ITK/commit/2a7f5ed199926999b67f61a97c2c9a2595a11558.patch +https://github.com/InsightSoftwareConsortium/ITK/commit/0c31aa688e82a34e5430873bc6176740fd09ad75.patch +https://github.com/InsightSoftwareConsortium/ITK/commit/28325d921a9b8793e6aaefd612f53989f951d19c.patch +https://github.com/InsightSoftwareConsortium/ITK/commit/aafd1f9631d0fad60e1b6f53e049e95a50c48bd1.patch + +From 2a7f5ed199926999b67f61a97c2c9a2595a11558 Mon Sep 17 00:00:00 2001 +From: Niels Dekker <N.Dekker@lumc.nl> +Date: Thu, 24 Jun 2021 18:00:01 +0200 +Subject: [PATCH] COMP: Add missing `#include <iostream>` to Deprecated module + test + +Fixed a Visual C++ 2019 error, saying: + +> Deprecated\test\itkSimpleFastMutexLockTest.cxx(48,12): error C2039: 'cout': is not a member of 'std' +--- + .../Deprecated/test/itkSimpleFastMutexLockTest.cxx | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Modules/Compatibility/Deprecated/test/itkSimpleFastMutexLockTest.cxx b/Modules/Compatibility/Deprecated/test/itkSimpleFastMutexLockTest.cxx +index 11ad0c52700..60aa1c065b4 100644 +--- a/Modules/Compatibility/Deprecated/test/itkSimpleFastMutexLockTest.cxx ++++ b/Modules/Compatibility/Deprecated/test/itkSimpleFastMutexLockTest.cxx +@@ -19,6 +19,8 @@ + + #include "itkSimpleFastMutexLock.h" + ++#include <iostream> // For cout. ++ + + int + itkSimpleFastMutexLockTest(int, char *[]) +From 0c31aa688e82a34e5430873bc6176740fd09ad75 Mon Sep 17 00:00:00 2001 +From: Pablo Hernandez-Cerdan <pablo.hernandez.cerdan@outlook.com> +Date: Tue, 20 Apr 2021 17:21:21 +0200 +Subject: [PATCH] COMP: CastXML, ITKVtkGlue, include only when property exists + +Some targets (VTK libraries) didn't have the property INTERFACE_INCLUDE_DIRECTORIES + +```bash +CMake Error in Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt: + Found relative path while evaluating include directories of + "ITKVtkGluePython": + + "_vtk_lib_include_dirs-NOTFOUND" +``` + +Triggered when compiling Slicer with `Slicer_BUILD_ITKPython:BOOL=ON` +aka `ITK_WRAP_PYTHON:BOOL=ON`. + +Full error log with extra printing: + +```bash + +CMake Warning at Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt:3 (message): + ITKVtkGlue_VTK_LIBRARIES: + VTK::IOImage;VTK::ImagingSources;VTK::WrappingPythonCore;VTK::CommonCore;VTK::CommonDataModel;VTK::kwiml;VTK::CommonExecutionModel;VTK::RenderingOpenGL2;VTK::RenderingFreeType;VTK::InteractionStyle;VTK::InteractionWidgets + +CMake Warning at Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt:6 (message): + _vtk_lib_include_dirs: _vtk_lib_include_dirs-NOTFOUND + +CMake Warning at Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt:6 (message): + _vtk_lib_include_dirs: _vtk_lib_include_dirs-NOTFOUND + +CMake Warning at Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt:6 (message): + _vtk_lib_include_dirs: + build/VTK-build/Wrapping/PythonCore;build/VTK/Wrapping/PythonCore + +CMake Warning at Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt:6 (message): + _vtk_lib_include_dirs: _vtk_lib_include_dirs-NOTFOUND + +CMake Warning at Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt:6 (message): + _vtk_lib_include_dirs: _vtk_lib_include_dirs-NOTFOUND + +CMake Warning at Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt:6 (message): + _vtk_lib_include_dirs: + build/VTK-build/Utilities/KWIML;build/VTK/Utilities/KWIML + +CMake Warning at Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt:6 (message): + _vtk_lib_include_dirs: _vtk_lib_include_dirs-NOTFOUND + +CMake Warning at Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt:6 (message): + _vtk_lib_include_dirs: _vtk_lib_include_dirs-NOTFOUND + +CMake Warning at Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt:6 (message): + _vtk_lib_include_dirs: _vtk_lib_include_dirs-NOTFOUND + +CMake Warning at Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt:6 (message): + _vtk_lib_include_dirs: _vtk_lib_include_dirs-NOTFOUND + +CMake Warning at Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt:6 (message): + _vtk_lib_include_dirs: _vtk_lib_include_dirs-NOTFOUND + +-- ITKVtkGlue: Creating module. +-- ITKVtkGlue: Creating itkImageToVTKImageFilter submodule. +-- ITKVtkGlue: Creating itkVTKImageToImageFilter submodule. +-- ITKVtkGlue: Creating itkViewImage submodule. +-- MGHIO: Creating module. +-- MGHIO: Creating itkMGHImageIO submodule. +-- MorphologicalContourInterpolation: Creating module. +-- MorphologicalContourInterpolation: Creating itkMorphologicalContourInterpolator submodule. +-- ITKPyUtils: Creating module. +-- ITKPyUtils: Creating itkPyCommand submodule. +-- ITKPyUtils: Creating itkPyImageFilter submodule. +-- Configuring done +CMake Error: The following variables are used in this project, but they are set to NOTFOUND. +Please set them or make sure they are set and tested correctly in the CMake files: +_vtk_lib_include_dirs + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + used as include directory in directory build/ITK/Modules/Bridge/VtkGlue/wrapping + +CMake Error in Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt: + Found relative path while evaluating include directories of + "ITKVtkGluePython": + + "_vtk_lib_include_dirs-NOTFOUND" + +``` +--- + Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt b/Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt +index 3f3322957e1..2fd6a5af8f6 100644 +--- a/Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt ++++ b/Modules/Bridge/VtkGlue/wrapping/CMakeLists.txt +@@ -2,7 +2,9 @@ + if(NOT VTK_RENDERING_BACKEND STREQUAL "None") + foreach(_vtk_lib IN LISTS ITKVtkGlue_VTK_LIBRARIES) + get_target_property(_vtk_lib_include_dirs ${_vtk_lib} INTERFACE_INCLUDE_DIRECTORIES) +- include_directories(${_vtk_lib_include_dirs}) ++ if(_vtk_lib_include_dirs) ++ include_directories(${_vtk_lib_include_dirs}) ++ endif() + endforeach() + endif() + +From 28325d921a9b8793e6aaefd612f53989f951d19c Mon Sep 17 00:00:00 2001 +From: Butui Hu <hot123tea123@gmail.com> +Date: Mon, 1 Aug 2022 14:26:39 +0800 +Subject: [PATCH] COMP: use sysconfig.get_path as PEP 632 deprecate distutils + module + +--- + Wrapping/Generators/Python/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Wrapping/Generators/Python/CMakeLists.txt b/Wrapping/Generators/Python/CMakeLists.txt +index fca3d999b87..3b7a1d37334 100644 +--- a/Wrapping/Generators/Python/CMakeLists.txt ++++ b/Wrapping/Generators/Python/CMakeLists.txt +@@ -36,7 +36,7 @@ file(MAKE_DIRECTORY ${WRAPPER_MASTER_INDEX_OUTPUT_DIR}/python) + ############################################################################### + # Configure Python wrapping installation + if(Python3_EXECUTABLE AND NOT PY_SITE_PACKAGES_PATH) +- set(python_check "try:\n import distutils.sysconfig\n print(distutils.sysconfig.get_python_lib(plat_specific=1, prefix=''))\nexcept:\n pass") ++ set(python_check "try:\n import sysconfig\n print(sysconfig.get_path('platlib'))\nexcept:\n pass") + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/detect_site_package_path.py ${python_check}) + execute_process(COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_BINARY_DIR}/detect_site_package_path.py" + OUTPUT_VARIABLE py_spp +From aafd1f9631d0fad60e1b6f53e049e95a50c48bd1 Mon Sep 17 00:00:00 2001 +From: Hans Johnson <hans-johnson@uiowa.edu> +Date: Wed, 15 Dec 2021 08:10:58 -0600 +Subject: [PATCH] COMP: Remove inclusion of .hxx files as headers + +The ability to include either .h or .hxx files as +header files required recursively reading the +.h files twice. The added complexity is +unnecessary, costly, and can confuse static +analysis tools that monitor header guardes (due +to reaching the maximum depth of recursion +limits for nested #ifdefs in checking). + +Co-authored-by: Simon Rit <simon.rit@creatis.insa-lyon.fr> +--- + CMake/ITKModuleHeaderTest.cmake | 3 +-- + Utilities/Maintenance/BuildHeaderTest.py | 4 ---- + 2 files changed, 1 insertion(+), 6 deletions(-) + +diff --git a/CMake/ITKModuleHeaderTest.cmake b/CMake/ITKModuleHeaderTest.cmake +index eb809d7e93d..82ad192a6f8 100644 +--- a/CMake/ITKModuleHeaderTest.cmake ++++ b/CMake/ITKModuleHeaderTest.cmake +@@ -36,8 +36,7 @@ macro( itk_module_headertest _name ) + # effected. + set( _include ${${_name}_SOURCE_DIR}/include ) + file( GLOB _h_files ${_include}/*.h ) +- file( GLOB _hxx_files ${_include}/*.hxx ) +- set( _header_files ${_h_files} ${_hxx_files} ) ++ set( _header_files ${_h_files} ) + list( LENGTH _h_files _num_headers ) + set( _outputs ${${_name}_BINARY_DIR}/test/${_name}HeaderTest1.cxx ) + set( _test_num 1 ) +diff --git a/Utilities/Maintenance/BuildHeaderTest.py b/Utilities/Maintenance/BuildHeaderTest.py +index 26a4b6ccb3f..f8ed9f7901e 100755 +--- a/Utilities/Maintenance/BuildHeaderTest.py ++++ b/Utilities/Maintenance/BuildHeaderTest.py +@@ -130,15 +130,11 @@ def main(): + else: + max_idx = added_header_idx + maximum_number_of_headers + for i in range(added_header_idx, max_idx): +- # Use the .hxx if possible. +- hxx_file = h_files[i][:-1] + "hxx" + # Files that include VTK headers need to link to VTK. + if h_files[i] in BANNED_HEADERS or h_files[i].lower().find("vtk") != -1: + to_include = ( + '// #include "' + h_files[i] + '" // Banned in BuildHeaderTest.py\n' + ) +- elif os.path.exists(os.path.join(module_source_path, "include", hxx_file)): +- to_include = '#include "' + hxx_file + '"\n' + else: + to_include = '#include "' + h_files[i] + '"\n' + diff --git a/sci-libs/itk/files/itk-5.3.0-system-openjpeg.patch b/sci-libs/itk/files/itk-5.3.0-system-openjpeg.patch new file mode 100644 index 000000000..27f139553 --- /dev/null +++ b/sci-libs/itk/files/itk-5.3.0-system-openjpeg.patch @@ -0,0 +1,550 @@ +--- a/Modules/ThirdParty/OpenJPEG/CMakeLists.txt ++++ b/Modules/ThirdParty/OpenJPEG/CMakeLists.txt +@@ -1,16 +1,32 @@ + project(ITKOpenJPEG) + set(ITKOpenJPEG_THIRD_PARTY 1) + +-set(ITKOpenJPEG_INCLUDE_DIRS +- ${ITKOpenJPEG_BINARY_DIR}/src/openjpeg +- ${ITKOpenJPEG_SOURCE_DIR}/src/openjpeg +- ) +-set(ITKOpenJPEG_LIBRARIES itkopenjpeg) ++option(ITK_USE_SYSTEM_OPENJPEG "Use system-installed openjpeg" ${ITK_USE_SYSTEM_LIBRARIES}) ++mark_as_advanced(ITK_USE_SYSTEM_OPENJPEG) ++ ++if(ITK_USE_SYSTEM_OPENJPEG) ++ find_package(OpenJPEG REQUIRED) ++ set(ITKOpenJPEG_INCLUDE_DIRS ++ ${ITKOpenJPEG_BINARY_DIR}/src ++ ) ++ set(ITKOpenJPEG_SYSTEM_INCLUDE_DIRS ++ ${OPENJPEG_INCLUDE_DIRS} ++ ) ++ set(ITKOpenJPEG_LIBRARIES "${OPENJPEG_LIBRARIES}") ++ set(ITKOpenJPEG_NO_SRC 1) ++else() ++ set(ITKOpenJPEG_INCLUDE_DIRS ++ ${ITKOpenJPEG_BINARY_DIR}/src/openjpeg ++ ${ITKOpenJPEG_SOURCE_DIR}/src/openjpeg ++ ) ++ set(ITKOpenJPEG_LIBRARIES itkopenjpeg) ++endif() ++ ++configure_file(src/itk_openjpeg.h.in src/itk_openjpeg.h) + set(ITK_LIBRARY_PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS FALSE) +- + itk_module_impl() + +-install(FILES ${ITKOpenJPEG_SOURCE_DIR}/src/itk_openjpeg.h ++install(FILES ${ITKOpenJPEG_BINARY_DIR}/src/itk_openjpeg.h + DESTINATION ${ITKOpenJPEG_INSTALL_INCLUDE_DIR} + COMPONENT Development + ) +diff --git a/Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h b/Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h.in +rename from Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h +rename to Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h.in +--- a/Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h ++++ b/Modules/ThirdParty/OpenJPEG/src/itk_openjpeg.h.in +@@ -25,6 +25,12 @@ + #ifndef itk_openjpeg_h + #define itk_openjpeg_h + +-#include <itkopenjpeg/openjpeg.h> ++/* Use the openjpeg library configured for ITK. */ ++#cmakedefine ITK_USE_SYSTEM_OPENJPEG ++#ifdef ITK_USE_SYSTEM_OPENJPEG ++# include <openjpeg.h> ++#else ++# include <itkopenjpeg/openjpeg.h> ++#endif + + #endif +--- a/Modules/IO/JPEG2000/src/itkJPEG2000ImageIO.cxx ++++ b/Modules/IO/JPEG2000/src/itkJPEG2000ImageIO.cxx +@@ -27,8 +27,6 @@ + extern "C" + { + #include "openjpeg.h" +-#include "j2k.h" +-#include "jp2.h" + } + + +@@ -139,11 +137,11 @@ + { + itkDebugMacro(<< "ReadImageInformation()"); + +- FILE * l_file = fopen(this->m_FileName.c_str(), "rb"); +- +- /* decompression parameters */ ++ /* set decoding parameters to default values */ ++ opj_set_default_decoder_parameters(&(this->m_Internal->m_DecompressionParameters)); + +- if (!l_file) ++ opj_stream_t * cio = opj_stream_create_default_file_stream(this->m_FileName.c_str(), true); ++ if (!cio) + { + itkExceptionMacro("JPEG2000ImageIO failed to open file for reading: " << this->GetFileName() << std::endl + << "Reason: " +@@ -151,10 +149,5 @@ + } + +- /* set decoding parameters to default values */ +- opj_set_default_decoder_parameters(&(this->m_Internal->m_DecompressionParameters)); +- +- opj_stream_t * cio = opj_stream_create_default_file_stream(l_file, true); +- + this->m_Internal->m_Dinfo = nullptr; /* handle to a decompressor */ + + opj_image_t * l_image = nullptr; +@@ -188,9 +181,8 @@ + + /* get a decoder handle */ +- this->m_Internal->m_Dinfo = opj_create_decompress(CODEC_J2K); ++ this->m_Internal->m_Dinfo = opj_create_decompress(OPJ_CODEC_J2K); + if (!this->m_Internal->m_Dinfo) + { + opj_stream_destroy(cio); +- fclose(l_file); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl +@@ -202,10 +194,9 @@ + { + /* JPEG 2000 compressed image data */ + /* get a decoder handle */ +- this->m_Internal->m_Dinfo = opj_create_decompress(CODEC_JP2); ++ this->m_Internal->m_Dinfo = opj_create_decompress(OPJ_CODEC_JP2); + if (!this->m_Internal->m_Dinfo) + { + opj_stream_destroy(cio); +- fclose(l_file); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl +@@ -217,10 +208,9 @@ + { + /* JPEG 2000, JPIP */ + /* get a decoder handle */ +- this->m_Internal->m_Dinfo = opj_create_decompress(CODEC_JPT); ++ this->m_Internal->m_Dinfo = opj_create_decompress(OPJ_CODEC_JPT); + if (!this->m_Internal->m_Dinfo) + { + opj_stream_destroy(cio); +- fclose(l_file); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl +@@ -230,7 +220,6 @@ + } + default: + opj_stream_destroy(cio); +- fclose(l_file); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl + << "Reason: " +@@ -248,26 +237,8 @@ + } + +- // Image parameters - first tile +- OPJ_INT32 l_tile_x0; +- OPJ_INT32 l_tile_y0; +- +- // Image parameters - tile width, height and number of tiles +- OPJ_UINT32 l_tile_width; +- OPJ_UINT32 l_tile_height; +- OPJ_UINT32 l_nb_tiles_x; +- OPJ_UINT32 l_nb_tiles_y; +- + itkDebugMacro(<< "Trying to read header now..."); + +- bResult = opj_read_header(this->m_Internal->m_Dinfo, +- &l_image, +- &l_tile_x0, +- &l_tile_y0, +- &l_tile_width, +- &l_tile_height, +- &l_nb_tiles_x, +- &l_nb_tiles_y, +- cio); ++ bResult = opj_read_header(cio, this->m_Internal->m_Dinfo, &l_image); + + if (!bResult) + { +@@ -284,13 +255,21 @@ + } + +- this->m_Internal->m_TileStartX = l_tile_x0; +- this->m_Internal->m_TileStartY = l_tile_y0; ++ opj_codestream_info_v2_t* cp = opj_get_cstr_info(this->m_Internal->m_Dinfo); ++ if (!cp) ++ { ++ opj_stream_destroy(cio); ++ opj_image_destroy(l_image); ++ itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl ++ << "Reason: Error while reading image header"); ++ } ++ this->m_Internal->m_TileStartX = cp->tx0; ++ this->m_Internal->m_TileStartY = cp->ty0; + +- this->m_Internal->m_TileWidth = l_tile_width; +- this->m_Internal->m_TileHeight = l_tile_height; ++ this->m_Internal->m_TileWidth = cp->tdx; ++ this->m_Internal->m_TileHeight = cp->tdy; + +- this->m_Internal->m_NumberOfTilesInX = l_nb_tiles_x; +- this->m_Internal->m_NumberOfTilesInY = l_nb_tiles_y; ++ this->m_Internal->m_NumberOfTilesInX = cp->tw; ++ this->m_Internal->m_NumberOfTilesInY = cp->th; + + + itkDebugMacro(<< "Number of Components = " << l_image->numcomps); +@@ -307,6 +286,7 @@ + else + { + opj_stream_destroy(cio); ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl + << "Reason: " + << "Unknown precision in file: " +@@ -320,6 +300,6 @@ + break; + case 3: +- if (l_image->color_space != CLRSPC_SRGB) ++ if (l_image->color_space != OPJ_CLRSPC_SRGB) + { + itkWarningMacro(<< "file does not specify color space, assuming sRGB"); + } +@@ -349,7 +329,6 @@ + + /* close the byte stream */ + opj_stream_destroy(cio); +- fclose(l_file); + + if (this->m_Internal->m_Dinfo) + { +@@ -368,16 +347,7 @@ + { + itkDebugMacro(<< "JPEG2000ImageIO::Read() Begin"); + +- FILE * l_file = fopen(this->m_FileName.c_str(), "rb"); +- +- if (!l_file) +- { +- itkExceptionMacro("JPEG2000ImageIO failed to open file for reading: " << this->GetFileName() << std::endl +- << "Reason: " +- << itksys::SystemTools::GetLastSystemError()); +- } +- +- opj_stream_t * l_stream = opj_stream_create_default_file_stream(l_file, true); ++ opj_stream_t * l_stream = opj_stream_create_default_file_stream(this->m_FileName.c_str(), true); + if (!l_stream) + { + itkExceptionMacro("JPEG2000ImageIO failed to read file: " +@@ -397,9 +367,10 @@ + { + /* JPEG-2000 codestream */ + /* get a decoder handle */ +- this->m_Internal->m_Dinfo = opj_create_decompress(CODEC_J2K); ++ this->m_Internal->m_Dinfo = opj_create_decompress(OPJ_CODEC_J2K); + if (!this->m_Internal->m_Dinfo) + { ++ opj_stream_destroy(l_stream); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl + << "Reason: opj_create_decompress(CODEC_J2K) returns nullptr"); +@@ -410,9 +381,10 @@ + { + /* JPEG 2000 compressed image data */ + /* get a decoder handle */ +- this->m_Internal->m_Dinfo = opj_create_decompress(CODEC_JP2); ++ this->m_Internal->m_Dinfo = opj_create_decompress(OPJ_CODEC_JP2); + if (!this->m_Internal->m_Dinfo) + { ++ opj_stream_destroy(l_stream); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl + << "Reason: opj_create_decompress(CODEC_JP2) returns nullptr"); +@@ -423,9 +395,10 @@ + { + /* JPEG 2000, JPIP */ + /* get a decoder handle */ +- this->m_Internal->m_Dinfo = opj_create_decompress(CODEC_JPT); ++ this->m_Internal->m_Dinfo = opj_create_decompress(OPJ_CODEC_JPT); + if (!this->m_Internal->m_Dinfo) + { ++ opj_stream_destroy(l_stream); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl + << "Reason: opj_create_decompress(CODEC_JPT) returns nullptr"); +@@ -433,7 +406,7 @@ + break; + } + default: +- fclose(l_file); ++ opj_stream_destroy(l_stream); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " + << this->GetFileName() << std::endl + << "Reason: " +@@ -445,32 +418,17 @@ + if (!opj_setup_decoder(this->m_Internal->m_Dinfo, &(this->m_Internal->m_DecompressionParameters))) + { ++ opj_stream_destroy(l_stream); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl + << "Reason: opj_setup_decoder returns false"); + } + +- OPJ_INT32 l_tile_x0, l_tile_y0; +- +- OPJ_UINT32 l_tile_width; +- OPJ_UINT32 l_tile_height; +- OPJ_UINT32 l_nb_tiles_x; +- OPJ_UINT32 l_nb_tiles_y; +- +- bool bResult = opj_read_header(this->m_Internal->m_Dinfo, +- &l_image, +- &l_tile_x0, +- &l_tile_y0, +- &l_tile_width, +- &l_tile_height, +- &l_nb_tiles_x, +- &l_nb_tiles_y, +- l_stream); ++ bool bResult = opj_read_header(l_stream, this->m_Internal->m_Dinfo, &l_image); + + if (!bResult) + { + opj_destroy_codec(this->m_Internal->m_Dinfo); + this->m_Internal->m_Dinfo = nullptr; + opj_stream_destroy(l_stream); +- fclose(l_file); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl + << "Reason: opj_read_header returns false"); + } +@@ -499,7 +457,7 @@ + itkDebugMacro(<< "p_end_x = " << p_end_x); + itkDebugMacro(<< "p_end_y = " << p_end_y); + +- bResult = opj_set_decode_area(this->m_Internal->m_Dinfo, p_start_x, p_start_y, p_end_x, p_end_y); ++ bResult = opj_set_decode_area(this->m_Internal->m_Dinfo, l_image, p_start_x, p_start_y, p_end_x, p_end_y); + + itkDebugMacro(<< "opj_set_decode_area() after"); + +@@ -509,6 +467,5 @@ + this->m_Internal->m_Dinfo = nullptr; + opj_stream_destroy(l_stream); +- fclose(l_file); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl + << "Reason: opj_set_decode_area returns false"); + } +@@ -525,13 +482,14 @@ + + OPJ_UINT32 l_max_data_size = 1000; + +- bool l_go_on = true; ++ OPJ_BOOL l_go_on = true; + + auto * l_data = (OPJ_BYTE *)malloc(1000); + + while (l_go_on) + { + bool tileHeaderRead = opj_read_tile_header(this->m_Internal->m_Dinfo, ++ l_stream, + &l_tile_index, + &l_data_size, + &l_current_tile_x0, +@@ -540,13 +498,11 @@ + &l_current_tile_y1, + &l_nb_comps, +- &l_go_on, +- l_stream); ++ &l_go_on); + + if (!tileHeaderRead) + { + free(l_data); + opj_stream_destroy(l_stream); +- fclose(l_file); + opj_destroy_codec(this->m_Internal->m_Dinfo); + opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl +@@ -571,7 +527,6 @@ + if (!l_data) + { + opj_stream_destroy(l_stream); +- fclose(l_file); + opj_destroy_codec(this->m_Internal->m_Dinfo); + opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl +@@ -590,7 +545,6 @@ + { + free(l_data); + opj_stream_destroy(l_stream); +- fclose(l_file); + opj_destroy_codec(this->m_Internal->m_Dinfo); + opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl +@@ -654,7 +608,6 @@ + { + free(l_data); + opj_stream_destroy(l_stream); +- fclose(l_file); + opj_destroy_codec(this->m_Internal->m_Dinfo); + opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl +@@ -667,13 +620,11 @@ + this->m_Internal->m_Dinfo = nullptr; + opj_stream_destroy(l_stream); +- fclose(l_file); + itkExceptionMacro("JPEG2000ImageIO failed to read file: " << this->GetFileName() << std::endl + << "Reason: error whle reading image"); + } + + /* close the byte stream */ + opj_stream_destroy(l_stream); +- fclose(l_file); + + if (this->m_Internal->m_Dinfo) + { +@@ -840,13 +791,13 @@ + + parameters.numresolution = numberOfResolutions; + +- OPJ_COLOR_SPACE color_space = CLRSPC_GRAY; ++ OPJ_COLOR_SPACE color_space = OPJ_CLRSPC_GRAY; + opj_image_cmptparm_t cmptparms[3]; + + if (this->GetNumberOfComponents() == 3) + { + +- color_space = (this->GetPixelType() == IOPixelEnum::RGB) ? CLRSPC_SRGB : CLRSPC_UNSPECIFIED; ++ color_space = (this->GetPixelType() == IOPixelEnum::RGB) ? OPJ_CLRSPC_SRGB : OPJ_CLRSPC_UNSPECIFIED; + + /* initialize image components */ + memset(&cmptparms[0], 0, 3 * sizeof(opj_image_cmptparm_t)); +@@ -864,7 +815,7 @@ + + if (this->GetNumberOfComponents() == 1) + { +- color_space = CLRSPC_GRAY; ++ color_space = OPJ_CLRSPC_GRAY; + + /* initialize image components */ + memset(&cmptparms[0], 0, sizeof(opj_image_cmptparm_t)); +@@ -941,8 +892,9 @@ + if (extension == ".j2k") + { +- cinfo = opj_create_compress(CODEC_J2K); ++ cinfo = opj_create_compress(OPJ_CODEC_J2K); + if (!cinfo) + { ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " + << this->GetFileName() << std::endl + << "Reason: opj_create_compress(CODEC_J2K) returns nullptr"); +@@ -950,9 +902,10 @@ + } + else if (extension == ".jp2") + { +- cinfo = opj_create_compress(CODEC_JP2); ++ cinfo = opj_create_compress(OPJ_CODEC_JP2); + if (!cinfo) + { ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " + << this->GetFileName() << std::endl + << "Reason: opj_create_compress(CODEC_JP2) returns nullptr"); +@@ -960,9 +913,10 @@ + } + else if (extension == ".jpt") + { +- cinfo = opj_create_compress(CODEC_JPT); ++ cinfo = opj_create_compress(OPJ_CODEC_JPT); + if (!cinfo) + { ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " + << this->GetFileName() << std::endl + << "Reason: opj_create_compress(CODEC_JPT) returns nullptr"); +@@ -970,6 +924,7 @@ + } + else + { ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " << this->GetFileName() << std::endl + << "Reason: unknown encode format: " << extension); + } +@@ -985,23 +940,19 @@ + + if (!opj_setup_encoder(cinfo, ¶meters, l_image)) + { ++ opj_destroy_codec(cinfo); ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " << this->GetFileName() << std::endl + << "Reason: opj_setup_encoder returns false"); + } + +- FILE * l_file = fopen(parameters.outfile, "wb"); +- if (!l_file) +- { +- itkExceptionMacro("JPEG2000ImageIO failed to open file for writing: " << this->GetFileName() << std::endl +- << "Reason: " +- << itksys::SystemTools::GetLastSystemError()); +- } +- + /* open a byte stream for writing */ + /* allocate memory for all tiles */ +- opj_stream_t * cio = opj_stream_create_default_file_stream(l_file, false); ++ opj_stream_t * cio = opj_stream_create_default_file_stream(parameters.outfile, false); + if (!cio) + { ++ opj_destroy_codec(cinfo); ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " + << this->GetFileName() << std::endl + << "Reason: " +@@ -1017,7 +968,8 @@ + if (!bSuccess) + { + opj_stream_destroy(cio); +- fclose(l_file); ++ opj_destroy_codec(cinfo); ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " << this->GetFileName() << std::endl + << "Reason: opj_start_compress returns false"); + } +@@ -1026,7 +978,8 @@ + if (!bSuccess) + { + opj_stream_destroy(cio); +- fclose(l_file); ++ opj_destroy_codec(cinfo); ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " << this->GetFileName() << std::endl + << "Reason: opj_encode returns false"); + } +@@ -1035,14 +988,14 @@ + if (!bSuccess) + { + opj_stream_destroy(cio); +- fclose(l_file); ++ opj_destroy_codec(cinfo); ++ opj_image_destroy(l_image); + itkExceptionMacro("JPEG2000ImageIO failed to write file: " << this->GetFileName() << std::endl + << "Reason: opj_end_compress returns false"); + } + + /* close and free the byte stream */ + opj_stream_destroy(cio); +- fclose(l_file); + + /* free remaining compression structures */ + opj_destroy_codec(cinfo); +--- a/Modules/Nonunit/Review/src/CMakeLists.txt ++++ b/Modules/Nonunit/Review/src/CMakeLists.txt +@@ -5,7 +5,7 @@ + + add_library(ITKReview ${ITKReview_SRC}) + itk_module_link_dependencies() +-target_link_libraries(ITKReview LINK_PUBLIC ${ITKTestKernel_LIBRARIES} ${ITKIOLSM_LIBRARIES} itkopenjpeg) ++target_link_libraries(ITKReview LINK_PUBLIC ${ITKTestKernel_LIBRARIES} ${ITKIOLSM_LIBRARIES} ${ITKOpenJPEG_LIBRARIES}) + itk_module_target(ITKReview) + + diff --git a/sci-libs/itk/files/itk-5.3.0-uint8.patch b/sci-libs/itk/files/itk-5.3.0-uint8.patch new file mode 100644 index 000000000..724314574 --- /dev/null +++ b/sci-libs/itk/files/itk-5.3.0-uint8.patch @@ -0,0 +1,10 @@ +--- a/Modules/Filtering/MathematicalMorphology/include/itkMathematicalMorphologyEnums.h ++++ b/Modules/Filtering/MathematicalMorphology/include/itkMathematicalMorphologyEnums.h +@@ -20,6 +20,7 @@ + + #include <iostream> + #include "ITKMathematicalMorphologyExport.h" ++#include <cstdint> + + + namespace itk diff --git a/sci-libs/itk/files/nrrdio-linking.patch b/sci-libs/itk/files/nrrdio-linking.patch deleted file mode 100644 index a549650d2..000000000 --- a/sci-libs/itk/files/nrrdio-linking.patch +++ /dev/null @@ -1,15 +0,0 @@ -Description: Link libITKNrrdIO with -lm (needed for sqrt) -Author: Steve Robbins <smr@debian.org> -Forwarded: no - ---- insighttoolkit4-4.5.0.orig/Modules/ThirdParty/NrrdIO/src/NrrdIO/CMakeLists.txt -+++ insighttoolkit4-4.5.0/Modules/ThirdParty/NrrdIO/src/NrrdIO/CMakeLists.txt -@@ -64,7 +64,7 @@ - ADD_DEFINITIONS(-DTEEM_ZLIB=1) - - ADD_LIBRARY(ITKNrrdIO ${nrrdio_SRCS} ) --TARGET_LINK_LIBRARIES(ITKNrrdIO ${ITKZLIB_LIBRARIES}) -+TARGET_LINK_LIBRARIES(ITKNrrdIO ${ITKZLIB_LIBRARIES} -lm) - - IF(ITK_LIBRARY_PROPERTIES) - SET_TARGET_PROPERTIES(ITKNrrdIO PROPERTIES ${ITK_LIBRARY_PROPERTIES}) diff --git a/sci-libs/itk/files/tests.patch b/sci-libs/itk/files/tests.patch deleted file mode 100644 index c24714e4d..000000000 --- a/sci-libs/itk/files/tests.patch +++ /dev/null @@ -1,41 +0,0 @@ -Known to fail by upstream: -https://github.com/InsightSoftwareConsortium/ITK/issues/1212#issuecomment-527998115 - ---- a/Modules/Bridge/VtkGlue/test/CMakeLists.txt 2019-09-09 00:45:14.736032139 +0200 -+++ b/Modules/Bridge/VtkGlue/test/CMakeLists.txt 2019-09-09 00:49:42.183935497 +0200 -@@ -7,8 +7,6 @@ - if(NOT VTK_RENDERING_BACKEND STREQUAL "None") - list(APPEND ITKVtkGlueTests - itkVtkMedianFilterTest.cxx -- itkVtkConnectedComponentImageFilterTest.cxx -- QuickViewTest.cxx - # ### runViewImage ### - # No test generated. Use it for view images (2D or 3D) with: - # ITKVtkGlueTestDriver runViewImage image_file -@@ -40,26 +38,3 @@ - NAME itkVTKImageToImageFilterTest - COMMAND ITKVtkGlueTestDriver - itkVTKImageToImageFilterTest) -- --if(NOT VTK_RENDERING_BACKEND STREQUAL "None") -- itk_add_test( -- NAME itkVtkMedianImageFilterTest -- COMMAND ITKVtkGlueTestDriver -- itkVtkMedianFilterTest DATA{${ITK_DATA_ROOT}/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{${ITK_DATA_ROOT}/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{${ITK_DATA_ROOT}/Input/cthead1.png}) -- set_property(TEST itkVtkConnectedComponentImageFilterTest APPEND PROPERTY LABELS REQUIRES_DISPLAY) --endif() |