Mercurial > hg > orthanc-stone
comparison Samples/README.md @ 1360:a3b453a833e2 broker
Some real doc
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 15 Apr 2020 15:46:06 +0200 |
parents | |
children | 5b750a4e1b52 |
comparison
equal
deleted
inserted
replaced
1359:2102bf5036b7 | 1360:a3b453a833e2 |
---|---|
1 General | |
2 ======= | |
3 These samples assume that a recent version of Orthanc is checked out in an | |
4 `orthanc` folder next to the `orthanc-stone` folder. Let's call the top folder | |
5 the `devroot` folder. This name does not matter and is not used anywhere. | |
6 | |
7 Here's the directory layout that we suggest: | |
8 | |
9 ``` | |
10 devroot/ | |
11 | | |
12 +- orthanc/ | |
13 | | |
14 +- orthanc-stone/ | |
15 | | |
16 ... | |
17 ``` | |
18 | |
19 Orthanc can be retrieved with: | |
20 ``` | |
21 hg clone https://hg.orthanc-server.com/orthanc | |
22 ``` | |
23 | |
24 WebAssembly samples | |
25 =================== | |
26 | |
27 Building the WebAssembly samples require the Emscripten SDK | |
28 (https://emscripten.org/). This SDK goes far beyond the simple compilation to | |
29 the wasm (Web Assembly) bytecode and provides a comprehensive library that | |
30 eases porting native C and C++ programs and libraries. The Emscripten SDK also | |
31 makes it easy to generate the companion Javascript files requires to use a | |
32 wasm module in a web application. | |
33 | |
34 Although Emscripten runs on all major platforms, Stone of Orthanc is developed | |
35 and tested with the Linux version of Emscripten. | |
36 | |
37 Emscripten runs perfectly fine under the Windows Subsystem for Linux (that is | |
38 the environment used quite often by the Stone of Orthanc team) | |
39 | |
40 **Important note:** The following examples **and the build scripts** will | |
41 assume that you have installed the Emscripten SDK in `~/apps/emsdk`. | |
42 | |
43 The following packages should get you going (a Debian-like distribution such | |
44 as Debian or Ubuntu is assumed) | |
45 | |
46 ``` | |
47 sudo apt-get update | |
48 sudo apt-get install -y build-essential curl wget git python cmake pkg-config | |
49 sudo apt-get install -y mercurial unzip npm ninja-build p7zip-full gettext-base | |
50 ``` | |
51 | |
52 SingleFrameViewer | |
53 ----------------- | |
54 | |
55 This sample application displays a single frame of a Dicom instance that can | |
56 be loaded from Orthanc, either by using the Orthanc REST API or through the | |
57 Dicomweb server functionality of Orthanc. | |
58 | |
59 This barebones sample uses plain Javascript and requires the | |
60 Emscripten toolchain and cmake, in addition to a few standard packages. | |
61 | |
62 Here's how you can build it: create the following script (for instance, | |
63 `build-wasm-SingleFrameViewer.sh`) one level above the orthanc-stone repository, | |
64 thus, in the folder we have called `devroot`. | |
65 | |
66 If you feel confident, you can also simply read the following script and | |
67 enter the commands interactively in the terminal. | |
68 | |
69 ``` | |
70 #!/bin/bash | |
71 | |
72 if [ ! -d "orthanc-stone" ]; then | |
73 echo "This script must be run from the folder one level above orthanc-stone" | |
74 exit 1 | |
75 fi | |
76 | |
77 if [[ ! $# -eq 1 ]]; then | |
78 echo "Usage:" | |
79 echo " $0 [BUILD_TYPE]" | |
80 echo "" | |
81 echo " with:" | |
82 echo " BUILD_TYPE = Debug, RelWithDebInfo or Release" | |
83 echo "" | |
84 exit 1 | |
85 fi | |
86 | |
87 # define the variables that we'll use | |
88 buildType=$1 | |
89 buildFolderName="`pwd`/out/build-stone-wasm-SingleFrameViewer-$buildType" | |
90 installFolderName="`pwd`/out/install-stone-wasm-SingleFrameViewer-$buildType" | |
91 | |
92 # configure the environment to use Emscripten | |
93 . ~/apps/emsdk/emsdk_env.sh | |
94 | |
95 | |
96 mkdir -p $buildFolderName | |
97 | |
98 # change current folder to the build folder | |
99 pushd $buildFolderName | |
100 | |
101 emcmake cmake -G "Ninja" \ | |
102 -DCMAKE_BUILD_TYPE=$buildType \ | |
103 -DCMAKE_INSTALL_PREFIX=$installFolderName \ | |
104 -DSTATIC_BUILD=ON -DOPENSSL_NO_CAPIENG=ON -DALLOW_DOWNLOADS=ON \ | |
105 ../orthanc-stone/Samples/WebAssembly/SingleFrameViewer | |
106 | |
107 # perform build + installation | |
108 ninja install | |
109 | |
110 # restore the original working folder | |
111 popd | |
112 | |
113 echo "If all went well, the output files can be found in $installFolderName:" | |
114 | |
115 ls $installFolderName``` | |
116 ``` | |
117 | |
118 Simply navigate to the dev root, and execute the script: | |
119 | |
120 ``` | |
121 ./build-wasm-SingleFrameViewer.sh RelWithDebInfo | |
122 ``` | |
123 | |
124 I suggest that you do *not* use the `Debug` confirmation unless you really | |
125 need it, for the additional checks that are made will lead to a very long | |
126 build time and much slower execution (more severe than with a native non-wasm | |
127 target) |