Mercurial > hg > orthanc-stone
view Samples/README.md @ 1398:c5403d52078c
moved Radiography into Deprecated
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Wed, 29 Apr 2020 20:43:09 +0200 |
parents | 62dc0d737e7b |
children | 5d7ee14dc1eb |
line wrap: on
line source
General ======= These samples assume that a recent version of Orthanc is checked out in an `orthanc` folder next to the `orthanc-stone` folder. Let's call the top folder the `devroot` folder. This name does not matter and is not used anywhere. Here's the directory layout that we suggest: ``` devroot/ | +- orthanc/ | +- orthanc-stone/ | ... ``` Orthanc can be retrieved with: ``` hg clone https://hg.orthanc-server.com/orthanc ``` Furthermore, the samples usually assume that an Orthanc is running locally, without authentication, on port 8042. The samples can easily be tweaked if your setup is different. When Dicom resources are to be displayed, their IDs can be supplied in the various ways suitable for the platform (command-line arguments, URL parameters or through the GUI) WebAssembly samples =================== Building the WebAssembly samples require the Emscripten SDK (https://emscripten.org/). This SDK goes far beyond the simple compilation to the wasm (Web Assembly) bytecode and provides a comprehensive library that eases porting native C and C++ programs and libraries. The Emscripten SDK also makes it easy to generate the companion Javascript files requires to use a wasm module in a web application. Although Emscripten runs on all major platforms, Stone of Orthanc is developed and tested with the Linux version of Emscripten. Emscripten runs perfectly fine under the Windows Subsystem for Linux (that is the environment used quite often by the Stone of Orthanc team) **Important note:** The following examples **and the build scripts** will assume that you have installed the Emscripten SDK in `~/apps/emsdk`. The following packages should get you going (a Debian-like distribution such as Debian or Ubuntu is assumed) ``` sudo apt-get update sudo apt-get install -y build-essential curl wget git python cmake pkg-config sudo apt-get install -y mercurial unzip npm ninja-build p7zip-full gettext-base ``` SingleFrameViewer ----------------- This sample application displays a single frame of a Dicom instance that can be loaded from Orthanc, either by using the Orthanc REST API or through the Dicomweb server functionality of Orthanc. This barebones sample uses plain Javascript and requires the Emscripten toolchain and cmake, in addition to a few standard packages. To build it, just launch the `build-wasm-SingleFrameViewer.sh` script from this folder. Optionaly, you can pass the build type as an argument. We suggest that you do *not* use the `Debug` configuration unless you really need it, for the additional checks that are made will lead to a very long build time and much slower execution (more severe than with a native non-wasm target) In order to run the sample, you may serve it with the ServeFolders plugin. You can i.e: add such a section in your orthanc configuration file: ``` { "Plugins" : ["LibServeFolders.so], "ServeFolders" : { "/single-frame-viewer" : "..../out/install-stone-wasm-SingleFrameViewer-RelWithDebInfo" } } ``` You'll then be able to open the demo at `http://localhost:8042/single-frame-viewer/index.html` Native samples ================= SdlSimpleViewer --------------- ### Windows build Here's how to build the SdlSimpleViewer example using Visual Studio 2019 (the shell is Powershell, but the legacy shell can also be used with some tweaks). This example is meant to be launched from the folder above orthanc-stone. ``` # create the build folder and navigate to it $buildDir = "build-stone-sdlviewer-msvc16-x64" if (-not (Test-Path $buildDir)) { mkdir -p $buildDir | Out-Null } cd $buildDir # perform the configuration cmake -G "Visual Studio 16 2019" -A x64 ` -DMSVC_MULTIPLE_PROCESSES=ON ` -DALLOW_DOWNLOADS=ON ` -DSTATIC_BUILD=ON ` -DOPENSSL_NO_CAPIENG=ON ` ../orthanc-stone/Samples/Sdl/SimpleViewer $solutionPath = ls -filter *.sln Write-Host "Solution file(s) available at: $solutionPath" ``` The initial configuration step will be quite lengthy, for CMake needs to setup its internal cache based on your environment and build tools. Subsequent runs will be several orders of magnitude faster! One the solution (.sln) file is ready, you can open it using the Visual Studio IDE and choose Build --> Build solution. An alternative is to execute `cmake --build .` in the build folder created by the script. In order to run the sample, make sure you've an Orthanc server running i.e. on port 8042 and launch: ``` ./SingleFrameViewer --orthanc http://localhost:8042 --instance 7fc84013-abef174e-3354ca83-b9cdb2a4-f1a74368 ```