Troubleshooting AutomatedJpeg2k Script


So I was hoping to implement the automatedjpeg2k lua script
(found here

In my logs it installs successfully, but when a study is sent from my US modality, this error gets printed to the Orthanc.log :

E0109 12:47:01.371328 LuaFunctionCall.cpp:107] [string “line”]:13: 8387f290-850a6905-7416af38-671e6274-76498a83-uncompressed.dcm: Permission denied

E0109 12:47:01.371635 ServerContext.cpp:303] Error in the Lua callback while receiving an instance: Cannot execute a Lua command (code 2031)

Line 13 of the lua script = local target = assert(, ‘wb’))

The script has full read and write permissions belonging to user and group orthanc, so I am hoping for some guidance as to why the script is giving me this error.

Server details: Debian Stretch, Orthanc 1.2.0+dfsg-1 installed.

Thanks for your time.


If used as such, this sample script will write the temporary files in the current working directory of the Orthanc command. If you use the default service of the Debian package, the current working directory will be “/usr/sbin/”, which is hold by the “root” user and where the “orthanc” user cannot write.

Replace the path to the temporary files:

local uncompressed = instanceId .. '-uncompressed.dcm' [...] local compressed = instanceId .. '-compressed.dcm'

By for instance:

local uncompressed = '/tmp/orthanc-' .. instanceId .. '-uncompressed.dcm' [...] local compressed = '/tmp/orthanc-' .. instanceId .. '-compressed.dcm'

Please also make sure that the command-line tools “gdcmconv” and “dcmodify” are both available. Under Debian, you’ll have to install the “libgdcm-tools” and “dcmtk” packages.


Works like a charm now.

Thanks Sebastien,

This software should be in every PACS admin’s tool-kit. It has become invaluable to my organization in a matter of weeks.

Again thanks for your hard work, and thank you to all who have contributed to this project.

-SysAdmin from Kansas