commontk / dcmjs Goto Github PK
View Code? Open in Web Editor NEWdcmjs is a javascript cross-compile of dcmtk (dcmtk.org).
Home Page: http://dcmjs.org
License: Other
dcmjs is a javascript cross-compile of dcmtk (dcmtk.org).
Home Page: http://dcmjs.org
License: Other
Hello,
I tried building dcmjs with a M1 Mac, but it did not succeed. I did the following:
docker run --rm --platform=linux/amd64 dockcross/web-wasm > ./dockcross-web-wasm
chmod +x dockcross-web-wasm
./dockcross-web-wasm -a "--platform=linux/amd64" cmake -Bdcmjs-build -H. -GNinja -Ddcmjs_USE_GIT_PROTOCOL=OFF
./dockcross-web-wasm -a "--platform=linux/amd64" ninja -Cdcmjs-build
The last command has the following output (slightly shortened):
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
ninja: Entering directory `dcmjs-build'
[1/41] Performing download step (git clone) for 'ZLIB'
Cloning into 'ZLIB'...
HEAD is now at 66a7530 Add option ZLIB_MANGLE_PREFIX
[3/41] Performing download step (download, verify and extract) for 'LibXml2'
-- verifying file...
file='/work/dcmjs-build/../dcmjs-download-cache/libxml2-2.9.8.tar.gz'
-- File already exists and hash match (skip download):
file='/work/dcmjs-build/../dcmjs-download-cache/libxml2-2.9.8.tar.gz'
MD5='b786e353e2aa1b872d70d5d1ca0c740d'
-- extracting...
src='/work/dcmjs-download-cache/libxml2-2.9.8.tar.gz'
dst='/work/dcmjs-build/LibXml2'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[4/41] Performing update step for 'ZLIB'
[5/41] No update step for 'LibXml2'
[7/41] Performing configure step for 'ZLIB'
loading initial cache file /work/dcmjs-build/ZLIB-prefix/tmp/ZLIB-cache-Release.cmake
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Warning (dev) at CMakeLists.txt:51 (ADD_LIBRARY):
ADD_LIBRARY called with SHARED option but the target platform does not
support dynamic linking. Building a STATIC library instead. This may lead
to problems.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: /work/dcmjs-build/ZLIB-build
[9/41] Performing configure step for 'LibXml2'
loading initial cache file /work/dcmjs-build/LibXml2-prefix/tmp/LibXml2-cache-Release.cmake
CMake Warning (dev) at CMakeLists.txt:82 (add_library):
ADD_LIBRARY called with SHARED option but the target platform does not
support dynamic linking. Building a STATIC library instead. This may lead
to problems.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: /work/dcmjs-build/LibXml2-build
[10/41] Performing build step for 'ZLIB'
[1/12] Building C object CMakeFiles/zlib.dir/compress.c.o
emcc: warning: linker setting ignored during compilation: 'ALLOW_MEMORY_GROWTH' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]
emcc: warning: linker flag ignored during compilation: '--memory-init-file' [-Wunused-command-line-argument]
[2/12] Building C object CMakeFiles/zlib.dir/zutil.c.o
...
emcc: warning: linker setting ignored during compilation: 'ALLOW_MEMORY_GROWTH' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]
emcc: warning: linker flag ignored during compilation: '--memory-init-file' [-Wunused-command-line-argument]
[12/12] Linking C static library libzlib.a
[11/41] Performing build step for 'LibXml2'
[1/45] Building C object CMakeFiles/xml2.dir/DOCBparser.c.o
emcc: warning: linker setting ignored during compilation: 'ALLOW_MEMORY_GROWTH' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]
emcc: warning: linker flag ignored during compilation: '--memory-init-file' [-Wunused-command-line-argument]
...
emcc: warning: linker setting ignored during compilation: 'ALLOW_MEMORY_GROWTH' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]
emcc: warning: linker flag ignored during compilation: '--memory-init-file' [-Wunused-command-line-argument]
/work/dcmjs-build/LibXml2/xmlmodule.c:32:14: warning: function 'xmlModulePlatformOpen' has internal linkage but is not defined [-Wundefined-internal]
static void *xmlModulePlatformOpen(const char *name);
^
/work/dcmjs-build/LibXml2/xmlmodule.c:90:22: note: used here
module->handle = xmlModulePlatformOpen(name);
^
/work/dcmjs-build/LibXml2/xmlmodule.c:34:12: warning: function 'xmlModulePlatformSymbol' has internal linkage but is not defined [-Wundefined-internal]
static int xmlModulePlatformSymbol(void *handle, const char *name, void **result);
^
/work/dcmjs-build/LibXml2/xmlmodule.c:130:10: note: used here
rc = xmlModulePlatformSymbol(module->handle, name, symbol);
^
/work/dcmjs-build/LibXml2/xmlmodule.c:33:12: warning: function 'xmlModulePlatformClose' has internal linkage but is not defined [-Wundefined-internal]
static int xmlModulePlatformClose(void *handle);
^
/work/dcmjs-build/LibXml2/xmlmodule.c:166:10: note: used here
rc = xmlModulePlatformClose(module->handle);
^
3 warnings generated.
[25/45] Building C object CMakeFiles/xml2.dir/uri.c.o
emcc: warning: linker setting ignored during compilation: 'ALLOW_MEMORY_GROWTH' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]
emcc: warning: linker flag ignored during compilation: '--memory-init-file' [-Wunused-command-line-argument]
...
emcc: warning: linker setting ignored during compilation: 'ALLOW_MEMORY_GROWTH' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]
emcc: warning: linker flag ignored during compilation: '--memory-init-file' [-Wunused-command-line-argument]
[45/45] Linking C static library libxml2.a
[12/41] Performing install step for 'ZLIB'
[0/1] Install the project...
-- Install configuration: "Release"
-- Installing: /work/dcmjs-build/ZLIB-install/lib/libzlib.a
-- Installing: /work/dcmjs-build/ZLIB-install/include/zlib.h
-- Installing: /work/dcmjs-build/ZLIB-install/include/zconf.h
-- Installing: /work/dcmjs-build/ZLIB-install/include/zlib_mangle.h
-- Installing: /work/dcmjs-build/ZLIB-install/include/zlibDllConfig.h
-- Installing: /work/dcmjs-build/ZLIB-install/doc/zlib-1.2.3/Copyright.txt
[13/41] No install step for 'LibXml2'
[17/41] Performing download step (download, verify and extract) for 'PNG'
-- Downloading...
dst='/work/dcmjs-build/../dcmjs-download-cache/libpng-1.6.36.tar.xz'
timeout='none'
inactivity timeout='none'
-- Using src='http://download.sourceforge.net/libpng/libpng-1.6.36.tar.xz'
-- verifying file...
file='/work/dcmjs-build/../dcmjs-download-cache/libpng-1.6.36.tar.xz'
-- Downloading... done
-- extracting...
src='/work/dcmjs-download-cache/libpng-1.6.36.tar.xz'
dst='/work/dcmjs-build/PNG'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[18/41] No update step for 'PNG'
[20/41] Performing configure step for 'PNG'
loading initial cache file /work/dcmjs-build/PNG-prefix/tmp/PNG-cache-Release.cmake
-- The ASM compiler identification is unknown
-- Found assembler: /emsdk/upstream/emscripten/emcc
-- Warning: Did not find file Compiler/-ASM
CMake Warning (dev) at CMakeLists.txt:42 (find_package):
Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
CMake variable ZLIB_ROOT is set to:
/work/dcmjs-build/ZLIB-install
For compatibility, CMake is ignoring the variable.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found ZLIB: /work/dcmjs-build/ZLIB-install/lib/libzlib.so (found version "1.2.3")
-- Performing Test HAVE_LD_VERSION_SCRIPT
-- Performing Test HAVE_LD_VERSION_SCRIPT - Success
-- Symbol prefix:
CMake Warning (dev) at CMakeLists.txt:530 (add_library):
ADD_LIBRARY called with SHARED option but the target platform does not
support dynamic linking. Building a STATIC library instead. This may lead
to problems.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: /work/dcmjs-build/PNG-build
[21/41] Performing build step for 'PNG'
ninja: error: '/work/dcmjs-build/ZLIB-install/lib/libzlib.so', needed by 'pngfix.js', missing and no known rule to make it
FAILED: PNG-prefix/src/PNG-stamp/PNG-build /work/dcmjs-build/PNG-prefix/src/PNG-stamp/PNG-build
cd /work/dcmjs-build/PNG-build && /usr/bin/cmake --build . && /usr/bin/cmake -E touch /work/dcmjs-build/PNG-prefix/src/PNG-stamp/PNG-build
ninja: build stopped: subcommand failed.
How can I fix this?
Best regards
Niclas
Hey guys this is more a question than an issue. I am trying to use this solution in node.js server side application. I was able to build dcmjs.js but when I try to execute it with node dcmjs.js dcmj2pnm x.dcm
it fails with an error "F: No such file or directory: reading file: x.dcm".
I've tried multiple variations like using absolute path, prefixing a path with './', moving file to file system root, executing in git-bash environment. But with no success.
In READEME.md there is a clause:
Note that node executables do not have access to the local file system. To use dcmjs on a browser see the demos in the gh-pages branch.
But I did not found out how to pass the file to the environment where is the dcmjs.js executed.
Do you have any hints?
Thank you.
Link to www.dcmjs.org in README.md is broken: there is no "www".dcmjs.org (only dcmjs.org).
CMake Warning (dev) at /usr/share/cmake-3.13/Modules/FindPNG.cmake:51 (find_package):
Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
CMake variable ZLIB_ROOT is set to:
/work/dcmjs-build/ZLIB-install
For compatibility, CMake is ignoring the variable.
Call Stack (most recent call first):
CMake/3rdparty.cmake:178 (find_package)
CMake/dcmtkPrepare.cmake:426 (include)
CMakeLists.txt:17 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
Dear Team,
You are amazing team and doing greate for medical imaging through this project. My concern is there is no recent activities updates in the project. I request you all to do active development with need of the current scenario.
Great projects are done with small incremental improvement.
[ 80%] Building CXX object src/CMakeFiles/dcmjs.dir/dcmjs.cpp.o
WARNING:root:not all asm.js optimizations are possible with ALLOW_MEMORY_GROWTH, disabling those. [-Walmost-asm]
[100%] Linking CXX executable ../bin/dcmjs.js
WARNING:root:emcc: cannot find library "nsl"
WARNING:root:emcc: cannot find library "socket"
WARNING:root:not all asm.js optimizations are possible with ALLOW_MEMORY_GROWTH, disabling those. [-Walmost-asm]
error: Linking globals named 'xmlParserMaxDepth': symbol multiply defined!
ERROR:root:Failed to run llvm optimizations:
src/CMakeFiles/dcmjs.dir/build.make:102: recipe for target 'bin/dcmjs.js' failed
I have a problem: when I build it and the dcmj2pnm app is in the build, the build is faild with this error:
In file included from /work/dcmjs-build/DCMTK/dcmjpeg/apps/dcmj2pnm.cc:27:
/work/dcmjs-build/DCMTK/dcmjpeg/apps/../../dcmimage/apps/dcm2pnm.cc:121:10: fatal error: 'dcmtk/config/dcm2pnm_app.h' file not found
#include "dcmtk/config/dcm2pnm_app.h"
If I am right the problem is in the dcmtk source code, my question is that is there any option to change the version of the used dcmtk source? (If I am right You forked the dcmtk git repo and You use your own version of it. ) Can You give me a little description how can I use an other version of the dcmtk? (On my machine I currently using the native c++ 3.6.2 and it is working well.)
thx
I download dcmjs project and run the below command then get the dcmjs.js file.
dockcross-browser-asmjs cmake -Bdcmjs-build -H. -GNinja
dockcross-browser-asmjs ninja -Cdcmjs-build
I run command node ./dcmjs.js dcmdump /working/test.dcm
, it works very well.
But when I replace the same file with the dcmjs.js file in dcmjs.org website project. It seems doesn't work on client side.
Is there any wrong what I do or is it a bug?
I tried it on macOS High Sierra 10.13.6 and Ubuntu 16.04 and Ubuntu 18.04, It has the same problem.
When I test dump dicom, Chrome DevTools Terminal console warning and error information on the below:
Assertion failed: undefined
exception thrown: abort("Assertion failed: undefined") at Error
abort @ dcmjs.js:23
assert @ dcmjs.js:1
mount @ dcmjs.js:1
mount @ dcmjs.js:1
(anonymous) @ dcmjs.js:1
_emscripten_asm_const_i @ dcmjs.js:1
Yc @ dcmjs.js:8
(anonymous) @ dcmjs.js:23
callMain @ dcmjs.js:23
dcmjs.utils.execute @ utils.js:97
dcmdump @ dump.js:24
(anonymous) @ utils.js:110
load (async)
dcmjs.utils.readFile @ utils.js:109
readSelectedFiles @ dump.js:38
handleFileDrop @ dump.js:67
[...]
[100%] Building CXX object dcmpstat/apps/CMakeFiles/dcmpsmk.dir/dcmpsmk.cc.o
Linking CXX executable ../../bin/dcmpsmk.js
warning: unresolved symbol: syslog
warning: unresolved symbol: openlog
warning: unresolved symbol: gethostbyaddr_r
warning: unresolved symbol: closelog
warning: unresolved symbol: getsockopt
[...]
Hello
I followed instructions from the wiki but I get an error when executing the following command :
dockcross-browser-asmjs ninja -Cdcmjs-build
I get the following message :
ninja: error: '/work/dcmjs-build/LibXml2/.libs/libxml2.so', needed by 'lib/libxml2dcm.so.3.6.1', missing and no known rule to make it
FAILED: DCMTK-prefix/src/DCMTK-stamp/DCMTK-build
cd /work/dcmjs-build/DCMTK-build && /usr/bin/cmake --build . && /usr/bin/cmake -E touch /work/dcmjs-build/DCMTK-prefix/src/DCMTK-stamp/DCMTK-build
ninja: build stopped: subcommand failed.
What can I do to fix it ?
NB: I'm using macOS 10.13.6
Thx for your help.
Any idea what's wrong?
/Users/arnaud/GITROOT/dcmjs/build/DCMTK/ofstd/include/dcmtk/ofstd/ofstream.h:43:2: error:
DCMTK needs stringstream or strstream type
^
/Users/arnaud/GITROOT/dcmjs/build/DCMTK/ofstd/include/dcmtk/ofstd/ofstream.h:118:23: error:
no type named 'strstream' in namespace 'std'
typedef STD_NAMESPACE strstream OFStringStream;
~~~~~~~~~~~~~ ^
/Users/arnaud/GITROOT/dcmjs/build/DCMTK/ofstd/include/dcmtk/ofstd/ofstream.h:119:23: error:
no type named 'ostrstream' in namespace 'std'
typedef STD_NAMESPACE ostrstream OFOStringStream;
~~~~~~~~~~~~~ ^
/Users/arnaud/GITROOT/dcmjs/build/DCMTK/ofstd/include/dcmtk/ofstd/ofstream.h:120:23: error:
no type named 'istrstream' in namespace 'std'
typedef STD_NAMESPACE istrstream OFIStringStream;
~~~~~~~~~~~~~ ^
4 errors generated.
ERROR root: compiler frontend failed to generate LLVM bitcode, halting
I build a dcm.js by myself, using Your description, I added the dcmsend during the build. But it is not working neither from cli and neither from browser. (If I am using the dcmsend from the installed dcmtk it works like charm)
Other dcmtk apps are working well (I tried dcmodify and dcmdump and both are working in the browser and in the cli too...).
command:
node dcmjs.js dcmsend localhost 6666 /working/1.dcm
This is the error message what I got for the above command :
Calling stub instead of signal()
F: cannot negotiate network association: Failed to establish association
F: 0006:0317 Peer aborted Association (or never connected)
F: 0006:031c TCP Initialization Error: Host is unreachable
Can You please give some hint about it?
My main goal is to make the dcmsend work in the browser.
While commit e5881ec added support for dynamic memory allocation, it also generates a warnings that we may want to suppress.
WARNING root: Disabling asm.js validation for memory growth (memory can grow, but you lose some amount of speed)
It's happened on two fresh builds now that I'll run make once and only the selected apps get built.
But then I'll run make again and a bunch of other apps, like the dicom networking apps, get built.
I suspect there's something wrong with the cmake code that enables and disables app building (BUILD_dcm*_APP).
Gzip'ing dcmdspfn.js
/usr/bin/gzip: invalid option -- k
Try `gzip --help' for more information.
make[2]: *** [bin/dcmdspfn.js] Error 1
make[1]: *** [dcmimgle/apps/CMakeFiles/dcmdspfn.dir/all] Error 2
make: *** [all] Error 2
I installed the last version emscripten and did make -j5 like the given tutorial in the building section , but I'm ending up with a lot of errors in my CMakeFiles/CMakeError.log"
Please any help would very appreciated.
If I try:
const dcm = require('./dcmjs/dcmjs')
I get
Usage: /Users/dbousamra/Code/Projects/functor/src/dcm.js <appname> [options]
Is there a recommended approach to using from NodejS?
Need to edit the documentation and issue a pull request
Build fails by default because the executable is missing.
A workaround is:
$ ln -s /usr/bin/python2.7 /usr/local/bin/python2
On a mac with dcmtk installed via homebrew the emscripten build of dcmtk was finding ofstd headers from /usr/local/lib rather than the ones in DCMTK-build. Uninstalling dcmtk from brew fixes this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.