comparison OrthancFramework/Resources/CodeGeneration/CheckDcmtkTransferSyntaxes.py @ 4468:9c070a34de18

IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 25 Jan 2021 15:18:34 +0100
parents
children 7053502fbf97
comparison
equal deleted inserted replaced
4467:c92ec129698a 4468:9c070a34de18
1 #!/usr/bin/python
2
3 # Orthanc - A Lightweight, RESTful DICOM Store
4 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
5 # Department, University Hospital of Liege, Belgium
6 # Copyright (C) 2017-2021 Osimis S.A., Belgium
7 #
8 # This program is free software: you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public License
10 # as published by the Free Software Foundation, either version 3 of
11 # the License, or (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
17 #
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this program. If not, see
20 # <http://www.gnu.org/licenses/>.
21
22
23 import json
24 import os
25 import re
26 import sys
27
28 if len(sys.argv) != 2:
29 print('Usage: %s [Path to DCMTK source code]' % sys.argv[0])
30 exit(-1)
31
32
33 orthancSyntaxes = []
34
35
36 with open(os.path.join(os.path.dirname(__file__), 'DicomTransferSyntaxes.json'), 'r') as f:
37 for syntax in json.loads(f.read()):
38 orthancSyntaxes.append(syntax['UID'])
39
40
41 with open(os.path.join(sys.argv[1], 'dcmdata/include/dcmtk/dcmdata/dcuid.h'), 'r') as f:
42 r = re.compile(r'^#define UID_([A-Za-z0-9_]+)TransferSyntax\s+"([0-9.]+)"$')
43
44 for line in f.readlines():
45 m = r.match(line)
46 if m != None:
47 syntax = m.group(2)
48 if not syntax in orthancSyntaxes:
49 print('Missing syntax: %s => %s' % (syntax, m.group(1)))