158.9. dcmtk-3.7.0
The OFFIS DICOM toolkit — medical image conversion, network storage and query tools
| Version | 3.7.0, release 2 |
| Shelf | bioscience — Bioinformatics, chemistry and medical informatics or imaging |
| Phase | 41_system (System), 217 of 1047 in build order |
| Licence | BSD-3-Clause |
| Homepage | https://dicom.offis.de/dcmtk |
| Build time | 16.5 SBU |
| Installed size | 63.6 MiB in 1403 files |
| Recipe | ports/core/bioscience/dcmtk/kpkgbuild |
About
DCMTK is the OFFIS DICOM toolkit: the libraries and command-line tools that read, write and convert DICOM, the file format and network protocol of medical imaging. dcmdump prints a file’s data set, dcm2img turns a DICOM image into PNM, BMP, PNG, TIFF, JPEG or JPEG-LS (the deprecated dcm2pnm and dcmj2pnm it supersedes are still installed), img2dcm wraps an ordinary image as DICOM, dcm2json and dcm2xml export the header, and storescu, storescp and findscu send, receive and query images on a PACS over the DICOM network protocol, with TLS from openssl. The port installs the shared libraries and DCMTK’s CMake package, so a program can be built against it.
Sources
dcmtk-3.7.0.tar.gz(9.3 MiB)
sha256f103df876040a4f904f01d2464f7868b4feb659d8cd3f46a5f1f61aa440be415
upstream: https://dicom.offis.de/download/dcmtk/dcmtk370/dcmtk-3.7.0.tar.gz
archive copy: sources-1/bioscience--dcmtk-3.7.0.tar.gz
Dependencies
Depends on: cmake, ninja, zlib, libpng, libtiff, libxml2, openjpeg, openssl.
Required by: no port names it.
Optional, off in KDOS
These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.
-DDCMTK_WITH_SNDFILE=OFF, line 36: libsndfile (explained with the switches below)
Patches
build.sh applies these; kpkg applies nothing by itself.
dont-export-executables.patch— Debian’s patch: it takes the tools out of DCMTK’s exported CMake targets, soDCMTKTargets.cmakenames only libraries and a consumer’sfind_package(DCMTK)does not check for tool files.openssl4.patch— Builds the signature module (dcmsign) against OpenSSL 4, whereASN1_STRINGis opaque: it reads strings throughASN1_STRING_type(),ASN1_STRING_length()andASN1_STRING_get0_data(), sets the time-stamp nonce withASN1_STRING_set(), checks a certificate’s validity period withX509_check_certificate_times()when CMake finds that function, and casts away theconston the extension pointerTS_TST_INFO_get_ext()returns.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install dcmtk'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/bioscience/dcmtk.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/bioscience/dcmtk
echo 'f103df876040a4f904f01d2464f7868b4feb659d8cd3f46a5f1f61aa440be415 dcmtk-3.7.0.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/dcmtk
SRC=$SRC_ROOT/dcmtk-3.7.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf dcmtk-3.7.0.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/dont-export-executables.patch"
patch -p1 -i "$PORT_SRC/openssl4.patch"
cmake -B build -G Ninja \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DBUILD_SHARED_LIBS=ON \
-DDCMTK_ENABLE_LFS=lfs \
-DDCMTK_ENABLE_STL=ON \
-DDCMTK_ENABLE_PRIVATE_TAGS=ON \
-DDCMTK_ENABLE_MANPAGES=ON \
-DDCMTK_ENABLE_CHARSET_CONVERSION=oficonv \
-DDCMTK_WITH_OPENSSL=ON \
-DDCMTK_WITH_OPENJPEG=ON \
-DDCMTK_WITH_PNG=ON \
-DDCMTK_WITH_TIFF=ON \
-DDCMTK_WITH_XML=ON \
-DDCMTK_WITH_ZLIB=ON \
-DDCMTK_WITH_THREADS=ON \
-DDCMTK_WITH_ICONV=OFF \
-DDCMTK_WITH_SNDFILE=OFF \
-DDCMTK_WITH_WRAP=OFF \
-DDCMTK_WITH_DOXYGEN=OFF
cmake --build build
DESTDIR=$PKG cmake --install build
rm -rf "$PKG/usr/share/doc"
rm -f "$PKG/usr/share/dcmtk-$version/SC.dump" "$PKG/usr/share/dcmtk-$version/VLP.dump"
The switches, and why each is set:
-DDCMTK_ENABLE_LFS=lfs— Use large-file support through the plainoff_tinterfaces. Left to detect it, DCMTK’s CMake code first tries the explicit*64interfaces with-D_LARGEFILE64_SOURCEand takes them when they compile. musl’soff_tis 64 bits already, and its headers declarestat64,off64_tand the rest only as aliases under_LARGEFILE64_SOURCE, so the*64path gains nothing and leans on names musl keeps for compatibility alone.-DDCMTK_ENABLE_STL=ON— Use the C++ standard library’s containers, strings and algorithms instead of DCMTK’s own replacements for them. Upstream’s default is off.-DDCMTK_ENABLE_PRIVATE_TAGS=ON— Build in the dictionary of vendors’ private DICOM tags that DCMTK ships. Upstream’s default is off.-DDCMTK_ENABLE_MANPAGES=ON,-DDCMTK_WITH_DOXYGEN=OFF— Install the manual page of every tool, and generate no API reference with Doxygen.-DDCMTK_ENABLE_CHARSET_CONVERSION=oficonv,-DDCMTK_WITH_ICONV=OFF— Convert between DICOM’s character sets with oficonv, the module built into DCMTK from FreeBSD’s Citrus iconv code, which DCMTK’sINSTALLrecommends over a C library’s iconv, and do not look for libiconv or the C library’s iconv at all.-DDCMTK_WITH_OPENSSL=ON,-DDCMTK_WITH_OPENJPEG=ON,-DDCMTK_WITH_PNG=ON,-DDCMTK_WITH_TIFF=ON,-DDCMTK_WITH_XML=ON,-DDCMTK_WITH_ZLIB=ON— TLS and the signature module from openssl, JPEG 2000 from openjpeg, PNG and TIFF output from libpng and libtiff, XML from libxml2 and deflated transfer syntaxes from zlib.-DDCMTK_WITH_THREADS=ON— Build DCMTK’s multi-threading support, with its code compiled reentrant.-DDCMTK_WITH_SNDFILE=OFF— No libsndfile, upstream’s default written out. No source file includessndfile.hor reads theWITH_SNDFILEdefine the switch sets; on, it would only addsndfileto theRequires.privateof DCMTK’s pkg-config file.-DDCMTK_WITH_WRAP=OFF— No TCP wrappers access control for the network servers. libwrap is not in the tree.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/dcmtk, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf dcmtk-3.7.0-2.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/dcmtk, and runs the triggers its paths call for.
Contents
Installed programs: cda2dcm, dcm2cda, dcm2img, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmicmp, dcmj2pnm, dcml2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmodify, dcmp2pgm, dcmprscp, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmpsrcv, dcmpssnd, dcmqridx, dcmqrscp, dcmqrti, dcmquant, dcmrecv, dcmscale, dcmsend, dcmsign, dcod2lum, dconvlum, drtdump, dsr2html, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, mkcsmapper, mkesdb, movescu, pdf2dcm, stl2dcm, storescp, storescu, termscu, wlmscpfs, xml2dcm, xml2dsr.
Installed libraries: libcmr.so, libdcmdata.so, libdcmdsig.so, libdcmect.so, libdcmfg.so, libdcmimage.so, libdcmimgle.so, libdcmiod.so, libdcmjpeg.so, libdcmjpls.so, libdcmnet.so, libdcmpmap.so, libdcmpstat.so, libdcmqrdb.so, libdcmrt.so, libdcmseg.so, libdcmsr.so, libdcmtkcharls.so, libdcmtls.so, libdcmtract.so, libdcmwlm.so, libdcmxml.so, libi2d.so, libijg12.so, libijg16.so, libijg8.so, liboficonv.so, liboflog.so, libofstd.so.
Installed directories: /etc/dcmtk-3.7.0, /usr/include/dcmtk, /usr/lib/cmake/dcmtk, /usr/share/dcmtk-3.7.0, /usr/share/licenses/dcmtk.
Short descriptions
cda2dcm |
Encapsulate CDA file into DICOM file format |
dcm2cda |
Extract CDA file from DICOM encapsulated CDA |
dcm2img |
Convert DICOM image to standard image format |
dcm2json |
Convert DICOM file and data set to JSON |
dcm2pdf |
Extract PDF file from DICOM encapsulated PDF |
dcm2pnm |
Convert DICOM images to PGM/PPM, PNG, TIFF or BMP |
dcm2xml |
Convert DICOM file and data set to XML |
dcmcjpeg |
Encode DICOM file to JPEG transfer syntax |
dcmcjpls |
Encode DICOM file to JPEG-LS transfer syntax |
dcmconv |
Convert DICOM file encoding |
dcmcrle |
Encode DICOM file to RLE transfer syntax |
dcmdecap |
Extract encapsulated file from DICOM encapsulated storage object |
dcmdjpeg |
Decode JPEG-compressed DICOM file |
dcmdjpls |
Decode JPEG-LS compressed DICOM file |
dcmdrle |
Decode RLE-compressed DICOM file |
dcmdspfn |
Export standard display curves to a text file |
dcmdump |
Dump DICOM file and data set |
dcmencap |
Encapsulate document into DICOM format |
dcmftest |
Test if file uses DICOM part 10 format |
dcmgpdir |
Create a general purpose DICOMDIR |
dcmicmp |
Compare DICOM images and compute difference metrics |
dcmj2pnm |
Convert DICOM images to PGM/PPM, PNG, TIFF, JPEG or BMP |
dcml2pnm |
Convert DICOM images to PGM/PPM, PNG, TIFF or BMP |
dcmmkcrv |
Add 2D curve data to image |
dcmmkdir |
Create a DICOMDIR file |
dcmmklut |
Create DICOM look-up tables |
dcmodify |
Modify DICOM files |
dcmp2pgm |
Read DICOM image and presentation state and render bitmap |
dcmprscp |
DICOM basic grayscale print management SCP |
dcmprscu |
Print spooler for presentation state viewer |
dcmpschk |
Checking tool for presentation states |
dcmpsmk |
Create DICOM grayscale softcopy presentation state |
dcmpsprt |
Read DICOM images and presentation states and render print job |
dcmpsrcv |
Network receive for presentation state viewer |
dcmpssnd |
Network send for presentation state viewer |
dcmqridx |
Register a DICOM image file in an image database index file |
dcmqrscp |
DICOM image archive (central test node) |
dcmqrti |
The Terminal Initiator Telnet Client Program |
dcmquant |
Convert DICOM color images to palette color |
dcmrecv |
Simple DICOM storage SCP (receiver) |
dcmscale |
Scale DICOM images |
dcmsend |
Simple DICOM storage SCU (sender) |
dcmsign |
Sign and Verify DICOM Files |
dcod2lum |
Convert hardcopy characteristic curve file to softcopy format |
dconvlum |
Convert VeriLUM files to DCMTK display files |
drtdump |
Dump DICOM RT file and data set |
dsr2html |
Render DICOM SR file and data set to HTML/XHTML |
dsr2xml |
Convert DICOM SR file and data set to XML |
dsrdump |
Dump DICOM SR file and data set |
dump2dcm |
Convert ASCII dump to DICOM file |
echoscu |
DICOM verification (C-ECHO) SCU |
findscu |
DICOM query (C-FIND) SCU |
getscu |
DICOM retrieve (C-GET) SCU |
img2dcm |
Convert standard image formats into DICOM format |
json2dcm |
Convert JSON document to DICOM file or data set |
mkcsmapper |
Create csmapper conversion files for oficonv |
mkesdb |
Create encoding scheme database (esdb) files for oficonv |
movescu |
DICOM retrieve (C-MOVE) SCU |
pdf2dcm |
Encapsulate PDF file into DICOM file format |
stl2dcm |
Encapsulate STL file into DICOM file format |
storescp |
DICOM storage (C-STORE) SCP |
storescu |
DICOM storage (C-STORE) SCU |
termscu |
DICOM termination SCU |
wlmscpfs |
DICOM Basic Worklist Management SCP (based on data files) |
xml2dcm |
Convert XML document to DICOM file or data set |
xml2dsr |
Convert XML document to DICOM SR file |
dcmtk.pc |
DICOM Toolkit (DCMTK) |
Notes
Every -DDCMTK_WITH_*=ON above only asks: when its library is missing, DCMTK’s CMake code prints a warning and builds without the feature. The depends line is what makes each one present.