From 820bccc1dd842230cf164e34b9699e1695495c91 Mon Sep 17 00:00:00 2001 From: Shreeraj Jadhav Date: Tue, 2 Aug 2022 12:36:10 -0400 Subject: [PATCH] feat(dcmtk): add ITKDCMTK to image-io pipelines Enable building of ITKDCMTK in ITK-C++ for supporting DCMTK related operations. We do NOT include ITKIODCMTK currently, since it links with dcmjpeg and other libraries that are not essential for structured reports. Additionally, WASI compiler doesn't support C++ header csetjmp which is used in dcmjpeg for calling functions such as setjmp() and longjmp(). Add options to Dockerfile to enable flags for DCMTK. Enable relevant flags for DCMTK building with emscripten and wasi. In particular: DCMTK_WITH_THREADS -> OFF, pthreads are not supported by emscripten/wasi DCMTK_BUILD_APPS -> ON, we need the cmd line apps like dsr2html. DNO_FLOAT_EXCEPTIONS -> ON, newly created flag to tell DCMTK to avoid using floating point exception macros when build with emscripten or wasi. Update git tags for ITK and DCMTK branches. Include fixes for ITK: $ git shortlog 7e35b64..afd7a44 Shreeraj Jadhav (4): COMP: provide option to disable use of float exception macros COMP: wasi doesn't support pthread COMP: enable minimal number of DCMTK libs for dcmsr COMP: enable DCMTK build apps Include fixes for DCMTK: $ git shortlog cba5794f..66fce682 Matt McCormick (2): Support the generation of arith.h with Emscription WIP: Do not use non-type template argument -1 in variadic template Shreeraj Jadhav (9): COMP: Remove floating point exceptions for emscripten COMP: fix missing header issue COMP: setjmp header required for emscripten COMP: use NO_FLOAT_EXCEPTIONS in place of __EMSCRIPTEN__ COMP: fix WASI compiler errors COMP: disable unneeded tests and apps COMP: Enable dcm2pdf, fix WIN32 build COMP: add fixes for Emscripten linker errors COMP: disable use of log4cplus::tistringstream --- src/docker/itk-wasm-base/Dockerfile | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/docker/itk-wasm-base/Dockerfile b/src/docker/itk-wasm-base/Dockerfile index c33f9310f..323e01207 100644 --- a/src/docker/itk-wasm-base/Dockerfile +++ b/src/docker/itk-wasm-base/Dockerfile @@ -7,14 +7,23 @@ LABEL org.opencontainers.image.source="https://github.com/InsightSoftwareConsort WORKDIR / -# 2022-07-02 master branch -ENV ITK_GIT_TAG 7e35b6443f7bec2aa74d439d066881971f5590db -RUN git clone https://github.com/thewtex/ITK.git && \ +# 2022-07-02 branch: ITKWASM-2022-07-02-5e7aea9 +ENV ITK_GIT_TAG afd7a44bd42cb56edb8fcd67bd0f5ecaa2e0f3db +RUN git clone https://github.com/KitwareMedical/ITK.git && \ cd ITK && \ git checkout ${ITK_GIT_TAG} && \ cd ../ && \ sed -i -e '/^option(OPJ_USE_THREAD/c\option(OPJ_USE_THREAD "use threads" OFF)' \ /ITK/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmopenjpeg/src/lib/openjp2/CMakeLists.txt + +# Modify CMake variable to use patched DCMTK library +# GIT_TAG refers to DCMTK branch: 20220802_DCMTK_PATCHES_FOR_ITK-wasm +RUN sed -i -e '/^set(DCMTK_GIT_REPOSITORY/c\set(DCMTK_GIT_REPOSITORY "https://github.com/InsightSoftwareConsortium/DCMTK.git")' \ + /ITK/Modules/ThirdParty/DCMTK/DCMTKGitTag.cmake + +RUN sed -i -e '/^set(DCMTK_GIT_TAG/c\set(DCMTK_GIT_TAG "66fce6822afb16bcfd926ac8a5f4ed8d7cd10981")' \ + /ITK/Modules/ThirdParty/DCMTK/DCMTKGitTag.cmake + ARG CMAKE_BUILD_TYPE=Release ARG LDFLAGS @@ -43,6 +52,7 @@ RUN mkdir ITK-build && \ -DModule_IOMeshSWC:BOOL=ON \ -DModule_IOScanco:BOOL=ON \ -DModule_IOFDF:BOOL=ON \ + -DModule_ITKDCMTK:BOOL=ON \ -DModule_ITKImageFunction:BOOL=ON \ -DModule_SmoothingRecursiveYvvGaussianFilter:BOOL=ON \ -DModule_MorphologicalContourInterpolation:BOOL=ON \ @@ -52,6 +62,9 @@ RUN mkdir ITK-build && \ -DModule_GenericLabelInterpolator:BOOL=ON \ -DDO_NOT_BUILD_ITK_TEST_DRIVER:BOOL=ON \ -DOPJ_USE_THREAD:BOOL=OFF \ + -DDCMTK_WITH_THREADS:BOOL=OFF \ + -DDCMTK_BUILD_APPS:BOOL=ON \ + -DNO_FLOAT_EXCEPTIONS:BOOL=ON \ ../ITK && \ ninja && \ find . -name '*.o' -delete && \