Docker compose constellation of Orthancs, SQL, Lua and Python

All,

In compliance with the AGPL licensing scheme, I am publishing my Orthanc setup to github.

https://github.com/HDVUCAIR/OrthancContribution

We developed and use this setup extensively at our university lab for anonymizing and managing our research DICOM. I wrote much of the framework in Lua back in the days when that was the only scripting language embedded in Orthanc. I have since started converting my Lua to Python with the Python plugin, but have not completed the conversion process.

I am a physicist by training and a coder by necessity. You have my apologies for the readability or lack thereof of my code. Since I make extensive use of Lua and Python as well as accompanying PostGreSQL servers, I knew I needed to publish the code to come into AGPL compliance.

I make no claims that the anonymized images produced by this setup meet the legal definition of anonymization and patient privacy in your setting. It is up to you to confirm that the output DICOM meet your local requirements.

At the moment, I have detected some non-compliance in the DICOM output based on Dave Clunie’s DICOM validator. Mostly, this involves missing DICOM tags that should be left blank rather than deleted by the anonymization.

A general description of the setup is given on github.

  • I use docker-compose to launch a number of Orthancs (built on the Osimis docker container) and accompanying PostGreSQL servers.
  • The main anonymizing Orthanc maintains a lookup table between original PatientID and anonymized ID, and original StudyInstanceUID and anonymized StudyInstanceUID.
  • Longitudinal anonymization is supported (repeat visits by the same subject)
    • This involves assigning and tracking a single random shift (up to 365 days) in time to each patient.
    • Longitudinal visits retain their order, but with a relative shift to obscure the true dates.
  • Inter-series relationships are retained. This is managed by first recursively searching all UID and links between series prior to anonymization and replacing all UID with new UID while retaining their link relationship.
  • Two optional Orthancs can receive the anonymized images from the anonymizing orthanc. Which Orthanc is used depends on user preference. The point is to separate the Orthanc with patient data (the anonymizing Orthanc) from the Orthancs users more often access.
    • One for simple web access (when there is no need for disk access)
    • Another if automated structured output to disk is desired.
      I am happy to answer questions as I am able. It is unlikely that I would have the time to support requested modifications, but people are free to fork this code base.

John.

Hi John,

Thanks for sharing this with us. I think I’ve never seen such a big Lua script running in Orthanc ! I’m pretty sure it can serve as an inspiration source for the community.

Best regards,

Alain.

Hi John,

This is indeed very impressive!

Could I suggest you to send a pull request to the “OrthancContributed” repository, so as to make sure that your contribution is indexed and easily findable by other users?

https://github.com/jodogne/OrthancContributed

Thanks in advance!
Sébastien-

I am a noob when it comes to git in the cloud. It is one of the reasons I avoided uploading my modifications for the longest time. I don’t really know how to integrate them into the code base without messing up your or my code.

At what level would I generate a pull request in your git tree? At the top (OrthancContributed)?

I guess I would first need to refactor my code tree to reflect the current OrthancContributed so the automatic diffs would make sense?

John.

Hello,

No, be reassured: The “OrthancContributed” repository is only there to maintain a centralized lists of contributions to Orthanc!

You should only modify the “Links.md” file, by adding a simple link to “https://github.com/HDVUCAIR/OrthancContribution”:
https://github.com/jodogne/OrthancContributed/blob/master/Links.md

This way, your contribution will be indexed, but you certainly won’t have to integrate anything in our code base.

Sébastien-

Done.

Sorry, I thought I had clicked through all the way. I just clicked the pull request.