How can I pull out all tags from an uploaded dicom and put them into a table on the Orthanc ODBC database?

Hi all.

I am at my wits end.

We need to be able to pull all the tag information from files that are uploaded (ALL the tags including private ones) and load them into the db.

I initially had some success with using an OnStoredInstance lua function to output tags to a json, then kick off a python script to upload those tags, but this isn’t capturing everything.

So I’ve been trying to kick off a lua script which will then run a python script taking the url and instances data with a particular instance (carried forward from the lua script), to make a post request and then loop through and return all tags.

url = 'http://localhost:8042/tools/find/'
data = {
"Level": "Instances",
"Query": {
    "StudyInstanceUID": StudyInstanceUID
},
"Normalize": False
}

This works perfectly fine if I run the Python on its own, but for some reason in practice (uploading a file), this just hangs the server unless I enforce a timeout:

Request failed: HTTPConnectionPool(host=‘localhost’, port=8042): Read timed out. (read timeout=20)

I haven’t been able to get around this at all, no idea what’s causing it.

I also tried using a direct Python plugin (Python plugin for Orthanc — Orthanc Book documentation) and whilst it claims to pick up on the plugin and the specified script (I tried one of their examples)

W1012 17:13:43.541896 PluginsManager.cpp:261] Registering plugin ‘python’ (version 4.1)
W1012 17:13:43.541896 PluginsManager.cpp:157] Python plugin is initializing
W1012 17:13:43.541896 PluginsManager.cpp:157] Using Python script “OnStoredInstance_py.py” from directory: C:\Program Files\Orthanc Server

It then does nothing at all when I upload a file.

Can someone please advise as I have no idea why neither approach is working.

Thank you.

Hi,

You’re probably not providing enough details for someone to help.

Required minimal quality of a message in the Orthanc Users discussion forum

While posting a message on the Orthanc Users discussion forum, you should not be surprised if your message does not get any response if it does not meet these minimal quality requirements:

  • Before posting, are you sure you have made everything possible to analyze and solve the issue by yourself? This includes, searching the web or the forum to see if the topic has already been discussed.
  • Describe your issue with as much details as possible.
  • Review your message as if you were the one who should help you - would you understand your problem?
  • Be polite and respectful, say hello, and adhere to the code of conduct.

Best regards,

Alain.