Hello all,
I had a working automated compress and forward script working for about a year without error. In quest to become more fluent with Orthanc and to get more performance I spun up a couple test vms to compile Orthanc myself and to try out the docker versions. For the most part everything installed fine but my lua script keeps failing to compress the dicom files. I thought I might have compiled something wrong, so I did a fresh install of Debian Stretch and installed Orthanc 1.2 from synaptic. The script still fails and spits out errors, even though the same script has been working fine for a year. I have attached my error log while running Orthanc with the --verbose flag. Here is a link with the log as well. https://ghostbin.com/paste/rduu9
The logs are basically telling my that it cant find the file or directory that I have told the script to write to. It looks like it could be something extremely simple that I have left out or forgotten.
Here is the lua script in question
`
function OnStoredInstance(instanceId, tags, metadata, origin)
– Do not compress twice the same file
if origin[‘RequestOrigin’] ~= ‘Lua’ then
– Retrieve the incoming DICOM instance from Orthanc
local dicom = RestApiGet(‘/instances/’ … instanceId … ‘/file’)
– Write the DICOM content to some temporary file
local uncompressed = ‘/home/dicadmin/test-’ … instanceId … ‘-uncompressed.dcm’
local target = assert(io.open(uncompressed, ‘wb’))
target:write(dicom)
target:close()
– Compress to JPEG2000 using gdcm
local compressed = ‘/home/dicadmin/test-’ …instanceId … ‘-compressed.dcm’
os.execute('gdcmconv -U --jpeg ’ … uncompressed … ’ ’ … compressed)
– Generate a new SOPInstanceUID for the JPEG2000 file, as
– gdcmconv does not do this by itself
os.execute(‘dcmodify --no-backup -gin ’ … compressed)
– Read the JPEG2000 file
local source = assert(io.open(compressed, ‘rb’))
local jpeg2k = source:read(“*all”)
source:close()
– Upload the JPEG2000 file and remove the uncompressed file
RestApiPost(’/instances’, jpeg2k)
RestApiDelete(‘/instances/’ … instanceId)
– Remove the temporary DICOM files
os.remove(uncompressed)
os.remove(compressed)
end
if origin[‘RequestOrigin’] == ‘Lua’ then
PrintRecursive(origin)
SendToModality(instanceId, ‘dockero’)
end
end
`
If anyone has hint or has a suggestion for me to try it would be much appreciated. Thanks for your time
rduu9.txt (10.7 KB)