# HG changeset patch # User Sebastien Jodogne # Date 1645610900 -3600 # Node ID 908ca7847b9d9915debb8e26befa38fea7a25153 # Parent a56c4128c9a2afd3539b8d2e62d18c9973e6e52c added incoming-cstore-filter.py diff -r a56c4128c9a2 -r 908ca7847b9d Sphinx/source/plugins/python/incoming-cstore-filter.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sphinx/source/plugins/python/incoming-cstore-filter.py Wed Feb 23 11:08:20 2022 +0100 @@ -0,0 +1,15 @@ +import json +import orthanc + +def Filter(receivedDicom): + # The list ofvalid status codes for DIMSE C-STORE can be found: + # https://dicom.nema.org/medical/Dicom/2021e/output/chtml/part04/sect_B.2.3.html + + tags = json.loads(receivedDicom.GetInstanceSimplifiedJson()) + if tags['PatientID'].startswith('001-'): + # Non-zero return value: The DICOM instance is discarded + return 0xA900 # DIMSE Failure: Data Set does not match SOP Class + else: + return 0 # Success: Accept the DICOM instance + +orthanc.RegisterIncomingCStoreInstanceFilter(Filter) diff -r a56c4128c9a2 -r 908ca7847b9d Sphinx/source/plugins/python/received-instance-callback.py --- a/Sphinx/source/plugins/python/received-instance-callback.py Wed Feb 23 09:26:51 2022 +0100 +++ b/Sphinx/source/plugins/python/received-instance-callback.py Wed Feb 23 11:08:20 2022 +0100 @@ -14,7 +14,6 @@ return memory_dataset.read() 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: