Mercurial > hg > orthanc-stone
annotate Samples/README.md @ 1396:dd2b75ee644b
cleanup + build script for RtViewer
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Wed, 29 Apr 2020 19:00:30 +0200 |
parents | 62dc0d737e7b |
children | 5d7ee14dc1eb |
rev | line source |
---|---|
1360 | 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 ``` | |
1378 | 23 |
24 Furthermore, the samples usually assume that an Orthanc is running locally, | |
25 without authentication, on port 8042. The samples can easily be tweaked if | |
26 your setup is different. | |
27 | |
28 When Dicom resources are to be displayed, their IDs can be supplied in the | |
29 various ways suitable for the platform (command-line arguments, URL parameters | |
30 or through the GUI) | |
31 | |
1360 | 32 |
33 WebAssembly samples | |
34 =================== | |
35 | |
36 Building the WebAssembly samples require the Emscripten SDK | |
37 (https://emscripten.org/). This SDK goes far beyond the simple compilation to | |
38 the wasm (Web Assembly) bytecode and provides a comprehensive library that | |
39 eases porting native C and C++ programs and libraries. The Emscripten SDK also | |
40 makes it easy to generate the companion Javascript files requires to use a | |
41 wasm module in a web application. | |
42 | |
43 Although Emscripten runs on all major platforms, Stone of Orthanc is developed | |
44 and tested with the Linux version of Emscripten. | |
45 | |
46 Emscripten runs perfectly fine under the Windows Subsystem for Linux (that is | |
47 the environment used quite often by the Stone of Orthanc team) | |
48 | |
49 **Important note:** The following examples **and the build scripts** will | |
50 assume that you have installed the Emscripten SDK in `~/apps/emsdk`. | |
51 | |
52 The following packages should get you going (a Debian-like distribution such | |
53 as Debian or Ubuntu is assumed) | |
54 | |
55 ``` | |
56 sudo apt-get update | |
57 sudo apt-get install -y build-essential curl wget git python cmake pkg-config | |
58 sudo apt-get install -y mercurial unzip npm ninja-build p7zip-full gettext-base | |
59 ``` | |
60 | |
61 SingleFrameViewer | |
62 ----------------- | |
63 | |
64 This sample application displays a single frame of a Dicom instance that can | |
65 be loaded from Orthanc, either by using the Orthanc REST API or through the | |
66 Dicomweb server functionality of Orthanc. | |
67 | |
68 This barebones sample uses plain Javascript and requires the | |
69 Emscripten toolchain and cmake, in addition to a few standard packages. | |
70 | |
1395
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
71 To build it, just launch the `build-wasm-SingleFrameViewer.sh` script from |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
72 this folder. Optionaly, you can pass the build type as an argument. |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
73 We suggest that you do *not* use the `Debug` configuration unless you really |
1360 | 74 need it, for the additional checks that are made will lead to a very long |
75 build time and much slower execution (more severe than with a native non-wasm | |
76 target) | |
1378 | 77 |
1395
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
78 In order to run the sample, you may serve it with the ServeFolders plugin. |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
79 You can i.e: add such a section in your orthanc configuration file: |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
80 |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
81 ``` |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
82 { |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
83 "Plugins" : ["LibServeFolders.so], |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
84 "ServeFolders" : { |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
85 "/single-frame-viewer" : "..../out/install-stone-wasm-SingleFrameViewer-RelWithDebInfo" |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
86 } |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
87 } |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
88 ``` |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
89 |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
90 You'll then be able to open the demo at `http://localhost:8042/single-frame-viewer/index.html` |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
91 |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
92 |
1378 | 93 Native samples |
94 ================= | |
95 | |
96 SdlSimpleViewer | |
97 --------------- | |
98 | |
99 ### Windows build | |
100 | |
101 Here's how to build the SdlSimpleViewer example using Visual Studio 2019 | |
102 (the shell is Powershell, but the legacy shell can also be used with some | |
103 tweaks). This example is meant to be launched from the folder above | |
104 orthanc-stone. | |
105 | |
106 ``` | |
107 # create the build folder and navigate to it | |
108 $buildDir = "build-stone-sdlviewer-msvc16-x64" | |
109 | |
110 if (-not (Test-Path $buildDir)) { | |
111 mkdir -p $buildDir | Out-Null | |
112 } | |
113 | |
114 cd $buildDir | |
115 | |
116 # perform the configuration | |
117 cmake -G "Visual Studio 16 2019" -A x64 ` | |
118 -DMSVC_MULTIPLE_PROCESSES=ON ` | |
119 -DALLOW_DOWNLOADS=ON ` | |
120 -DSTATIC_BUILD=ON ` | |
121 -DOPENSSL_NO_CAPIENG=ON ` | |
122 ../orthanc-stone/Samples/Sdl/SimpleViewer | |
123 | |
124 $solutionPath = ls -filter *.sln | |
125 Write-Host "Solution file(s) available at: $solutionPath" | |
126 ``` | |
127 | |
128 The initial configuration step will be quite lengthy, for CMake needs to | |
129 setup its internal cache based on your environment and build tools. | |
130 | |
131 Subsequent runs will be several orders of magnitude faster! | |
132 | |
133 One the solution (.sln) file is ready, you can open it using the Visual Studio | |
134 IDE and choose Build --> Build solution. | |
135 | |
136 An alternative is to execute `cmake --build .` in the build folder created by | |
137 the script. | |
138 | |
1395
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
139 In order to run the sample, make sure you've an Orthanc server running i.e. on |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
140 port 8042 and launch: |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
141 |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
142 ``` |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
143 ./SingleFrameViewer --orthanc http://localhost:8042 --instance 7fc84013-abef174e-3354ca83-b9cdb2a4-f1a74368 |
62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
Alain Mazy <alain@mazy.be>
parents:
1378
diff
changeset
|
144 ``` |