Mercurial > hg > orthanc
annotate OrthancServer/Resources/Samples/ImportDicomFiles/ImportDicomFiles.py @ 5596:81a29ad7fb4b find-refactoring
added possibility to retrieve main DICOM tags and metadata at any level
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 07 May 2024 18:44:53 +0200 |
parents | 48b8dae6dc77 |
children | f7adfb22e20e |
rev | line source |
---|---|
5469
514fd39f87a8
improved handling of X-Content-Type-Options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
1 #!/usr/bin/env python3 |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 |
747
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
3 # Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 4 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
747
diff
changeset
|
5 # Department, University Hospital of Liege, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5469
diff
changeset
|
6 # Copyright (C) 2017-2024 Osimis S.A., Belgium |
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5469
diff
changeset
|
7 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
747
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
8 # |
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
9 # This program is free software: you can redistribute it and/or |
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
10 # modify it under the terms of the GNU General Public License as |
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
11 # published by the Free Software Foundation, either version 3 of the |
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
12 # License, or (at your option) any later version. |
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
13 # |
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
14 # This program is distributed in the hope that it will be useful, but |
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
15 # WITHOUT ANY WARRANTY; without even the implied warranty of |
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
17 # General Public License for more details. |
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
18 # |
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
19 # You should have received a copy of the GNU General Public License |
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
20 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
21 |
44382c8bcd15
added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
22 |
4748
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
23 import base64 |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
24 import httplib2 |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
25 import json |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 import os |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 import os.path |
4748
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
28 import sys |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 |
370 | 30 if len(sys.argv) != 4 and len(sys.argv) != 6: |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 print(""" |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 Sample script to recursively import in Orthanc all the DICOM files |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 that are stored in some path. Please make sure that Orthanc is running |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 before starting this script. The files are uploaded through the REST |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 API. |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 Usage: %s [hostname] [HTTP port] [path] |
370 | 38 Usage: %s [hostname] [HTTP port] [path] [username] [password] |
2032
65b1ce7cb84f
Replaced "localhost" by "127.0.0.1", as it might impact performance on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
39 For instance: %s 127.0.0.1 8042 . |
370 | 40 """ % (sys.argv[0], sys.argv[0], sys.argv[0])) |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 exit(-1) |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 URL = 'http://%s:%d/instances' % (sys.argv[1], int(sys.argv[2])) |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 |
4748
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
45 dicom_count = 0 |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
46 json_count = 0 |
733
29982cfc5009
improvements to ImportDicomFiles tx Karsten Hilbert
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
373
diff
changeset
|
47 total_file_count = 0 |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 |
4748
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
50 def IsJson(content): |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
51 try: |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
52 if (sys.version_info >= (3, 0)): |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
53 json.loads(content.decode()) |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
54 return True |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
55 else: |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
56 json.loads(content) |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
57 return True |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
58 except: |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
59 return False |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
60 |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
61 |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 # This function will upload a single file to Orthanc through the REST API |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 def UploadFile(path): |
4748
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
64 global dicom_count |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
65 global json_count |
733
29982cfc5009
improvements to ImportDicomFiles tx Karsten Hilbert
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
373
diff
changeset
|
66 global total_file_count |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 |
4748
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
68 f = open(path, 'rb') |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 content = f.read() |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 f.close() |
733
29982cfc5009
improvements to ImportDicomFiles tx Karsten Hilbert
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
373
diff
changeset
|
71 total_file_count += 1 |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 |
4748
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
73 sys.stdout.write('Importing %s' % path) |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
74 |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
75 if IsJson(content): |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
76 sys.stdout.write(' => ignored JSON file\n') |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
77 json_count += 1 |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
78 return |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
79 |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 try: |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 h = httplib2.Http() |
370 | 82 |
373
7000726bade7
fix ImportDicomFiles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
370
diff
changeset
|
83 headers = { 'content-type' : 'application/dicom' } |
7000726bade7
fix ImportDicomFiles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
370
diff
changeset
|
84 |
370 | 85 if len(sys.argv) == 6: |
373
7000726bade7
fix ImportDicomFiles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
370
diff
changeset
|
86 username = sys.argv[4] |
7000726bade7
fix ImportDicomFiles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
370
diff
changeset
|
87 password = sys.argv[5] |
7000726bade7
fix ImportDicomFiles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
370
diff
changeset
|
88 |
7000726bade7
fix ImportDicomFiles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
370
diff
changeset
|
89 # h.add_credentials(username, password) |
7000726bade7
fix ImportDicomFiles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
370
diff
changeset
|
90 |
7000726bade7
fix ImportDicomFiles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
370
diff
changeset
|
91 # This is a custom reimplementation of the |
7000726bade7
fix ImportDicomFiles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
370
diff
changeset
|
92 # "Http.add_credentials()" method for Basic HTTP Access |
7000726bade7
fix ImportDicomFiles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
370
diff
changeset
|
93 # Authentication (for some weird reason, this method does |
7000726bade7
fix ImportDicomFiles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
370
diff
changeset
|
94 # not always work) |
7000726bade7
fix ImportDicomFiles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
370
diff
changeset
|
95 # http://en.wikipedia.org/wiki/Basic_access_authentication |
3815
c81ac6ff232b
ImportDicomFiles.py is now compatible
Benjamin Golinvaux <bgo@osimis.io>
parents:
3640
diff
changeset
|
96 creds_str = username + ':' + password |
4748
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
97 creds_str_bytes = creds_str.encode('ascii') |
3815
c81ac6ff232b
ImportDicomFiles.py is now compatible
Benjamin Golinvaux <bgo@osimis.io>
parents:
3640
diff
changeset
|
98 creds_str_bytes_b64 = b'Basic ' + base64.b64encode(creds_str_bytes) |
4748
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
99 headers['authorization'] = creds_str_bytes_b64.decode('ascii') |
733
29982cfc5009
improvements to ImportDicomFiles tx Karsten Hilbert
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
373
diff
changeset
|
100 |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 resp, content = h.request(URL, 'POST', |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 body = content, |
373
7000726bade7
fix ImportDicomFiles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
370
diff
changeset
|
103 headers = headers) |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 if resp.status == 200: |
4748
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
106 sys.stdout.write(' => success\n') |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
107 dicom_count += 1 |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 else: |
4748
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
109 sys.stdout.write(' => failure (Is it a DICOM file? Is there a password?)\n') |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 except: |
3815
c81ac6ff232b
ImportDicomFiles.py is now compatible
Benjamin Golinvaux <bgo@osimis.io>
parents:
3640
diff
changeset
|
112 type, value, traceback = sys.exc_info() |
c81ac6ff232b
ImportDicomFiles.py is now compatible
Benjamin Golinvaux <bgo@osimis.io>
parents:
3640
diff
changeset
|
113 sys.stderr.write(str(value)) |
4748
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
114 sys.stdout.write(' => unable to connect (Is Orthanc running? Is there a password?)\n') |
280
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 if os.path.isfile(sys.argv[3]): |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 # Upload a single file |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 UploadFile(sys.argv[3]) |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 else: |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 # Recursively upload a directory |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 for root, dirs, files in os.walk(sys.argv[3]): |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 for f in files: |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 UploadFile(os.path.join(root, f)) |
77e526e6fdf8
sample script to import DICOM files in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 |
4748
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
126 |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
127 if dicom_count + json_count == total_file_count: |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
128 print('\nSUCCESS: %d DICOM file(s) have been successfully imported' % dicom_count) |
733
29982cfc5009
improvements to ImportDicomFiles tx Karsten Hilbert
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
373
diff
changeset
|
129 else: |
4748
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
130 print('\nWARNING: Only %d out of %d file(s) have been successfully imported as DICOM instance(s)' % (dicom_count, total_file_count - json_count)) |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
131 |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
132 if json_count != 0: |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
133 print('NB: %d JSON file(s) have been ignored' % json_count) |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
134 |
4336642b8cff
ignore JSON files in sample Python upload scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
135 print('') |