Mercurial > hg > orthanc-book
changeset 819:a67ceccebf02
releasing Python plugin 4.0
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 23 Feb 2022 18:46:15 +0100 |
parents | 48676fb3ac0f |
children | fa6d9c7237b4 |
files | Sphinx/source/plugins/python.rst Sphinx/source/plugins/python/received-instance-callback.py |
diffstat | 2 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Sphinx/source/plugins/python.rst Wed Feb 23 15:03:47 2022 +0100 +++ b/Sphinx/source/plugins/python.rst Wed Feb 23 18:46:15 2022 +0100 @@ -771,10 +771,10 @@ .. _python_received_instance: -Modifying received instances (new in 3.5 - not released yet) -............................................................ +Modifying received instances (new in 4.0) +......................................... -Starting with release 3.5 of the Python plugin, it is possible to +Starting with release 4.0 of the Python plugin, it is possible to modify instances received by Orthanc before they are stored in the storage. This is usually easier to perform modification at this stage compared to using the ``/modify`` route once the instances
--- a/Sphinx/source/plugins/python/received-instance-callback.py Wed Feb 23 15:03:47 2022 +0100 +++ b/Sphinx/source/plugins/python/received-instance-callback.py Wed Feb 23 18:46:15 2022 +0100 @@ -23,17 +23,17 @@ if dataset.PatientID.startswith('001-'): orthanc.LogWarning('Discard instance') - return orthanc.ReceivedInstanceCallbackResult.DISCARD, None + return orthanc.ReceivedInstanceAction.DISCARD, None elif dataset.PatientID.startswith('002-'): orthanc.LogWarning('Store source instance as it is') - return orthanc.ReceivedInstanceCallbackResult.KEEP_AS_IS, None + return orthanc.ReceivedInstanceAction.KEEP_AS_IS, None else: orthanc.LogWarning('Modify the source instance') dataset.PatientName = str(dataset.PatientName).upper() dataset.PatientID = '002-' + dataset.PatientID dataset.InstitutionName = "MY INSTITUTION" - return orthanc.ReceivedInstanceCallbackResult.MODIFIED, write_dataset_to_bytes(dataset) + return orthanc.ReceivedInstanceAction.MODIFY, write_dataset_to_bytes(dataset) orthanc.RegisterReceivedInstanceCallback(ReceivedInstanceCallback)