Mercurial > hg > orthanc-book
changeset 1231:8a74fe148311
reverted dicom-find-move-scp.py that was removed by changeset 7035bf7ce6bc
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Tue, 02 Dec 2025 11:48:13 +0100 |
| parents | b99a0058a589 |
| children | 30379a1c4242 |
| files | Sphinx/source/plugins/python/dicom-find-move-scp.py |
| diffstat | 1 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sphinx/source/plugins/python/dicom-find-move-scp.py Tue Dec 02 11:48:13 2025 +0100 @@ -0,0 +1,27 @@ +import json +import orthanc +import pprint + +def OnFind(answers, query, issuerAet, calledAet): + print('Received incoming C-FIND request from %s:' % issuerAet) + + answer = {} + for i in range(query.GetFindQuerySize()): + print(' %s (%04x,%04x) = [%s]' % (query.GetFindQueryTagName(i), + query.GetFindQueryTagGroup(i), + query.GetFindQueryTagElement(i), + query.GetFindQueryValue(i))) + answer[query.GetFindQueryTagName(i)] = ('HELLO%d-%s' % (i, query.GetFindQueryValue(i))) + + answers.FindAddAnswer(orthanc.CreateDicom( + json.dumps(answer), None, orthanc.CreateDicomFlags.NONE)) + +def OnMove(**request): + orthanc.LogWarning('C-MOVE request to be handled in Python: %s' % + json.dumps(request, indent = 4, sort_keys = True)) + + # To indicate a failure in the processing, one can raise an exception: + # raise Exception('Cannot handle C-MOVE') + +orthanc.RegisterFindCallback(OnFind) +orthanc.RegisterMoveCallback(OnMove)
