changeset 815:a56c4128c9a2

ReceivedInstanceCallback in Python: added origin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Feb 2022 09:26:51 +0100
parents b14dbbb8eda9
children 908ca7847b9d
files Sphinx/source/plugins/python/received-instance-callback.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Sphinx/source/plugins/python/received-instance-callback.py	Wed Feb 23 08:38:50 2022 +0100
+++ b/Sphinx/source/plugins/python/received-instance-callback.py	Wed Feb 23 09:26:51 2022 +0100
@@ -13,7 +13,13 @@
         memory_dataset.seek(0)
         return memory_dataset.read()
 
-def ReceivedInstanceCallback(receivedDicom):
+def ReceivedInstanceCallback(receivedDicom, origin):
+    orthanc.LogWarning('SOURCE: %d' % origin)
+    if origin == orthanc.InstanceOrigin.REST_API:
+        orthanc.LogWarning('DICOM instance received from the REST API')
+    elif origin == orthanc.InstanceOrigin.DICOM_PROTOCOL:
+        orthanc.LogWarning('DICOM instance received from the DICOM protocol')
+    
     dataset = dcmread(BytesIO(receivedDicom))
 
     if dataset.PatientID.startswith('001-'):