Skip to content
/ dcmjs Public

dcmjs is a javascript cross-compile of dcmtk (dcmtk.org).

License

Notifications You must be signed in to change notification settings

commontk/dcmjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dcmjs

Note: for the pure-JavaScript DICOM implementation, see github.com/dcmjs-org/dcmjs. The package here may still be useful for specialized tasks.

Overview

dcmjs is a javascript cross-compilation of dcmtk (dcmtk.org) for use in a javascript environment. Uses emscripten.

See http://dcmjs.org

See License.txt for information on using and contributing.

This package is intended for use in browser environments. For server side use probably you want to call to the corresponding natively compiled dcmtk executables.

To see javascript that uses dcmjs.js see the gh-pages branch of commontk/dcmjs.org repository which is what hosts dcmjs.org.

Usage

The module dcmjs allows to selectively execute a dcmtk application.

  • To list available application:
require('dcmjs').run(['list'])
$ node dcmjs-cli list

Output:

dcm2pnm
dcmdump
dcm2xml
dcmftest
  • To execute an application:
require('dcmjs').run(['dcmdump'])
$ node dcmjs-cli dcmdump

Output:

$dcmtk: dcmdump v3.6.1 DEV $

dcmdump: Dump DICOM file and data set
usage: dcmdump [options] dcmfile-in...

parameters:
  dcmfile-in                    DICOM input file or directory to be dumped
[...]

Prerequisites

docker pull dockcross/web-wasm
docker run dockcross/web-wasm > ~/bin/dockcross-web-wasm
chmod u+x ~/bin/dockcross-web-wasm

For more details, see https://github.com/dockcross/dockcross#readme

Building

The following commands will checkout dcmjs project and build dcmjs.js using dockcross-web-wasm.

git clone git://github.com/commontk/dcmjs
cd dcmjs
dockcross-web-wasm cmake -Bdcmjs-build -H. -GNinja
dockcross-web-wasm ninja -Cdcmjs-build

When done, you will have these files in the dcmjs-build/dcmjs-build/bin folder:

$ ls -1 dcmjs-build/dcmjs-build/bin/
dcmjs-cli
dcmjs.js
dcmjs.js.gz
dcmjs.wasm
dcmjs.wasmt

File IO using node

To support using the javascript module with node, the current folder is mounted as /working. This means that input files must be in in the current directory or a sub-directory.

For example, assuming we have the these files:

/home/awesome/downloads/dcmjs-cli
/home/awesome/downloads/dcmjs.js
/tmp/data/sr.dcm

The following is expected to work:

cd /tmp
node /home/awesome/downloads/dcmjs-cli dsr2xml /working/data/sr.dcm

Add / Remove applications

Re-configuring the project setting any of these options allows to customize the list of applications bundled in the dcmjs.js module:

  • cda2dcm: -DBUILD_cda2dcm_APP:BOOL=[ON|OFF]
  • dcm2json: -DBUILD_dcm2json_APP:BOOL=[ON|OFF]
  • dcm2pdf: -DBUILD_dcm2pdf_APP:BOOL=[ON|OFF]
  • dcm2pnm: -DBUILD_dcm2pnm_APP:BOOL=[ON|OFF]
  • dcm2xml: -DBUILD_dcm2xml_APP:BOOL=[ON|OFF]
  • dcmcjpeg: -DBUILD_dcmcjpeg_APP:BOOL=[ON|OFF]
  • dcmcjpls: -DBUILD_dcmcjpls_APP:BOOL=[ON|OFF]
  • dcmconv: -DBUILD_dcmconv_APP:BOOL=[ON|OFF]
  • dcmcrle: -DBUILD_dcmcrle_APP:BOOL=[ON|OFF]
  • dcmdjpeg: -DBUILD_dcmdjpeg_APP:BOOL=[ON|OFF]
  • dcmdjpls: -DBUILD_dcmdjpls_APP:BOOL=[ON|OFF]
  • dcmdrle: -DBUILD_dcmdrle_APP:BOOL=[ON|OFF]
  • dcmdspfn: -DBUILD_dcmdspfn_APP:BOOL=[ON|OFF]
  • dcmdump: -DBUILD_dcmdump_APP:BOOL=[ON|OFF]
  • dcmftest: -DBUILD_dcmftest_APP:BOOL=[ON|OFF]
  • dcmgpdir: -DBUILD_dcmgpdir_APP:BOOL=[ON|OFF]
  • dcmicmp: -DBUILD_dcmicmp_APP:BOOL=[ON|OFF]
  • dcmj2pnm: -DBUILD_dcmj2pnm_APP:BOOL=[ON|OFF]
  • dcml2pnm: -DBUILD_dcml2pnm_APP:BOOL=[ON|OFF]
  • dcmmkcrv: -DBUILD_dcmmkcrv_APP:BOOL=[ON|OFF]
  • dcmmkdir: -DBUILD_dcmmkdir_APP:BOOL=[ON|OFF]
  • dcmmklut: -DBUILD_dcmmklut_APP:BOOL=[ON|OFF]
  • dcmodify: -DBUILD_dcmodify_APP:BOOL=[ON|OFF]
  • dcmp2pgm: -DBUILD_dcmp2pgm_APP:BOOL=[ON|OFF]
  • dcmprscp: -DBUILD_dcmprscp_APP:BOOL=[ON|OFF]
  • dcmprscu: -DBUILD_dcmprscu_APP:BOOL=[ON|OFF]
  • dcmpschk: -DBUILD_dcmpschk_APP:BOOL=[ON|OFF]
  • dcmpsmk: -DBUILD_dcmpsmk_APP:BOOL=[ON|OFF]
  • dcmpsprt: -DBUILD_dcmpsprt_APP:BOOL=[ON|OFF]
  • dcmpsrcv: -DBUILD_dcmpsrcv_APP:BOOL=[ON|OFF]
  • dcmpssnd: -DBUILD_dcmpssnd_APP:BOOL=[ON|OFF]
  • dcmqridx: -DBUILD_dcmqridx_APP:BOOL=[ON|OFF]
  • dcmqrscp: -DBUILD_dcmqrscp_APP:BOOL=[ON|OFF]
  • dcmqrti: -DBUILD_dcmqrti_APP:BOOL=[ON|OFF]
  • dcmquant: -DBUILD_dcmquant_APP:BOOL=[ON|OFF]
  • dcmrecv: -DBUILD_dcmrecv_APP:BOOL=[ON|OFF]
  • dcmscale: -DBUILD_dcmscale_APP:BOOL=[ON|OFF]
  • dcmsend: -DBUILD_dcmsend_APP:BOOL=[ON|OFF]
  • dcmsign: -DBUILD_dcmsign_APP:BOOL=[ON|OFF]
  • dcod2lum: -DBUILD_dcod2lum_APP:BOOL=[ON|OFF]
  • dconvlum: -DBUILD_dconvlum_APP:BOOL=[ON|OFF]
  • drtdump: -DBUILD_drtdump_APP:BOOL=[ON|OFF]
  • dsr2html: -DBUILD_dsr2html_APP:BOOL=[ON|OFF]
  • dsr2xml: -DBUILD_dsr2xml_APP:BOOL=[ON|OFF]
  • dsrdump: -DBUILD_dsrdump_APP:BOOL=[ON|OFF]
  • dump2dcm: -DBUILD_dump2dcm_APP:BOOL=[ON|OFF]
  • echoscu: -DBUILD_echoscu_APP:BOOL=[ON|OFF]
  • findscu: -DBUILD_findscu_APP:BOOL=[ON|OFF]
  • getscu: -DBUILD_getscu_APP:BOOL=[ON|OFF]
  • img2dcm: -DBUILD_img2dcm_APP:BOOL=[ON|OFF]
  • mdfconen: -DBUILD_mdfconen_APP:BOOL=[ON|OFF]
  • mdfdsman: -DBUILD_mdfdsman_APP:BOOL=[ON|OFF]
  • movescu: -DBUILD_movescu_APP:BOOL=[ON|OFF]
  • pdf2dcm: -DBUILD_pdf2dcm_APP:BOOL=[ON|OFF]
  • stl2dcm: -DBUILD_stl2dcm_APP:BOOL=[ON|OFF]
  • storescp: -DBUILD_storescp_APP:BOOL=[ON|OFF]
  • storescu: -DBUILD_storescu_APP:BOOL=[ON|OFF]
  • termscu: -DBUILD_termscu_APP:BOOL=[ON|OFF]
  • wlcefs: -DBUILD_wlcefs_APP:BOOL=[ON|OFF]
  • wlmscpfs: -DBUILD_wlmscpfs_APP:BOOL=[ON|OFF]
  • xml2dcm: -DBUILD_xml2dcm_APP:BOOL=[ON|OFF]
  • xml2dsr: -DBUILD_xml2dsr_APP:BOOL=[ON|OFF]

The list above has been generated using:

cd DCMTK
for file in `find -wholename *apps/*.cc`; do
  appname=$( basename ${file%.*} );
  echo -e "* [${appname}](http://support.dcmtk.org/docs/${appname}.html): \`-DBUILD_${appname}_APP:BOOL=[ON|OFF]\`";
done | sort

List of options found in CMake/Externals/External_DCMTK.cmake can be generated using:

cd DCMTK
for file in `find -wholename *apps/*.cc`; do
  appname=$( basename ${file%.*} );
  echo -e "dcmtk_build_app_option(BUILD_${appname}_APP OFF)";
done | sort | column -t

Creating a release

  1. Choose a release name (e.g dcmjs-3.6.1)
release=<name-of-release>
  1. Fetch and tag repository
git fetch
git tag -s -m "${release}" ${release} origin/master
  1. Publish tag
git push origin ${release}