Mercurial > hg > orthanc-book
comparison Sphinx/source/plugins/python/dicom-find-move-scp.py @ 704:ba2403ebd4b7
moving python samples in separate files (3)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 11 Jun 2021 10:24:08 +0200 |
parents | |
children | 745d93684b0b |
comparison
equal
deleted
inserted
replaced
703:a589668768d7 | 704:ba2403ebd4b7 |
---|---|
1 import json | |
2 import orthanc | |
3 import pprint | |
4 | |
5 def OnFind(answers, query, issuerAet, calledAet): | |
6 print('Received incoming C-FIND request from %s:' % issuerAet) | |
7 | |
8 answer = {} | |
9 for i in range(query.GetFindQuerySize()): | |
10 print(' %s (%04x,%04x) = [%s]' % (query.GetFindQueryTagName(i), | |
11 query.GetFindQueryTagGroup(i), | |
12 query.GetFindQueryTagElement(i), | |
13 query.GetFindQueryValue(i))) | |
14 answer[query.GetFindQueryTagName(i)] = ('HELLO%d-%s' % (i, query.GetFindQueryValue(i))) | |
15 | |
16 answers.FindAddAnswer(orthanc.CreateDicom( | |
17 json.dumps(answer), None, orthanc.CreateDicomFlags.NONE)) | |
18 | |
19 def OnMove(**request): | |
20 orthanc.LogWarning('C-MOVE request to be handled in Python: %s' % | |
21 json.dumps(request, indent = 4, sort_keys = True)) | |
22 | |
23 orthanc.RegisterFindCallback(OnFind) | |
24 orthanc.RegisterMoveCallback(OnMove) |