Mercurial > hg > orthanc-tests
annotate Plugins/DicomWeb/Run.py @ 274:6b522ef4c3ec
cont
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 03 Mar 2020 17:20:13 +0100 |
parents | afcd550a9216 |
children | 264bb7744679 |
rev | line source |
---|---|
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 #!/usr/bin/python |
224
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
2 # -*- coding: utf-8 -*- |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
3 |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 # Orthanc - A Lightweight, RESTful DICOM Store |
73 | 6 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 # Department, University Hospital of Liege, Belgium |
260
943166deebcb
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
259
diff
changeset
|
8 # Copyright (C) 2017-2020 Osimis S.A., Belgium |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 # |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 # This program is free software: you can redistribute it and/or |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 # modify it under the terms of the GNU General Public License as |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 # published by the Free Software Foundation, either version 3 of the |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 # License, or (at your option) any later version. |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 # |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 # This program is distributed in the hope that it will be useful, but |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 # WITHOUT ANY WARRANTY; without even the implied warranty of |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 # General Public License for more details. |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 # |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 # You should have received a copy of the GNU General Public License |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
85 | 24 |
25 # You must add the following to the configuration file: | |
26 # | |
27 # "DicomWeb" : { | |
28 # "Servers" : { | |
29 # "sample" : [ "http://localhost:8042/dicom-web/", "alice", "orthanctest" ] | |
30 # } | |
31 # } | |
32 | |
33 | |
34 | |
35 | |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 import os |
33 | 37 import pprint |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 import sys |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 import argparse |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 import unittest |
83 | 41 import re |
33 | 42 from DicomWeb import * |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'Tests')) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 from Toolbox import * |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 ## |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 ## Parse the command-line arguments |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 ## |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 parser = argparse.ArgumentParser(description = 'Run the integration tests for the DICOMweb plugin.') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 parser.add_argument('--server', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 default = 'localhost', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 help = 'Address of the Orthanc server to test') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 parser.add_argument('--rest', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 type = int, |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 default = 8042, |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 help = 'Port to the REST API') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 parser.add_argument('--username', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 default = 'alice', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 help = 'Username to the REST API') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 parser.add_argument('--password', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 default = 'orthanctest', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 help = 'Password to the REST API') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 parser.add_argument('--wado', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 default = '/wado', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 help = 'Path to the WADO API') |
33 | 70 parser.add_argument('--dicomweb', |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 default = '/dicom-web/', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 help = 'Path to the DICOMweb API') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 parser.add_argument('--force', help = 'Do not warn the user', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 action = 'store_true') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 parser.add_argument('options', metavar = 'N', nargs = '*', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 help='Arguments to Python unittest') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 args = parser.parse_args() |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 ## |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 ## Configure the testing context |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 ## |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 if not args.force: |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 print(""" |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 WARNING: This test will remove all the content of your |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 Orthanc instance running on %s! |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 Are you sure ["yes" to go on]?""" % args.server) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 if sys.stdin.readline().strip() != 'yes': |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 print('Aborting...') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 exit(0) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 ORTHANC = DefineOrthanc(server = args.server, |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 username = args.username, |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 password = args.password, |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 restPort = args.rest) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 ## |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 ## The tests |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 ## |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
107 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
108 def UploadAndGetWadoPath(dicom): |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
109 i = UploadInstance(ORTHANC, dicom) ['ID'] |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
110 study = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i) ['StudyInstanceUID'] |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
111 series = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i) ['SeriesInstanceUID'] |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
112 instance = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i) ['SOPInstanceUID'] |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
113 return '/studies/%s/series/%s/instances/%s' % (study, series, instance) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
114 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
115 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
116 |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 class Orthanc(unittest.TestCase): |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 def setUp(self): |
83 | 119 if (sys.version_info >= (3, 0)): |
120 # Remove annoying warnings about unclosed socket in Python 3 | |
121 import warnings | |
122 warnings.simplefilter("ignore", ResourceWarning) | |
123 | |
270
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
124 #print("In test: ", self._testMethodName) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
125 |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 DropOrthanc(ORTHANC) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 def test_wado_dicom(self): |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 UploadInstance(ORTHANC, 'Brainix/Flair/IM-0001-0001.dcm') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 SIZE = 169478 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 INSTANCE = '1.3.46.670589.11.0.0.11.4.2.0.8743.5.5396.2006120114314079549' |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 SERIES = '1.3.46.670589.11.0.0.11.4.2.0.8743.5.5396.2006120114285654497' |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 STUDY = '2.16.840.1.113669.632.20.1211.10000357775' |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 self.assertRaises(Exception, lambda: DoGet(ORTHANC, args.wado)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 self.assertRaises(Exception, lambda: DoGet(ORTHANC, args.wado + '?requestType=WADO')) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 self.assertRaises(Exception, lambda: DoGet(ORTHANC, args.wado + '?objectUID=%s' % INSTANCE)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 dicom = DoGet(ORTHANC, args.wado + '?contentType=application/dicom&requestType=WADO&objectUID=%s' % INSTANCE) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 self.assertEqual(SIZE, len(dicom)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 dicom = DoGet(ORTHANC, args.wado + '?contentType=application/dicom&requestType=WADO&objectUID=%s&seriesUID=%s' % (INSTANCE, SERIES)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 self.assertEqual(SIZE, len(dicom)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 dicom = DoGet(ORTHANC, args.wado + '?contentType=application/dicom&requestType=WADO&objectUID=%s&seriesUID=%s&studyUID=%s' % (INSTANCE, SERIES, STUDY)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 self.assertEqual(SIZE, len(dicom)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 dicom = DoGet(ORTHANC, args.wado + '?contentType=application/dicom&requestType=WADO&objectUID=%s&seriesUID=%s' % (INSTANCE, SERIES)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 self.assertEqual(SIZE, len(dicom)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 dicom = DoGet(ORTHANC, args.wado + '?contentType=application/dicom&requestType=WADO&objectUID=%s&studyUID=%s' % (INSTANCE, STUDY)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 self.assertEqual(SIZE, len(dicom)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 self.assertRaises(Exception, lambda: DoGet(ORTHANC, args.wado + '?requestType=WADO&objectUID=%s&seriesUID=nope' % INSTANCE)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 self.assertRaises(Exception, lambda: DoGet(ORTHANC, args.wado + '?requestType=WADO&objectUID=%s&studyUID=nope' % INSTANCE)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 self.assertRaises(Exception, lambda: DoGet(ORTHANC, args.wado + '?requestType=WADO&objectUID=%s&seriesUID=nope&studyUID=nope' % INSTANCE)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 def test_wado_image(self): |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 UploadInstance(ORTHANC, 'Phenix/IM-0001-0001.dcm') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 INSTANCE = '1.2.840.113704.7.1.1.6632.1127829031.2' |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 im = GetImage(ORTHANC, args.wado + '?requestType=WADO&objectUID=%s' % INSTANCE) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 self.assertEqual('JPEG', im.format) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 self.assertEqual('L', im.mode) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 self.assertEqual(512, im.size[0]) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 self.assertEqual(358, im.size[1]) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 im = GetImage(ORTHANC, args.wado + '?contentType=image/jpg&requestType=WADO&objectUID=%s' % INSTANCE) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 self.assertEqual('JPEG', im.format) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 im = GetImage(ORTHANC, args.wado + '?contentType=image/png&requestType=WADO&objectUID=%s' % INSTANCE) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 self.assertEqual('PNG', im.format) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 self.assertEqual('L', im.mode) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 self.assertEqual(512, im.size[0]) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 self.assertEqual(358, im.size[1]) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 |
33 | 178 def test_stow(self): |
179 self.assertEqual(0, len(DoGet(ORTHANC, '/instances'))) | |
180 SendStow(ORTHANC, args.dicomweb + '/studies', GetDatabasePath('Phenix/IM-0001-0001.dcm')) | |
181 self.assertEqual(1, len(DoGet(ORTHANC, '/instances'))) | |
182 a = SendStow(ORTHANC, args.dicomweb + '/studies', GetDatabasePath('Phenix/IM-0001-0001.dcm')) | |
183 self.assertEqual(1, len(DoGet(ORTHANC, '/instances'))) | |
184 | |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
185 self.assertEqual(4, len(a)) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
186 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
187 # Specific character set |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
188 self.assertTrue('00080005' in a) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
189 self.assertEqual('CS', a['00080005']['vr']) |
33 | 190 |
191 self.assertTrue(a['00081190']['Value'][0].endswith('studies/2.16.840.1.113669.632.20.1211.10000098591')) | |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
192 self.assertEqual('UR', a['00081190']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
193 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
194 self.assertFalse('Value' in a['00081198']) # No error => empty sequence |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
195 self.assertEqual('SQ', a['00081198']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
196 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
197 self.assertEqual(1, len(a['00081199']['Value'])) # 1 success |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
198 self.assertEqual('SQ', a['00081199']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
199 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
200 b = a['00081199']['Value'][0] |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
201 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
202 # Referenced SOP class UID |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
203 self.assertEqual('UI', b['00081150']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
204 self.assertEqual(1, len(b['00081150']['Value'])) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
205 self.assertEqual('1.2.840.10008.5.1.4.1.1.2', b['00081150']['Value'][0]) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
206 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
207 # Referenced SOP instance UID |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
208 self.assertEqual('UI', b['00081155']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
209 self.assertEqual(1, len(b['00081155']['Value'])) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
210 self.assertEqual('1.2.840.113704.7.1.1.6632.1127829031.2', b['00081155']['Value'][0]) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
211 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
212 # Retrieve URL |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
213 self.assertEqual('UR', b['00081190']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
214 self.assertEqual(1, len(b['00081190']['Value'])) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
215 self.assertTrue(b['00081190']['Value'][0]. |
33 | 216 endswith('series/1.2.840.113704.1.111.5692.1127828999.2/instances/1.2.840.113704.7.1.1.6632.1127829031.2')) |
217 | |
83 | 218 # Remove the "http://localhost:8042" prefix |
219 url = a['00081190']['Value'][0] | |
220 url = re.sub(r'(http|https)://[^/]+(/.*)', r'\2', url) | |
221 | |
222 # Get the content-length of all the multiparts of this WADO-RS request | |
223 b = DoGet(ORTHANC, url).decode('utf-8', 'ignore') | |
224 parts = re.findall(r'^Content-Length:\s*(\d+)\s*', b, re.IGNORECASE | re.MULTILINE) | |
225 self.assertEqual(1, len(parts)) | |
226 self.assertEqual(os.path.getsize(GetDatabasePath('Phenix/IM-0001-0001.dcm')), int(parts[0])) | |
33 | 227 |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
228 |
84 | 229 def test_server_get(self): |
230 UploadInstance(ORTHANC, 'Knee/T1/IM-0001-0001.dcm') | |
231 | |
232 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/servers'))) | |
233 self.assertTrue('sample' in DoGet(ORTHANC, '/dicom-web/servers')) | |
234 | |
129 | 235 serversReadback = DoGet(ORTHANC, '/dicom-web/servers?expand') |
236 self.assertEqual('http://localhost:8042/dicom-web/', serversReadback['sample']['Url']) | |
237 self.assertEqual('alice', serversReadback['sample']['Username']) | |
238 | |
84 | 239 sample = DoGet(ORTHANC, '/dicom-web/servers/sample') |
244 | 240 self.assertEqual(5, len(sample)) |
84 | 241 self.assertTrue('stow' in sample) |
242 self.assertTrue('retrieve' in sample) | |
243 self.assertTrue('get' in sample) | |
244 | 244 self.assertTrue('wado' in sample) # New in 0.7 |
245 self.assertTrue('qido' in sample) # New in 0.7 | |
84 | 246 |
247 # application/dicom+xml | |
131
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
248 self.assertEqual(2, len(re.findall('^--', DoGet(ORTHANC, '/dicom-web/studies', |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
249 headers = { 'Accept' : 'application/dicom+xml' }), |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
250 re.MULTILINE))) |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
251 self.assertEqual(2, len(re.findall('^--', DoPost |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
252 (ORTHANC, '/dicom-web/servers/sample/get', |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
253 { 'Uri' : '/studies', |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
254 'HttpHeaders' : { 'Accept' : 'application/dicom+xml' } |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
255 }), re.MULTILINE))) |
84 | 256 |
257 # application/dicom+json | |
131
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
258 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies', |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
259 headers = { 'Accept' : 'application/dicom+json' }))) |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
260 self.assertEqual(1, len(DoPost(ORTHANC, '/dicom-web/servers/sample/get', |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
261 { 'Uri' : '/studies', |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
262 'HttpHeaders' : { 'Accept' : 'application/dicom+json' }}))) |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
263 |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
264 # application/json |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
265 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies', |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
266 headers = { 'Accept' : 'application/json' }))) |
84 | 267 self.assertEqual(1, len(DoPost(ORTHANC, '/dicom-web/servers/sample/get', |
268 { 'Uri' : '/studies', | |
269 'HttpHeaders' : { 'Accept' : 'application/json' }}))) | |
270 | |
131
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
271 # application/dicom+json is the default as of OrthancDicomWeb-0.5 |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
272 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies'))) |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
273 self.assertEqual(1, len(DoPost(ORTHANC, '/dicom-web/servers/sample/get', |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
274 { 'Uri' : '/studies' }))) |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
275 |
84 | 276 |
277 def test_server_stow(self): | |
278 UploadInstance(ORTHANC, 'Knee/T1/IM-0001-0001.dcm') | |
279 | |
280 self.assertRaises(Exception, lambda: | |
281 DoPost(ORTHANC, '/dicom-web/servers/sample/stow', | |
246
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
282 { 'Resources' : [ 'nope' ], |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
283 'Synchronous' : True })) # inexisting resource |
84 | 284 |
246
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
285 l = 2 # For >= 0.7 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
286 #l = 0 # For <= 0.6 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
287 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
288 self.assertEqual(l, len(DoPost(ORTHANC, '/dicom-web/servers/sample/stow', |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
289 { 'Resources' : [ '0a9b3153-2512774b-2d9580de-1fc3dcf6-3bd83918' ], |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
290 'Synchronous' : True }))) # study |
84 | 291 |
246
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
292 self.assertEqual(l, len(DoPost(ORTHANC, '/dicom-web/servers/sample/stow', |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
293 { 'Resources' : [ '6de73705-c4e65c1b-9d9ea1b5-cabcd8e7-f15e4285' ], |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
294 'Synchronous' : True }))) # series |
84 | 295 |
246
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
296 self.assertEqual(l, len(DoPost(ORTHANC, '/dicom-web/servers/sample/stow', |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
297 { 'Resources' : [ 'c8df6478-d7794217-0f11c293-a41237c9-31d98357' ], |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
298 'Synchronous' : True }))) # instance |
84 | 299 |
246
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
300 self.assertEqual(l, len(DoPost(ORTHANC, '/dicom-web/servers/sample/stow', |
84 | 301 { 'Resources' : [ |
302 'ca29faea-b6a0e17f-067743a1-8b778011-a48b2a17', | |
303 '0a9b3153-2512774b-2d9580de-1fc3dcf6-3bd83918', | |
304 '6de73705-c4e65c1b-9d9ea1b5-cabcd8e7-f15e4285', | |
246
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
305 'c8df6478-d7794217-0f11c293-a41237c9-31d98357' ], |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
306 'Synchronous' : True }))) # altogether |
84 | 307 |
308 | |
309 def test_server_retrieve(self): | |
244 | 310 COUNT = 'ReceivedInstancesCount' |
311 #COUNT = 'Instances' # In version <= 0.6 | |
312 | |
84 | 313 UploadInstance(ORTHANC, 'Knee/T1/IM-0001-0001.dcm') |
314 UploadInstance(ORTHANC, 'Knee/T1/IM-0001-0002.dcm') | |
315 UploadInstance(ORTHANC, 'Knee/T2/IM-0001-0001.dcm') | |
316 | |
317 self.assertRaises(Exception, lambda: | |
318 DoPost(ORTHANC, '/dicom-web/servers/sample/retrieve', | |
319 { 'Resources' : [ { 'Study' : 'nope' } ]})) # inexisting resource | |
320 | |
321 t = DoPost(ORTHANC, '/dicom-web/servers/sample/retrieve', | |
322 { 'Resources' : [ { 'Study' : '2.16.840.1.113669.632.20.121711.10000160881' } ] }) | |
244 | 323 self.assertEqual(3, int(t[COUNT])) |
84 | 324 |
325 # Missing "Study" field | |
326 self.assertRaises(Exception, lambda: | |
327 DoPost(ORTHANC, '/dicom-web/servers/sample/retrieve', | |
328 { 'Resources' : [ { 'Series' : '1.3.46.670589.11.17521.5.0.3124.2008081908564160709' } ]})) | |
329 | |
330 t = DoPost(ORTHANC, '/dicom-web/servers/sample/retrieve', | |
331 { 'Resources' : [ { 'Study' : '2.16.840.1.113669.632.20.121711.10000160881', | |
332 'Series' : '1.3.46.670589.11.17521.5.0.3124.2008081908564160709' } ] }) | |
244 | 333 self.assertEqual(2, int(t[COUNT])) |
84 | 334 |
335 t = DoPost(ORTHANC, '/dicom-web/servers/sample/retrieve', | |
336 { 'Resources' : [ { 'Study' : '2.16.840.1.113669.632.20.121711.10000160881', | |
337 'Series' : '1.3.46.670589.11.17521.5.0.3124.2008081909090037350' } ] }) | |
244 | 338 self.assertEqual(1, int(t[COUNT])) |
84 | 339 |
340 t = DoPost(ORTHANC, '/dicom-web/servers/sample/retrieve', | |
341 { 'Resources' : [ { 'Study' : '2.16.840.1.113669.632.20.121711.10000160881', | |
342 'Series' : '1.3.46.670589.11.17521.5.0.3124.2008081909090037350' }, | |
343 { 'Study' : '2.16.840.1.113669.632.20.121711.10000160881', | |
344 'Series' : '1.3.46.670589.11.17521.5.0.3124.2008081908564160709' } ] }) | |
244 | 345 self.assertEqual(3, int(t[COUNT])) |
84 | 346 |
347 t = DoPost(ORTHANC, '/dicom-web/servers/sample/retrieve', | |
348 { 'Resources' : [ { 'Study' : '2.16.840.1.113669.632.20.121711.10000160881', | |
349 'Series' : '1.3.46.670589.11.17521.5.0.3124.2008081909090037350', | |
350 'Instance' : '1.3.46.670589.11.17521.5.0.3124.2008081909113806560' } ] }) | |
244 | 351 self.assertEqual(1, int(t[COUNT])) |
84 | 352 |
353 | |
114
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
354 def test_bitbucket_issue_53(self): |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
355 # DICOMWeb plugin support for "limit" and "offset" parameters in QIDO-RS |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
356 # https://bitbucket.org/sjodogne/orthanc/issues/53 |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
357 |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
358 UploadInstance(ORTHANC, 'Brainix/Flair/IM-0001-0001.dcm') |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
359 UploadInstance(ORTHANC, 'Knee/T1/IM-0001-0001.dcm') |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
360 |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
361 brainix = '2.16.840.1.113669.632.20.1211.10000357775' |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
362 knee = '2.16.840.1.113669.632.20.121711.10000160881' |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
363 |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
364 a = DoGet(ORTHANC, '/dicom-web/studies', |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
365 headers = { 'accept' : 'application/json' }) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
366 self.assertEqual(2, len(a)) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
367 |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
368 b = [] |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
369 a = DoGet(ORTHANC, '/dicom-web/studies?limit=1', |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
370 headers = { 'accept' : 'application/json' }) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
371 self.assertEqual(1, len(a)) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
372 b.append(a[0]['0020000D']['Value'][0]) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
373 |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
374 a = DoGet(ORTHANC, '/dicom-web/studies?limit=1&offset=1', |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
375 headers = { 'accept' : 'application/json' }) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
376 self.assertEqual(1, len(a)) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
377 b.append(a[0]['0020000D']['Value'][0]) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
378 |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
379 self.assertTrue(brainix in b) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
380 self.assertTrue(knee in b) |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
381 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
382 |
184
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
383 def test_bitbucket_issue_111(self): |
223
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
384 # Wrong serialization of empty values |
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
385 # https://bitbucket.org/sjodogne/orthanc/issues/111 |
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
386 # https://bitbucket.org/sjodogne/orthanc-dicomweb/issues/3/ |
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
387 |
184
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
388 # According to the standard, section F.2.5 |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
389 # (http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_F.2.5.html), |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
390 # null values behave as follows: If an attribute is present in |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
391 # DICOM but empty (i.e., Value Length is 0), it shall be |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
392 # preserved in the DICOM JSON attribute object containing no |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
393 # "Value", "BulkDataURI" or "InlineBinary". |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
394 # https://bitbucket.org/sjodogne/orthanc/issues/111/qido-rs-wrong-serialization-of-empty |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
395 |
223
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
396 UploadInstance(ORTHANC, 'Issue111.dcm') |
184
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
397 |
223
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
398 # Test WADO-RS |
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
399 a = DoGet(ORTHANC, '/dicom-web/studies/1.2.276.0.7230010.3.1.2.8323329.30185.1551199973.371589/metadata') |
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
400 self.assertEqual(1, len(a)) |
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
401 self.assertTrue('00080050' in a[0]) # AccessionNumber is null |
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
402 self.assertEqual(1, len(a[0]['00080050'])) # 'vr' is the only field to be present |
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
403 self.assertEqual('SH', a[0]['00080050']['vr']) |
184
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
404 |
223
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
405 # Test QIDO-RS |
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
406 a = DoGet(ORTHANC, '/dicom-web/studies') |
184
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
407 self.assertEqual(1, len(a)) |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
408 self.assertTrue('00080050' in a[0]) # AccessionNumber is null |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
409 self.assertEqual(1, len(a[0]['00080050'])) # 'vr' is the only field to be present |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
410 self.assertEqual('SH', a[0]['00080050']['vr']) |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
411 |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
412 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
413 def test_wado_hierarchy(self): |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
414 def CheckJson(uri, headers = {}): |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
415 with open(GetDatabasePath('DummyCT.json'), 'r') as f: |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
416 expected = json.loads(f.read()) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
417 actual = DoGet(ORTHANC, uri, headers) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
418 self.assertEqual(1, len(actual)) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
419 AssertAlmostEqualRecursive(self, expected, actual[0]) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
420 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
421 UploadInstance(ORTHANC, 'DummyCT.dcm') |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
422 study = '1.2.840.113619.2.176.2025.1499492.7391.1171285944.390' |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
423 series = '1.2.840.113619.2.176.2025.1499492.7391.1171285944.394' |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
424 instance = '1.2.840.113619.2.176.2025.1499492.7040.1171286242.109' |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
425 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
426 URI = '/dicom-web/studies/%s/series/%s/instances/%s/metadata' |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
427 self.assertRaises(Exception, lambda: DoGet(ORTHANC, URI % (study, series, instance), |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
428 headers = { 'accept' : 'application/nope' })) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
429 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
430 CheckJson(URI % (study, series, instance), headers = { 'accept' : 'application/dicom+json' }) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
431 CheckJson('/dicom-web/studies/%s/series/%s/metadata' % (study, series)) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
432 CheckJson('/dicom-web/studies/%s/metadata' % study) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
433 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
434 self.assertRaises(Exception, lambda: DoGet(ORTHANC, URI % ('nope', series, instance))) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
435 self.assertRaises(Exception, lambda: DoGet(ORTHANC, URI % (study, 'nope', instance))) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
436 self.assertRaises(Exception, lambda: DoGet(ORTHANC, URI % (study, series, 'nope'))) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
437 self.assertRaises(Exception, lambda: DoGet(ORTHANC, '/dicom-web/studies/%s/series/%s/metadata' % ('nope', series))) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
438 self.assertRaises(Exception, lambda: DoGet(ORTHANC, '/dicom-web/studies/%s/series/%s/metadata' % (study, 'nope'))) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
439 self.assertRaises(Exception, lambda: DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % 'nope')) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
440 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
441 |
228 | 442 def test_wado_pixel_data(self): |
443 orthanc = UploadInstance(ORTHANC, 'Issue29.dcm') ['ID'] | |
444 a = DoGet(ORTHANC, '/dicom-web/instances') | |
445 self.assertEqual(1, len(a)) | |
446 url = a[0]['00081190']['Value'][0] | |
447 | |
448 prefix = 'http://localhost:8042' | |
449 self.assertTrue(url.startswith(prefix)) | |
450 | |
451 b = DoGet(ORTHANC, url[len(prefix):] + '/metadata') | |
452 self.assertEqual('OB', b[0]['7FE00010']['vr']) | |
453 self.assertEqual(2, len(b[0]['7FE00010'])) | |
454 self.assertTrue('BulkDataURI' in b[0]['7FE00010']) | |
455 | |
456 url = b[0]['7FE00010']['BulkDataURI'] | |
457 self.assertTrue(url.startswith(prefix)) | |
458 | |
459 p = DoGetMultipart(ORTHANC, url[len(prefix):]) | |
460 | |
461 self.assertEqual(2, len(p)) # There are 2 fragments in this image | |
462 self.assertEqual(4, len(p[0])) | |
463 self.assertEqual(114486, len(p[1])) | |
464 | |
465 | |
466 def test_wado_hierarchy_bulk(self): | |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
467 def CheckBulk(value, bulk): |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
468 self.assertEqual(2, len(value)) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
469 self.assertTrue('BulkDataURI' in value) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
470 self.assertTrue('vr' in value) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
471 self.assertEqual(value['BulkDataURI'], bulk) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
472 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
473 orthanc = UploadInstance(ORTHANC, 'PrivateTags.dcm') ['ID'] |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
474 study = '1.2.840.113619.2.115.147416.1094281639.0.29' |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
475 series = '1.2.840.113619.2.115.147416.1094281639.0.30' |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
476 sop = '1.2.840.113619.2.115.147416.1094281639.0.38' |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
477 |
228 | 478 # WARNING: This test will fail on Orthanc <= 1.5.5, because |
479 # the following fix is not included yet: | |
480 # https://bitbucket.org/sjodogne/orthanc/commits/b88937ef597b33c4387a546c751827019bcdc205 | |
481 | |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
482 a = DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
483 self.assertEqual(1, len(a)) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
484 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
485 BASE_URI = '/dicom-web/studies/%s/series/%s/instances/%s/bulk' % (study, series, sop) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
486 BASE_URL = 'http://localhost:8042%s' % BASE_URI |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
487 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
488 self.assertEqual(2, len(a[0]['60031010']['Value'])) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
489 CheckBulk(a[0]['60031010']['Value'][0]['60031011'], '%s/60031010/1/60031011' % BASE_URL) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
490 CheckBulk(a[0]['60031010']['Value'][1]['60031011'], '%s/60031010/2/60031011' % BASE_URL) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
491 CheckBulk(a[0]['7FE00010'], '%s/7fe00010' % BASE_URL) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
492 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
493 b = DoGetRaw(ORTHANC, '/instances/%s/content/6003-1010/0/6003-1011' % orthanc) [1] |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
494 c = DoGetMultipart(ORTHANC, '%s/60031010/1/60031011' % BASE_URI) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
495 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
496 self.assertEqual(12288, len(b)) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
497 self.assertEqual(1, len(c)) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
498 self.assertEqual(b, c[0]) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
499 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
500 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
501 def test_bitbucket_issue_112(self): |
223
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
502 # Wrong serialization of number values |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
503 # https://bitbucket.org/sjodogne/orthanc/issues/112 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
504 # https://bitbucket.org/sjodogne/orthanc-dicomweb/issues/4/ |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
505 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
506 UploadInstance(ORTHANC, 'DummyCT.dcm') |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
507 study = '1.2.840.113619.2.176.2025.1499492.7391.1171285944.390' |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
508 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
509 # This is the WADO-RS testing |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
510 a = DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
511 self.assertEqual(1, len(a)) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
512 self.assertEqual('IS', a[0]['00180091']['vr']) # EchoTrainLength |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
513 |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
514 if (sys.version_info >= (3, 0)): |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
515 types = (int) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
516 else: |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
517 types = (int, long) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
518 |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
519 b = a[0]['00180091']['Value'][0] |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
520 self.assertTrue(isinstance(b, types)) |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
521 self.assertEqual(10, b) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
522 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
523 # This is the QIDO-RS testing |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
524 a = DoGet(ORTHANC, '/dicom-web/studies') |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
525 self.assertEqual(1, len(a)) |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
526 self.assertEqual('IS', a[0]['00201208']['vr']) # Number of Study Related Instances |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
527 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
528 b = a[0]['00201208']['Value'][0] |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
529 self.assertTrue(isinstance(b, types)) |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
530 self.assertEqual(1, b) |
223
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
531 |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
532 |
224
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
533 def test_bitbucket_issue_113(self): |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
534 # Wrong serialization of PN VR |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
535 # https://bitbucket.org/sjodogne/orthanc/issues/113 |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
536 # https://bitbucket.org/sjodogne/orthanc-dicomweb/issues/2/ |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
537 |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
538 UploadInstance(ORTHANC, 'Encodings/DavidClunie/SCSX1') |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
539 study = '1.3.6.1.4.1.5962.1.2.0.1175775771.5711.0' |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
540 |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
541 # This is the WADO-RS testing |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
542 a = DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
543 self.assertEqual(1, len(a)) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
544 |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
545 pn = a[0]['00100010'] # Patient name |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
546 self.assertEqual('PN', pn['vr']) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
547 self.assertEqual(1, len(pn['Value'])) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
548 self.assertEqual('Wang^XiaoDong', pn['Value'][0]['Alphabetic']) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
549 self.assertEqual(u'王^小東', pn['Value'][0]['Ideographic']) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
550 |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
551 # This is the QIDO-RS testing |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
552 a = DoGet(ORTHANC, '/dicom-web/studies') |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
553 self.assertEqual(1, len(a)) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
554 |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
555 pn = a[0]['00100010'] # Patient name |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
556 self.assertEqual('PN', pn['vr']) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
557 self.assertEqual(1, len(pn['Value'])) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
558 self.assertEqual('Wang^XiaoDong', pn['Value'][0]['Alphabetic']) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
559 self.assertEqual(u'王^小東', pn['Value'][0]['Ideographic']) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
560 |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
561 |
225 | 562 def test_bitbucket_issue_96(self): |
563 # WADO-RS RetrieveFrames rejects valid accept headers | |
564 # https://bitbucket.org/sjodogne/orthanc/issues/96 | |
565 # https://bitbucket.org/sjodogne/orthanc-dicomweb/issues/5/ | |
566 | |
228 | 567 UploadInstance(ORTHANC, 'Brainix/Epi/IM-0001-0001.dcm') |
225 | 568 |
569 a = DoGet(ORTHANC, '/dicom-web/instances') | |
570 self.assertEqual(1, len(a)) | |
228 | 571 self.assertEqual(256, a[0]['00280010']['Value'][0]) # Rows |
572 self.assertEqual(256, a[0]['00280011']['Value'][0]) # Columns | |
573 self.assertEqual(16, a[0]['00280100']['Value'][0]) # Bits allocated | |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
574 |
225 | 575 url = a[0]['00081190']['Value'][0] |
576 | |
577 prefix = 'http://localhost:8042' | |
578 self.assertTrue(url.startswith(prefix)) | |
579 uri = url[len(prefix):] | |
580 | |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
581 self.assertRaises(Exception, lambda: DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 0))) |
228 | 582 self.assertRaises(Exception, lambda: DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 2))) |
583 | |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
584 b = DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 1)) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
585 self.assertEqual(1, len(b)) |
228 | 586 self.assertEqual(256 * 256 * 2, len(b[0])) |
225 | 587 |
228 | 588 c = DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 1), |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
589 headers = { 'Accept' : 'multipart/related; type=application/octet-stream' }) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
590 self.assertEqual(1, len(c)) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
591 self.assertEqual(b[0], c[0]) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
592 |
228 | 593 c = DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 1), |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
594 headers = { 'Accept' : 'multipart/related; type="application/octet-stream"' }) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
595 self.assertEqual(1, len(c)) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
596 self.assertEqual(b[0], c[0]) |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
597 |
228 | 598 self.assertRaises(Exception, lambda: DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 1), |
599 headers = { 'Accept' : 'multipart/related; type="nope"' })) | |
600 | |
601 self.assertRaises(Exception, lambda: DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 1), | |
602 headers = { 'Accept' : 'multipart/related; type=nope' })) | |
603 | |
604 self.assertRaises(Exception, lambda: DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 1), | |
605 headers = { 'Accept' : 'nope' })) | |
606 | |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
607 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
608 def test_qido_fields(self): |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
609 UploadInstance(ORTHANC, 'DummyCT.dcm') |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
610 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
611 a = DoGet(ORTHANC, '/dicom-web/studies') |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
612 self.assertEqual(1, len(a)) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
613 self.assertFalse('00280010' in a[0]) # Rows |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
614 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
615 a = DoGet(ORTHANC, '/dicom-web/studies?includefield=Rows') |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
616 self.assertEqual(1, len(a)) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
617 self.assertTrue('00280010' in a[0]) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
618 self.assertEqual(512, a[0]['00280010']['Value'][0]) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
619 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
620 a = DoGet(ORTHANC, '/dicom-web/studies?Rows=128') |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
621 self.assertEqual(0, len(a)) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
622 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
623 a = DoGet(ORTHANC, '/dicom-web/studies?Rows=512') |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
624 self.assertEqual(1, len(a)) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
625 self.assertTrue('00280010' in a[0]) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
626 self.assertEqual(512, a[0]['00280010']['Value'][0]) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
627 |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
628 |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
629 def test_stow_errors(self): |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
630 # Pushing an instance to a study that is not its parent |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
631 a = SendStow(ORTHANC, args.dicomweb + '/studies/nope', GetDatabasePath('Phenix/IM-0001-0001.dcm')) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
632 self.assertEqual(3, len(a)) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
633 self.assertTrue('00080005' in a) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
634 self.assertEqual('CS', a['00080005']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
635 self.assertTrue('00081198' in a) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
636 self.assertEqual('SQ', a['00081198']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
637 self.assertEqual(1, len(['00081198'])) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
638 self.assertTrue('00081199' in a) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
639 self.assertEqual('SQ', a['00081199']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
640 self.assertEqual(1, len(['00081199'])) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
641 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
642 # Pushing an instance with missing tags |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
643 a = SendStow(ORTHANC, args.dicomweb + '/studies', GetDatabasePath('Issue111.dcm')) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
644 self.assertEqual(3, len(a)) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
645 self.assertTrue('00080005' in a) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
646 self.assertEqual('CS', a['00080005']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
647 self.assertTrue('00081198' in a) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
648 self.assertEqual('SQ', a['00081198']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
649 self.assertEqual(1, len(['00081198'])) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
650 self.assertTrue('00081199' in a) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
651 self.assertEqual('SQ', a['00081199']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
652 self.assertEqual(1, len(['00081199'])) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
653 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
654 # Pushing a file that is not in the DICOM format |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
655 a = SendStow(ORTHANC, args.dicomweb + '/studies', GetDatabasePath('Issue111.dump')) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
656 self.assertEqual(3, len(a)) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
657 self.assertTrue('00080005' in a) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
658 self.assertEqual('CS', a['00080005']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
659 self.assertTrue('00081198' in a) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
660 self.assertEqual('SQ', a['00081198']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
661 self.assertEqual(1, len(['00081198'])) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
662 self.assertTrue('00081199' in a) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
663 self.assertEqual('SQ', a['00081199']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
664 self.assertEqual(1, len(['00081199'])) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
665 |
239
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
666 |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
667 def test_allowed_methods(self): |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
668 self.assertEqual(0, len(DoGet(ORTHANC, '/dicom-web/studies'))) |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
669 |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
670 with self.assertRaises(Exception) as e: |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
671 DoPut(ORTHANC, '/dicom-web/studies') |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
672 |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
673 self.assertEqual(405, e.exception[0]) |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
674 self.assertEqual("GET,POST", e.exception[1]['allow']) |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
675 |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
676 with self.assertRaises(Exception) as e: |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
677 DoDelete(ORTHANC, '/dicom-web/studies') |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
678 |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
679 self.assertEqual(405, e.exception[0]) |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
680 self.assertEqual("GET,POST", e.exception[1]['allow']) |
241
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
681 |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
682 |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
683 def test_add_server(self): |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
684 try: |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
685 DoDelete(ORTHANC, '/dicom-web/servers/hello') |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
686 except: |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
687 pass |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
688 |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
689 l = DoGet(ORTHANC, '/dicom-web/servers') |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
690 self.assertEqual(1, len(l)) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
691 self.assertTrue('sample' in l) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
692 |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
693 url = 'http://localhost:8042/dicom-web/' |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
694 DoPut(ORTHANC, '/dicom-web/servers/hello', { |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
695 'Url': url, |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
696 'HttpHeaders' : { |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
697 'Hello' : 'World' |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
698 }, |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
699 'Username' : 'bob', |
242 | 700 'Password' : 'password', |
701 'UserProperty' : 'Test', | |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
702 'HasDelete' : True, |
241
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
703 }) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
704 |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
705 l = DoGet(ORTHANC, '/dicom-web/servers') |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
706 self.assertEqual(2, len(l)) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
707 self.assertTrue('sample' in l) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
708 self.assertTrue('hello' in l) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
709 |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
710 o = DoGet(ORTHANC, '/dicom-web/servers/sample') |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
711 self.assertEqual(5, len(o)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
712 self.assertTrue('stow' in o) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
713 self.assertTrue('retrieve' in o) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
714 self.assertTrue('get' in o) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
715 self.assertTrue('wado' in o) # New in 0.7 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
716 self.assertTrue('qido' in o) # New in 0.7 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
717 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
718 o = DoGet(ORTHANC, '/dicom-web/servers/hello') |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
719 self.assertEqual(6, len(o)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
720 self.assertTrue('stow' in o) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
721 self.assertTrue('retrieve' in o) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
722 self.assertTrue('get' in o) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
723 self.assertTrue('wado' in o) # New in 0.7 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
724 self.assertTrue('qido' in o) # New in 0.7 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
725 self.assertTrue('delete' in o) # New in 0.7 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
726 |
241
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
727 s = DoGet(ORTHANC, '/dicom-web/servers?expand') |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
728 self.assertEqual(7, len(s['hello'])) |
241
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
729 self.assertEqual(url, s['hello']['Url']) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
730 self.assertEqual('bob', s['hello']['Username']) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
731 self.assertEqual(None, s['hello']['Password']) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
732 self.assertFalse(s['hello']['Pkcs11']) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
733 self.assertEqual(1, len(s['hello']['HttpHeaders'])) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
734 self.assertTrue('Hello' in s['hello']['HttpHeaders']) |
242 | 735 self.assertEqual('Test', s['hello']['UserProperty']) |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
736 self.assertEqual('1', s['hello']['HasDelete']) |
241
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
737 |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
738 DoDelete(ORTHANC, '/dicom-web/servers/hello') |
246
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
739 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
740 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
741 def test_bitbucket_issue_143(self): |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
742 # WADO-RS metadata request returns "500 Internal Server Error" |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
743 # instead of "404 Not Found" for missing instance |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
744 # https://bitbucket.org/sjodogne/orthanc/issues/143 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
745 UploadInstance(ORTHANC, 'Issue143.dcm') |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
746 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
747 try: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
748 DoGet(ORTHANC, '/dicom-web/studies/1.2.840.113619.2.55.3.671756986.106.1316467036.460/series/1.2.840.113619.2.55.3.671756986.106.1316467036.465/instances/0.0.0.0.0/metadata') |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
749 self.assertFail() |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
750 except Exception as e: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
751 self.assertEqual(404, e[0]) |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
752 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
753 DoGet(ORTHANC, '/dicom-web/studies/1.3.6.1.4.1.34261.90254037371867.41912.1553085024.2/series/1.3.6.1.4.1.34261.90254037371867.41912.1553085024.3/instances/1.2.276.0.7230010.3.1.4.253549293.36648.1555586123.754/metadata') |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
754 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
755 try: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
756 DoGet(ORTHANC, '/dicom-web/studies/0.0.0.0.0/series/1.3.6.1.4.1.34261.90254037371867.41912.1553085024.3/instances/1.2.276.0.7230010.3.1.4.253549293.36648.1555586123.754/metadata') |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
757 self.fail() |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
758 except Exception as e: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
759 self.assertEqual(404, e[0]) |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
760 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
761 try: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
762 DoGet(ORTHANC, '/dicom-web/studies/1.3.6.1.4.1.34261.90254037371867.41912.1553085024.2/series/0.0.0.0.0/instances/1.2.276.0.7230010.3.1.4.253549293.36648.1555586123.754/metadata') |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
763 self.assertFail() |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
764 except Exception as e: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
765 self.assertEqual(404, e[0]) |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
766 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
767 try: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
768 DoGet(ORTHANC, '/dicom-web/studies/0.0.0.0.0/series/0.0.0.0.0/instances/0.0.0.0.0/metadata') |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
769 self.assertFail() |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
770 except Exception as e: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
771 self.assertEqual(404, e[0]) |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
772 |
248
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
773 |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
774 def test_encodings_qido(self): |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
775 # The "DefaultEncoding" condifuration option is set to "UTF8" |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
776 # in the integration tests, so all the QIDO-RS requests must |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
777 # lead to a "ISO_IR 192" specific character set |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
778 def GetPatientName(dicom, onlyAlphabetic): |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
779 i = UploadInstance(ORTHANC, dicom) ['ID'] |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
780 j = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i) ['StudyInstanceUID'] |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
781 qido = DoGet(ORTHANC, '/dicom-web/studies?0020000D=%s' % j) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
782 self.assertEqual(1, len(qido)) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
783 self.assertEqual('CS', qido[0]['00080005']['vr']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
784 self.assertEqual('ISO_IR 192', qido[0]['00080005']['Value'][0]) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
785 if onlyAlphabetic: |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
786 self.assertEqual(1, len(qido[0]['00100010']['Value'][0])) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
787 else: |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
788 self.assertEqual(3, len(qido[0]['00100010']['Value'][0])) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
789 return qido[0]['00100010']['Value'][0] |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
790 |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
791 # Check out "test_issue_95_encodings" in "../../Tests/Tests.py" |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
792 |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
793 self.assertEqual(u'Buc^Jérôme', GetPatientName('Encodings/DavidClunie/SCSFREN', True) ['Alphabetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
794 self.assertEqual(u'Äneas^Rüdiger', GetPatientName('Encodings/DavidClunie/SCSGERM', True)['Alphabetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
795 self.assertEqual(u'Διονυσιος', GetPatientName('Encodings/DavidClunie/SCSGREEK', True)['Alphabetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
796 self.assertEqual(u'Люкceмбypг', GetPatientName('Encodings/DavidClunie/SCSRUSS', True)['Alphabetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
797 self.assertEqual(u'שרון^דבורה', GetPatientName('Encodings/DavidClunie/SCSHBRW', True)['Alphabetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
798 self.assertEqual(u'قباني^لنزار', GetPatientName('Encodings/DavidClunie/SCSARAB', True)['Alphabetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
799 |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
800 self.assertEqual(u'Hong^Gildong', GetPatientName('Encodings/DavidClunie/SCSI2', False)['Alphabetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
801 self.assertEqual(u'洪^吉洞', GetPatientName('Encodings/DavidClunie/SCSI2', False)['Ideographic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
802 self.assertEqual(u'홍^길동', GetPatientName('Encodings/DavidClunie/SCSI2', False)['Phonetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
803 self.assertEqual(u'Wang^XiaoDong', GetPatientName('Encodings/DavidClunie/SCSX2', False)['Alphabetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
804 self.assertEqual(u'王^小东', GetPatientName('Encodings/DavidClunie/SCSX2', False)['Ideographic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
805 self.assertEqual(u'', GetPatientName('Encodings/DavidClunie/SCSX2', False)['Phonetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
806 self.assertEqual(u'Wang^XiaoDong', GetPatientName('Encodings/DavidClunie/SCSX1', False)['Alphabetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
807 self.assertEqual(u'王^小東', GetPatientName('Encodings/DavidClunie/SCSX1', False)['Ideographic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
808 self.assertEqual(u'', GetPatientName('Encodings/DavidClunie/SCSX1', False)['Phonetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
809 self.assertEqual(u'Yamada^Tarou', GetPatientName('Encodings/DavidClunie/SCSH31', False)['Alphabetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
810 self.assertEqual(u'山田^太郎', GetPatientName('Encodings/DavidClunie/SCSH31', False)['Ideographic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
811 self.assertEqual(u'やまだ^たろう', GetPatientName('Encodings/DavidClunie/SCSH31', False)['Phonetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
812 self.assertEqual(u'ヤマダ^タロウ', GetPatientName('Encodings/DavidClunie/SCSH32', False)['Alphabetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
813 |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
814 # TODO - Not supported yet by the Orthanc core as of 1.5.7 |
248
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
815 #self.assertEqual(u'山田^太郎', GetPatientName('Encodings/DavidClunie/SCSH32')['Ideographic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
816 #self.assertEqual(u'やまだ^たろう', GetPatientName('Encodings/DavidClunie/SCSH32')['Phonetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
817 |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
818 |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
819 def test_encodings_wado_metadata(self): |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
820 # If querying the instance metadata, the "DefaultEncoding" |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
821 # configuration is not used, but the actual encoding |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
822 def GetEncoding(dicom, length): |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
823 qido = DoGet(ORTHANC, '/dicom-web/%s/metadata' % UploadAndGetWadoPath(dicom)) |
248
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
824 self.assertEqual(1, len(qido)) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
825 self.assertEqual(length, len(qido[0]['00080005']['Value'])) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
826 self.assertEqual('CS', qido[0]['00080005']['vr']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
827 return qido[0]['00080005']['Value'] |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
828 |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
829 self.assertEqual('ISO_IR 100', GetEncoding('Encodings/DavidClunie/SCSFREN', 1)[0]) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
830 self.assertEqual('ISO_IR 100', GetEncoding('Encodings/DavidClunie/SCSGERM', 1)[0]) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
831 self.assertEqual('ISO_IR 126', GetEncoding('Encodings/DavidClunie/SCSGREEK', 1)[0]) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
832 self.assertEqual('ISO_IR 144', GetEncoding('Encodings/DavidClunie/SCSRUSS', 1)[0]) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
833 self.assertEqual('ISO_IR 138', GetEncoding('Encodings/DavidClunie/SCSHBRW', 1)[0]) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
834 self.assertEqual('ISO_IR 127', GetEncoding('Encodings/DavidClunie/SCSARAB', 1)[0]) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
835 self.assertEqual('ISO 2022 IR 149', GetEncoding('Encodings/DavidClunie/SCSI2', 1)[0]) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
836 self.assertEqual('GB18030', GetEncoding('Encodings/DavidClunie/SCSX2', 1)[0]) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
837 self.assertEqual('ISO_IR 192', GetEncoding('Encodings/DavidClunie/SCSX1', 1)[0]) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
838 self.assertEqual('ISO 2022 IR 87', GetEncoding('Encodings/DavidClunie/SCSH31', 1)[0]) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
839 self.assertEqual('ISO 2022 IR 13', GetEncoding('Encodings/DavidClunie/SCSH32', 2)[0]) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
840 self.assertEqual('ISO 2022 IR 87', GetEncoding('Encodings/DavidClunie/SCSH32', 2)[1]) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
841 |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
842 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
843 def test_rendered(self): |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
844 def RenderFrame(path, i): |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
845 return DoPost(ORTHANC, '/dicom-web/servers/sample/get', { |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
846 'Uri' : '%s/frames/%d/rendered' % (path, i) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
847 }) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
848 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
849 # This image has 76 frames |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
850 path = UploadAndGetWadoPath('Multiframe.dcm') |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
851 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
852 self.assertRaises(Exception, lambda: RenderFrame(path, 0)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
853 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
854 frame1 = RenderFrame(path, 1) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
855 im = UncompressImage(frame1) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
856 self.assertEqual("L", im.mode) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
857 self.assertEqual(512, im.size[0]) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
858 self.assertEqual(512, im.size[1]) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
859 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
860 im = UncompressImage(RenderFrame(path, 76)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
861 self.assertEqual("L", im.mode) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
862 self.assertEqual(512, im.size[0]) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
863 self.assertEqual(512, im.size[1]) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
864 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
865 self.assertRaises(Exception, lambda: RenderFrame(path, 77)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
866 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
867 defaultFrame = DoPost(ORTHANC, '/dicom-web/servers/sample/get', { |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
868 'Uri' : '%s/rendered' % path |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
869 }) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
870 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
871 self.assertEqual(len(frame1), len(defaultFrame)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
872 self.assertEqual(frame1, defaultFrame) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
873 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
874 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
875 # This image has 1 frame |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
876 path = UploadAndGetWadoPath('Phenix/IM-0001-0001.dcm') |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
877 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
878 self.assertRaises(Exception, lambda: RenderFrame(path, 0)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
879 self.assertRaises(Exception, lambda: RenderFrame(path, 2)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
880 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
881 frame1 = RenderFrame(path, 1) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
882 im = UncompressImage(frame1) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
883 self.assertEqual("L", im.mode) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
884 self.assertEqual(512, im.size[0]) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
885 self.assertEqual(358, im.size[1]) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
886 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
887 defaultFrame = DoPost(ORTHANC, '/dicom-web/servers/sample/get', { |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
888 'Uri' : '%s/rendered' % path |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
889 }) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
890 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
891 self.assertEqual(len(frame1), len(defaultFrame)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
892 self.assertEqual(frame1, defaultFrame) |
259
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
893 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
894 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
895 def test_qido_parent_attributes(self): |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
896 UploadInstance(ORTHANC, 'Brainix/Flair/IM-0001-0001.dcm') |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
897 study = '2.16.840.1.113669.632.20.1211.10000357775' |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
898 series = '1.3.46.670589.11.0.0.11.4.2.0.8743.5.5396.2006120114285654497' |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
899 instance = '1.3.46.670589.11.0.0.11.4.2.0.8743.5.5396.2006120114314079549' |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
900 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
901 a = DoGet(ORTHANC, '/dicom-web/studies') |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
902 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
903 self.assertFalse('00080018' in a[0]) # SOPInstanceUID |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
904 self.assertFalse('0020000E' in a[0]) # SeriesInstanceUID |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
905 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
906 self.assertEqual('BRAINIX', a[0]['00100010']['Value'][0]['Alphabetic']) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
907 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
908 a = DoGet(ORTHANC, '/dicom-web/studies?0020000D=%s' % study) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
909 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
910 self.assertFalse('00080018' in a[0]) # SOPInstanceUID |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
911 self.assertFalse('0020000E' in a[0]) # SeriesInstanceUID |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
912 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
913 self.assertEqual('BRAINIX', a[0]['00100010']['Value'][0]['Alphabetic']) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
914 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
915 a = DoGet(ORTHANC, '/dicom-web/series') |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
916 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
917 self.assertFalse('00080018' in a[0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
918 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
919 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
920 self.assertEqual('MR', a[0]['00080060']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
921 self.assertEqual('BRAINIX', a[0]['00100010']['Value'][0]['Alphabetic']) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
922 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
923 a = DoGet(ORTHANC, '/dicom-web/instances') |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
924 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
925 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
926 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
927 self.assertEqual(instance, a[0]['00080018']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
928 self.assertEqual('MR', a[0]['00080060']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
929 self.assertEqual('BRAINIX', a[0]['00100010']['Value'][0]['Alphabetic']) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
930 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
931 a = DoGet(ORTHANC, '/dicom-web/studies/%s/series' % study) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
932 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
933 self.assertFalse('00080018' in a[0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
934 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
935 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
936 self.assertEqual('MR', a[0]['00080060']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
937 self.assertEqual('BRAINIX', a[0]['00100010']['Value'][0]['Alphabetic']) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
938 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
939 a = DoGet(ORTHANC, '/dicom-web/studies/%s/series/%s/instances' % (study, series)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
940 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
941 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
942 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
943 self.assertEqual(instance, a[0]['00080018']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
944 self.assertEqual('MR', a[0]['00080060']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
945 self.assertEqual('BRAINIX', a[0]['00100010']['Value'][0]['Alphabetic']) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
946 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
947 # "If {StudyInstanceUID} is not specified, all Study-level |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
948 # attributes specified in Table 6.7.1-2" => Here, |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
949 # {StudyInstanceUID} *is* specified, so we must *not* get the |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
950 # PatientName. |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
951 # http://dicom.nema.org/medical/dicom/2019a/output/html/part18.html#table_6.7.1-2a |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
952 a = DoGet(ORTHANC, '/dicom-web/series?0020000D=%s' % study) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
953 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
954 self.assertFalse('00100010' in a[0]) # PatientName |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
955 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
956 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
957 self.assertEqual('MR', a[0]['00080060']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
958 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
959 # http://dicom.nema.org/medical/dicom/2019a/output/html/part18.html#table_6.7.1-2b |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
960 a = DoGet(ORTHANC, '/dicom-web/instances?0020000D=%s' % study) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
961 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
962 self.assertFalse('00100010' in a[0]) # PatientName |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
963 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
964 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
965 self.assertEqual('MR', a[0]['00080060']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
966 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
967 a = DoGet(ORTHANC, '/dicom-web/instances?0020000E=%s' % series) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
968 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
969 self.assertFalse('00080060' in a[0]) # Modality |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
970 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
971 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
972 self.assertEqual('BRAINIX', a[0]['00100010']['Value'][0]['Alphabetic']) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
973 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
974 a = DoGet(ORTHANC, '/dicom-web/instances?0020000D=%s&0020000E=%s' % (study, series)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
975 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
976 self.assertFalse('00100010' in a[0]) # PatientName |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
977 self.assertFalse('00080060' in a[0]) # Modality |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
978 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
979 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
261
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
980 |
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
981 |
270
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
982 #@unittest.skip("Skip this test on GDCM 2.8.4") |
261
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
983 def test_bitbucket_issue_164(self): |
270
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
984 # WARNING - This makes GDCM 2.8.4 crash |
261
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
985 # https://bitbucket.org/sjodogne/orthanc/issues/164 |
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
986 UploadInstance(ORTHANC, 'Issue164.dcm') |
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
987 |
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
988 p = DoGetMultipart(ORTHANC, 'dicom-web/studies/1.2.276.0.26.1.1.1.2.2020.45.52293.1506048/series/1.2.276.0.26.1.1.1.2.2020.45.52293.6384450/instances/1.2.276.0.26.1.1.1.2.2020.45.52366.2551599.179568640/frames/5') |
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
989 self.assertEqual(1, len(p)) |
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
990 self.assertEqual(743 * 975 * 3, len(p[0])) |
270
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
991 |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
992 |
271 | 993 def test_bitbucket_issue_168(self): |
270
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
994 # "Plugins can't read private tags from the configuration file" |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
995 # This test will fail if DCMTK <= 3.6.1 (e.g. on Ubuntu 16.04) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
996 # https://bitbucket.org/sjodogne/orthanc/issues/168/ |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
997 |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
998 UploadInstance(ORTHANC, 'Issue168.dcm') |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
999 |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1000 a = DoGet(ORTHANC, '/dicom-web/studies') |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1001 self.assertEqual(1, len(a)) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1002 self.assertFalse('00090010' in a[0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1003 self.assertFalse('00091001' in a[0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1004 self.assertEqual('20170404', a[0]['00080020']['Value'][0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1005 |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1006 a = DoGet(ORTHANC, '/dicom-web/studies?includefield=00091001') |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1007 self.assertEqual(1, len(a)) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1008 self.assertFalse('00090010' in a[0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1009 self.assertTrue('00091001' in a[0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1010 self.assertEqual('DS', a[0]['00091001']['vr']) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1011 self.assertEqual(1, len(a[0]['00091001']['Value'])) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1012 self.assertAlmostEqual(98.41, a[0]['00091001']['Value'][0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1013 |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1014 a = DoGet(ORTHANC, '/dicom-web/studies?00090010=Lunit&includefield=00091001') |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1015 self.assertEqual(1, len(a)) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1016 self.assertTrue('00090010' in a[0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1017 self.assertEqual('LO', a[0]['00090010']['vr']) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1018 self.assertEqual(1, len(a[0]['00090010']['Value'])) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1019 self.assertEqual('Lunit', a[0]['00090010']['Value'][0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1020 self.assertTrue('00091001' in a[0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1021 self.assertEqual('DS', a[0]['00091001']['vr']) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1022 self.assertEqual(1, len(a[0]['00091001']['Value'])) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1023 self.assertAlmostEqual(98.41, a[0]['00091001']['Value'][0]) |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
1024 |
270
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1025 a = DoGet(ORTHANC, '/dicom-web/studies?00090010=Lunit2&includefield=00091001') |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1026 self.assertEqual(0, len(a)) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1027 |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1028 |
272
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1029 def test_rendered_studies_series(self): |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1030 i = UploadInstance(ORTHANC, 'Phenix/IM-0001-0001.dcm') ['ID'] |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1031 study = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i) ['StudyInstanceUID'] |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1032 series = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i) ['SeriesInstanceUID'] |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1033 instance = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i) ['SOPInstanceUID'] |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1034 |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1035 a = DoPost(ORTHANC, '/dicom-web/servers/sample/get', { |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1036 'Uri' : '/studies/%s/series/%s/instances/%s/rendered' % (study, series, instance) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1037 }) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1038 |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1039 im = UncompressImage(a) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1040 self.assertEqual("L", im.mode) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1041 self.assertEqual(512, im.size[0]) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1042 self.assertEqual(358, im.size[1]) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1043 |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1044 b = DoPost(ORTHANC, '/dicom-web/servers/sample/get', { |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1045 'Uri' : '/studies/%s/series/%s/rendered' % (study, series) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1046 }) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1047 |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1048 self.assertEqual(len(a), len(b)) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1049 self.assertEqual(a, b) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1050 |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1051 c = DoPost(ORTHANC, '/dicom-web/servers/sample/get', { |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1052 'Uri' : '/studies/%s/rendered' % study |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1053 }) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1054 |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1055 self.assertEqual(len(a), len(c)) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1056 self.assertEqual(a, c) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1057 |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1058 |
273
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1059 def test_multiple_mime_accept_wado_rs(self): |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1060 # "Multiple MIME type Accept Headers for Wado-RS" |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1061 # https://groups.google.com/forum/#!msg/orthanc-users/P3B6J9abZpE/syn5dnW2AwAJ |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1062 |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1063 UploadInstance(ORTHANC, 'DummyCT.dcm') |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1064 study = '1.2.840.113619.2.176.2025.1499492.7391.1171285944.390' |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1065 |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1066 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study))) |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1067 |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1068 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study, |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1069 headers = { 'Accept' : 'application/json, application/dicom+json' }))) |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1070 |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1071 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study, |
274 | 1072 headers = { 'Accept' : 'application/json' }))) |
1073 | |
1074 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study, | |
1075 headers = { 'Accept' : 'application/dicom+json' }))) | |
1076 | |
1077 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study, | |
273
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1078 headers = { 'Accept' : 'toto, application/dicom+json' }))) |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1079 |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1080 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study, |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1081 headers = { 'Accept' : 'application/json, tata' }))) |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1082 |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1083 self.assertRaises(Exception, lambda: DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study, |
274 | 1084 headers = { 'Accept' : 'toto' })) |
1085 | |
1086 self.assertRaises(Exception, lambda: DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study, | |
273
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1087 headers = { 'Accept' : 'toto, tata' })) |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1088 |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1089 |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1090 |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1091 try: |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1092 print('\nStarting the tests...') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1093 unittest.main(argv = [ sys.argv[0] ] + args.options) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1094 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1095 finally: |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1096 print('\nDone') |