comparison OrthancServer/Resources/Samples/Lua/ModifyInstanceWithSequence.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/ModifyInstanceWithSequence.lua@38c7bf2e10f6
children
comparison
equal deleted inserted replaced
4043:6c6239aec462 4044:d25f4c0fa160
1 -- Answer to:
2 -- https://groups.google.com/d/msg/orthanc-users/0ymHe1cDBCQ/YfD0NoOTn0wJ
3 -- Applicable starting with Orthanc 0.9.5
4
5 function OnStoredInstance(instanceId, tags, metadata, origin)
6 -- Do not modify twice the same file
7 if origin['RequestOrigin'] ~= 'Lua' then
8 local replace = {}
9 replace['0010,1002'] = {}
10 replace['0010,1002'][1] = {}
11 replace['0010,1002'][1]['PatientID'] = 'Hello'
12 replace['0010,1002'][2] = {}
13 replace['0010,1002'][2]['PatientID'] = 'World'
14
15 local request = {}
16 request['Replace'] = replace
17
18 -- Create the modified instance
19 local modified = RestApiPost('/instances/' .. instanceId .. '/modify',
20 DumpJson(request, true))
21
22 -- Upload the modified instance to the Orthanc store
23 RestApiPost('/instances/', modified)
24
25 -- Delete the original instance
26 RestApiDelete('/instances/' .. instanceId)
27 end
28 end