Mercurial > hg > orthanc-tests
annotate Plugins/DicomWeb/Run.py @ 543:8722f7f95a38
fix
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 20 Jun 2023 17:24:56 +0200 |
parents | ef41b62b456e |
children | bcd87bf59630 |
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 |
511
933fe1bbce4f
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
510
diff
changeset
|
8 # Copyright (C) 2017-2023 Osimis S.A., Belgium |
933fe1bbce4f
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
510
diff
changeset
|
9 # Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 # |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 # 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
|
12 # 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
|
13 # 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
|
14 # License, or (at your option) any later version. |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 # |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 # 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
|
17 # WITHOUT ANY WARRANTY; without even the implied warranty of |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 # General Public License for more details. |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 # |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 # 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
|
22 # 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
|
23 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 |
85 | 25 |
26 # You must add the following to the configuration file: | |
27 # | |
28 # "DicomWeb" : { | |
29 # "Servers" : { | |
30 # "sample" : [ "http://localhost:8042/dicom-web/", "alice", "orthanctest" ] | |
31 # } | |
32 # } | |
33 | |
34 | |
35 | |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
36 import copy |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 import os |
33 | 38 import pprint |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 import sys |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 import argparse |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 import unittest |
83 | 42 import re |
304 | 43 from PIL import ImageChops |
44 | |
33 | 45 from DicomWeb import * |
32
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 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
|
48 from Toolbox import * |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 |
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 ## Parse the command-line arguments |
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 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 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
|
56 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 parser.add_argument('--server', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 default = 'localhost', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 help = 'Address of the Orthanc server to test') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 parser.add_argument('--rest', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 type = int, |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 default = 8042, |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 help = 'Port to the REST API') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 parser.add_argument('--username', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 default = 'alice', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 help = 'Username to the REST API') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 parser.add_argument('--password', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 default = 'orthanctest', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 help = 'Password to the REST API') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 parser.add_argument('--wado', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 default = '/wado', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 help = 'Path to the WADO API') |
33 | 73 parser.add_argument('--dicomweb', |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 default = '/dicom-web/', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 help = 'Path to the DICOMweb API') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 parser.add_argument('--force', help = 'Do not warn the user', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 action = 'store_true') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 parser.add_argument('options', metavar = 'N', nargs = '*', |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 help='Arguments to Python unittest') |
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 args = parser.parse_args() |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 |
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 ## Configure the testing context |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 ## |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 if not args.force: |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 print(""" |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 WARNING: This test will remove all the content of your |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 Orthanc instance running on %s! |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 Are you sure ["yes" to go on]?""" % args.server) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 if sys.stdin.readline().strip() != 'yes': |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 print('Aborting...') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 exit(0) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 ORTHANC = DefineOrthanc(server = args.server, |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 username = args.username, |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 password = args.password, |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 restPort = args.rest) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 |
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 ## |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 ## The tests |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 ## |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
110 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
111 def UploadAndGetWadoPath(dicom): |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
112 i = UploadInstance(ORTHANC, dicom) ['ID'] |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
113 study = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i) ['StudyInstanceUID'] |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
114 series = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i) ['SeriesInstanceUID'] |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
115 instance = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i) ['SOPInstanceUID'] |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
116 return '/studies/%s/series/%s/instances/%s' % (study, series, instance) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
117 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
118 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
119 |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 class Orthanc(unittest.TestCase): |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 def setUp(self): |
83 | 122 if (sys.version_info >= (3, 0)): |
123 # Remove annoying warnings about unclosed socket in Python 3 | |
124 import warnings | |
125 warnings.simplefilter("ignore", ResourceWarning) | |
126 | |
270
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
127 #print("In test: ", self._testMethodName) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
128 |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 DropOrthanc(ORTHANC) |
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 def test_wado_dicom(self): |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 UploadInstance(ORTHANC, 'Brainix/Flair/IM-0001-0001.dcm') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 SIZE = 169478 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 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
|
136 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
|
137 STUDY = '2.16.840.1.113669.632.20.1211.10000357775' |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 self.assertRaises(Exception, lambda: DoGet(ORTHANC, args.wado)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 self.assertRaises(Exception, lambda: DoGet(ORTHANC, args.wado + '?requestType=WADO')) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 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
|
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' % INSTANCE) |
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' % (INSTANCE, SERIES)) |
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&studyUID=%s' % (INSTANCE, SERIES, STUDY)) |
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&seriesUID=%s' % (INSTANCE, SERIES)) |
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 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
|
156 self.assertEqual(SIZE, len(dicom)) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 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
|
159 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
|
160 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
|
161 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 def test_wado_image(self): |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 UploadInstance(ORTHANC, 'Phenix/IM-0001-0001.dcm') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 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
|
165 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 im = GetImage(ORTHANC, args.wado + '?requestType=WADO&objectUID=%s' % INSTANCE) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 self.assertEqual('JPEG', im.format) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 self.assertEqual('L', im.mode) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 self.assertEqual(512, im.size[0]) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 self.assertEqual(358, im.size[1]) |
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/jpg&requestType=WADO&objectUID=%s' % INSTANCE) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 self.assertEqual('JPEG', im.format) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 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
|
176 self.assertEqual('PNG', im.format) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 self.assertEqual('L', im.mode) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 self.assertEqual(512, im.size[0]) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 self.assertEqual(358, im.size[1]) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 |
33 | 181 def test_stow(self): |
182 self.assertEqual(0, len(DoGet(ORTHANC, '/instances'))) | |
183 SendStow(ORTHANC, args.dicomweb + '/studies', GetDatabasePath('Phenix/IM-0001-0001.dcm')) | |
184 self.assertEqual(1, len(DoGet(ORTHANC, '/instances'))) | |
185 a = SendStow(ORTHANC, args.dicomweb + '/studies', GetDatabasePath('Phenix/IM-0001-0001.dcm')) | |
186 self.assertEqual(1, len(DoGet(ORTHANC, '/instances'))) | |
187 | |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
188 self.assertEqual(4, len(a)) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
189 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
190 # Specific character set |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
191 self.assertTrue('00080005' in a) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
192 self.assertEqual('CS', a['00080005']['vr']) |
33 | 193 |
194 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
|
195 self.assertEqual('UR', a['00081190']['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.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
|
198 self.assertEqual('SQ', a['00081198']['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 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
|
201 self.assertEqual('SQ', a['00081199']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
202 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
203 b = a['00081199']['Value'][0] |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
204 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
205 # Referenced SOP class UID |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
206 self.assertEqual('UI', b['00081150']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
207 self.assertEqual(1, len(b['00081150']['Value'])) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
208 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
|
209 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
210 # Referenced SOP instance UID |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
211 self.assertEqual('UI', b['00081155']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
212 self.assertEqual(1, len(b['00081155']['Value'])) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
213 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
|
214 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
215 # Retrieve URL |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
216 self.assertEqual('UR', b['00081190']['vr']) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
217 self.assertEqual(1, len(b['00081190']['Value'])) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
218 self.assertTrue(b['00081190']['Value'][0]. |
33 | 219 endswith('series/1.2.840.113704.1.111.5692.1127828999.2/instances/1.2.840.113704.7.1.1.6632.1127829031.2')) |
220 | |
83 | 221 # Remove the "http://localhost:8042" prefix |
222 url = a['00081190']['Value'][0] | |
223 url = re.sub(r'(http|https)://[^/]+(/.*)', r'\2', url) | |
224 | |
367
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
225 # Get the content-length of all the multiparts of this WADO-RS |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
226 # request (prevent transcoding by setting transfer-syntax to |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
227 # "*", necessary since release 1.5 of the DICOMweb plugin) |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
228 b = DoGet(ORTHANC, url, headers = { |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
229 'Accept' : 'multipart/related;type=application/dicom;transfer-syntax=*' |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
230 }).decode('utf-8', 'ignore') |
83 | 231 parts = re.findall(r'^Content-Length:\s*(\d+)\s*', b, re.IGNORECASE | re.MULTILINE) |
232 self.assertEqual(1, len(parts)) | |
233 self.assertEqual(os.path.getsize(GetDatabasePath('Phenix/IM-0001-0001.dcm')), int(parts[0])) | |
33 | 234 |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
235 |
84 | 236 def test_server_get(self): |
277 | 237 try: |
238 DoDelete(ORTHANC, '/dicom-web/servers/google') # If "AllWindowsStart.sh" is used | |
239 except: | |
240 pass | |
241 | |
388
3ef44d201875
revert incorrect changeset 386
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
386
diff
changeset
|
242 try: |
3ef44d201875
revert incorrect changeset 386
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
386
diff
changeset
|
243 DoDelete(ORTHANC, '/dicom-web/servers/hello') # If "test_add_server" fails |
3ef44d201875
revert incorrect changeset 386
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
386
diff
changeset
|
244 except: |
3ef44d201875
revert incorrect changeset 386
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
386
diff
changeset
|
245 pass |
3ef44d201875
revert incorrect changeset 386
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
386
diff
changeset
|
246 |
84 | 247 UploadInstance(ORTHANC, 'Knee/T1/IM-0001-0001.dcm') |
248 | |
249 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/servers'))) | |
250 self.assertTrue('sample' in DoGet(ORTHANC, '/dicom-web/servers')) | |
251 | |
129 | 252 serversReadback = DoGet(ORTHANC, '/dicom-web/servers?expand') |
253 self.assertEqual('http://localhost:8042/dicom-web/', serversReadback['sample']['Url']) | |
254 self.assertEqual('alice', serversReadback['sample']['Username']) | |
255 | |
84 | 256 sample = DoGet(ORTHANC, '/dicom-web/servers/sample') |
244 | 257 self.assertEqual(5, len(sample)) |
84 | 258 self.assertTrue('stow' in sample) |
259 self.assertTrue('retrieve' in sample) | |
260 self.assertTrue('get' in sample) | |
244 | 261 self.assertTrue('wado' in sample) # New in 0.7 |
262 self.assertTrue('qido' in sample) # New in 0.7 | |
84 | 263 |
264 # application/dicom+xml | |
131
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
265 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
|
266 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
|
267 re.MULTILINE))) |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
268 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
|
269 (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
|
270 { 'Uri' : '/studies', |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
271 '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
|
272 }), re.MULTILINE))) |
84 | 273 |
274 # application/dicom+json | |
131
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
275 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
|
276 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
|
277 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
|
278 { 'Uri' : '/studies', |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
279 '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
|
280 |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
281 # application/json |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
282 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
|
283 headers = { 'Accept' : 'application/json' }))) |
84 | 284 self.assertEqual(1, len(DoPost(ORTHANC, '/dicom-web/servers/sample/get', |
285 { 'Uri' : '/studies', | |
286 'HttpHeaders' : { 'Accept' : 'application/json' }}))) | |
287 | |
131
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
288 # 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
|
289 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
|
290 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
|
291 { 'Uri' : '/studies' }))) |
90e5331ddee9
application/dicom+json is now the default in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
292 |
84 | 293 |
294 def test_server_stow(self): | |
295 UploadInstance(ORTHANC, 'Knee/T1/IM-0001-0001.dcm') | |
296 | |
297 self.assertRaises(Exception, lambda: | |
298 DoPost(ORTHANC, '/dicom-web/servers/sample/stow', | |
246
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
299 { 'Resources' : [ 'nope' ], |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
300 'Synchronous' : True })) # inexisting resource |
84 | 301 |
499 | 302 l = 3 # For >= 1.10.1 |
303 | |
304 # study | |
305 r = DoPost(ORTHANC, '/dicom-web/servers/sample/stow', | |
246
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
306 { 'Resources' : [ '0a9b3153-2512774b-2d9580de-1fc3dcf6-3bd83918' ], |
499 | 307 'Synchronous' : True }) |
308 | |
309 self.assertEqual(l, len(r)) | |
310 self.assertEqual("0a9b3153-2512774b-2d9580de-1fc3dcf6-3bd83918", r['Resources']['Studies'][0]) | |
84 | 311 |
499 | 312 # series |
313 r = DoPost(ORTHANC, '/dicom-web/servers/sample/stow', | |
246
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
314 { 'Resources' : [ '6de73705-c4e65c1b-9d9ea1b5-cabcd8e7-f15e4285' ], |
499 | 315 'Synchronous' : True }) |
316 self.assertEqual(l, len(r)) | |
317 self.assertEqual("6de73705-c4e65c1b-9d9ea1b5-cabcd8e7-f15e4285", r['Resources']['Series'][0]) | |
84 | 318 |
499 | 319 # instances |
320 r = DoPost(ORTHANC, '/dicom-web/servers/sample/stow', | |
246
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
321 { 'Resources' : [ 'c8df6478-d7794217-0f11c293-a41237c9-31d98357' ], |
499 | 322 'Synchronous' : True }) |
323 self.assertEqual(l, len(r)) | |
324 self.assertEqual("c8df6478-d7794217-0f11c293-a41237c9-31d98357", r['Resources']['Instances'][0]) | |
84 | 325 |
499 | 326 # altogether |
327 r = DoPost(ORTHANC, '/dicom-web/servers/sample/stow', | |
84 | 328 { 'Resources' : [ |
329 'ca29faea-b6a0e17f-067743a1-8b778011-a48b2a17', | |
330 '0a9b3153-2512774b-2d9580de-1fc3dcf6-3bd83918', | |
331 '6de73705-c4e65c1b-9d9ea1b5-cabcd8e7-f15e4285', | |
246
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
332 'c8df6478-d7794217-0f11c293-a41237c9-31d98357' ], |
499 | 333 'Synchronous' : True }) |
510 | 334 # pprint.pprint(r) |
499 | 335 self.assertEqual(l, len(r)) |
336 self.assertEqual("ca29faea-b6a0e17f-067743a1-8b778011-a48b2a17", r['Resources']['Patients'][0]) | |
337 self.assertEqual("0a9b3153-2512774b-2d9580de-1fc3dcf6-3bd83918", r['Resources']['Studies'][0]) | |
338 self.assertEqual("6de73705-c4e65c1b-9d9ea1b5-cabcd8e7-f15e4285", r['Resources']['Series'][0]) | |
339 self.assertEqual("c8df6478-d7794217-0f11c293-a41237c9-31d98357", r['Resources']['Instances'][0]) | |
340 | |
84 | 341 |
342 | |
343 def test_server_retrieve(self): | |
244 | 344 COUNT = 'ReceivedInstancesCount' |
345 #COUNT = 'Instances' # In version <= 0.6 | |
346 | |
84 | 347 UploadInstance(ORTHANC, 'Knee/T1/IM-0001-0001.dcm') |
348 UploadInstance(ORTHANC, 'Knee/T1/IM-0001-0002.dcm') | |
349 UploadInstance(ORTHANC, 'Knee/T2/IM-0001-0001.dcm') | |
350 | |
351 self.assertRaises(Exception, lambda: | |
352 DoPost(ORTHANC, '/dicom-web/servers/sample/retrieve', | |
353 { 'Resources' : [ { 'Study' : 'nope' } ]})) # inexisting resource | |
354 | |
355 t = DoPost(ORTHANC, '/dicom-web/servers/sample/retrieve', | |
356 { 'Resources' : [ { 'Study' : '2.16.840.1.113669.632.20.121711.10000160881' } ] }) | |
244 | 357 self.assertEqual(3, int(t[COUNT])) |
84 | 358 |
359 # Missing "Study" field | |
360 self.assertRaises(Exception, lambda: | |
361 DoPost(ORTHANC, '/dicom-web/servers/sample/retrieve', | |
362 { 'Resources' : [ { 'Series' : '1.3.46.670589.11.17521.5.0.3124.2008081908564160709' } ]})) | |
363 | |
364 t = DoPost(ORTHANC, '/dicom-web/servers/sample/retrieve', | |
365 { 'Resources' : [ { 'Study' : '2.16.840.1.113669.632.20.121711.10000160881', | |
366 'Series' : '1.3.46.670589.11.17521.5.0.3124.2008081908564160709' } ] }) | |
244 | 367 self.assertEqual(2, int(t[COUNT])) |
84 | 368 |
369 t = DoPost(ORTHANC, '/dicom-web/servers/sample/retrieve', | |
370 { 'Resources' : [ { 'Study' : '2.16.840.1.113669.632.20.121711.10000160881', | |
371 'Series' : '1.3.46.670589.11.17521.5.0.3124.2008081909090037350' } ] }) | |
244 | 372 self.assertEqual(1, int(t[COUNT])) |
84 | 373 |
374 t = DoPost(ORTHANC, '/dicom-web/servers/sample/retrieve', | |
375 { 'Resources' : [ { 'Study' : '2.16.840.1.113669.632.20.121711.10000160881', | |
376 'Series' : '1.3.46.670589.11.17521.5.0.3124.2008081909090037350' }, | |
377 { 'Study' : '2.16.840.1.113669.632.20.121711.10000160881', | |
378 'Series' : '1.3.46.670589.11.17521.5.0.3124.2008081908564160709' } ] }) | |
244 | 379 self.assertEqual(3, int(t[COUNT])) |
84 | 380 |
381 t = DoPost(ORTHANC, '/dicom-web/servers/sample/retrieve', | |
382 { 'Resources' : [ { 'Study' : '2.16.840.1.113669.632.20.121711.10000160881', | |
383 'Series' : '1.3.46.670589.11.17521.5.0.3124.2008081909090037350', | |
384 'Instance' : '1.3.46.670589.11.17521.5.0.3124.2008081909113806560' } ] }) | |
244 | 385 self.assertEqual(1, int(t[COUNT])) |
84 | 386 |
387 | |
114
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
388 def test_bitbucket_issue_53(self): |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
389 # DICOMWeb plugin support for "limit" and "offset" parameters in QIDO-RS |
319 | 390 # https://bugs.orthanc-server.com/show_bug.cgi?id=53 |
114
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
391 |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
392 UploadInstance(ORTHANC, 'Brainix/Flair/IM-0001-0001.dcm') |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
393 UploadInstance(ORTHANC, 'Knee/T1/IM-0001-0001.dcm') |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
394 |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
395 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
|
396 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
|
397 |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
398 a = DoGet(ORTHANC, '/dicom-web/studies', |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
399 headers = { 'accept' : 'application/json' }) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
400 self.assertEqual(2, len(a)) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
401 |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
402 b = [] |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
403 a = DoGet(ORTHANC, '/dicom-web/studies?limit=1', |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
404 headers = { 'accept' : 'application/json' }) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
405 self.assertEqual(1, len(a)) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
406 b.append(a[0]['0020000D']['Value'][0]) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
407 |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
408 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
|
409 headers = { 'accept' : 'application/json' }) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
410 self.assertEqual(1, len(a)) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
411 b.append(a[0]['0020000D']['Value'][0]) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
412 |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
413 self.assertTrue(brainix in b) |
a6019560272f
test_bitbucket_issue_53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
414 self.assertTrue(knee in b) |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
415 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
416 |
184
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
417 def test_bitbucket_issue_111(self): |
223
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
418 # Wrong serialization of empty values |
319 | 419 # https://bugs.orthanc-server.com/show_bug.cgi?id=111 |
420 # https://bitbucket.org/sjodogne/orthanc-dicomweb/issues/3 | |
223
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
421 |
184
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
422 # According to the standard, section F.2.5 |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
423 # (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
|
424 # 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
|
425 # 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
|
426 # preserved in the DICOM JSON attribute object containing no |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
427 # "Value", "BulkDataURI" or "InlineBinary". |
319 | 428 # https://bugs.orthanc-server.com/show_bug.cgi?id=111 |
184
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
429 |
223
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
430 UploadInstance(ORTHANC, 'Issue111.dcm') |
184
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
431 |
223
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
432 # Test WADO-RS |
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
433 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
|
434 self.assertEqual(1, len(a)) |
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
435 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
|
436 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
|
437 self.assertEqual('SH', a[0]['00080050']['vr']) |
184
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
438 |
223
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
439 # Test QIDO-RS |
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
440 a = DoGet(ORTHANC, '/dicom-web/studies') |
184
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
441 self.assertEqual(1, len(a)) |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
442 self.assertTrue('00080050' in a[0]) # AccessionNumber is null |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
443 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
|
444 self.assertEqual('SH', a[0]['00080050']['vr']) |
e244312964d6
test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
445 |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
446 |
537 | 447 # this test fails if SeriesMetadata = "MainDicomTags" (this is expected since the reference json is the full json) |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
448 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
|
449 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
|
450 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
|
451 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
|
452 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
|
453 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
|
454 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
|
455 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
456 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
|
457 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
|
458 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
|
459 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
|
460 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
461 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
|
462 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
|
463 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
|
464 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
465 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
|
466 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
|
467 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
|
468 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
469 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
|
470 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
|
471 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
|
472 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
|
473 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
|
474 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
|
475 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
476 |
228 | 477 def test_wado_pixel_data(self): |
478 orthanc = UploadInstance(ORTHANC, 'Issue29.dcm') ['ID'] | |
479 a = DoGet(ORTHANC, '/dicom-web/instances') | |
480 self.assertEqual(1, len(a)) | |
481 url = a[0]['00081190']['Value'][0] | |
482 | |
278
514785dacd6d
fix dicomweb tests with debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
277
diff
changeset
|
483 prefix = 'http://%s:%s' % (args.server, args.rest) |
228 | 484 self.assertTrue(url.startswith(prefix)) |
485 | |
486 b = DoGet(ORTHANC, url[len(prefix):] + '/metadata') | |
487 self.assertEqual('OB', b[0]['7FE00010']['vr']) | |
488 self.assertEqual(2, len(b[0]['7FE00010'])) | |
489 self.assertTrue('BulkDataURI' in b[0]['7FE00010']) | |
490 | |
491 url = b[0]['7FE00010']['BulkDataURI'] | |
492 self.assertTrue(url.startswith(prefix)) | |
493 | |
494 p = DoGetMultipart(ORTHANC, url[len(prefix):]) | |
495 | |
496 self.assertEqual(2, len(p)) # There are 2 fragments in this image | |
497 self.assertEqual(4, len(p[0])) | |
498 self.assertEqual(114486, len(p[1])) | |
499 | |
500 | |
501 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
|
502 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
|
503 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
|
504 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
|
505 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
|
506 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
|
507 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
508 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
|
509 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
|
510 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
|
511 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
|
512 |
228 | 513 # WARNING: This test will fail on Orthanc <= 1.5.5, because |
319 | 514 # the following fix was not included yet: |
515 # https://hg.orthanc-server.com/orthanc/rev/b88937ef597b | |
228 | 516 |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
517 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
|
518 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
|
519 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
520 BASE_URI = '/dicom-web/studies/%s/series/%s/instances/%s/bulk' % (study, series, sop) |
278
514785dacd6d
fix dicomweb tests with debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
277
diff
changeset
|
521 BASE_URL = 'http://%s:%s%s' % (args.server, args.rest, BASE_URI) |
222
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 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
|
524 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
|
525 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
|
526 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
|
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 = 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
|
529 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
|
530 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
531 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
|
532 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
|
533 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
|
534 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
535 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
536 def test_bitbucket_issue_112(self): |
223
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
537 # Wrong serialization of number values |
319 | 538 # https://bugs.orthanc-server.com/show_bug.cgi?id=112 |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
539 # 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
|
540 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
541 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
|
542 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
|
543 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
544 # 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
|
545 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
|
546 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
|
547 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
|
548 |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
549 if (sys.version_info >= (3, 0)): |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
550 types = (int) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
551 else: |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
552 types = (int, long) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
553 |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
554 b = a[0]['00180091']['Value'][0] |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
555 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
|
556 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
|
557 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
558 # 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
|
559 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
|
560 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
|
561 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
|
562 |
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
563 b = a[0]['00201208']['Value'][0] |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
564 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
|
565 self.assertEqual(1, b) |
223
f5aca0917d60
DICOMweb: test_bitbucket_issue_111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
222
diff
changeset
|
566 |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
567 |
224
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
568 def test_bitbucket_issue_113(self): |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
569 # Wrong serialization of PN VR |
319 | 570 # https://bugs.orthanc-server.com/show_bug.cgi?id=113 |
224
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
571 # https://bitbucket.org/sjodogne/orthanc-dicomweb/issues/2/ |
314 | 572 |
573 # Make sure UTF-8 encoding is used | |
574 self.assertEqual('Utf8', DoPut(ORTHANC, '/tools/default-encoding', 'Utf8')) | |
224
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
575 |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
576 UploadInstance(ORTHANC, 'Encodings/DavidClunie/SCSX1') |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
577 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
|
578 |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
579 # This is the WADO-RS testing |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
580 a = DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
581 self.assertEqual(1, len(a)) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
582 |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
583 pn = a[0]['00100010'] # Patient name |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
584 self.assertEqual('PN', pn['vr']) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
585 self.assertEqual(1, len(pn['Value'])) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
586 self.assertEqual('Wang^XiaoDong', pn['Value'][0]['Alphabetic']) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
587 self.assertEqual(u'王^小東', pn['Value'][0]['Ideographic']) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
588 |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
589 # This is the QIDO-RS testing |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
590 a = DoGet(ORTHANC, '/dicom-web/studies') |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
591 self.assertEqual(1, len(a)) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
592 |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
593 pn = a[0]['00100010'] # Patient name |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
594 self.assertEqual('PN', pn['vr']) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
595 self.assertEqual(1, len(pn['Value'])) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
596 self.assertEqual('Wang^XiaoDong', pn['Value'][0]['Alphabetic']) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
597 self.assertEqual(u'王^小東', pn['Value'][0]['Ideographic']) |
f5414254ccaa
test_bitbucket_issue_113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
223
diff
changeset
|
598 |
222
0f03ee6ffa80
DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
195
diff
changeset
|
599 |
225 | 600 def test_bitbucket_issue_96(self): |
601 # WADO-RS RetrieveFrames rejects valid accept headers | |
319 | 602 # https://bugs.orthanc-server.com/show_bug.cgi?id=96 |
225 | 603 # https://bitbucket.org/sjodogne/orthanc-dicomweb/issues/5/ |
604 | |
228 | 605 UploadInstance(ORTHANC, 'Brainix/Epi/IM-0001-0001.dcm') |
225 | 606 |
607 a = DoGet(ORTHANC, '/dicom-web/instances') | |
608 self.assertEqual(1, len(a)) | |
228 | 609 self.assertEqual(256, a[0]['00280010']['Value'][0]) # Rows |
610 self.assertEqual(256, a[0]['00280011']['Value'][0]) # Columns | |
611 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
|
612 |
225 | 613 url = a[0]['00081190']['Value'][0] |
614 | |
278
514785dacd6d
fix dicomweb tests with debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
277
diff
changeset
|
615 prefix = 'http://%s:%s' % (args.server, args.rest) |
225 | 616 self.assertTrue(url.startswith(prefix)) |
617 uri = url[len(prefix):] | |
618 | |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
619 self.assertRaises(Exception, lambda: DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 0))) |
228 | 620 self.assertRaises(Exception, lambda: DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 2))) |
621 | |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
622 b = DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 1)) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
623 self.assertEqual(1, len(b)) |
228 | 624 self.assertEqual(256 * 256 * 2, len(b[0])) |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
625 self.assertEqual('ce394eb4d4de4eeef348436108101f3b', ComputeMD5(b[0])) |
225 | 626 |
228 | 627 c = DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 1), |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
628 headers = { 'Accept' : 'multipart/related; type=application/octet-stream' }) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
629 self.assertEqual(1, len(c)) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
630 self.assertEqual(b[0], c[0]) |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
631 self.assertEqual('ce394eb4d4de4eeef348436108101f3b', ComputeMD5(c[0])) |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
632 |
228 | 633 c = DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 1), |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
634 headers = { 'Accept' : 'multipart/related; type="application/octet-stream"' }) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
635 self.assertEqual(1, len(c)) |
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
636 self.assertEqual(b[0], c[0]) |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
637 self.assertEqual('ce394eb4d4de4eeef348436108101f3b', ComputeMD5(c[0])) |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
638 |
228 | 639 self.assertRaises(Exception, lambda: DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 1), |
640 headers = { 'Accept' : 'multipart/related; type="nope"' })) | |
641 | |
642 self.assertRaises(Exception, lambda: DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 1), | |
643 headers = { 'Accept' : 'multipart/related; type=nope' })) | |
644 | |
645 self.assertRaises(Exception, lambda: DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 1), | |
646 headers = { 'Accept' : 'nope' })) | |
647 | |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
648 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
649 def test_qido_fields(self): |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
650 UploadInstance(ORTHANC, 'DummyCT.dcm') |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
651 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
652 a = DoGet(ORTHANC, '/dicom-web/studies') |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
653 self.assertEqual(1, len(a)) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
654 self.assertFalse('00280010' in a[0]) # Rows |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
655 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
656 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
|
657 self.assertEqual(1, len(a)) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
658 self.assertTrue('00280010' in a[0]) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
659 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
|
660 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
661 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
|
662 self.assertEqual(0, len(a)) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
663 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
664 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
|
665 self.assertEqual(1, len(a)) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
666 self.assertTrue('00280010' in a[0]) |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
667 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
|
668 |
226
230aede7f8d5
test_bitbucket_issue_96
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
225
diff
changeset
|
669 |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
670 def test_stow_errors(self): |
398
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
671 def CheckSequences(a): |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
672 self.assertEqual(3, len(a)) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
673 self.assertTrue('00080005' in a) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
674 self.assertTrue('00081198' in a) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
675 self.assertTrue('00081199' in a) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
676 self.assertEqual('CS', a['00080005']['vr']) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
677 self.assertEqual('SQ', a['00081198']['vr']) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
678 self.assertEqual('SQ', a['00081199']['vr']) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
679 |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
680 # Pushing an instance to a study that is not its parent |
398
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
681 (status, a) = SendStowRaw(ORTHANC, args.dicomweb + '/studies/nope', GetDatabasePath('Phenix/IM-0001-0001.dcm')) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
682 self.assertEqual(409, status) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
683 CheckSequences(a) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
684 |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
685 self.assertFalse('Value' in a['00081199']) # No success instance |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
686 |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
687 self.assertEqual(1, len(a['00081198']['Value'])) # One failed instance |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
688 self.assertEqual('1.2.840.10008.5.1.4.1.1.2', |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
689 a['00081198']['Value'][0]['00081150']['Value'][0]) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
690 self.assertEqual('1.2.840.113704.7.1.1.6632.1127829031.2', |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
691 a['00081198']['Value'][0]['00081155']['Value'][0]) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
692 self.assertEqual(0x0110, # Processing failure |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
693 a['00081198']['Value'][0]['00081197']['Value'][0]) |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
694 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
695 # Pushing an instance with missing tags |
398
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
696 (status, a) = SendStowRaw(ORTHANC, args.dicomweb + '/studies', GetDatabasePath('Issue111.dcm')) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
697 self.assertEqual(400, status) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
698 CheckSequences(a) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
699 |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
700 self.assertFalse('Value' in a['00081198']) # No failed instance, as tags are missing |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
701 self.assertFalse('Value' in a['00081199']) # No success instance |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
702 |
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
703 # Pushing a file that is not in the DICOM format |
398
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
704 (status, a) = SendStowRaw(ORTHANC, args.dicomweb + '/studies', GetDatabasePath('Issue111.dump')) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
705 self.assertEqual(400, status) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
706 CheckSequences(a) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
707 |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
708 self.assertFalse('Value' in a['00081198']) # No failed instance, as non-DICOM |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
709 self.assertFalse('Value' in a['00081199']) # No success instance |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
710 |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
711 # Pushing a DICOM instance with only SOP class and instance UID |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
712 (status, a) = SendStowRaw(ORTHANC, args.dicomweb + '/studies', GetDatabasePath('Issue196.dcm')) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
713 self.assertEqual(400, status) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
714 CheckSequences(a) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
715 |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
716 self.assertFalse('Value' in a['00081199']) # No success instance |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
717 |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
718 self.assertEqual(1, len(a['00081198']['Value'])) # One failed instance |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
719 self.assertEqual('1.2.840.10008.5.1.4.1.1.4', |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
720 a['00081198']['Value'][0]['00081150']['Value'][0]) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
721 self.assertEqual('1.2.840.113619.2.176.2025.1499492.7040.1171286242.109', |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
722 a['00081198']['Value'][0]['00081155']['Value'][0]) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
723 self.assertEqual(0xC000, # Error: Cannot understand (cannot understand certain Data Elements) |
9528e2a03d3c
adapt DICOMweb tests following fix of issue 196 (STOW-RS: Should return 200 only when successfully stored all instances)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
388
diff
changeset
|
724 a['00081198']['Value'][0]['00081197']['Value'][0]) |
227
875ff7460ae8
test_qido_fields, test_stow_errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
725 |
239
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
726 |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
727 def test_allowed_methods(self): |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
728 self.assertEqual(0, len(DoGet(ORTHANC, '/dicom-web/studies'))) |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
729 |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
730 with self.assertRaises(Exception) as e: |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
731 DoPut(ORTHANC, '/dicom-web/studies') |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
732 |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
733 self.assertEqual(405, e.exception[0]) |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
734 self.assertEqual("GET,POST", e.exception[1]['allow']) |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
735 |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
736 with self.assertRaises(Exception) as e: |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
737 DoDelete(ORTHANC, '/dicom-web/studies') |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
738 |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
739 self.assertEqual(405, e.exception[0]) |
8980bd19e31d
dicomweb: test_allowed_methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
229
diff
changeset
|
740 self.assertEqual("GET,POST", e.exception[1]['allow']) |
241
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
741 |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
742 |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
743 def test_add_server(self): |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
744 try: |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
745 DoDelete(ORTHANC, '/dicom-web/servers/hello') |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
746 except: |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
747 pass |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
748 |
277 | 749 try: |
750 DoDelete(ORTHANC, '/dicom-web/servers/google') # If "AllWindowsStart.sh" is used | |
751 except: | |
752 pass | |
753 | |
241
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
754 l = DoGet(ORTHANC, '/dicom-web/servers') |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
755 self.assertEqual(1, len(l)) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
756 self.assertTrue('sample' in l) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
757 |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
758 url = 'http://localhost:8042/dicom-web/' |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
759 DoPut(ORTHANC, '/dicom-web/servers/hello', { |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
760 'Url': url, |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
761 'HttpHeaders' : { |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
762 'Hello' : 'World' |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
763 }, |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
764 'Username' : 'bob', |
242 | 765 'Password' : 'password', |
766 'UserProperty' : 'Test', | |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
767 'HasDelete' : True, |
381
fd6d805eae37
new option "Timeout" in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
367
diff
changeset
|
768 'Timeout' : 66 # New in 1.6 |
241
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
769 }) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
770 |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
771 l = DoGet(ORTHANC, '/dicom-web/servers') |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
772 self.assertEqual(2, len(l)) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
773 self.assertTrue('sample' in l) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
774 self.assertTrue('hello' in l) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
775 |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
776 o = DoGet(ORTHANC, '/dicom-web/servers/sample') |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
777 self.assertEqual(5, len(o)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
778 self.assertTrue('stow' in o) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
779 self.assertTrue('retrieve' in o) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
780 self.assertTrue('get' in o) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
781 self.assertTrue('wado' in o) # New in 0.7 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
782 self.assertTrue('qido' in o) # New in 0.7 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
783 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
784 o = DoGet(ORTHANC, '/dicom-web/servers/hello') |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
785 self.assertEqual(6, len(o)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
786 self.assertTrue('stow' in o) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
787 self.assertTrue('retrieve' in o) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
788 self.assertTrue('get' in o) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
789 self.assertTrue('wado' in o) # New in 0.7 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
790 self.assertTrue('qido' in o) # New in 0.7 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
791 self.assertTrue('delete' in o) # New in 0.7 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
792 |
241
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
793 s = DoGet(ORTHANC, '/dicom-web/servers?expand') |
381
fd6d805eae37
new option "Timeout" in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
367
diff
changeset
|
794 self.assertEqual(8, len(s['hello'])) |
241
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
795 self.assertEqual(url, s['hello']['Url']) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
796 self.assertEqual('bob', s['hello']['Username']) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
797 self.assertEqual(None, s['hello']['Password']) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
798 self.assertFalse(s['hello']['Pkcs11']) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
799 self.assertEqual(1, len(s['hello']['HttpHeaders'])) |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
800 self.assertTrue('Hello' in s['hello']['HttpHeaders']) |
242 | 801 self.assertEqual('Test', s['hello']['UserProperty']) |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
802 self.assertEqual('1', s['hello']['HasDelete']) |
388
3ef44d201875
revert incorrect changeset 386
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
386
diff
changeset
|
803 self.assertEqual(66, s['hello']['Timeout']) # New in 1.6 (interpreted as a string in <= 1.5) |
241
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
804 |
adc6372b8820
dicomweb: test_add_server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
239
diff
changeset
|
805 DoDelete(ORTHANC, '/dicom-web/servers/hello') |
246
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
806 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
807 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
808 def test_bitbucket_issue_143(self): |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
809 # WADO-RS metadata request returns "500 Internal Server Error" |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
810 # instead of "404 Not Found" for missing instance |
319 | 811 # https://bugs.orthanc-server.com/show_bug.cgi?id=143 |
246
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
812 UploadInstance(ORTHANC, 'Issue143.dcm') |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
813 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
814 try: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
815 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
|
816 self.assertFail() |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
817 except Exception as e: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
818 self.assertEqual(404, e[0]) |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
819 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
820 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
|
821 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
822 try: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
823 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
|
824 self.fail() |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
825 except Exception as e: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
826 self.assertEqual(404, e[0]) |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
827 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
828 try: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
829 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
|
830 self.assertFail() |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
831 except Exception as e: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
832 self.assertEqual(404, e[0]) |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
833 |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
834 try: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
835 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
|
836 self.assertFail() |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
837 except Exception as e: |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
838 self.assertEqual(404, e[0]) |
e4e0e2ff91ae
test_bitbucket_issue_143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
244
diff
changeset
|
839 |
248
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
840 |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
841 def test_encodings_qido(self): |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
842 # The "DefaultEncoding" condifuration option is set to "UTF8" |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
843 # 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
|
844 # 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
|
845 def GetPatientName(dicom, onlyAlphabetic): |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
846 i = UploadInstance(ORTHANC, dicom) ['ID'] |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
847 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
|
848 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
|
849 self.assertEqual(1, len(qido)) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
850 self.assertEqual('CS', qido[0]['00080005']['vr']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
851 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
|
852 if onlyAlphabetic: |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
853 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
|
854 else: |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
855 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
|
856 return qido[0]['00100010']['Value'][0] |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
857 |
314 | 858 # Make sure UTF-8 encoding is used |
859 self.assertEqual('Utf8', DoPut(ORTHANC, '/tools/default-encoding', 'Utf8')) | |
860 | |
248
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
861 # 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
|
862 |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
863 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
|
864 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
|
865 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
|
866 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
|
867 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
|
868 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
|
869 |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
870 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
|
871 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
|
872 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
|
873 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
|
874 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
|
875 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
|
876 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
|
877 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
|
878 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
|
879 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
|
880 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
|
881 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
|
882 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
|
883 |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
884 # 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
|
885 #self.assertEqual(u'山田^太郎', GetPatientName('Encodings/DavidClunie/SCSH32')['Ideographic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
886 #self.assertEqual(u'やまだ^たろう', GetPatientName('Encodings/DavidClunie/SCSH32')['Phonetic']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
887 |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
888 |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
889 def test_encodings_wado_metadata(self): |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
890 # If querying the instance metadata, the "DefaultEncoding" |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
891 # configuration is not used, but the actual encoding |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
892 def GetEncoding(dicom, length): |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
893 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
|
894 self.assertEqual(1, len(qido)) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
895 self.assertEqual(length, len(qido[0]['00080005']['Value'])) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
896 self.assertEqual('CS', qido[0]['00080005']['vr']) |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
897 return qido[0]['00080005']['Value'] |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
898 |
26c3a1ed935a
testing of encodings in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
246
diff
changeset
|
899 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
|
900 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
|
901 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
|
902 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
|
903 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
|
904 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
|
905 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
|
906 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
|
907 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
|
908 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
|
909 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
|
910 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
|
911 |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
912 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
913 def test_rendered(self): |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
914 def RenderFrame(path, i): |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
915 return DoPost(ORTHANC, '/dicom-web/servers/sample/get', { |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
916 'Uri' : '%s/frames/%d/rendered' % (path, i) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
917 }) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
918 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
919 # This image has 76 frames |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
920 path = UploadAndGetWadoPath('Multiframe.dcm') |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
921 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
922 self.assertRaises(Exception, lambda: RenderFrame(path, 0)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
923 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
924 frame1 = RenderFrame(path, 1) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
925 im = UncompressImage(frame1) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
926 self.assertEqual("L", im.mode) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
927 self.assertEqual(512, im.size[0]) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
928 self.assertEqual(512, im.size[1]) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
929 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
930 im = UncompressImage(RenderFrame(path, 76)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
931 self.assertEqual("L", im.mode) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
932 self.assertEqual(512, im.size[0]) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
933 self.assertEqual(512, im.size[1]) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
934 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
935 self.assertRaises(Exception, lambda: RenderFrame(path, 77)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
936 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
937 defaultFrame = DoPost(ORTHANC, '/dicom-web/servers/sample/get', { |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
938 'Uri' : '%s/rendered' % path |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
939 }) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
940 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
941 self.assertEqual(len(frame1), len(defaultFrame)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
942 self.assertEqual(frame1, defaultFrame) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
943 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
944 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
945 # This image has 1 frame |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
946 path = UploadAndGetWadoPath('Phenix/IM-0001-0001.dcm') |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
947 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
948 self.assertRaises(Exception, lambda: RenderFrame(path, 0)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
949 self.assertRaises(Exception, lambda: RenderFrame(path, 2)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
950 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
951 frame1 = RenderFrame(path, 1) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
952 im = UncompressImage(frame1) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
953 self.assertEqual("L", im.mode) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
954 self.assertEqual(512, im.size[0]) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
955 self.assertEqual(358, im.size[1]) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
956 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
957 defaultFrame = DoPost(ORTHANC, '/dicom-web/servers/sample/get', { |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
958 'Uri' : '%s/rendered' % path |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
959 }) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
960 |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
961 self.assertEqual(len(frame1), len(defaultFrame)) |
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
962 self.assertEqual(frame1, defaultFrame) |
259
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
963 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
964 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
965 def test_qido_parent_attributes(self): |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
966 UploadInstance(ORTHANC, 'Brainix/Flair/IM-0001-0001.dcm') |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
967 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
|
968 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
|
969 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
|
970 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
971 a = DoGet(ORTHANC, '/dicom-web/studies') |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
972 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
973 self.assertFalse('00080018' in a[0]) # SOPInstanceUID |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
974 self.assertFalse('0020000E' in a[0]) # SeriesInstanceUID |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
975 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
976 self.assertEqual('BRAINIX', a[0]['00100010']['Value'][0]['Alphabetic']) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
977 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
978 a = DoGet(ORTHANC, '/dicom-web/studies?0020000D=%s' % study) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
979 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
980 self.assertFalse('00080018' in a[0]) # SOPInstanceUID |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
981 self.assertFalse('0020000E' in a[0]) # SeriesInstanceUID |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
982 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
983 self.assertEqual('BRAINIX', a[0]['00100010']['Value'][0]['Alphabetic']) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
984 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
985 a = DoGet(ORTHANC, '/dicom-web/series') |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
986 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
987 self.assertFalse('00080018' in a[0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
988 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
989 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
990 self.assertEqual('MR', a[0]['00080060']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
991 self.assertEqual('BRAINIX', a[0]['00100010']['Value'][0]['Alphabetic']) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
992 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
993 a = DoGet(ORTHANC, '/dicom-web/instances') |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
994 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
995 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
996 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
997 self.assertEqual(instance, a[0]['00080018']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
998 self.assertEqual('MR', a[0]['00080060']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
999 self.assertEqual('BRAINIX', a[0]['00100010']['Value'][0]['Alphabetic']) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1000 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1001 a = DoGet(ORTHANC, '/dicom-web/studies/%s/series' % study) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1002 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1003 self.assertFalse('00080018' in a[0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1004 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1005 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1006 self.assertEqual('MR', a[0]['00080060']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1007 self.assertEqual('BRAINIX', a[0]['00100010']['Value'][0]['Alphabetic']) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1008 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1009 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
|
1010 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1011 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1012 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1013 self.assertEqual(instance, a[0]['00080018']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1014 self.assertEqual('MR', a[0]['00080060']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1015 self.assertEqual('BRAINIX', a[0]['00100010']['Value'][0]['Alphabetic']) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1016 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1017 # "If {StudyInstanceUID} is not specified, all Study-level |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1018 # attributes specified in Table 6.7.1-2" => Here, |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1019 # {StudyInstanceUID} *is* specified, so we must *not* get the |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1020 # PatientName. |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1021 # 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
|
1022 a = DoGet(ORTHANC, '/dicom-web/series?0020000D=%s' % study) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1023 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1024 self.assertFalse('00100010' in a[0]) # PatientName |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1025 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1026 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1027 self.assertEqual('MR', a[0]['00080060']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1028 |
487 | 1029 # if we ask explicitely for the Patient and Study tags, we must get it |
1030 a = DoGet(ORTHANC, '/dicom-web/series?0020000D=%s&includefield=00100010&includefield=00080020' % study) | |
1031 self.assertEqual(1, len(a)) | |
1032 self.assertTrue('00100010' in a[0]) # PatientName | |
1033 self.assertTrue('00080020' in a[0]) # StudyDate | |
1034 | |
1035 # if {StudyInstanceUID} *is not* specified, we must get the PatientName | |
1036 a = DoGet(ORTHANC, '/dicom-web/series') | |
1037 self.assertTrue('00100010' in a[0]) # PatientName | |
1038 | |
259
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1039 # 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
|
1040 a = DoGet(ORTHANC, '/dicom-web/instances?0020000D=%s' % study) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1041 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1042 self.assertFalse('00100010' in a[0]) # PatientName |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1043 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1044 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1045 self.assertEqual('MR', a[0]['00080060']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1046 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1047 a = DoGet(ORTHANC, '/dicom-web/instances?0020000E=%s' % series) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1048 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1049 self.assertFalse('00080060' in a[0]) # Modality |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1050 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1051 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1052 self.assertEqual('BRAINIX', a[0]['00100010']['Value'][0]['Alphabetic']) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1053 |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1054 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
|
1055 self.assertEqual(1, len(a)) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1056 self.assertFalse('00100010' in a[0]) # PatientName |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1057 self.assertFalse('00080060' in a[0]) # Modality |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1058 self.assertEqual(study, a[0]['0020000D']['Value'][0]) |
298f80c6ccc4
test_qido_parent_attributes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
249
diff
changeset
|
1059 self.assertEqual(series, a[0]['0020000E']['Value'][0]) |
261
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
1060 |
487 | 1061 # if we ask explicitely for the Patient and Study tags, we must get it |
1062 a = DoGet(ORTHANC, '/dicom-web/instances?0020000D=%s&includefield=00100010&includefield=00080020' % study) | |
1063 self.assertEqual(1, len(a)) | |
1064 self.assertTrue('00100010' in a[0]) # PatientName | |
1065 self.assertTrue('00080020' in a[0]) # StudyDate | |
1066 | |
1067 # if {StudyInstanceUID} *is not* specified, we must get all Study, Series and Patient tags | |
1068 a = DoGet(ORTHANC, '/dicom-web/instances') | |
1069 self.assertTrue('00100010' in a[0]) # PatientName | |
1070 self.assertTrue('00080020' in a[0]) # StudyDate | |
1071 self.assertTrue('00080060' in a[0]) # Modality | |
1072 | |
261
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
1073 |
270
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1074 #@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
|
1075 def test_bitbucket_issue_164(self): |
270
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1076 # WARNING - This makes GDCM 2.8.4 crash |
319 | 1077 # https://bugs.orthanc-server.com/show_bug.cgi?id=164 |
261
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
1078 UploadInstance(ORTHANC, 'Issue164.dcm') |
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
1079 |
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
1080 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
|
1081 self.assertEqual(1, len(p)) |
b8cdb0aef4b9
test_bitbucket_issue_164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
260
diff
changeset
|
1082 self.assertEqual(743 * 975 * 3, len(p[0])) |
304 | 1083 |
539
ef41b62b456e
updated DicomWEB tests for YBR images that are not transformed into RGB anymore
Alain Mazy <am@osimis.io>
parents:
537
diff
changeset
|
1084 metadata = DoGet(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/metadata') |
ef41b62b456e
updated DicomWEB tests for YBR images that are not transformed into RGB anymore
Alain Mazy <am@osimis.io>
parents:
537
diff
changeset
|
1085 self.assertEqual("YBR_FULL_422", metadata[0]['00280004']['Value'][0]) |
ef41b62b456e
updated DicomWEB tests for YBR images that are not transformed into RGB anymore
Alain Mazy <am@osimis.io>
parents:
537
diff
changeset
|
1086 |
543 | 1087 # TODO |
1088 # # starting from X.XX.X, Orthanc won't convert YBR to RGB anymore -> new checksum (https://discourse.orthanc-server.org/t/orthanc-convert-ybr-to-rgb-but-does-not-change-metadata/3533) | |
1089 # if IsOrthancVersionAbove(ORTHANC, 1, XX, 1): | |
1090 # expectedDcmtkChecksum = '7535a11e7da0fa590c467ac9d323c5c1' | |
1091 # else: | |
1092 expectedDcmtkChecksum = 'b3662c4bfa24a0c73abb08548c63319b' | |
539
ef41b62b456e
updated DicomWEB tests for YBR images that are not transformed into RGB anymore
Alain Mazy <am@osimis.io>
parents:
537
diff
changeset
|
1093 |
304 | 1094 if HasGdcmPlugin(ORTHANC): |
1095 self.assertTrue(ComputeMD5(p[0]) in [ | |
1096 'b952d67da9ff004b0adae3982e89d620', # GDCM >= 3.0 | |
539
ef41b62b456e
updated DicomWEB tests for YBR images that are not transformed into RGB anymore
Alain Mazy <am@osimis.io>
parents:
537
diff
changeset
|
1097 expectedDcmtkChecksum # Fallback to DCMTK |
304 | 1098 ]) |
1099 else: | |
539
ef41b62b456e
updated DicomWEB tests for YBR images that are not transformed into RGB anymore
Alain Mazy <am@osimis.io>
parents:
537
diff
changeset
|
1100 self.assertEqual(expectedDcmtkChecksum, ComputeMD5(p[0])) # DCMTK |
270
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1101 |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1102 |
271 | 1103 def test_bitbucket_issue_168(self): |
276 | 1104 # "Plugins can't read private tags from the configuration |
1105 # file" This test will fail if DCMTK <= 3.6.1 (e.g. on Ubuntu | |
1106 # 16.04), or if Orthanc <= 1.5.8 | |
319 | 1107 # https://bugs.orthanc-server.com/show_bug.cgi?id=168 |
270
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1108 |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1109 UploadInstance(ORTHANC, 'Issue168.dcm') |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1110 |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1111 a = DoGet(ORTHANC, '/dicom-web/studies') |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1112 self.assertEqual(1, len(a)) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1113 self.assertFalse('00090010' in a[0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1114 self.assertFalse('00091001' in a[0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1115 self.assertEqual('20170404', a[0]['00080020']['Value'][0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1116 |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1117 a = DoGet(ORTHANC, '/dicom-web/studies?includefield=00091001') |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1118 self.assertEqual(1, len(a)) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1119 self.assertFalse('00090010' in a[0]) |
325
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1120 self.assertTrue('00091001' in a[0]) # This fails if DCMTK <= 3.6.1 |
270
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1121 self.assertEqual('DS', a[0]['00091001']['vr']) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1122 self.assertEqual(1, len(a[0]['00091001']['Value'])) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1123 self.assertAlmostEqual(98.41, a[0]['00091001']['Value'][0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1124 |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1125 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
|
1126 self.assertEqual(1, len(a)) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1127 self.assertTrue('00090010' in a[0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1128 self.assertEqual('LO', a[0]['00090010']['vr']) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1129 self.assertEqual(1, len(a[0]['00090010']['Value'])) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1130 self.assertEqual('Lunit', a[0]['00090010']['Value'][0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1131 self.assertTrue('00091001' in a[0]) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1132 self.assertEqual('DS', a[0]['00091001']['vr']) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1133 self.assertEqual(1, len(a[0]['00091001']['Value'])) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1134 self.assertAlmostEqual(98.41, a[0]['00091001']['Value'][0]) |
249
24e5c8ca9440
DICOMweb: test_rendered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
248
diff
changeset
|
1135 |
270
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1136 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
|
1137 self.assertEqual(0, len(a)) |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1138 |
082f35cb4459
test_bitbuck_issue_168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
261
diff
changeset
|
1139 |
272
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1140 def test_rendered_studies_series(self): |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1141 i = UploadInstance(ORTHANC, 'Phenix/IM-0001-0001.dcm') ['ID'] |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1142 study = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i) ['StudyInstanceUID'] |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1143 series = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i) ['SeriesInstanceUID'] |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1144 instance = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i) ['SOPInstanceUID'] |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1145 |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1146 a = DoPost(ORTHANC, '/dicom-web/servers/sample/get', { |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1147 '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
|
1148 }) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1149 |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1150 im = UncompressImage(a) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1151 self.assertEqual("L", im.mode) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1152 self.assertEqual(512, im.size[0]) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1153 self.assertEqual(358, im.size[1]) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1154 |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1155 b = DoPost(ORTHANC, '/dicom-web/servers/sample/get', { |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1156 'Uri' : '/studies/%s/series/%s/rendered' % (study, series) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1157 }) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1158 |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1159 self.assertEqual(len(a), len(b)) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1160 self.assertEqual(a, b) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1161 |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1162 c = DoPost(ORTHANC, '/dicom-web/servers/sample/get', { |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1163 'Uri' : '/studies/%s/rendered' % study |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1164 }) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1165 |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1166 self.assertEqual(len(a), len(c)) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1167 self.assertEqual(a, c) |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1168 |
a94b0409fdac
test_rendered_studies_series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
271
diff
changeset
|
1169 |
273
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1170 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
|
1171 # "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
|
1172 # 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
|
1173 |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1174 UploadInstance(ORTHANC, 'DummyCT.dcm') |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1175 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
|
1176 |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1177 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
|
1178 |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1179 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
|
1180 headers = { 'Accept' : 'application/json, application/dicom+json' }))) |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1181 |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1182 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study, |
274 | 1183 headers = { 'Accept' : 'application/json' }))) |
1184 | |
1185 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study, | |
1186 headers = { 'Accept' : 'application/dicom+json' }))) | |
1187 | |
1188 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
|
1189 headers = { 'Accept' : 'toto, application/dicom+json' }))) |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1190 |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1191 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
|
1192 headers = { 'Accept' : 'application/json, tata' }))) |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1193 |
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1194 self.assertRaises(Exception, lambda: DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study, |
274 | 1195 headers = { 'Accept' : 'toto' })) |
1196 | |
1197 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
|
1198 headers = { 'Accept' : 'toto, tata' })) |
275 | 1199 |
1200 # https://groups.google.com/d/msg/orthanc-users/9o5kItsMQI0/Og6B27YyBgAJ | |
1201 self.assertEqual(1, len(DoGetMultipart(ORTHANC, '/dicom-web/studies/%s/metadata' % study, | |
1202 headers = { 'Accept' : 'multipart/related;type=application/dicom+xml' }))) | |
1203 | |
1204 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study, | |
1205 headers = { 'Accept' : 'application/json, application/dicom+xml' }))) | |
1206 | |
1207 self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study, | |
1208 headers = { 'Accept' : 'application/dicom+xml, application/json' }))) | |
284
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1209 |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1210 |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1211 |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1212 def test_bitbucket_issue_56(self): |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1213 # "Case-insensitive matching over accents" => DICOMweb part |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1214 # from AlexanderM on 2020-03-20 |
319 | 1215 # https://bugs.orthanc-server.com/show_bug.cgi?id=56 |
284
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1216 UploadInstance(ORTHANC, 'Issue56-NoPixelData.dcm') |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1217 |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1218 self.assertEqual(1, len(DoPost(ORTHANC, '/tools/find', { |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1219 'Level' : 'Patient', |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1220 'Query' : { |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1221 'PatientName' : 'Гусева*', |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1222 }, |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1223 }))) |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1224 |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1225 self.assertEqual(1, len(DoPost(ORTHANC, '/tools/find', { |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1226 'Level' : 'Patient', |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1227 'Query' : { |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1228 'PatientName' : 'гусева*', |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1229 }, |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1230 }))) |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1231 |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1232 self.assertEqual(1, len(DoGet(ORTHANC, u'/dicom-web/studies?PatientName=Гусева*', |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1233 headers = { 'accept' : 'application/json' }))) |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1234 |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1235 # This line is the issue |
284
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1236 self.assertEqual(1, len(DoGet(ORTHANC, u'/dicom-web/studies?PatientName=гусева*', |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1237 headers = { 'accept' : 'application/json' }))) |
7fa5c7a03137
added test for issue 56
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
278
diff
changeset
|
1238 |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1239 |
318
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1240 def test_frames_transcoding(self): |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1241 ACCEPT = { |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1242 '1.2.840.10008.1.2' : 'multipart/related; type=application/octet-stream; transfer-syntax=1.2.840.10008.1.2', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1243 '1.2.840.10008.1.2.1' : 'multipart/related; type=application/octet-stream; transfer-syntax=1.2.840.10008.1.2.1', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1244 '1.2.840.10008.1.2.4.50' : 'multipart/related; type=image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.50', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1245 '1.2.840.10008.1.2.4.51' : 'multipart/related; type=image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.51', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1246 '1.2.840.10008.1.2.4.57' : 'multipart/related; type=image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.57', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1247 '1.2.840.10008.1.2.4.70' : 'multipart/related; type=image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.70', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1248 } |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1249 |
321
3c8c6b41eec4
dealing with Content-Location in test_frames_transcoding of DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
319
diff
changeset
|
1250 uri = 'dicom-web%s' % UploadAndGetWadoPath('TransferSyntaxes/1.2.840.10008.1.2.4.50.dcm') |
539
ef41b62b456e
updated DicomWEB tests for YBR images that are not transformed into RGB anymore
Alain Mazy <am@osimis.io>
parents:
537
diff
changeset
|
1251 truthRGB = Image.open(GetDatabasePath('TransferSyntaxes/1.2.840.10008.1.2.4.50.png')) |
543 | 1252 |
1253 # TODO | |
1254 # # starting from X.XX.X, Orthanc won't convert YBR to RGB anymore -> new checksum (https://discourse.orthanc-server.org/t/orthanc-convert-ybr-to-rgb-but-does-not-change-metadata/3533) | |
1255 # with open(GetDatabasePath('TransferSyntaxes/1.2.840.10008.1.2.4.50.YBR.raw'), 'rb') as f: | |
1256 # truthRawYbr = f.read() | |
539
ef41b62b456e
updated DicomWEB tests for YBR images that are not transformed into RGB anymore
Alain Mazy <am@osimis.io>
parents:
537
diff
changeset
|
1257 |
ef41b62b456e
updated DicomWEB tests for YBR images that are not transformed into RGB anymore
Alain Mazy <am@osimis.io>
parents:
537
diff
changeset
|
1258 # first test: no transcoding since we accept the JPEG transfer syntax |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1259 a = DoGetMultipart(ORTHANC, '%s/frames/1' % uri, |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1260 headers = { 'Accept' : ACCEPT['1.2.840.10008.1.2.4.50'] }, |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1261 returnHeaders = True) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1262 self.assertEqual(1, len(a)) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1263 self.assertEqual(2, len(a[0])) |
321
3c8c6b41eec4
dealing with Content-Location in test_frames_transcoding of DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
319
diff
changeset
|
1264 self.assertEqual('%s%s/frames/1' % (ORTHANC['Url'], uri), |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1265 a[0][1]['Content-Location']) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1266 self.assertEqual(ACCEPT['1.2.840.10008.1.2.4.50'], |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1267 'multipart/related; type=%s' % a[0][1]['Content-Type']) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1268 self.assertEqual(53476, len(a[0][0])) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1269 self.assertEqual('142fdb8a1dc2aa7e6b8952aa294a6e22', ComputeMD5(a[0][0])) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1270 |
539
ef41b62b456e
updated DicomWEB tests for YBR images that are not transformed into RGB anymore
Alain Mazy <am@osimis.io>
parents:
537
diff
changeset
|
1271 # second test: no accept header -> defaults to raw explicit |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1272 a = DoGetMultipart(ORTHANC, '%s/frames/1' % uri) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1273 self.assertEqual(1, len(a)) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1274 self.assertEqual(480 * 640 * 3, len(a[0])) |
304 | 1275 |
539
ef41b62b456e
updated DicomWEB tests for YBR images that are not transformed into RGB anymore
Alain Mazy <am@osimis.io>
parents:
537
diff
changeset
|
1276 # Orthanc is now returning the YBR image instead of the RGB |
543 | 1277 # TODO |
1278 # # starting from X.XX.X, Orthanc won't convert YBR to RGB anymore -> new checksum (https://discourse.orthanc-server.org/t/orthanc-convert-ybr-to-rgb-but-does-not-change-metadata/3533) | |
1279 # if IsOrthancVersionAbove(ORTHANC, 1, XX, 1) and not HasGdcmPlugin(ORTHANC): | |
1280 # # GetMaxImageDifference does not work with YBR images -> strict comparison with the output of dcmdjpeg | |
1281 # self.assertEqual('d4aacc6c7758c7c968a4fc8d59b041d5', ComputeMD5(a[0])) | |
1282 # else: | |
1283 # http://effbot.org/zone/pil-comparing-images.htm | |
1284 img = Image.frombytes('RGB', [ 640, 480 ], a[0]) | |
1285 self.assertLessEqual(GetMaxImageDifference(img, truthRGB), 2) | |
304 | 1286 |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1287 ACCEPT2 = copy.deepcopy(ACCEPT) |
304 | 1288 if HasGdcmPlugin(ORTHANC): |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1289 IS_GDCM = True |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1290 ACCEPT2['1.2.840.10008.1.2.1'] = 'multipart/related; type=application/octet-stream' |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1291 del ACCEPT2['1.2.840.10008.1.2'] |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1292 else: |
539
ef41b62b456e
updated DicomWEB tests for YBR images that are not transformed into RGB anymore
Alain Mazy <am@osimis.io>
parents:
537
diff
changeset
|
1293 if not IsOrthancVersionAbove(ORTHANC, 1, 12, 1): |
ef41b62b456e
updated DicomWEB tests for YBR images that are not transformed into RGB anymore
Alain Mazy <am@osimis.io>
parents:
537
diff
changeset
|
1294 self.assertEqual('dfdc79f5070926bbb8ac079ee91f5b91', ComputeMD5(a[0])) |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1295 IS_GDCM = False |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1296 |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1297 a = DoGetMultipart(ORTHANC, '%s/frames/1' % uri, |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1298 headers = { 'Accept' : ACCEPT2['1.2.840.10008.1.2.1'] }) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1299 self.assertEqual(1, len(a)) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1300 self.assertEqual(480 * 640 * 3, len(a[0])) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1301 |
543 | 1302 # TODO |
1303 # # starting from X.XX.X, Orthanc won't convert YBR to RGB anymore -> new checksum (https://discourse.orthanc-server.org/t/orthanc-convert-ybr-to-rgb-but-does-not-change-metadata/3533) | |
1304 # if IsOrthancVersionAbove(ORTHANC, 1, XX, X) and not HasGdcmPlugin(ORTHANC): | |
1305 # # GetMaxImageDifference does not work with YBR images -> strict comparison with the output of dcmdjpeg | |
1306 # self.assertEqual('d4aacc6c7758c7c968a4fc8d59b041d5', ComputeMD5(a[0])) | |
1307 # else: | |
1308 # http://effbot.org/zone/pil-comparing-images.htm | |
1309 img = Image.frombytes('RGB', [ 640, 480 ], a[0]) | |
1310 self.assertLessEqual(GetMaxImageDifference(img, truthRGB), 2) | |
304 | 1311 |
543 | 1312 # TODO: if not IS_GDCM and not IsOrthancVersionAbove(ORTHANC, 1, XX, X): |
1313 if not IS_GDCM: | |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1314 self.assertEqual('dfdc79f5070926bbb8ac079ee91f5b91', ComputeMD5(a[0])) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1315 |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1316 |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1317 # Test download using the same transfer syntax |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1318 RESULTS = { |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1319 '1.2.840.10008.1.2' : 'f54c7ea520ab3ec32b6303581ecd262f', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1320 '1.2.840.10008.1.2.1' : '4b350b9353a93c747917c7c3bf9b8f44', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1321 '1.2.840.10008.1.2.4.50' : '142fdb8a1dc2aa7e6b8952aa294a6e22', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1322 '1.2.840.10008.1.2.4.51' : '8b37945d75f9d2899ed868bdba429a0d', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1323 '1.2.840.10008.1.2.4.57' : '75c84823eddb560d127b1d24c9406f30', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1324 '1.2.840.10008.1.2.4.70' : '2c35726328f0200396e583a0038b0269', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1325 } |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1326 |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1327 if IS_GDCM: |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1328 # This file was failing with GDCM, as it has 2 fragments, |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1329 # and only the first one was returned => the MD5 below is BAD |
304 | 1330 #RESULTS['1.2.840.10008.1.2.4.51'] = '901963a322a817946b074f9ed0afa060' |
1331 pass | |
1332 | |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1333 for syntax in ACCEPT2: |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1334 uri = '/dicom-web%s' % UploadAndGetWadoPath('TransferSyntaxes/%s.dcm' % syntax) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1335 a = DoGetMultipart(ORTHANC, '%s/frames/1' % uri, |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1336 headers = { 'Accept' : ACCEPT2[syntax] }) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1337 self.assertEqual(1, len(a)) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1338 self.assertEqual(RESULTS[syntax], ComputeMD5(a[0])) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1339 |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1340 # Test transcoding to all the possible transfer syntaxes |
321
3c8c6b41eec4
dealing with Content-Location in test_frames_transcoding of DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
319
diff
changeset
|
1341 uri = 'dicom-web%s' % UploadAndGetWadoPath('KarstenHilbertRF.dcm') |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1342 for syntax in ACCEPT2: |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1343 a = DoGetMultipart(ORTHANC, '%s/frames/1' % uri, |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1344 headers = { 'Accept' : ACCEPT2[syntax] }, |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1345 returnHeaders = True) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1346 self.assertEqual(1, len(a)) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1347 self.assertEqual(2, len(a[0])) |
321
3c8c6b41eec4
dealing with Content-Location in test_frames_transcoding of DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
319
diff
changeset
|
1348 self.assertEqual('%s%s/frames/1' % (ORTHANC['Url'], uri), |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1349 a[0][1]['Content-Location']) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1350 self.assertEqual(ACCEPT[syntax], |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1351 'multipart/related; type=%s' % a[0][1]['Content-Type']) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1352 if IS_GDCM: |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1353 self.assertEqual({ |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1354 '1.2.840.10008.1.2' : '1c8cebde0c74450ce4dfb75dd52ddad7', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1355 '1.2.840.10008.1.2.1' : '1c8cebde0c74450ce4dfb75dd52ddad7', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1356 '1.2.840.10008.1.2.4.50' : 'f4d145e5f33fbd39375ce0f91453d6cc', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1357 '1.2.840.10008.1.2.4.51' : 'f4d145e5f33fbd39375ce0f91453d6cc', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1358 '1.2.840.10008.1.2.4.57' : 'dc55800ce1a8ac556c266cdb26d75757', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1359 '1.2.840.10008.1.2.4.70' : 'dc55800ce1a8ac556c266cdb26d75757', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1360 } [syntax], ComputeMD5(a[0][0])) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1361 else: |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1362 self.assertEqual({ |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1363 '1.2.840.10008.1.2' : '1c8cebde0c74450ce4dfb75dd52ddad7', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1364 '1.2.840.10008.1.2.1' : '1c8cebde0c74450ce4dfb75dd52ddad7', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1365 '1.2.840.10008.1.2.4.50' : '0a0ab74fe7c68529bdd416fc9e5e742a', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1366 '1.2.840.10008.1.2.4.51' : '33d1ab2fe169c5b5ba932a9bbc3c6306', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1367 '1.2.840.10008.1.2.4.57' : '3d21c969da846ca41e0498a0dcfad061', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1368 '1.2.840.10008.1.2.4.70' : '49d5353c8673208629847ad45a855557', |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1369 } [syntax], ComputeMD5(a[0][0])) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1370 |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1371 |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1372 # JPEG image with many fragments for 2 frames |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1373 uri = '/dicom-web%s' % UploadAndGetWadoPath('LenaTwiceWithFragments.dcm') |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1374 |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1375 a = DoGetMultipart(ORTHANC, '%s/frames/1' % uri, |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1376 headers = { 'Accept' : ACCEPT['1.2.840.10008.1.2.4.50'] }) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1377 self.assertEqual(1, len(a)) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1378 self.assertEqual(69214, len(a[0])) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1379 self.assertEqual('0eaf36d4881c513ca70b6684bfaa5b08', ComputeMD5(a[0])) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1380 |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1381 b = DoGetMultipart(ORTHANC, '%s/frames/2' % uri, |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1382 headers = { 'Accept' : ACCEPT['1.2.840.10008.1.2.4.50'] }) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1383 self.assertEqual(1, len(b)) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1384 self.assertEqual(a[0], b[0]) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1385 |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1386 b = DoGetMultipart(ORTHANC, '%s/frames/1,2' % uri, |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1387 headers = { 'Accept' : ACCEPT['1.2.840.10008.1.2.4.50'] }) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1388 self.assertEqual(2, len(b)) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1389 self.assertEqual(a[0], b[0]) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1390 self.assertEqual(a[0], b[1]) |
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1391 |
318
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1392 |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1393 def test_wado_transcoding(self): |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1394 uri = '/dicom-web%s' % UploadAndGetWadoPath('TransferSyntaxes/1.2.840.10008.1.2.4.50.dcm') |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1395 |
367
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1396 compressedSize = os.path.getsize(GetDatabasePath('TransferSyntaxes/1.2.840.10008.1.2.4.50.dcm')) |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1397 |
318
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1398 self.assertRaises(Exception, lambda: DoGetMultipart(ORTHANC, '%s' % uri, |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1399 headers = { 'Accept' : 'nope' })) |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1400 |
367
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1401 # Up to release 1.5 of the DICOMweb plugin, if no |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1402 # transfer-syntax was specified, no transcoding occured. This |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1403 # was because of an undefined behavior up to DICOM |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1404 # 2016b. Starting with DICOM 2016c, the standard explicitly |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1405 # states that the image should be transcoded to Little Endian |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1406 # Explicit. |
318
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1407 a = DoGetMultipart(ORTHANC, '%s' % uri, |
367
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1408 headers = { }) |
318
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1409 self.assertEqual(1, len(a)) |
367
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1410 self.assertEqual('1.2.840.10008.1.2.1', GetTransferSyntax(a[0])) |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1411 self.assertTrue(10 * compressedSize < len(a[0])) |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1412 uncompressedSize = len(a[0]) |
297
f95cd3af1c7a
DICOMweb: test_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
284
diff
changeset
|
1413 |
318
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1414 a = DoGetMultipart(ORTHANC, '%s' % uri, |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1415 headers = { 'Accept' : 'multipart/related' }) |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1416 self.assertEqual(1, len(a)) |
367
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1417 self.assertEqual('1.2.840.10008.1.2.1', GetTransferSyntax(a[0])) |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1418 self.assertEqual(uncompressedSize, len(a[0])) |
318
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1419 |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1420 a = DoGetMultipart(ORTHANC, '%s' % uri, |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1421 headers = { 'Accept' : 'multipart/related; type=application/dicom' }) |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1422 self.assertEqual(1, len(a)) |
367
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1423 self.assertEqual('1.2.840.10008.1.2.1', GetTransferSyntax(a[0])) |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1424 self.assertEqual(uncompressedSize, len(a[0])) |
318
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1425 |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1426 a = DoGetMultipart(ORTHANC, '%s' % uri, |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1427 headers = { 'Accept' : 'multipart/related; type=application/dicom; transfer-syntax=*' }) |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1428 self.assertEqual(1, len(a)) |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1429 self.assertEqual('1.2.840.10008.1.2.4.50', GetTransferSyntax(a[0])) |
367
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1430 self.assertEqual(compressedSize, len(a[0])) |
318
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1431 |
367
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1432 # Use source transfer syntax |
318
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1433 a = DoGetMultipart(ORTHANC, '%s' % uri, |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1434 headers = { 'Accept' : 'multipart/related; type=application/dicom; transfer-syntax=1.2.840.10008.1.2.4.50' }) |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1435 self.assertEqual(1, len(a)) |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1436 self.assertEqual('1.2.840.10008.1.2.4.50', GetTransferSyntax(a[0])) |
367
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1437 self.assertEqual(compressedSize, len(a[0])) |
318
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1438 |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1439 a = DoGetMultipart(ORTHANC, '%s' % uri, |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1440 headers = { 'Accept' : 'multipart/related; type=application/dicom; transfer-syntax=1.2.840.10008.1.2.1' }) |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1441 self.assertEqual(1, len(a)) |
bac7cc80f240
dicomweb: test_wado_transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
314
diff
changeset
|
1442 self.assertEqual('1.2.840.10008.1.2.1', GetTransferSyntax(a[0])) |
367
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1443 self.assertEqual(uncompressedSize, len(a[0])) |
325
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1444 |
367
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1445 # Transcoding |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1446 a = DoGetMultipart(ORTHANC, '%s' % uri, |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1447 headers = { 'Accept' : 'multipart/related; type=application/dicom; transfer-syntax=1.2.840.10008.1.2.4.57' }) |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1448 self.assertEqual(1, len(a)) |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1449 self.assertEqual('1.2.840.10008.1.2.4.57', GetTransferSyntax(a[0])) |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1450 self.assertNotEqual(compressedSize, len(a[0])) |
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1451 self.assertNotEqual(uncompressedSize, len(a[0])) |
325
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1452 |
367
9d2a63afdb73
Test compliance with DICOM >= 2016c: WADO-RS Retrieve transcodes to Little Endian Explicit by default
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
1453 |
325
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1454 def test_compare_wado_uri_and_rs(self): |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1455 # https://groups.google.com/d/msg/orthanc-users/mKgr2QAKTCU/R7u4I1LvBAAJ |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1456 |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1457 # Image "2020-08-12-Christopher.dcm" corresponds to the result of: |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1458 # $ gdcmconv --raw 1.2.840.113704.9.1000.16.2.20190613104005642000100010001.dcm 2020-08-12-Christopher.dcm |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1459 # Image "2020-08-12-Christopher.png" corresponds to "2.png" |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1460 |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1461 i = UploadInstance(ORTHANC, '2020-08-12-Christopher.dcm') ['ID'] |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1462 STUDY = '1.2.840.113704.9.1000.16.0.20190613103939444' |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1463 SERIES = '1.2.840.113704.9.1000.16.1.2019061310394289000010001' |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1464 INSTANCE = '1.2.840.113704.9.1000.16.2.20190613104005642000100010001' |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1465 |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1466 with open(GetDatabasePath('2020-08-12-Christopher.png'), 'rb') as f: |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1467 truth = UncompressImage(f.read()) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1468 |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1469 im1 = GetImage(ORTHANC, args.wado + '?requestType=WADO&objectUID=%s&contentType=image/jpg' % INSTANCE) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1470 self.assertEqual('JPEG', im1.format) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1471 |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1472 im2 = GetImage(ORTHANC, args.wado + '?requestType=WADO&objectUID=%s&contentType=image/png' % INSTANCE) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1473 self.assertEqual('PNG', im2.format) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1474 |
434
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1475 im3 = GetImage(ORTHANC, '/dicom-web/studies/%s/series/%s/instances/%s/frames/1/rendered?window=200,800,linear' % (STUDY, SERIES, INSTANCE)) |
325
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1476 self.assertEqual('JPEG', im3.format) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1477 |
434
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1478 im4 = GetImage(ORTHANC, '/dicom-web/studies/%s/series/%s/instances/%s/rendered?window=200,800,linear' % (STUDY, SERIES, INSTANCE), |
325
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1479 headers = { 'Accept' : 'image/png' }) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1480 self.assertEqual('PNG', im4.format) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1481 |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1482 im5 = GetImage(ORTHANC, '/instances/%s/rendered' % i, { 'Accept' : 'image/jpeg' }) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1483 self.assertEqual('JPEG', im5.format) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1484 |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1485 im6 = GetImage(ORTHANC, '/instances/%s/rendered' % i) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1486 self.assertEqual('PNG', im6.format) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1487 |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1488 for im in [ truth, im1, im2, im3, im4, im5, im6 ]: |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1489 self.assertEqual('L', im.mode) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1490 self.assertEqual(512, im.size[0]) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1491 self.assertEqual(512, im.size[1]) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1492 |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1493 # The following fails in DICOMweb plugin <= 1.2, as "/rendered" |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1494 # was redirecting to the "/preview" route of Orthanc |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1495 # http://effbot.org/zone/pil-comparing-images.htm |
434
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1496 self.assertLess(ImageChops.difference(im1, im3).getextrema() [1], 10) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1497 self.assertLess(ImageChops.difference(im2, im4).getextrema() [1], 2) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1498 self.assertLess(ImageChops.difference(im3, im5).getextrema() [1], 10) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1499 self.assertLess(ImageChops.difference(im4, im6).getextrema() [1], 2) |
325
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1500 self.assertTrue(ImageChops.difference(im1, im5).getbbox() is None) |
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1501 self.assertTrue(ImageChops.difference(im2, im6).getbbox() is None) |
345 | 1502 |
1503 bbox = ImageChops.difference(im2, truth).getbbox() | |
346 | 1504 if bbox != None: |
1505 # Tolerance of just 1 pixel of difference (needed on Windows) | |
1506 #print(im2.getpixel((238,275))) # => 255 | |
1507 #print(truth.getpixel((238,275))) # => 254 | |
1508 self.assertLessEqual(abs(bbox[2] - bbox[0]), 1) | |
1509 self.assertLessEqual(abs(bbox[3] - bbox[1]), 1) | |
399
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1510 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1511 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1512 def test_issue_195(self): |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1513 # This fails on Orthanc <= 1.9.2 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1514 # https://bugs.orthanc-server.com/show_bug.cgi?id=195 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1515 a = UploadInstance(ORTHANC, 'Issue195.dcm') ['ID'] |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1516 b = DoGet(ORTHANC, 'dicom-web/studies/1.2.276.0.7230010.3.1.2.8323329.13188.1620309604.848733/series/1.2.276.0.7230010.3.1.3.8323329.13188.1620309604.848734/instances/1.2.276.0.7230010.3.1.4.8323329.13188.1620309604.848735/metadata', |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1517 headers = { 'Accept' : 'application/dicom+json' }) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1518 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1519 self.assertEqual(1, len(b)) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1520 self.assertEqual(5, len(b[0])) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1521 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1522 # The expected result can be found by typing "dcm2json Database/Issue195.dcm" |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1523 self.assertEqual(2, len(b[0]["00080018"])) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1524 self.assertEqual("UI", b[0]["00080018"]["vr"]) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1525 self.assertEqual("1.2.276.0.7230010.3.1.4.8323329.13188.1620309604.848735", |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1526 b[0]["00080018"]["Value"][0]) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1527 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1528 self.assertEqual(2, len(b[0]["0020000D"])) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1529 self.assertEqual("UI", b[0]["0020000D"]["vr"]) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1530 self.assertEqual("1.2.276.0.7230010.3.1.2.8323329.13188.1620309604.848733", |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1531 b[0]["0020000D"]["Value"][0]) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1532 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1533 self.assertEqual(2, len(b[0]["0020000E"])) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1534 self.assertEqual("UI", b[0]["0020000E"]["vr"]) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1535 self.assertEqual("1.2.276.0.7230010.3.1.3.8323329.13188.1620309604.848734", |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1536 b[0]["0020000E"]["Value"][0]) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1537 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1538 self.assertEqual(1, len(b[0]["00081030"])) # Case of an empty value |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1539 self.assertEqual("LO", b[0]["00081030"]["vr"]) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1540 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1541 self.assertEqual(2, len(b[0]["0008103E"])) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1542 self.assertEqual("LO", b[0]["0008103E"]["vr"]) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1543 self.assertEqual("Hello1", b[0]["0008103E"]["Value"][0]) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1544 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1545 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1546 DoDelete(ORTHANC, 'instances/%s' % a) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1547 a = UploadInstance(ORTHANC, 'Issue195-bis.dcm') ['ID'] |
434
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1548 URI = 'dicom-web/studies/1.2.276.0.7230010.3.1.2.8323329.6792.1625504071.652468/series/1.2.276.0.7230010.3.1.3.8323329.6792.1625504071.652469/instances/1.2.276.0.7230010.3.1.4.8323329.6792.1625504071.652470' |
399
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1549 b = DoGet(ORTHANC, '%s/metadata' % URI, |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1550 headers = { 'Accept' : 'application/dicom+json' }) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1551 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1552 self.assertEqual(1, len(b)) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1553 self.assertEqual(5, len(b[0])) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1554 |
434
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1555 # The expected result can be found by typing "dcm2json ../../Database/Issue195-bis.dcm" |
399
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1556 self.assertEqual(2, len(b[0]["00080018"])) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1557 self.assertEqual("UI", b[0]["00080018"]["vr"]) |
434
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1558 self.assertEqual("1.2.276.0.7230010.3.1.4.8323329.6792.1625504071.652470", |
399
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1559 b[0]["00080018"]["Value"][0]) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1560 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1561 self.assertEqual(2, len(b[0]["0020000D"])) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1562 self.assertEqual("UI", b[0]["0020000D"]["vr"]) |
434
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1563 self.assertEqual("1.2.276.0.7230010.3.1.2.8323329.6792.1625504071.652468", |
399
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1564 b[0]["0020000D"]["Value"][0]) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1565 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1566 self.assertEqual(2, len(b[0]["0020000E"])) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1567 self.assertEqual("UI", b[0]["0020000E"]["vr"]) |
434
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1568 self.assertEqual("1.2.276.0.7230010.3.1.3.8323329.6792.1625504071.652469", |
399
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1569 b[0]["0020000E"]["Value"][0]) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1570 |
434
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1571 self.assertEqual(2, len(b[0]["00084567"])) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1572 self.assertEqual("UN", b[0]["00084567"]["vr"]) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1573 self.assertEqual('http://%s:%s%s' % (args.server, args.rest, '/%s/bulk/00084567' % URI), |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1574 b[0]["00084567"]["BulkDataURI"]) |
399
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1575 |
434
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1576 c = DoGet(ORTHANC, '%s/bulk/00084567' % URI) |
399
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1577 self.assertTrue('Content-Length: 2\r\n' in c) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1578 index = c.find('\r\n\r\n') |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1579 self.assertEqual(0x42, ord(c[index + 4])) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1580 self.assertEqual(0x00, ord(c[index + 5])) |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1581 |
dd519677974d
integration tests for issue 195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
1582 # Case of an empty value, fails in Orthanc <= 1.9.2 because of issue #195 |
434
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1583 self.assertEqual(1, len(b[0]["00084565"])) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1584 self.assertEqual("UN", b[0]["00084565"]["vr"]) |
325
b7c2fb8e1b57
DICOMweb: test_compare_wado_uri_and_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
321
diff
changeset
|
1585 |
273
afcd550a9216
test_multiple_mime_accept_wado_rs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
1586 |
434
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1587 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1588 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1589 def test_multiframe_windowing(self): |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1590 # Fixed in DICOMweb 1.7 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1591 def GetLinear(x, c, w): |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1592 # http://dicom.nema.org/MEDICAL/dicom/2019a/output/chtml/part03/sect_C.11.2.html#sect_C.11.2.1.2.1 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1593 ymin = 0.0 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1594 ymax = 255.0 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1595 if float(x) <= float(c) - 0.5 - (float(w) - 1.0) / 2.0: |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1596 return ymin |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1597 elif float(x) > float(c) - 0.5 + (float(w) - 1.0) / 2.0 : |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1598 return ymax |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1599 else: |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1600 return ((float(x) - (float(c) - 0.5)) / (float(w) - 1.0) + 0.5) * (ymax - ymin) + ymin |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1601 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1602 def GetLinearExact(x, c, w): |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1603 # http://dicom.nema.org/MEDICAL/dicom/2019a/output/chtml/part03/sect_C.11.2.html#sect_C.11.2.1.3.2 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1604 ymin = 0.0 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1605 ymax = 255.0 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1606 if float(x) <= float(c) - float(w) / 2.0: |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1607 return ymin |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1608 elif float(x) > float(c) + float(w) / 2.0: |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1609 return ymax |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1610 else: |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1611 return (float(x) - float(c)) / float(w) * (ymax- ymin) + ymin |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1612 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1613 def GetSigmoid(x, c, w): |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1614 # http://dicom.nema.org/MEDICAL/dicom/2019a/output/chtml/part03/sect_C.11.2.html#sect_C.11.2.1.3.1 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1615 ymin = 0.0 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1616 ymax = 255.0 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1617 return (ymax - ymin) / (1.0 + math.exp(-4 * (float(x) - float(c)) / float(w))) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1618 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1619 self.assertAlmostEqual(GetLinear(10, 0, 100), 154.54545454545456) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1620 self.assertAlmostEqual(GetLinear(-1000, 2048, 4096), 0) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1621 self.assertAlmostEqual(GetLinear(5096, 2048, 4096), 255) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1622 self.assertAlmostEqual(GetLinear(333, 2048, 4096), 20.7362637362637) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1623 self.assertAlmostEqual(GetLinear(16, 127, 256), 17) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1624 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1625 self.assertAlmostEqual(GetLinearExact(-1000, 2048, 4096), 0) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1626 self.assertAlmostEqual(GetLinearExact(5096, 2048, 4096), 255) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1627 self.assertAlmostEqual(GetLinearExact(150, 127, 256), 22.91015625) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1628 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1629 self.assertAlmostEqual(GetSigmoid(150, 127, 256), 150.166728345797) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1630 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1631 UploadInstance(ORTHANC, 'MultiframeWindowing.dcm') |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1632 STUDY = '1.2.840.113619.2.176.2025.1499492.7391.1175285944.390' |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1633 SERIES = '1.2.840.113619.2.176.2025.1499492.7391.1175285944.394' |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1634 INSTANCE = '1.2.840.113619.2.176.2025.1499492.7040.1175286242.109' |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1635 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1636 im = GetImage(ORTHANC, '/dicom-web/studies/%s/series/%s/instances/%s/frames/1/rendered?window=127,256,linear' % (STUDY, SERIES, INSTANCE)) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1637 self.assertLessEqual(abs(GetLinear(0x00, 127, 256) - im.getpixel((0, 0))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1638 self.assertLessEqual(abs(GetLinear(0x10, 127, 256) - im.getpixel((1, 0))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1639 self.assertLessEqual(abs(GetLinear(0x20, 127, 256) - im.getpixel((0, 1))), 1.1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1640 self.assertLessEqual(abs(GetLinear(0x30, 127, 256) - im.getpixel((1, 1))), 1.1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1641 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1642 im = GetImage(ORTHANC, '/dicom-web/studies/%s/series/%s/instances/%s/frames/1/rendered?window=0,256,linear-exact' % (STUDY, SERIES, INSTANCE)) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1643 self.assertLessEqual(abs(GetLinearExact(0x00, 0, 256) - im.getpixel((0, 0))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1644 self.assertLessEqual(abs(GetLinearExact(0x10, 0, 256) - im.getpixel((1, 0))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1645 self.assertLessEqual(abs(GetLinearExact(0x20, 0, 256) - im.getpixel((0, 1))), 1.2) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1646 self.assertLessEqual(abs(GetLinearExact(0x30, 0, 256) - im.getpixel((1, 1))), 1.2) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1647 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1648 im = GetImage(ORTHANC, '/dicom-web/studies/%s/series/%s/instances/%s/frames/1/rendered?window=127,256,sigmoid' % (STUDY, SERIES, INSTANCE)) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1649 self.assertLessEqual(abs(GetSigmoid(0x00, 127, 256) - im.getpixel((0, 0))), 3) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1650 self.assertLessEqual(abs(GetSigmoid(0x10, 127, 256) - im.getpixel((1, 0))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1651 self.assertLessEqual(abs(GetSigmoid(0x20, 127, 256) - im.getpixel((0, 1))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1652 self.assertLessEqual(abs(GetSigmoid(0x30, 127, 256) - im.getpixel((1, 1))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1653 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1654 im = GetImage(ORTHANC, '/dicom-web/studies/%s/series/%s/instances/%s/frames/1/rendered?window=16,128,linear' % (STUDY, SERIES, INSTANCE)) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1655 self.assertLessEqual(abs(GetLinear(0x00, 16, 128) - im.getpixel((0, 0))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1656 self.assertLessEqual(abs(GetLinear(0x10, 16, 128) - im.getpixel((1, 0))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1657 self.assertLessEqual(abs(GetLinear(0x20, 16, 128) - im.getpixel((0, 1))), 2) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1658 self.assertLessEqual(abs(GetLinear(0x30, 16, 128) - im.getpixel((1, 1))), 2) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1659 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1660 im = GetImage(ORTHANC, '/dicom-web/studies/%s/series/%s/instances/%s/frames/2/rendered?window=127,256,linear' % (STUDY, SERIES, INSTANCE)) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1661 ri = 100.0 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1662 rs = 1.0 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1663 self.assertLessEqual(abs(GetLinear(0x00 * rs + ri, 127, 256) - im.getpixel((0, 0))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1664 self.assertLessEqual(abs(GetLinear(0x10 * rs + ri, 127, 256) - im.getpixel((1, 0))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1665 self.assertLessEqual(abs(GetLinear(0x20 * rs + ri, 127, 256) - im.getpixel((0, 1))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1666 self.assertLessEqual(abs(GetLinear(0x30 * rs + ri, 127, 256) - im.getpixel((1, 1))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1667 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1668 im = GetImage(ORTHANC, '/dicom-web/studies/%s/series/%s/instances/%s/frames/3/rendered?window=127,256,linear' % (STUDY, SERIES, INSTANCE)) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1669 ri = 0.0 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1670 rs = 2.0 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1671 self.assertLessEqual(abs(GetLinear(0x00 * rs + ri, 127, 256) - im.getpixel((0, 0))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1672 self.assertLessEqual(abs(GetLinear(0x10 * rs + ri, 127, 256) - im.getpixel((1, 0))), 1.1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1673 self.assertLessEqual(abs(GetLinear(0x20 * rs + ri, 127, 256) - im.getpixel((0, 1))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1674 self.assertLessEqual(abs(GetLinear(0x30 * rs + ri, 127, 256) - im.getpixel((1, 1))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1675 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1676 im = GetImage(ORTHANC, '/dicom-web/studies/%s/series/%s/instances/%s/frames/4/rendered?window=127,256,linear' % (STUDY, SERIES, INSTANCE)) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1677 ri = 100.0 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1678 rs = 2.0 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1679 self.assertLessEqual(abs(GetLinear(0x00 * rs + ri, 127, 256) - im.getpixel((0, 0))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1680 self.assertLessEqual(abs(GetLinear(0x10 * rs + ri, 127, 256) - im.getpixel((1, 0))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1681 self.assertLessEqual(abs(GetLinear(0x20 * rs + ri, 127, 256) - im.getpixel((0, 1))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1682 self.assertLessEqual(abs(GetLinear(0x30 * rs + ri, 127, 256) - im.getpixel((1, 1))), 1) |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1683 |
2c142e070f19
dicomweb: added test_multiframe_windowing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1684 |
532 | 1685 def test_forwarded_headers(self): |
1686 study = UploadInstance(ORTHANC, 'ColorTestImageJ.dcm')['ParentStudy'] | |
1687 studyId = DoGet(ORTHANC, '/studies/%s' % study)['MainDicomTags']['StudyInstanceUID'] | |
1688 | |
1689 m = DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % studyId) | |
533 | 1690 self.assertIn(ORTHANC['Url'], m[0][u'7FE00010']['BulkDataURI']) |
532 | 1691 |
1692 m = DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % studyId, headers= { | |
1693 'host': 'my-domain' | |
1694 }) | |
1695 self.assertIn("http://my-domain/dicom-web", m[0][u'7FE00010']['BulkDataURI']) | |
1696 | |
1697 m = DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % studyId, headers= { | |
1698 'forwarded': 'host=my-domain;proto=https' | |
1699 }) | |
1700 self.assertIn("https://my-domain/dicom-web", m[0][u'7FE00010']['BulkDataURI']) | |
1701 | |
1702 if IsPluginVersionAbove(ORTHANC, "dicom-web", 1, 13, 1): | |
1703 m = DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % studyId, headers= { | |
1704 'X-Forwarded-Host': 'my-domain', | |
1705 'X-Forwarded-Proto': 'https' | |
1706 }) | |
1707 self.assertIn("https://my-domain/dicom-web", m[0][u'7FE00010']['BulkDataURI']) | |
1708 | |
1709 | |
1710 | |
32
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1711 try: |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1712 print('\nStarting the tests...') |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1713 unittest.main(argv = [ sys.argv[0] ] + args.options) |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1714 |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1715 finally: |
682c4e2a1162
integration tests for wado
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1716 print('\nDone') |