comparison OrthancStone/Samples/README.md @ 1512:244ad1e4e76a

reorganization of folders
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 16:21:02 +0200
parents Samples/README.md@f5493e5a51a3
children 307a805d0587
comparison
equal deleted inserted replaced
1511:9dfeee74c1e6 1512:244ad1e4e76a
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 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
32
33 This repo contains two sample projects:
34
35 SingleFrameViewer
36 -----------------
37
38 This sample application displays a single frame of a Dicom instance that can
39 be loaded from Orthanc, either by using the Orthanc REST API or through the
40 Dicomweb server functionality of Orthanc.
41
42 RtViewer
43 --------
44
45 This sample application displays set of Radiotherapy data:
46 - a CT scan
47 - an RT-Dose
48 - an RT-Struct
49
50 The WebAssembly version displays 3 viewports with MPR data
51 while the SDL sample displays a single viewport.
52
53
54 WebAssembly samples
55 ===================
56
57 Building the WebAssembly samples require the Emscripten SDK
58 (https://emscripten.org/). This SDK goes far beyond the simple compilation to
59 the wasm (Web Assembly) bytecode and provides a comprehensive library that
60 eases porting native C and C++ programs and libraries. The Emscripten SDK also
61 makes it easy to generate the companion Javascript files requires to use a
62 wasm module in a web application.
63
64 Although Emscripten runs on all major platforms, Stone of Orthanc is developed
65 and tested with the Linux version of Emscripten.
66
67 Emscripten runs perfectly fine under the Windows Subsystem for Linux (that is
68 the environment used quite often by the Stone of Orthanc team)
69
70 **Important note:** The following examples **and the build scripts** will
71 assume that you have installed the Emscripten SDK in `~/apps/emsdk`.
72
73 The following packages should get you going (a Debian-like distribution such
74 as Debian or Ubuntu is assumed)
75
76 ```
77 sudo apt-get update
78 sudo apt-get install -y build-essential curl wget git python cmake pkg-config
79 sudo apt-get install -y mercurial unzip npm ninja-build p7zip-full gettext-base
80 ```
81
82 To build the Wasm samples, just launch the `build-wasm-samples.sh` script from
83 this folder. Optionaly, you can pass the build type as an argument.
84 We suggest that you do *not* use the `Debug` configuration unless you really
85 need it, for the additional checks that are made will lead to a very long
86 build time and much slower execution (more severe than with a native non-wasm
87 target)
88
89 In order to run the sample, you may serve it with the ServeFolders plugin.
90 You can i.e: add such a section in your orthanc configuration file:
91
92 ```
93 {
94 "Plugins" : ["LibServeFolders.so],
95 "ServeFolders" : {
96 "/single-frame-viewer" : "..../out/install-stone-wasm-samples-RelWithDebInfo/SingleFrameViewer",
97 "/rt-viewer": "..../out/install-stone-wasm-samples-RelWithDebInfo/RtViewer"
98 }
99 }
100 ```
101
102 You'll then be able to open the single-frame-viewer demo at `http://localhost:8042/single-frame-viewer/index.html`
103
104 The rt-viewer demo at
105 `http://localhost:8044/rt-viewer/index.html?ctseries=a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa&rtdose=eac822ef-a395f94e-e8121fe0-8411fef8-1f7bffad&rtstruct=54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9`. Note that you must provide 3 ids in the url:
106
107 - the CT series Orthanc ID
108 - the RT-Dose instance Orthanc ID
109 - the RT-Struct instance Orthanc ID
110
111
112 RtViewer
113 -----------------
114
115 This sample application displays three MPR views of a CT+RTDOSE+RTSTRUCT dataset, loaded from Orthanc. The Orthanc IDs of the dataset must be supplied as URL parameters like:
116
117 ```
118 http://localhost:9979/rtviewer/index.html?loglevel=info&ctseries=a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa&rtdose=830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb&rtstruct=54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9
119 ```
120
121 (notice the loglevel parameter that can be `warning`, `info` or `trace`, in increasing verbosity order)
122
123 This sample uses plain Javascript and requires the
124 Emscripten toolchain and cmake, in addition to a few standard packages.
125
126 To build it, just launch the `build-wasm-RtViewer.sh` script from
127 this folder. Optionaly, you can pass the build type as an argument.
128 We suggest that you do *not* use the `Debug` configuration unless you really
129 need it, for the additional checks that are made will lead to a very long
130 build time and much slower execution (more severe than with a native non-wasm
131 target)
132
133 In order to run the sample, you may serve it with the ServeFolders plugin.
134 You can i.e: add such a section in your orthanc configuration file:
135
136 ```
137 {
138 "Plugins" : ["LibServeFolders.so],
139 "ServeFolders" : {
140 "/rt-viewer" : "..../out/install-stone-wasm-RtViewer-RelWithDebInfo"
141 }
142 }
143 ```
144
145 You'll then be able to open the demo at `http://localhost:8042/rt-viewer/index.html`
146
147
148 Native samples
149 =================
150
151 ### Windows build
152
153 Here's how to build the SdlSimpleViewer example using Visual Studio 2019
154 (the shell is Powershell, but the legacy shell can also be used with some
155 tweaks). This example is meant to be launched from the folder above
156 orthanc-stone.
157
158 ```
159 # create the build folder and navigate to it
160 $buildDir = "build-stone-sdlviewer-msvc16-x64"
161
162 if (-not (Test-Path $buildDir)) {
163 mkdir -p $buildDir | Out-Null
164 }
165
166 cd $buildDir
167
168 # perform the configuration
169 cmake -G "Visual Studio 16 2019" -A x64 `
170 -DMSVC_MULTIPLE_PROCESSES=ON `
171 -DALLOW_DOWNLOADS=ON `
172 -DSTATIC_BUILD=ON `
173 -DOPENSSL_NO_CAPIENG=ON `
174 ../orthanc-stone/Samples/Sdl
175
176 $solutionPath = ls -filter *.sln
177 Write-Host "Solution file(s) available at: $solutionPath"
178 ```
179
180 The initial configuration step will be quite lengthy, for CMake needs to
181 setup its internal cache based on your environment and build tools.
182
183 Subsequent runs will be several orders of magnitude faster!
184
185 One the solution (.sln) file is ready, you can open it using the Visual Studio
186 IDE and choose Build --> Build solution.
187
188 An alternative is to execute `cmake --build .` in the build folder created by
189 the script.
190
191 In order to run the sample, make sure you've an Orthanc server running i.e. on
192 port 8042 and launch:
193
194 ```
195 ./SdlSimpleViewer --orthanc http://localhost:8042 --instance 7fc84013-abef174e-3354ca83-b9cdb2a4-f1a74368
196
197 ./RtViewerSdl --orthanc http://localhost:8042 --ctseries a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa --rtdose 830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb --rtstruct 54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9
198 ```
199
200 RtViewer
201 ---------------
202
203 ### Windows build
204
205 Here's how to build the SdlSimpleViewer example using Visual Studio 2019
206 (the shell is Powershell, but the legacy shell can also be used with some
207 tweaks). This example is meant to be launched from the folder above
208 orthanc-stone.
209
210 ```
211 $buildRootDir = "out"
212 $buildDirName = "build-stone-sdl-RtViewer-msvc16-x64"
213 $buildDir = Join-Path -Path $buildRootDir -ChildPath $buildDirName
214
215 if (-not (Test-Path $buildDir)) {
216 mkdir -p $buildDir | Out-Null
217 }
218
219 cd $buildDir
220
221 cmake -G "Visual Studio 16 2019" -A x64 `
222 -DMSVC_MULTIPLE_PROCESSES=ON `
223 -DALLOW_DOWNLOADS=ON `
224 -DSTATIC_BUILD=ON `
225 -DOPENSSL_NO_CAPIENG=ON `
226 ../../orthanc-stone/Samples/Sdl/RtViewer
227 ```
228
229 Executing `cmake --build .` in the build folder will launch the Microsoft
230 builder on the solution.
231
232 Alternatively, you can open and build the solution using Visual Studio 2019.
233