comparison OrthancServer/Resources/Samples/Lua/AutoroutingModification.lua @ 4044:d25f4c0fa160 framework

splitting code into OrthancFramework and OrthancServer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 20:30:34 +0200
parents Resources/Samples/Lua/AutoroutingModification.lua@bfdf24883ff3
children
comparison
equal deleted inserted replaced
4043:6c6239aec462 4044:d25f4c0fa160
1 function OnStoredInstance(instanceId, tags, metadata, origin)
2 -- Ignore the instances that result from the present Lua script to
3 -- avoid infinite loops
4 if origin['RequestOrigin'] ~= 'Lua' then
5
6 -- The tags to be replaced
7 local replace = {}
8 replace['StationName'] = 'My Medical Device'
9 replace['0031-1020'] = 'Some private tag'
10
11 -- The tags to be removed
12 local remove = { 'MilitaryRank' }
13
14 -- Modify the instance
15 local command = {}
16 command['Replace'] = replace
17 command['Remove'] = remove
18 local modifiedFile = RestApiPost('/instances/' .. instanceId .. '/modify', DumpJson(command, true))
19
20 -- Upload the modified instance to the Orthanc database so that
21 -- it can be sent by Orthanc to other modalities
22 local modifiedId = ParseJson(RestApiPost('/instances/', modifiedFile)) ['ID']
23
24 -- Send the modified instance to another modality
25 RestApiPost('/modalities/sample/store', modifiedId)
26
27 -- Delete the original and the modified instances
28 RestApiDelete('/instances/' .. instanceId)
29 RestApiDelete('/instances/' .. modifiedId)
30 end
31 end