changeset 445:ee41b6a017d7 bgo-commands-codegen

dumb change
author bgo-osimis
date Wed, 16 Jan 2019 16:24:45 +0100
parents a750f11892ec
children 58cf2aac3280
files .hgignore Applications/Samples/CMakeLists.txt Applications/Samples/SimpleViewer/ApplicationCommands.fbs Applications/Samples/SimpleViewer/MainWidgetInteractor.h Applications/Samples/SimpleViewer/Wasm/mainWasm.cpp Applications/Samples/SingleFrameEditorApplication.h Applications/Samples/build-wasm-ext.sh Applications/Samples/build-wasm.sh Applications/Samples/build-web-ext.sh Applications/Samples/get-requirements-windows.ps1 Applications/Samples/nginx.local.conf Applications/Samples/package-lock.json README README.md Resources/CMake/BoostExtendedConfiguration.cmake Resources/CMake/FlatBuffersConfiguration.cmake Resources/CMake/OrthancStoneConfiguration.cmake Resources/CMake/OrthancStoneParameters.cmake Resources/CommandTool/flatc-tests/basic/BasicCommands.fbs Resources/CommandTool/flatc-tests/basic/CMakeLists.txt Resources/CommandTool/flatc-tests/basic/basic_test_gen.ps1 Resources/CommandTool/flatc-tests/basic/main.cpp Resources/CommandTool/protoc-tests/basic.proto Resources/CommandTool/protoc-tests/basic_js_test.ps1 Resources/CommandTool/protoc-tests/basic_test.html Resources/CommandTool/protoc-tests/basic_ts_test.ps1 Resources/CommandTool/protoc-tests/package-lock.json
diffstat 27 files changed, 863 insertions(+), 168 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Fri Dec 28 10:40:34 2018 +0100
+++ b/.hgignore	Wed Jan 16 16:24:45 2019 +0100
@@ -4,4 +4,10 @@
 Applications/Samples/ThirdPartyDownloads/
 Applications/Samples/build-wasm/
 Applications/Samples/build-web/
+Applications/Samples/node_modules/
+Resources/CommandTool/protoc-tests/node_modules/
+Resources/CommandTool/protoc-tests/generated_js/
+Resources/CommandTool/protoc-tests/generated_ts/
+Resources/CommandTool/flatc-tests/basic/build/
 .vscode/
+proutttttttttttttttttttttt/
\ No newline at end of file
--- a/Applications/Samples/CMakeLists.txt	Fri Dec 28 10:40:34 2018 +0100
+++ b/Applications/Samples/CMakeLists.txt	Wed Jan 16 16:24:45 2019 +0100
@@ -1,9 +1,19 @@
-# Usage (Linux):
-# to build the WASM samples
-# source ~/Downloads/emsdk/emsdk_env.sh && cmake -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DSTONE_SOURCES_DIR=$currentDir/../../../orthanc-stone -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT=$currentDir/../../../orthanc -DALLOW_DOWNLOADS=ON .. -DENABLE_WASM=ON
-# to build the Qt samples
+# Usage: see README file
 
 cmake_minimum_required(VERSION 2.8.3)
+
+# Automatically link Qt executables to qtmain target on Windows
+# ("OLD" == do not link)
+if(POLICY CMP0020)
+  cmake_policy(SET CMP0020 OLD)
+endif()
+
+# Only interpret if() arguments as variables or keywords when unquoted.
+# NEW = do NOT dereference *quoted* variables
+if(POLICY CMP0054)
+  cmake_policy(SET CMP0054 NEW)
+endif()
+
 project(OrthancStone)
 
 include(../../Resources/CMake/OrthancStoneParameters.cmake)
@@ -14,6 +24,8 @@
 set(ENABLE_QT OFF CACHE BOOL "Target Qt Native application")
 set(ENABLE_WASM OFF CACHE BOOL "Target WASM application")
 
+# TODO: replace or compute STONE_SOURCES_DIR from CMAKE_CURRENT_LIST_FILE
+
 if (ENABLE_WASM)
   #####################################################################
   ## Configuration of the Emscripten compiler for WebAssembly target
@@ -65,15 +77,14 @@
 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"")
 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"")
 
-
 #####################################################################
 ## Build a static library containing the Orthanc Stone framework
 #####################################################################
 
-
 LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options)
 
 include(../../Resources/CMake/OrthancStoneConfiguration.cmake)
+include(../../Resources/CMake/FlatBuffersConfiguration.cmake)
 
 add_library(OrthancStone STATIC
   ${ORTHANC_STONE_SOURCES}
@@ -132,6 +143,16 @@
     )
   set_target_properties(${Target} PROPERTIES COMPILE_DEFINITIONS ORTHANC_STONE_SAMPLE=${Sample})
   target_link_libraries(${Target} OrthancStone)
+  
+  if (ENABLE_QT AND (CMAKE_SYSTEM_NAME STREQUAL "Windows"))
+    message("(ENABLE_QT and (CMAKE_SYSTEM_NAME matches \"Windows\")) is true")
+    add_custom_command(
+      TARGET ${Target} POST_BUILD
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Core> $<TARGET_FILE_DIR:${Target}>
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Widgets> $<TARGET_FILE_DIR:${Target}>
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Gui> $<TARGET_FILE_DIR:${Target}>
+    )
+  endif()
 endmacro()
 
 #BuildSingleFileSample(OrthancStoneEmpty EmptyApplication.h 1)
@@ -148,6 +169,12 @@
 
 if (ENABLE_QT OR ENABLE_WASM)
 
+      GenerateCodeFromFlatBufferSchema("${ORTHANC_STONE_ROOT}/Applications/Samples/SimpleViewer/ApplicationCommands.fbs")
+
+      list(APPEND SIMPLE_VIEWER_APPLICATION_SOURCES ${FLATC_AUTOGENERATED_SOURCES})
+      message(STATUS "SIMPLE_VIEWER_APPLICATION_SOURCES = ${SIMPLE_VIEWER_APPLICATION_SOURCES}")
+      message(STATUS "FLATC_AUTOGENERATED_SOURCES = ${FLATC_AUTOGENERATED_SOURCES}")
+
     if (ENABLE_QT)
       list(APPEND SIMPLE_VIEWER_APPLICATION_SOURCES
         ${ORTHANC_STONE_ROOT}/Applications/Samples/SimpleViewer/Qt/SimpleViewerMainWindow.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Applications/Samples/SimpleViewer/ApplicationCommands.fbs	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,35 @@
+// Example IDL file for our monster's schema.
+namespace Orthanc.Stone.Applications;
+
+union VsolCommands {SelectPanel, ConfigurePanel, StartAcquisition}
+union VsolReplies { SelectPanelReply, StartAcquisitionReply }
+
+table SelectPanel {
+  panelNumber:int32;
+}
+
+table SelectPanelReply {
+  ok:bool;
+  errorMessage:string;
+}
+
+table ConfigurePanel {
+}
+
+table StartAcquisition {
+}
+
+table StartAcquisitionReply {
+  ok:bool;
+}
+
+table VsolCommand {
+  command: VsolCommands;
+}
+
+table VsolReply {
+  command: VsolReplies;
+}
+
+// root_type Monster;
+
--- a/Applications/Samples/SimpleViewer/MainWidgetInteractor.h	Fri Dec 28 10:40:34 2018 +0100
+++ b/Applications/Samples/SimpleViewer/MainWidgetInteractor.h	Wed Jan 16 16:24:45 2019 +0100
@@ -18,7 +18,6 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
-
 #pragma once
 
 #include "Framework/Widgets/IWorldSceneInteractor.h"
@@ -40,6 +39,9 @@
     {
     }
 
+    /**
+        WorldSceneWidget: 
+    */
     virtual IWorldSceneMouseTracker* CreateMouseTracker(WorldSceneWidget& widget,
                                                         const ViewportGeometry& view,
                                                         MouseButton button,
--- a/Applications/Samples/SimpleViewer/Wasm/mainWasm.cpp	Fri Dec 28 10:40:34 2018 +0100
+++ b/Applications/Samples/SimpleViewer/Wasm/mainWasm.cpp	Wed Jan 16 16:24:45 2019 +0100
@@ -35,4 +35,4 @@
 OrthancStone::WasmPlatformApplicationAdapter* CreateWasmApplicationAdapter(OrthancStone::MessageBroker& broker, IStoneApplication* application)
 {
   return new SimpleViewer::SimpleViewerWasmApplicationAdapter(broker, *(dynamic_cast<SimpleViewer::SimpleViewerApplication*>(application)));
-}
\ No newline at end of file
+}
--- a/Applications/Samples/SingleFrameEditorApplication.h	Fri Dec 28 10:40:34 2018 +0100
+++ b/Applications/Samples/SingleFrameEditorApplication.h	Wed Jan 16 16:24:45 2019 +0100
@@ -468,8 +468,7 @@
         fontRegistry_.AddFromResource(Orthanc::EmbeddedResources::FONT_UBUNTU_MONO_BOLD_16);
         
         scene_.reset(new RadiographyScene(GetBroker()));
-        //scene_->LoadDicomFrame(instance, frame, false); //.SetPan(200, 0);
-        scene_->LoadDicomFrame(context->GetOrthancApiClient(), "61f3143e-96f34791-ad6bbb8d-62559e75-45943e1b", 0, false, NULL);
+        scene_->LoadDicomFrame(context->GetOrthancApiClient(), instance, 0, false, NULL);
 
 #if !defined(ORTHANC_ENABLE_WASM) || ORTHANC_ENABLE_WASM != 1
         Orthanc::HttpClient::ConfigureSsl(true, "/etc/ssl/certs/ca-certificates.crt");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Applications/Samples/build-wasm-ext.sh	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# usage:
+# to build all targets:
+# ./build-wasm.sh
+#
+# to build a single target:
+# ./build-wasm.sh OrthancStoneSingleFrameEditor
+
+set -e
+
+target=${1:-all}
+
+# we will create the output files in a "build-wasm" folder in current location
+
+# let's save current dir
+currentDir=$(pwd)
+
+scriptDirRel=$(dirname $0)
+#echo $scriptDirRel
+scriptDirAbs=$(realpath $scriptDirRel)
+echo $scriptDirAbs
+
+pushd
+# echo "$0"
+# echo $BASH_SOURCE
+# echo "$BASH_SOURCE"
+# scriptDir=dirname $0
+# echo "***********"
+# echo "***********"
+
+#echo "Script folder is" 
+#echo "$(cd "$(dirname "$BASH_SOURCE")"; pwd)/$(basename ""$BASH_SOURCE")"
+
+#samplesRootDir=$(pwd)
+samplesRootDir=${scriptDirAbs}
+echo "samplesRootDir = " ${samplesRootDir}
+
+mkdir -p build-wasm
+cd build-wasm
+
+source ~/apps/emsdk/emsdk_env.sh
+cmake -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DSTONE_SOURCES_DIR=$samplesRootDir/../.. -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT=$samplesRootDir/../../../orthanc -DALLOW_DOWNLOADS=ON $samplesRootDir -DENABLE_WASM=ON
+make -j 5 $target
+
+echo "-- building the web application -- "
+cd ${samplesRootDir}
+./build-web-ext.sh
+
+popd
--- a/Applications/Samples/build-wasm.sh	Fri Dec 28 10:40:34 2018 +0100
+++ b/Applications/Samples/build-wasm.sh	Wed Jan 16 16:24:45 2019 +0100
@@ -17,10 +17,10 @@
 mkdir -p $samplesRootDir/build-wasm
 cd $samplesRootDir/build-wasm
 
-source ~/Downloads/emsdk/emsdk_env.sh
+source ~/apps/emsdk/emsdk_env.sh
 cmake -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DSTONE_SOURCES_DIR=$currentDir/../../../orthanc-stone -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT=$currentDir/../../../orthanc -DALLOW_DOWNLOADS=ON .. -DENABLE_WASM=ON
 make -j 5 $target
 
 echo "-- building the web application -- "
 cd $currentDir
-./build-web.sh
\ No newline at end of file
+./build-web.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Applications/Samples/build-web-ext.sh	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+set -e
+
+target=${1:-all}
+# this script currently assumes that the wasm code has been built on its side and is availabie in build-wasm/
+
+currentDir=$(pwd)
+
+scriptDirRel=$(dirname $0)
+#echo $scriptDirRel
+scriptDirAbs=$(realpath $scriptDirRel)
+echo $scriptDirAbs
+
+samplesRootDir=scriptDirAbs
+
+outputDir=$samplesRootDir/build-web/
+mkdir -p $outputDir
+
+# files used by all single files samples
+cp $samplesRootDir/Web/index.html $outputDir
+cp $samplesRootDir/Web/samples-styles.css $outputDir
+
+# build simple-viewer-single-file (obsolete project)
+if [[ $target == "all" || $target == "OrthancStoneSimpleViewerSingleFile" ]]; then
+  cp $samplesRootDir/Web/simple-viewer-single-file.html $outputDir
+  tsc --allowJs --project $samplesRootDir/Web/simple-viewer-single-file.tsconfig.json
+  cp $currentDir/build-wasm/OrthancStoneSimpleViewerSingleFile.js  $outputDir
+  cp $currentDir/build-wasm/OrthancStoneSimpleViewerSingleFile.wasm  $outputDir
+fi
+
+# build single-frame
+if [[ $target == "all" || $target == "OrthancStoneSingleFrame" ]]; then
+  cp $samplesRootDir/Web/single-frame.html $outputDir
+  tsc --allowJs --project $samplesRootDir/Web/single-frame.tsconfig.json
+  cp $currentDir/build-wasm/OrthancStoneSingleFrame.js  $outputDir
+  cp $currentDir/build-wasm/OrthancStoneSingleFrame.wasm  $outputDir
+fi
+
+# build single-frame-editor
+if [[ $target == "all" || $target == "OrthancStoneSingleFrameEditor" ]]; then
+  cp $samplesRootDir/Web/single-frame-editor.html $outputDir
+  tsc --allowJs --project $samplesRootDir/Web/single-frame-editor.tsconfig.json
+  cp $currentDir/build-wasm/OrthancStoneSingleFrameEditor.js  $outputDir
+  cp $currentDir/build-wasm/OrthancStoneSingleFrameEditor.wasm  $outputDir
+fi
+
+# build simple-viewer project
+if [[ $target == "all" || $target == "OrthancStoneSimpleViewer" ]]; then
+  mkdir -p $outputDir/simple-viewer/
+  cp $samplesRootDir/SimpleViewer/Wasm/simple-viewer.html $outputDir/simple-viewer/
+  cp $samplesRootDir/SimpleViewer/Wasm/styles.css $outputDir/simple-viewer/
+  tsc --allowJs --project $samplesRootDir/SimpleViewer/Wasm/tsconfig-simple-viewer.json
+  cp $currentDir/build-wasm/OrthancStoneSimpleViewer.js  $outputDir/simple-viewer/
+  cp $currentDir/build-wasm/OrthancStoneSimpleViewer.wasm  $outputDir/simple-viewer/
+fi
+
+cd $currentDir
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Applications/Samples/get-requirements-windows.ps1	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,50 @@
+
+if ($true) {
+
+    Write-Error "This script is obsolete. Please work under WSL and run build-wasm.sh"
+
+} else {
+
+    param(
+        [IO.DirectoryInfo] $EmsdkRootDir = "C:\Emscripten",
+        [bool] $Overwrite = $false
+      )
+    
+    if (Test-Path -Path $EmsdkRootDir) {
+        if( $Override) {
+            Remove-Item -Path $EmsdkRootDir -Force -Recurse
+        } else {
+            throw "The `"$EmsdkRootDir`" folder may not exist! Use the Overwrite flag to bypass this check."
+        }
+    }
+    
+    # TODO: detect whether git is installed
+    # choco install -y git
+    
+    Write-Host "Will retrieve the Emscripten SDK to the `"$EmsdkRootDir`" folder"
+    
+    $EmsdkParentDir = split-path -Parent $EmsdkRootDir
+    $EmsdkRootName = split-path -Leaf $EmsdkRootDir
+    
+    Push-Location $EmsdkParentDir
+    
+    git clone https://github.com/juj/emsdk.git $EmsdkRootName
+    cd $EmsdkRootName
+    
+    git pull
+    
+    ./emsdk install latest
+    
+    ./emsdk activate latest
+    
+    echo "INFO: the ~/.emscripten file has been configured for this installation of Emscripten."
+    
+    Write-Host "emsdk is now installed in $EmsdkRootDir"
+    
+    Pop-Location
+
+}
+
+
+
+
--- a/Applications/Samples/nginx.local.conf	Fri Dec 28 10:40:34 2018 +0100
+++ b/Applications/Samples/nginx.local.conf	Wed Jan 16 16:24:45 2019 +0100
@@ -30,7 +30,7 @@
     # reverse proxy orthanc
 	location /orthanc/ {
 		rewrite /orthanc(.*) $1 break;
-		proxy_pass http://127.0.0.1:8042;
+		proxy_pass http://127.0.0.1:8044;
 		proxy_set_header Host $http_host;
 		proxy_set_header my-auth-header good-token;
 		proxy_request_buffering off;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Applications/Samples/package-lock.json	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,11 @@
+{
+  "requires": true,
+  "lockfileVersion": 1,
+  "dependencies": {
+    "typescript": {
+      "version": "3.2.2",
+      "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.2.tgz",
+      "integrity": "sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg=="
+    }
+  }
+}
--- a/README	Fri Dec 28 10:40:34 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-Stone of Orthanc
-================
-
-
-General Information
--------------------
-
-This repository contains the source code of the Stone of Orthanc.
-
-Stone of Orthanc is a lightweight, cross-platform C++ framework for
-the CPU-based rendering of medical images. It notably features support
-for MPR (multiplanar reconstruction of volume images), PET-CT fusion,
-and accurate physical world coordinates.
-
-Stone of Orthanc comes bundled with its own software-based rendering
-engine (based upon pixman). This engine will use CPU hardware
-acceleration if available (notably SSE2, SSSE3, and NEON instruction
-sets), but not the GPU. This makes Stone a highly versatile framework
-that can run even on low-performance platforms. Note that Stone is
-able to display DICOM series without having to entirely store them in
-the RAM (i.e. frame by frame).
-
-Thanks to its standalone rendering engine, Stone of Orthanc is also
-compatible with any GUI framework (such as Qt, wxWidgets, MFC...). The
-provided sample applications use the SDL framework.
-
-Stone is conceived as a companion toolbox to the Orthanc VNA (vendor
-neutral archive, i.e. DICOM server). As a consequence, Stone will
-smoothly interface with Orthanc out of the box. Interestingly, Stone
-does not contain any DICOM toolkit: It entirely relies on the REST API
-of Orthanc to parse/decode DICOM images. However, thanks to the
-object-oriented architecture of Stone, it is possible to avoid this
-dependency upon Orthanc, e.g. to download DICOM datasets using
-DICOMweb.
-
-
-Comparison
-----------
-
-Pay attention to the fact that Stone of Orthanc is a toolkit, and not
-a fully-featured application for the visualization of medical images
-(such as Horos/OsiriX or Ginkgo CADx). However, such applications
-could be built on the top of Stone of Orthanc.
-
-Stone of Orthanc is quite similar to two other well-known toolkits:
-
-* Cornerstone, a client-side JavaScript toolkit to display medical
-  images in Web browsers, by Chris Hafey <chafey@gmail.com>:
-  https://github.com/chafey/cornerstone
-
-  Contrarily to Cornerstone, Stone of Orthanc can be embedded into
-  native, heavyweight applications.
-
-* VTK, a C++ toolkit for scientific visualization, by Kitware:
-  http://www.vtk.org/
-
-  Contrarily to VTK, Stone of Orthanc is focused on CPU-based, 2D
-  rendering: The GPU will not be used.
-
-
-Dependencies
-------------
-
-Stone of Orthanc is based upon the following projects:
-
-* Orthanc, a lightweight Vendor Neutral Archive (DICOM server):
-  http://www.orthanc-server.com/
-
-* Cairo and pixman, a cross-platform 2D graphics library:
-  https://www.cairographics.org/
-
-* Optionally, SDL, a cross-platform multimedia library:
-  https://www.libsdl.org/
-
-Prerequisites to compile on Ubuntu: 
-```
-sudo apt-get install -y libcairo-dev libpixman-1-dev libsdl2-dev
-```
-
-Installation and usage
-----------------------
-
-Build instructions are similar to that of Orthanc:
-https://orthanc.chu.ulg.ac.be/book/faq/compiling.html
-
-Usage details are available as part of the Orthanc Book:
-http://book.orthanc-server.com/developers/stone.html
-
-Stone of Orthanc comes with several sample applications in the
-"Samples" folder. These samples can be compiled into Web Assembly
-or into native SDL applications.
-
-to build the WASM samples:
--------------------------
-```
-cd ~/orthanc-stone/Applications/Samples
-./build-wasm.sh
-```
-
-to serve the WASM samples:
-```
-# launch an Orthanc listening on 8042 port:
-Orthanc
-
-# launch an nginx that will serve the WASM static files and reverse proxy Orthanc
-sudo nginx -p $(pwd) -c nginx.local.conf
-```
-Now, you can open the samples in http://localhost:9977
-
-to build the SDL native samples (SimpleViewer only):
--------------------------------
-```
-mkdir -p ~/builds/orthanc-stone-build
-cd ~/builds/orthanc-stone-build
-cmake -DALLOW_DOWNLOADS=ON -DENABLE_SDL=ON ~/orthanc-stone/Applications/Samples/
-cmake --build . --target OrthancStoneSimpleViewer -- -j 5
-```
-
-to execute the native samples:
-```
-# launch an Orthanc listening on 8042 port:
-Orthanc
-
-# launch the sample
-./OrthancStoneSimpleViewer --studyId=XX
-``` 
-
-
-Licensing
----------
-
-Stone of Orthanc is licensed under the AGPL license.
-
-We also kindly ask scientific works and clinical studies that make
-use of Orthanc to cite Orthanc in their associated publications.
-Similarly, we ask open-source and closed-source products that make
-use of Orthanc to warn us about this use. You can cite our work
-using the following BibTeX entry:
-
-@Article{Jodogne2018,
-  author="Jodogne, S{\'e}bastien",
-  title="The {O}rthanc Ecosystem for Medical Imaging",
-  journal="Journal of Digital Imaging",
-  year="2018",
-  month="Jun",
-  day="01",
-  volume="31",
-  number="3",
-  pages="341--352",
-  issn="1618-727X",
-  doi="10.1007/s10278-018-0082-y",
-  url="https://doi.org/10.1007/s10278-018-0082-y"
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,194 @@
+Stone of Orthanc
+================
+
+General Information
+-------------------
+
+This repository contains the source code of the Stone of Orthanc.
+
+Stone of Orthanc is a lightweight, cross-platform C++ framework for
+the CPU-based rendering of medical images. It notably features support
+for MPR (multiplanar reconstruction of volume images), PET-CT fusion,
+and accurate physical world coordinates.
+
+Stone of Orthanc comes bundled with its own software-based rendering
+engine (based upon pixman). This engine will use CPU hardware
+acceleration if available (notably SSE2, SSSE3, and NEON instruction
+sets), but not the GPU. This makes Stone a highly versatile framework
+that can run even on low-performance platforms. Note that Stone is
+able to display DICOM series without having to entirely store them in
+the RAM (i.e. frame by frame).
+
+Thanks to its standalone rendering engine, Stone of Orthanc is also
+compatible with any GUI framework (such as Qt, wxWidgets, MFC...). The
+provided sample applications use the SDL framework.
+
+Stone is conceived as a companion toolbox to the Orthanc VNA (vendor
+neutral archive, i.e. DICOM server). As a consequence, Stone will
+smoothly interface with Orthanc out of the box. Interestingly, Stone
+does not contain any DICOM toolkit: It entirely relies on the REST API
+of Orthanc to parse/decode DICOM images. However, thanks to the
+object-oriented architecture of Stone, it is possible to avoid this
+dependency upon Orthanc, e.g. to download DICOM datasets using
+DICOMweb.
+
+
+Comparison
+----------
+
+Pay attention to the fact that Stone of Orthanc is a toolkit, and not
+a fully-featured application for the visualization of medical images
+(such as Horos/OsiriX or Ginkgo CADx). However, such applications
+can be built on the top of Stone of Orthanc.
+
+Stone of Orthanc is quite similar to two other well-known toolkits:
+
+* Cornerstone, a client-side JavaScript toolkit to display medical
+  images in Web browsers, by Chris Hafey <chafey@gmail.com>:
+  https://github.com/chafey/cornerstone
+
+  Contrarily to Cornerstone, Stone of Orthanc can be embedded into
+  native, heavyweight applications.
+
+* VTK, a C++ toolkit for scientific visualization, by Kitware:
+  http://www.vtk.org/
+
+  Contrarily to VTK, Stone of Orthanc is focused on CPU-based, 2D
+  rendering: The GPU will not be used.
+
+
+Dependencies
+------------
+
+Stone of Orthanc is based upon the following projects:
+
+* Orthanc, a lightweight Vendor Neutral Archive (DICOM server):
+  http://www.orthanc-server.com/
+
+* Cairo and pixman, a cross-platform 2D graphics library:
+  https://www.cairographics.org/
+
+* Optionally, SDL, a cross-platform multimedia library:
+  https://www.libsdl.org/
+
+Prerequisites to compile natively on Ubuntu: 
+```
+sudo apt-get install -y libcairo-dev libpixman-1-dev libsdl2-dev
+```
+
+The emscripten SDK is required for the WASM build. Please install it
+in `~/apps/emsdk`. If you wish to use it in another way, please edit
+the `build-wasm.sh` file.
+
+Installation and usage ----------------------
+
+Build instructions are similar to that of Orthanc:
+https://orthanc.chu.ulg.ac.be/book/faq/compiling.html
+
+Usage details are available as part of the Orthanc Book:
+http://book.orthanc-server.com/developers/stone.html
+
+Stone of Orthanc comes with several sample applications in the
+`Samples` folder. These samples can be compiled into Web Assembly or
+into native SDL applications.
+
+The following assumes that the source code to be downloaded in
+`~/orthanc-stone` and Orthanc source code to be checked out in
+`~/orthanc`. 
+
+Building the WASM samples
+-------------------------------------
+```
+cd ~/orthanc-stone/Applications/Samples
+./build-wasm.sh
+```
+
+Serving the WASM samples
+------------------------------------
+```
+# launch an Orthanc listening on 8042 port:
+Orthanc
+
+# launch an nginx that will serve the WASM static files and reverse
+# proxy
+sudo nginx -p $(pwd) -c nginx.local.conf
+```
+
+You can now open the samples in http://localhost:9977
+
+Building the SDL native samples (SimpleViewer only)
+---------------------------------------------------
+
+The following also assumes that you have checked out the Orthanc
+source code in an `orthanc` folder next to the Stone of Orthanc
+repository, please enter the following:
+
+```
+mkdir -p ~/builds/orthanc-stone-build
+cd ~/builds/orthanc-stone-build
+cmake -DORTHANC_FRAMEWORK_SOURCE=path \
+    -DORTHANC_FRAMEWORK_ROOT=$currentDir/../../../orthanc \
+    -DALLOW_DOWNLOADS=ON -DENABLE_SDL=ON \
+    ~/orthanc-stone/Applications/Samples/
+```
+
+If you are working on Windows, add the correct generator option to
+cmake to, for instance, generate msbuild files for Visual Studio.
+
+Then, under Linux:
+```
+cmake --build . --target OrthancStoneSimpleViewer -- -j 5
+```
+
+Note: replace `$($pwd)` with the current directory when not using Powershell
+
+Building the Qt native samples (SimpleViewer only) under Windows:
+------------------------------------------------------------------
+For instance, if Qt is installed in `C:\Qt\5.12.0\msvc2017_64`
+
+`cmake -DSTATIC_BUILD=ON -DCMAKE_PREFIX_PATH=C:\Qt\5.12.0\msvc2017_64 -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT="$($pwd)\..\orthanc" -DALLOW_DOWNLOADS=ON -DENABLE_QT=ON -G "Visual Studio 15 2017 Win64" ../orthanc-stone/Applications/Samples/`
+
+Note: replace `$($pwd)` with the current directory when not using Powershell
+
+
+Building the SDL native samples (SimpleViewer only) under Windows:
+------------------------------------------------------------------
+`cmake -DSTATIC_BUILD=ON -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT="$($pwd)\..\orthanc" -DALLOW_DOWNLOADS=ON -DENABLE_SDL=ON -G "Visual Studio 15 2017 Win64" ../orthanc-stone/Applications/Samples/`
+
+Note: replace `$($pwd)` with the current directory when not using Powershell
+
+Executing the native samples:
+--------------------------------
+```
+# launch an Orthanc listening on 8042 port:
+Orthanc
+
+# launch the sample
+./OrthancStoneSimpleViewer --studyId=XX
+``` 
+
+Licensing
+---------
+
+Stone of Orthanc is licensed under the AGPL license.
+
+We also kindly ask scientific works and clinical studies that make
+use of Orthanc to cite Orthanc in their associated publications.
+Similarly, we ask open-source and closed-source products that make
+use of Orthanc to warn us about this use. You can cite our work
+using the following BibTeX entry:
+
+@Article{Jodogne2018,
+  author="Jodogne, S{\'e}bastien",
+  title="The {O}rthanc Ecosystem for Medical Imaging",
+  journal="Journal of Digital Imaging",
+  year="2018",
+  month="Jun",
+  day="01",
+  volume="31",
+  number="3",
+  pages="341--352",
+  issn="1618-727X",
+  doi="10.1007/s10278-018-0082-y",
+  url="https://doi.org/10.1007/s10278-018-0082-y"
+}
--- a/Resources/CMake/BoostExtendedConfiguration.cmake	Fri Dec 28 10:40:34 2018 +0100
+++ b/Resources/CMake/BoostExtendedConfiguration.cmake	Wed Jan 16 16:24:45 2019 +0100
@@ -29,6 +29,9 @@
     ${BOOST_SOURCES_DIR}/libs/program_options/src/utf8_codecvt_facet.cpp
     ${BOOST_SOURCES_DIR}/libs/program_options/src/value_semantic.cpp
     ${BOOST_SOURCES_DIR}/libs/program_options/src/variables_map.cpp
+    ${BOOST_SOURCES_DIR}/libs/chrono/src/thread_clock.cpp
+    ${BOOST_SOURCES_DIR}/libs/chrono/src/chrono.cpp
+    ${BOOST_SOURCES_DIR}/libs/chrono/src/process_cpu_clocks.cpp
     #${BOOST_SOURCES_DIR}/libs/program_options/src/winmain.cpp
     )
   add_definitions(-DBOOST_PROGRAM_OPTIONS_NO_LIB)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CMake/FlatBuffersConfiguration.cmake	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,171 @@
+# Stone of Orthanc
+# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+# Department, University Hospital of Liege, Belgium
+# Copyright (C) 2017-2019 Osimis S.A., Belgium
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Affero General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake)
+set(FLATC_AUTOGENERATED_SOURCES)
+
+if (STATIC_BUILD OR NOT USE_SYSTEM_FLATBUFFERS)
+  SET(FLATBUFFERS_SOURCES_DIR ${CMAKE_BINARY_DIR}/flatbuffers-1.10)
+  SET(FLATBUFFERS_URL "http://127.0.0.1:8000/flatbuffers-1.10.tar.gz")
+  SET(FLATBUFFERS_MD5 "d5f131809c14def9682d49385b452e43")
+
+  DownloadPackage(${FLATBUFFERS_MD5} ${FLATBUFFERS_URL} "${FLATBUFFERS_SOURCES_DIR}")
+
+  include_directories(${FLATBUFFERS_SOURCES_DIR}/include)
+
+  # we only need the flatc compiler!
+  set(FLATBUFFERS_BUILD_TESTS OFF)
+  set(FLATBUFFERS_INSTALL OFF)
+  set(FLATBUFFERS_BUILD_FLATLIB OFF)
+  set(FLATBUFFERS_BUILD_FLATC ON)
+  set(FLATBUFFERS_BUILD_FLATHASH OFF)
+  set(FLATBUFFERS_BUILD_GRPCTEST OFF)
+  set(FLATBUFFERS_BUILD_SHAREDLIB OFF)
+  set(FLATBUFFERS_LIBCXX_WITH_CLANG OFF)
+
+  # add_subdirectory(${FLATBUFFERS_SOURCES_DIR}
+  #    ${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-build
+  #    EXCLUDE_FROM_ALL)
+
+  # Now simply link against flatbuffers as needed to your already declared target.
+  # The flatbuffers target carry header search path automatically if CMake > 2.8.11.
+  #target_link_libraries(own_project_target PRIVATE flatbuffers)
+
+else()
+  find_package(FlatBuffers)
+  include_directories(${SDL2_INCLUDE_DIRS})
+  link_libraries(${SDL2_LIBRARIES})
+endif()
+
+macro(GetFilenameFromPath TargetVariable Path)
+  #message(STATUS "GetFilenameFromPath (1): Path = ${Path} TargetVariable = ${${TargetVariable}}")
+  string(REPLACE "\\" "/" PathWithFwdSlashes "${Path}")
+  string(REGEX REPLACE "^.*/" "" ${TargetVariable} "${PathWithFwdSlashes}")
+  #message(STATUS "GetFilenameFromPath (2): Path = ${Path} Path = ${PathWithFwdSlashes} TargetVariable = ${TargetVariable}")
+endmacro()
+
+macro(GetFilePathWithoutLastExtension TargetVariable FilePath)
+  string(REGEX REPLACE "(^.*)\\.([^\\.]+)" "\\1" ${TargetVariable} "${FilePath}")
+  #message(STATUS "GetFileNameWithoutLastExtension: FilePath = ${FilePath} TargetVariable = ${${TargetVariable}}")
+endmacro()
+
+macro(Test_GetFilePathWithoutLastExtension)
+  set(tmp "/prout/zi/goui.goui.cpp")
+  GetFilePathWithoutLastExtension(TargetVariable "${tmp}")
+  if(NOT ("${TargetVariable}" STREQUAL "/prout/zi/goui.goui"))
+    message(FATAL_ERROR "Test_GetFilePathWithoutLastExtension failed (1)")
+  else()
+    #message(STATUS "Test_GetFilePathWithoutLastExtension: <<OK>>")
+  endif()
+endmacro()
+
+Test_GetFilePathWithoutLastExtension()
+
+macro(Test_GetFilenameFromPath)
+  set(tmp "/prout/../../dada/zi/goui.goui.cpp")
+  GetFilenameFromPath(TargetVariable "${tmp}")
+  if(NOT ("${TargetVariable}" STREQUAL "goui.goui.cpp"))
+    message(FATAL_ERROR "Test_GetFilenameFromPath failed")
+  else()
+    #message(STATUS "Test_GetFilenameFromPath: <<OK>>")
+  endif()
+endmacro()
+
+Test_GetFilenameFromPath()
+
+macro(GenerateCodeFromFlatBufferSchema schemaFilePath)
+  # extract file name
+  GetFilePathWithoutLastExtension(schemaFilePathWithoutExt ${schemaFilePath})
+  
+  # remove extension
+  GetFilenameFromPath(schemaFileNameWithoutExt ${schemaFilePathWithoutExt})
+  
+  set(generatedFilePathWithoutExtension "${CMAKE_BINARY_DIR}/${schemaFileNameWithoutExt}_generated")
+  set(generatedCppFileName "${generatedFilePathWithoutExtension}.h")
+  set(generatedTsFileName "${generatedFilePathWithoutExtension}.ts")
+  set(generatedJsFileName "${generatedFilePathWithoutExtension}.js")
+
+  set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED")
+  set(AUTOGENERATED_SOURCES)
+  
+  set(FLATC_EXECUTABLE "flatc")
+  find_program(FLATC_EXECUTABLE_SEARCH ${FLATC_EXECUTABLE})
+  if(NOT FLATC_EXECUTABLE_SEARCH)
+    message(FATAL_ERROR "FlatBuffers compiler not found")
+  endif()
+
+  set(SCRIPT_CPP_OPTIONS)
+  list(APPEND SCRIPT_CPP_OPTIONS "--gen-object-api")
+  list(APPEND SCRIPT_CPP_OPTIONS "--cpp")
+  list(APPEND SCRIPT_CPP_OPTIONS "--gen-onefile")
+  list(APPEND SCRIPT_CPP_OPTIONS "--gen-all")
+  list(APPEND SCRIPT_CPP_OPTIONS "--force-empty")
+  list(APPEND SCRIPT_CPP_OPTIONS "--reflect-types")
+  list(APPEND SCRIPT_CPP_OPTIONS "--reflect-names")
+
+  set(SCRIPT_TS_OPTIONS)
+  list(APPEND SCRIPT_TS_OPTIONS "--gen-object-api")
+  list(APPEND SCRIPT_TS_OPTIONS "--ts")
+  list(APPEND SCRIPT_TS_OPTIONS "--gen-onefile")
+  list(APPEND SCRIPT_TS_OPTIONS "--gen-all")
+  list(APPEND SCRIPT_TS_OPTIONS "--no-js-exports")
+  list(APPEND SCRIPT_TS_OPTIONS "--force-empty")
+  list(APPEND SCRIPT_TS_OPTIONS "--reflect-types")
+  list(APPEND SCRIPT_TS_OPTIONS "--reflect-names")
+
+  set(SCRIPT_JS_OPTIONS)
+  list(APPEND SCRIPT_JS_OPTIONS "--gen-object-api")
+  list(APPEND SCRIPT_JS_OPTIONS "--js")
+  list(APPEND SCRIPT_JS_OPTIONS "--gen-onefile")
+  list(APPEND SCRIPT_JS_OPTIONS "--gen-all")
+  list(APPEND SCRIPT_JS_OPTIONS "--no-js-exports")
+  list(APPEND SCRIPT_JS_OPTIONS "--force-empty")
+  list(APPEND SCRIPT_JS_OPTIONS "--reflect-types")
+  list(APPEND SCRIPT_JS_OPTIONS "--reflect-names")
+
+  add_custom_command(
+    OUTPUT
+    ${generatedCppFileName}
+    COMMAND 
+    ${FLATC_EXECUTABLE} ${SCRIPT_CPP_OPTIONS} ${schemaFilePath}
+    DEPENDS
+    ${schemaFilePath}
+    )
+  
+  add_custom_command(
+    OUTPUT
+    ${generatedTsFileName}
+    COMMAND 
+    ${FLATC_EXECUTABLE} ${SCRIPT_TS_OPTIONS} ${schemaFilePath}
+    DEPENDS
+    ${schemaFilePath}
+    )
+  
+  add_custom_command(
+    OUTPUT
+    ${generatedJsFileName}
+    COMMAND 
+    ${FLATC_EXECUTABLE} ${SCRIPT_JS_OPTIONS} ${schemaFilePath}
+    DEPENDS
+    ${schemaFilePath}
+    )
+
+    list(APPEND FLATC_AUTOGENERATED_SOURCES "${generatedCppFileName}") 
+    list(APPEND FLATC_AUTOGENERATED_SOURCES "${generatedJsFileName}") 
+    list(APPEND FLATC_AUTOGENERATED_SOURCES "${generatedTsFileName}") 
+
+endmacro()
--- a/Resources/CMake/OrthancStoneConfiguration.cmake	Fri Dec 28 10:40:34 2018 +0100
+++ b/Resources/CMake/OrthancStoneConfiguration.cmake	Wed Jan 16 16:24:45 2019 +0100
@@ -101,8 +101,6 @@
   add_definitions(-DORTHANC_ENABLE_NATIVE=0)
 endif()
 
-
-
 #####################################################################
 ## Configuration of the C/C++ macros
 #####################################################################
--- a/Resources/CMake/OrthancStoneParameters.cmake	Fri Dec 28 10:40:34 2018 +0100
+++ b/Resources/CMake/OrthancStoneParameters.cmake	Wed Jan 16 16:24:45 2019 +0100
@@ -22,6 +22,8 @@
 ## Import the parameters of the Orthanc Framework
 #####################################################################
 
+message("CMAKE_CURRENT_LIST_DIR = ${CMAKE_CURRENT_LIST_DIR}")
+
 include(${CMAKE_CURRENT_LIST_DIR}/../../Resources/Orthanc/DownloadOrthancFramework.cmake)
 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CommandTool/flatc-tests/basic/BasicCommands.fbs	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,41 @@
+// Example IDL file for our monster's schema.
+namespace Orthanc.Stone.Applications;
+
+union BasicCommands = {SelectTool, PanImage}
+union BasicReplies = {SelectToolReply, PanImageReply, LoadFileReply }
+
+table SelectTool {
+  tool:Tool;
+}
+
+table SelectToolReply {
+}
+
+table PanImage {
+  x:int32;
+  y:int32;
+}
+
+table PanImageReply {
+  x:int32;
+  y:int32;
+}
+
+table LoadFile {
+  filePath:string;
+}
+
+table LoadFileReply {
+  success:bool;
+}
+
+union BasicCommand {
+  command: BasicCommands
+}
+
+union BasicReply {
+  command: BasicReplies
+}
+
+// root_type Monster;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CommandTool/flatc-tests/basic/CMakeLists.txt	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,79 @@
+cmake_minimum_required(VERSION 2.8.3)
+
+project(BasicFlatBuffersTest)
+
+set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED")
+set(AUTOGENERATED_SOURCES)
+
+set(FLATC_EXECUTABLE "flatc")
+
+set(DEPOT_ROOT "/osimis")
+
+set(SCRIPT_CPP_OPTIONS)
+list(APPEND SCRIPT_CPP_OPTIONS "--gen-object-api")
+list(APPEND SCRIPT_CPP_OPTIONS "--cpp")
+list(APPEND SCRIPT_CPP_OPTIONS "--gen-onefile")
+list(APPEND SCRIPT_CPP_OPTIONS "--gen-all")
+list(APPEND SCRIPT_CPP_OPTIONS "--force-empty")
+list(APPEND SCRIPT_CPP_OPTIONS "--reflect-types")
+list(APPEND SCRIPT_CPP_OPTIONS "--reflect-names")
+
+set(SCRIPT_TS_OPTIONS)
+list(APPEND SCRIPT_TS_OPTIONS "--gen-object-api")
+list(APPEND SCRIPT_TS_OPTIONS "--ts")
+list(APPEND SCRIPT_TS_OPTIONS "--gen-onefile")
+list(APPEND SCRIPT_TS_OPTIONS "--gen-all")
+list(APPEND SCRIPT_TS_OPTIONS "--no-js-exports")
+list(APPEND SCRIPT_TS_OPTIONS "--force-empty")
+list(APPEND SCRIPT_TS_OPTIONS "--reflect-types")
+list(APPEND SCRIPT_TS_OPTIONS "--reflect-names")
+
+set(SCRIPT_JS_OPTIONS)
+list(APPEND SCRIPT_JS_OPTIONS "--gen-object-api")
+list(APPEND SCRIPT_JS_OPTIONS "--js")
+list(APPEND SCRIPT_JS_OPTIONS "--gen-onefile")
+list(APPEND SCRIPT_JS_OPTIONS "--gen-all")
+list(APPEND SCRIPT_JS_OPTIONS "--no-js-exports")
+list(APPEND SCRIPT_JS_OPTIONS "--force-empty")
+list(APPEND SCRIPT_JS_OPTIONS "--reflect-types")
+list(APPEND SCRIPT_JS_OPTIONS "--reflect-names")
+
+set(SCHEMA_FILE "${CMAKE_CURRENT_LIST_DIR}/basic.fbs")
+set(AUTOGENERATED_CPP_FILE "${CMAKE_BINARY_DIR}/basic_generated.h")
+set(AUTOGENERATED_TS_FILE "${CMAKE_BINARY_DIR}/basic_generated.ts")
+set(AUTOGENERATED_JS_FILE "${CMAKE_BINARY_DIR}/basic_generated.js")
+
+add_custom_command(
+  OUTPUT
+  ${AUTOGENERATED_CPP_FILE}
+  COMMAND 
+  ${FLATC_EXECUTABLE} ${SCRIPT_CPP_OPTIONS} ${SCHEMA_FILE}
+  DEPENDS
+  ${SCHEMA_FILE}
+  )
+
+add_custom_command(
+  OUTPUT
+  ${AUTOGENERATED_TS_FILE}
+  COMMAND 
+  ${FLATC_EXECUTABLE} ${SCRIPT_TS_OPTIONS} ${SCHEMA_FILE}
+  DEPENDS
+  ${SCHEMA_FILE}
+  )
+
+add_custom_command(
+  OUTPUT
+  ${AUTOGENERATED_JS_FILE}
+  COMMAND 
+  ${FLATC_EXECUTABLE} ${SCRIPT_JS_OPTIONS} ${SCHEMA_FILE}
+  DEPENDS
+  ${SCHEMA_FILE}
+  )
+
+list(APPEND AUTOGENERATED_SOURCES ${AUTOGENERATED_CPP_FILE} ${AUTOGENERATED_TS_FILE} ${AUTOGENERATED_JS_FILE})
+
+message("AUTOGENERATED_SOURCES = ${AUTOGENERATED_SOURCES}")
+add_executable(BasicFlatBuffersTest main.cpp ${SCHEMA_FILE} ${AUTOGENERATED_SOURCES})
+
+target_include_directories(BasicFlatBuffersTest PRIVATE ${DEPOT_ROOT}/ThirdParty/flatbuffers-1.10/include)
+target_include_directories(BasicFlatBuffersTest PRIVATE ${CMAKE_BINARY_DIR})
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CommandTool/flatc-tests/basic/basic_test_gen.ps1	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,2 @@
+flatc --gen-object-api --cpp .\basic.fbs
+flatc --ts .\basic.fbs
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CommandTool/flatc-tests/basic/main.cpp	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,38 @@
+#include <iostream>
+#include "basic_generated.h"
+
+using namespace Orthanc::Stone::Samples::SimpleViewer;
+
+namespace OrthancStone
+{
+    class IPocMessage
+    {
+    public:
+        virtual std::string GetType() = 0;
+    };
+
+
+}
+
+
+
+int main()
+{
+    Request;
+
+    Request::messageType = SelectTool;
+
+    SelectToolT tool2;
+    tool2.tool = Tool_CircleMeasure;
+    
+    SendToApplication(tool2);
+    
+
+    tool2.tool = Tool_CircleMeasure;
+
+    CircleToolT circleTool;
+    circleTool.centerX = 3;
+    circleTool.centerY = 4;
+
+    std::cout << "Hello from flatc generator sample!" << std::endl;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CommandTool/protoc-tests/basic.proto	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,9 @@
+syntax = "proto3";
+
+// Taken from https://developers.google.com/protocol-buffers/docs/proto
+message SearchRequest {
+    string query = 1;
+    int32 page_number = 2;
+    int32 result_per_page = 3;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CommandTool/protoc-tests/basic_js_test.ps1	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,15 @@
+# Path to this plugin 
+
+# Under Linux
+# $PROTOC_GEN_TS_PATH="$PSScriptRoot/node_modules/.bin/protoc-gen-ts"
+
+# Under Windows
+
+# Directory to write generated code to (.js and .d.ts files) 
+$OUT_DIR="./generated_js"
+ 
+protoc `
+    --js_out="$OUT_DIR" `
+    basic.proto
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CommandTool/protoc-tests/basic_test.html	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,24 @@
+<html>
+<head>
+<title>Notepad</title>
+<script src='https://cdn.rawgit.com/google/closure-library/master/closure/goog/base.js'></script>
+<script src="generated_js/searchrequest.js"></script>
+</head>
+<body>
+
+<div id="notes">
+</div>
+
+<script>
+function main() {
+  var noteData = [
+    {'title': 'Note 1', 'content': 'Content of Note 1'},
+    {'title': 'Note 2', 'content': 'Content of Note 2'}];
+
+  var noteListElement = document.getElementById('notes');
+  var notes = proto.SearchRequest(1);
+}
+main();
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CommandTool/protoc-tests/basic_ts_test.ps1	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,18 @@
+# Path to this plugin 
+
+# Under Linux
+# $PROTOC_GEN_TS_PATH="$PSScriptRoot/node_modules/.bin/protoc-gen-ts"
+
+# Under Windows
+$PROTOC_GEN_TS_PATH="$PSScriptRoot/node_modules/.bin/protoc-gen-ts.cmd"
+
+# Directory to write generated code to (.js and .d.ts files) 
+$OUT_DIR="./generated_ts"
+ 
+protoc `
+    --plugin="protoc-gen-ts=$PROTOC_GEN_TS_PATH" `
+    --js_out="import_style=commonjs,binary:$OUT_DIR" `
+    --ts_out="$OUT_DIR" `
+    basic.proto
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CommandTool/protoc-tests/package-lock.json	Wed Jan 16 16:24:45 2019 +0100
@@ -0,0 +1,16 @@
+{
+  "requires": true,
+  "lockfileVersion": 1,
+  "dependencies": {
+    "google-protobuf": {
+      "version": "3.6.1",
+      "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.6.1.tgz",
+      "integrity": "sha512-SJYemeX5GjDLPnadcmCNQePQHCS4Hl5fOcI/JawqDIYFhCmrtYAjcx/oTQx/Wi8UuCuZQhfvftbmPePPAYHFtA=="
+    },
+    "ts-protoc-gen": {
+      "version": "0.9.0",
+      "resolved": "https://registry.npmjs.org/ts-protoc-gen/-/ts-protoc-gen-0.9.0.tgz",
+      "integrity": "sha512-cFEUTY9U9o6C4DPPfMHk2ZUdIAKL91hZN1fyx5Stz3g56BDVOC7hk+r5fEMCAGaaIgi2akkT1a2hrxu1wo2Phg=="
+    }
+  }
+}