Skip to content

Commit

Permalink
feat(dcmtk): add ITKDCMTK to image-io pipelines
Browse files Browse the repository at this point in the history
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 <csetjmp> 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
  • Loading branch information
jadh4v committed Aug 24, 2022
1 parent 00f8815 commit 820bccc
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/docker/itk-wasm-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand All @@ -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 && \
Expand Down

0 comments on commit 820bccc

Please sign in to comment.