Mercurial > hg > orthanc
view Resources/Samples/Lua/AutoroutingModification.lua @ 3489:e7723a39adf8
Fixed alignment issue in Toolbox::DetectEndianness() + made the internal logger
use an std::stringstream so that manipulators like "std::hex" are supported
(when using ORTHANC_ENABLE_LOGGING_PLUGIN or ORTHANC_ENABLE_LOGGING_STDIO)
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Sat, 10 Aug 2019 13:40:08 +0200 |
parents | bfdf24883ff3 |
children |
line wrap: on
line source
function OnStoredInstance(instanceId, tags, metadata, origin) -- Ignore the instances that result from the present Lua script to -- avoid infinite loops if origin['RequestOrigin'] ~= 'Lua' then -- The tags to be replaced local replace = {} replace['StationName'] = 'My Medical Device' replace['0031-1020'] = 'Some private tag' -- The tags to be removed local remove = { 'MilitaryRank' } -- Modify the instance local command = {} command['Replace'] = replace command['Remove'] = remove local modifiedFile = RestApiPost('/instances/' .. instanceId .. '/modify', DumpJson(command, true)) -- Upload the modified instance to the Orthanc database so that -- it can be sent by Orthanc to other modalities local modifiedId = ParseJson(RestApiPost('/instances/', modifiedFile)) ['ID'] -- Send the modified instance to another modality RestApiPost('/modalities/sample/store', modifiedId) -- Delete the original and the modified instances RestApiDelete('/instances/' .. instanceId) RestApiDelete('/instances/' .. modifiedId) end end