Can we have an OnStoreInstance callback please?

Hi Everyone,

Suggestion for what i think will be an extremely useful generic feature…

We have a callback called OnStoredInstance that is called just after receiving an object. It is widely used and well documented for tag mapping, anonymisation, rejecting specific objects, and so on.

I would love a similar callback that is called just prior to C-Storing an object. Then i can store a study once, and tag map on the way out, with different tags to different destinations. We can also choose whether to send a specific image/series or not.

A specific example is where we receive a CT study and auto route to PACS and an AI tool. The AI tool may not want the CT dose report. The AI tool may also require some tag mapping… this could be achieved using a Lua OnStoreInstance callback :slight_smile:

Thoughts?

Stefan

Did you check the Orthanc Book ?

OnStoredInstance

https://orthanc.uclouvain.be/book/plugins/python.html?highlight=received#filtering-incoming-c-store-instances-new-in-4-0

Hi Stefan,

It would actually be quite difficult to implement such a callback in lua because we currently don’t have the methods to modify an outgoing DICOM buffer in lua (right now, you can actually only call the Orthanc Rest API to modify an instance that is stored in Orthanc - which is quite different).

If the C-Store is triggered by the Rest API, you can probably implement this in python by overriding the /modalities/.../store route to:

  • download a modified copy of the instance from Orthanc by calling /instances/../modify
  • send the modified instance to the C-Store destination by using Modalities/../store-straight

HTH,

Alain