# HG changeset patch # User Benjamin Golinvaux # Date 1579527853 -3600 # Node ID d9adeb40333dbfdb8c90856883653d5f2b6505d0 # Parent 64d1ddab8246434345ddd130a31ca3b035029b36# Parent f977ad02e1e9a488001916deb9e365cb2b478725 merge diff -r f977ad02e1e9 -r d9adeb40333d Sphinx/buildWithDocker.ps1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sphinx/buildWithDocker.ps1 Mon Jan 20 14:44:13 2020 +0100 @@ -0,0 +1,9 @@ +# This has been tested with Docker for Windows CE version 2.0.0.2 (30215) +# on Windows 10 Pro x64 (10.0.17134) with stock Powershell (5.1) + +docker build -t orthanc-book-builder . + +$pwdSlash = $pwd.Path.Replace("\","/") +docker run --rm -v "$($pwdSlash):/app" orthanc-book-builder + +docker rmi orthanc-book-builder # since we rebuild it anyway, no need to keep it -> don't accumulate images diff -r f977ad02e1e9 -r d9adeb40333d Sphinx/source/users/advanced-rest.rst --- a/Sphinx/source/users/advanced-rest.rst Fri Jan 17 09:01:24 2020 +0100 +++ b/Sphinx/source/users/advanced-rest.rst Mon Jan 20 14:44:13 2020 +0100 @@ -164,9 +164,9 @@ They convert the ``HelloWorld2.pdf`` file to base64, then perform a ``POST`` request with JSON data containing the converted payload. -.. highlight:: bash +Using bash: -Using bash:: +.. code-block:: bash # create the json data, with the BASE64 data embedded in it (echo -n '{"Tags" : {"PatientName" : "Benjamino", "Modality" : "CT"},"Content" : "data:application/pdf;base64,'; base64 HelloWorld2.pdf; echo '"}') > /tmp/foo @@ -174,9 +174,10 @@ # upload it to Orthanc cat /tmp/foo | curl -H "Content-Type: application/json" -d @- http://localhost:8042/tools/create-dicom -.. highlight:: powershell -Using Powershell:: +Using powershell: + +.. code-block:: perl # create the BASE64 string data $fileInBase64 = $([Convert]::ToBase64String((gc -Path "HelloWorld2.pdf" -Encoding Byte))) @@ -184,8 +185,11 @@ # create the json data $params = @{Tags = @{PatientName = "Benjamino";Modality = "CT"};Content= "data:application/pdf;base64,$fileInBase64"} - # upload it to Orthanc and convert the result to json - $reply = Invoke-WebRequest -Uri http://localhost:8042/tools/create-dicom -Method POST -Body ($params|ConvertTo-Json) -ContentType "application/json" | ConvertFrom-Json + # disabling progress bar tremendously increases the Invoke-RestMethod call + $ProgressPreference = 'SilentlyContinue' + + # upload it to Orthanc + $reply = Invoke-RestMethod http://localhost:8042/tools/create-dicom -Method POST -Body ($params|ConvertTo-Json) -ContentType 'application/json' # display the result Write-Host "The instance can be retrieved in PDF at http://localhost:8042$($reply.Path)/pdf" diff -r f977ad02e1e9 -r d9adeb40333d Sphinx/source/users/rest.rst --- a/Sphinx/source/users/rest.rst Fri Jan 17 09:01:24 2020 +0100 +++ b/Sphinx/source/users/rest.rst Mon Jan 20 14:44:13 2020 +0100 @@ -64,6 +64,20 @@ $ python ImportDicomFiles.py localhost 8042 ~/DICOM/ +.. highlight:: perl + +If you are using Powershell (>= 3.0), you can use the following to send a single +Dicom instance to Orthanc:: + + # disabling progress bar tremendously increases the Invoke-RestMethod call + $ProgressPreference = 'SilentlyContinue' + + # upload it to Orthanc + $reply = Invoke-RestMethod http://localhost:8042/instances -Method POST -InFile CT.X.1.2.276.0.7230010.dcm + + # display the result + Write-Host "The instance can be retrieved at http://localhost:8042$($reply.Path)" + .. _rest-access: Accessing the content of Orthanc