Hello everyone, glad to foind this group.
I´m trying to build a lua script (already created the .lua file an added to the config.json)
The thing is I would like to make a lua script to call to a web dicom viewer which can be called through URL (GET i Assume?), everytime a new study is uploaded or sent to the orthanc pacs.
Do you think this would be doable? because I found functions for incoming instances but no for studies…
Dr Lehmann, welcome to the group!
What you’re after is very doable sir. Use the OnStableStudy() Lua function (triggered after a study has reached it’s StableAge resting period) to trigger your call to the viewer. The call itself can take any method (GET, POST, etc) which will be dependent on the web dicom viewer you’re anticipating using.
Hi BNOEAFK again, fist of all sorry for my ignorance and thank you for your coopertation. I´m a radiologist with certain amateur C++ and Python experience, but never dealed with a lua engine embedded in Orthanc, really my first time, but enthusiastic about many ideas I would like to get done. The thing is I can just get started with the basic…
well I made a script file with this code
function OnStableStudy(studyId, tags, metadata)
print(“it works”)
end
Where should I see where the “print” goes?
or how could I do an easy way to see if the script is being called?, perhaps not even waiting fot the OnStableStudy function to be called,just for starters something so see if the script is being readed? As I told you before y added the path where I saved the script.lua file, in the config.json file:
“LuaScripts” : [“C:\Orthancscripts\script.lua”],
till there, I got it working without giving me any errors in the logfile and orthanc server starts ok in the browser. May there be any other thing Im forgetting?
Dr Luis,
When you use a print() statement it’ll print to the Orthanc log. If you’re using docker to run your server then those logs will be available using “docker logs -f NameOfYourDockerContainer” from your host.
Personally i would set the following in your orthanc.json file: “StableAge” : 15 and then restart the server. This setting will make Orthanc register the study as stable 15s after the last image hits the server (from the default of 60s) and once a study is regarded as stable, the OnStableStudy() function automatically runs.
Now send something to Orthanc, either through standard DICOM or the REST API. 15 seconds after the last instance of the study makes it to Orthanc, you should see the result of your print() statement.