Mercurial > hg > orthanc-tests
annotate Plugins/WSI/Run.py @ 735:be8f174d3c9d find-refactoring tip
tools/find: Limit and Since are now forbidden when filtering on DICOM tags that are not stored in DB
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Thu, 24 Oct 2024 15:08:59 +0200 |
parents | 54d382626bfd |
children | d2ac1c6588db |
rev | line source |
---|---|
251 | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | |
3 | |
4 | |
5 # Orthanc - A Lightweight, RESTful DICOM Store | |
6 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
7 # Department, University Hospital of Liege, Belgium | |
649
5d7b6e43ab7d
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
640
diff
changeset
|
8 # Copyright (C) 2017-2023 Osimis S.A., Belgium |
5d7b6e43ab7d
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
640
diff
changeset
|
9 # Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
640
9f8276ac1cdd
update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
588
diff
changeset
|
10 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
251 | 11 # |
12 # This program is free software: you can redistribute it and/or | |
13 # modify it under the terms of the GNU General Public License as | |
14 # published by the Free Software Foundation, either version 3 of the | |
15 # License, or (at your option) any later version. | |
16 # | |
17 # This program is distributed in the hope that it will be useful, but | |
18 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
20 # General Public License for more details. | |
21 # | |
22 # You should have received a copy of the GNU General Public License | |
23 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
24 | |
25 | |
26 import argparse | |
27 import os | |
28 import pprint | |
29 import re | |
30 import subprocess | |
31 import sys | |
32 import tempfile | |
33 import unittest | |
34 from shutil import copyfile | |
35 | |
36 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'Tests')) | |
37 from Toolbox import * | |
38 | |
39 | |
40 ## | |
41 ## Parse the command-line arguments | |
42 ## | |
43 | |
44 parser = argparse.ArgumentParser(description = 'Run the integration tests for the WSI Dicomizer.') | |
45 | |
46 parser.add_argument('--server', | |
47 default = 'localhost', | |
48 help = 'Address of the Orthanc server to test') | |
49 parser.add_argument('--rest', | |
50 type = int, | |
51 default = 8042, | |
52 help = 'Port to the REST API') | |
53 parser.add_argument('--username', | |
54 default = 'alice', | |
55 help = 'Username to the REST API') | |
56 parser.add_argument('--password', | |
57 default = 'orthanctest', | |
58 help = 'Password to the REST API') | |
59 parser.add_argument('--dicomizer', | |
568
6399d3a1cd30
WSI: fix compatibility with Python 3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
567
diff
changeset
|
60 default = os.path.join(os.environ['HOME'], 'Subversion/orthanc-wsi/Applications/i/OrthancWSIDicomizer'), |
251 | 61 help = 'Password to the REST API') |
62 parser.add_argument('--to-tiff', | |
568
6399d3a1cd30
WSI: fix compatibility with Python 3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
567
diff
changeset
|
63 default = os.path.join(os.environ['HOME'], 'Subversion/orthanc-wsi/Applications/i/OrthancWSIDicomToTiff'), |
251 | 64 help = 'Password to the REST API') |
252 | 65 parser.add_argument('--valgrind', help = 'Use valgrind while running the DICOM-izer', |
66 action = 'store_true') | |
251 | 67 parser.add_argument('--force', help = 'Do not warn the user', |
68 action = 'store_true') | |
69 parser.add_argument('options', metavar = 'N', nargs = '*', | |
70 help='Arguments to Python unittest') | |
71 | |
72 args = parser.parse_args() | |
73 | |
74 if not args.force: | |
75 print(""" | |
76 WARNING: This test will remove all the content of your | |
77 Orthanc instance running on %s! | |
78 | |
79 Are you sure ["yes" to go on]?""" % args.server) | |
80 | |
81 if sys.stdin.readline().strip() != 'yes': | |
82 print('Aborting...') | |
83 exit(0) | |
84 | |
85 | |
86 | |
87 | |
88 ## | |
89 ## The tests | |
90 ## | |
91 | |
92 ORTHANC = DefineOrthanc(server = args.server, | |
93 username = args.username, | |
94 password = args.password, | |
95 restPort = args.rest) | |
96 | |
253 | 97 def CallCommand(command): |
252 | 98 prefix = [] |
99 if args.valgrind: | |
100 prefix = [ 'valgrind' ] | |
101 | |
253 | 102 log = subprocess.check_output(prefix + command, |
252 | 103 stderr=subprocess.STDOUT) |
571 | 104 |
105 if sys.version_info >= (3, 0): | |
106 log = log.decode('ascii') | |
107 | |
252 | 108 # If using valgrind, only print the lines from the log starting |
109 # with '==' (they contain the report from valgrind) | |
110 if args.valgrind: | |
111 print('\n'.join(filter(lambda x: x.startswith('=='), log.splitlines()))) | |
251 | 112 |
253 | 113 |
114 def CallDicomizer(suffix): | |
115 CallCommand([ args.dicomizer, | |
460 | 116 '--orthanc=http://%s:%s' % (args.server, args.rest), |
253 | 117 '--username=%s' % args.username, |
459 | 118 '--password=%s' % args.password ] + suffix |
119 ) | |
253 | 120 |
121 | |
122 def CallDicomToTiff(suffix): | |
316 | 123 CallCommand([ args.to_tiff, |
460 | 124 '--orthanc=http://%s:%s' % (args.server, args.rest), |
316 | 125 '--username=%s' % args.username, |
126 '--password=%s' % args.password ] + suffix) | |
253 | 127 |
128 | |
129 def CallTiffInfoOnSeries(series): | |
130 with tempfile.NamedTemporaryFile(delete = False) as temp: | |
131 temp.close() | |
132 CallDicomToTiff([ series, temp.name ]) | |
316 | 133 try: |
134 tiff = subprocess.check_output([ 'tiffinfo', temp.name ]) | |
135 except: | |
136 print('\ntiffinfo is probably not installed => sudo apt-get install libtiff-tools\n') | |
137 tiff = None | |
568
6399d3a1cd30
WSI: fix compatibility with Python 3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
567
diff
changeset
|
138 |
6399d3a1cd30
WSI: fix compatibility with Python 3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
567
diff
changeset
|
139 if (tiff != None and sys.version_info >= (3, 0)): |
6399d3a1cd30
WSI: fix compatibility with Python 3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
567
diff
changeset
|
140 tiff = tiff.decode('ascii') |
316 | 141 |
253 | 142 os.unlink(temp.name) |
143 | |
144 return tiff | |
145 | |
251 | 146 |
147 class Orthanc(unittest.TestCase): | |
148 def setUp(self): | |
149 if (sys.version_info >= (3, 0)): | |
150 # Remove annoying warnings about unclosed socket in Python 3 | |
151 import warnings | |
152 warnings.simplefilter("ignore", ResourceWarning) | |
153 | |
154 DropOrthanc(ORTHANC) | |
155 | |
156 | |
157 def test_single(self): | |
158 CallDicomizer([ GetDatabasePath('Lena.jpg') ]) | |
159 | |
160 i = DoGet(ORTHANC, '/instances') | |
161 self.assertEqual(1, len(i)) | |
162 | |
163 tags = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i[0]) | |
164 self.assertEqual(1, int(tags['NumberOfFrames'])) | |
165 self.assertEqual(512, int(tags['Columns'])) | |
166 self.assertEqual(512, int(tags['Rows'])) | |
167 self.assertEqual('YBR_FULL_422', tags['PhotometricInterpretation']) | |
168 | |
169 s = DoGet(ORTHANC, '/series') | |
170 self.assertEqual(1, len(s)) | |
171 | |
172 pyramid = DoGet(ORTHANC, '/wsi/pyramids/%s' % s[0]) | |
173 self.assertEqual(s[0], pyramid['ID']) | |
174 self.assertEqual(1, len(pyramid['Resolutions'])) | |
175 self.assertEqual(1, len(pyramid['Sizes'])) | |
176 self.assertEqual(1, len(pyramid['TilesCount'])) | |
177 self.assertEqual(1, pyramid['Resolutions'][0]) | |
178 self.assertEqual(512, pyramid['Sizes'][0][0]) | |
179 self.assertEqual(512, pyramid['Sizes'][0][1]) | |
364
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
180 self.assertEqual(1, len(pyramid['TilesSizes'])) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
181 self.assertEqual(2, len(pyramid['TilesSizes'][0])) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
182 self.assertEqual(512, pyramid['TilesSizes'][0][0]) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
183 self.assertEqual(512, pyramid['TilesSizes'][0][1]) |
251 | 184 self.assertEqual(512, pyramid['TotalWidth']) |
185 self.assertEqual(512, pyramid['TotalHeight']) | |
186 self.assertEqual(1, pyramid['TilesCount'][0][0]) | |
187 self.assertEqual(1, pyramid['TilesCount'][0][1]) | |
188 | |
253 | 189 tiff = CallTiffInfoOnSeries(s[0]) |
568
6399d3a1cd30
WSI: fix compatibility with Python 3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
567
diff
changeset
|
190 p = list(filter(lambda x: 'Photometric Interpretation' in x, tiff.splitlines())) |
253 | 191 self.assertEqual(1, len(p)) |
192 self.assertTrue('YCbCr' in p[0]) | |
193 | |
251 | 194 |
195 def test_grayscale_pyramid(self): | |
196 CallDicomizer([ GetDatabasePath('LenaGrayscale.png'), '--tile-width=64', '--tile-height=64' ]) | |
197 | |
198 i = DoGet(ORTHANC, '/instances') | |
199 self.assertEqual(4, len(i)) | |
200 | |
201 for j in range(4): | |
202 tags = DoGet(ORTHANC, '/instances/%s/tags?simplify' % i[j]) | |
203 self.assertEqual(64, int(tags['Columns'])) | |
204 self.assertEqual(64, int(tags['Rows'])) | |
205 self.assertEqual('MONOCHROME2', tags['PhotometricInterpretation']) | |
206 | |
207 s = DoGet(ORTHANC, '/series') | |
208 self.assertEqual(1, len(s)) | |
209 | |
210 pyramid = DoGet(ORTHANC, '/wsi/pyramids/%s' % s[0]) | |
211 self.assertEqual(s[0], pyramid['ID']) | |
212 self.assertEqual(4, len(pyramid['Resolutions'])) | |
213 self.assertEqual(4, len(pyramid['Sizes'])) | |
214 self.assertEqual(4, len(pyramid['TilesCount'])) | |
364
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
215 self.assertEqual(4, len(pyramid['TilesSizes'])) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
216 |
251 | 217 self.assertEqual(1, pyramid['Resolutions'][0]) |
218 self.assertEqual(2, pyramid['Resolutions'][1]) | |
219 self.assertEqual(4, pyramid['Resolutions'][2]) | |
220 self.assertEqual(8, pyramid['Resolutions'][3]) | |
221 self.assertEqual(512, pyramid['Sizes'][0][0]) | |
222 self.assertEqual(512, pyramid['Sizes'][0][1]) | |
223 self.assertEqual(256, pyramid['Sizes'][1][0]) | |
224 self.assertEqual(256, pyramid['Sizes'][1][1]) | |
225 self.assertEqual(128, pyramid['Sizes'][2][0]) | |
226 self.assertEqual(128, pyramid['Sizes'][2][1]) | |
227 self.assertEqual(64, pyramid['Sizes'][3][0]) | |
228 self.assertEqual(64, pyramid['Sizes'][3][1]) | |
364
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
229 for i in range(4): |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
230 self.assertEqual(2, len(pyramid['TilesSizes'][i])) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
231 self.assertEqual(64, pyramid['TilesSizes'][i][0]) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
232 self.assertEqual(64, pyramid['TilesSizes'][i][1]) |
251 | 233 self.assertEqual(512, pyramid['TotalWidth']) |
234 self.assertEqual(512, pyramid['TotalHeight']) | |
235 self.assertEqual(8, pyramid['TilesCount'][0][0]) | |
236 self.assertEqual(8, pyramid['TilesCount'][0][1]) | |
237 self.assertEqual(4, pyramid['TilesCount'][1][0]) | |
238 self.assertEqual(4, pyramid['TilesCount'][1][1]) | |
239 self.assertEqual(2, pyramid['TilesCount'][2][0]) | |
240 self.assertEqual(2, pyramid['TilesCount'][2][1]) | |
241 self.assertEqual(1, pyramid['TilesCount'][3][0]) | |
242 self.assertEqual(1, pyramid['TilesCount'][3][1]) | |
253 | 243 |
244 tiff = CallTiffInfoOnSeries(s[0]) | |
568
6399d3a1cd30
WSI: fix compatibility with Python 3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
567
diff
changeset
|
245 p = list(filter(lambda x: 'Photometric Interpretation' in x, tiff.splitlines())) |
253 | 246 self.assertEqual(4, len(p)) |
247 for j in range(4): | |
248 self.assertTrue('min-is-black' in p[j]) | |
249 | |
250 | |
251 def test_import_tiff_grayscale(self): | |
252 CallDicomizer([ GetDatabasePath('WSI/LenaGrayscaleJpeg.tiff') ]) | |
253 | |
254 s = DoGet(ORTHANC, '/series') | |
255 self.assertEqual(1, len(s)) | |
256 | |
257 pyramid = DoGet(ORTHANC, '/wsi/pyramids/%s' % s[0]) | |
258 self.assertEqual(4, len(pyramid['Resolutions'])) | |
259 | |
260 tiff = CallTiffInfoOnSeries(s[0]) | |
568
6399d3a1cd30
WSI: fix compatibility with Python 3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
567
diff
changeset
|
261 p = list(filter(lambda x: 'Photometric Interpretation' in x, tiff.splitlines())) |
253 | 262 self.assertEqual(4, len(p)) |
263 for j in range(4): | |
264 self.assertTrue('min-is-black' in p[j]) | |
265 | |
266 | |
267 def test_import_tiff_ycbcr(self): | |
268 CallDicomizer([ GetDatabasePath('WSI/LenaColorJpegYCbCr.tiff') ]) | |
269 | |
270 s = DoGet(ORTHANC, '/series') | |
271 self.assertEqual(1, len(s)) | |
272 | |
273 pyramid = DoGet(ORTHANC, '/wsi/pyramids/%s' % s[0]) | |
274 self.assertEqual(4, len(pyramid['Resolutions'])) | |
275 | |
276 tiff = CallTiffInfoOnSeries(s[0]) | |
568
6399d3a1cd30
WSI: fix compatibility with Python 3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
567
diff
changeset
|
277 p = list(filter(lambda x: 'Photometric Interpretation' in x, tiff.splitlines())) |
253 | 278 self.assertEqual(4, len(p)) |
279 for j in range(4): | |
280 self.assertTrue('YCbCr' in p[j]) | |
281 | |
282 | |
283 def test_import_tiff_rgb(self): | |
284 CallDicomizer([ GetDatabasePath('WSI/LenaColorJpegRGB.tiff') ]) | |
285 | |
286 s = DoGet(ORTHANC, '/series') | |
287 self.assertEqual(1, len(s)) | |
288 | |
289 pyramid = DoGet(ORTHANC, '/wsi/pyramids/%s' % s[0]) | |
290 self.assertEqual(4, len(pyramid['Resolutions'])) | |
291 | |
292 tiff = CallTiffInfoOnSeries(s[0]) | |
568
6399d3a1cd30
WSI: fix compatibility with Python 3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
567
diff
changeset
|
293 p = list(filter(lambda x: 'Photometric Interpretation' in x, tiff.splitlines())) |
253 | 294 self.assertEqual(4, len(p)) |
295 for j in range(4): | |
296 self.assertTrue('RGB' in p[j]) | |
297 | |
364
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
298 |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
299 def test_concatenation(self): |
588
8aa101e126d0
migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
571
diff
changeset
|
300 # https://orthanc.uclouvain.be/bugs/show_bug.cgi?id=145 |
364
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
301 CallDicomizer([ GetDatabasePath('LenaGrayscale.png'), '--levels=1', ]) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
302 i = DoGet(ORTHANC, '/instances') |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
303 self.assertEqual(1, len(i)) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
304 tags = DoGet(ORTHANC, '/instances/%s/tags?short' % i[0]) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
305 self.assertTrue('0020,0242' in tags) # SOP Instance UID of Concatenation Source |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
306 self.assertTrue('0020,9161' in tags) # Concatenation UID |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
307 self.assertTrue('0020,9162' in tags) # In-concatenation Number |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
308 self.assertTrue('0020,9228' in tags) # Concatenation Frame Offset Number |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
309 self.assertEqual('1', tags['0020,9162']) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
310 self.assertEqual('0', tags['0020,9228']) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
311 |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
312 DropOrthanc(ORTHANC) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
313 |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
314 # "--max-size" disables the concatenation |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
315 CallDicomizer([ GetDatabasePath('LenaGrayscale.png'), '--levels=1', '--max-size=0' ]) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
316 i = DoGet(ORTHANC, '/instances') |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
317 self.assertEqual(1, len(i)) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
318 tags = DoGet(ORTHANC, '/instances/%s/tags?short' % i[0]) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
319 self.assertFalse('0020,0242' in tags) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
320 self.assertFalse('0020,9161' in tags) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
321 self.assertFalse('0020,9162' in tags) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
322 self.assertFalse('0020,9228' in tags) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
323 |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
324 DropOrthanc(ORTHANC) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
325 |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
326 # This creates a series with 2 instances of roughly 1.5MB (= 2 frames x 512 x 512 x 3 (RGB24) + DICOM overhead) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
327 CallDicomizer([ GetDatabasePath('WSI/Lena2x2.png'), '--levels=1', '--max-size=1', '--compression=none' ]) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
328 i = DoGet(ORTHANC, '/instances') |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
329 self.assertEqual(2, len(i)) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
330 t1 = DoGet(ORTHANC, '/instances/%s/tags?short' % i[0]) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
331 t2 = DoGet(ORTHANC, '/instances/%s/tags?short' % i[1]) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
332 self.assertTrue('0020,0242' in t1) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
333 self.assertTrue('0020,9161' in t1) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
334 self.assertTrue('0020,9162' in t1) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
335 self.assertTrue('0020,9228' in t1) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
336 self.assertEqual(t1['0020,0242'], t2['0020,0242']) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
337 self.assertEqual(t1['0020,9161'], t2['0020,9161']) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
338 if t1['0020,9162'] == '1': |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
339 self.assertEqual('1', t1['0020,9162']) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
340 self.assertEqual('0', t1['0020,9228']) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
341 self.assertEqual('2', t2['0020,9162']) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
342 self.assertEqual('2', t2['0020,9228']) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
343 else: |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
344 self.assertEqual('1', t2['0020,9162']) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
345 self.assertEqual('0', t2['0020,9228']) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
346 self.assertEqual('2', t1['0020,9162']) |
6fa8218cf8db
wsi: test_concatenation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
347 self.assertEqual('2', t1['0020,9228']) |
365
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
348 |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
349 |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
350 def test_pixel_spacing(self): |
588
8aa101e126d0
migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
571
diff
changeset
|
351 # https://orthanc.uclouvain.be/bugs/show_bug.cgi?id=139 |
365
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
352 CallDicomizer([ GetDatabasePath('LenaGrayscale.png'), # Image is 512x512 |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
353 '--levels=4', '--tile-width=64', '--tile-height=64', '--max-size=0', |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
354 '--imaged-width=20', '--imaged-height=10' ]) |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
355 |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
356 instances = DoGet(ORTHANC, '/instances') |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
357 self.assertEqual(4, len(instances)) |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
358 |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
359 spacings = {} |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
360 for i in instances: |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
361 t = DoGet(ORTHANC, '/instances/%s/tags?short' % i) |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
362 spacings[t['0028,0008']] = t['5200,9229'][0]['0028,9110'][0]['0028,0030'] |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
363 |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
364 self.assertEqual(4, len(spacings)) |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
365 for i in range(4): |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
366 s = spacings[str(4 ** i)].split('\\') |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
367 self.assertEqual(2, len(s)) |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
368 self.assertEqual(20.0 / 512.0 * (2.0 ** (3 - i)), float(s[0])) |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
369 self.assertEqual(10.0 / 512.0 * (2.0 ** (3 - i)), float(s[1])) |
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
370 |
567
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
371 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
372 def test_http_accept(self): |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
373 # https://discourse.orthanc-server.org/t/orthanc-wsi-image-quality-issue/3331 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
374 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
375 def TestTransferSyntax(s, expected): |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
376 instance = DoGet(ORTHANC, '/series/%s' % s[0]) ['Instances'][0] |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
377 self.assertEqual(expected, DoGet(ORTHANC, '/instances/%s/metadata/TransferSyntax' % instance)) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
378 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
379 def TestDefaultAccept(s, mime): |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
380 tile = GetImage(ORTHANC, '/wsi/tiles/%s/0/0/0' % s[0]) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
381 self.assertEqual(mime, tile.format) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
382 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
383 tile = GetImage(ORTHANC, '/wsi/tiles/%s/0/0/0' % s[0], { |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
384 'Accept' : 'text/html,*/*' |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
385 }) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
386 self.assertEqual(mime, tile.format) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
387 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
388 tile = GetImage(ORTHANC, '/wsi/tiles/%s/0/0/0' % s[0], { |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
389 'Accept' : 'image/*,text/html' |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
390 }) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
391 self.assertEqual(mime, tile.format) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
392 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
393 tile = DoGetRaw(ORTHANC, '/wsi/tiles/%s/0/0/0' % s[0], headers = { |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
394 'Accept' : 'text/html' |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
395 }) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
396 self.assertEqual(406, int(tile[0]['status'])) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
397 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
398 def TestForceAccept(s): |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
399 tile = GetImage(ORTHANC, '/wsi/tiles/%s/0/0/0' % s[0], { |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
400 'Accept' : 'image/jpeg' |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
401 }) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
402 self.assertEqual('JPEG', tile.format) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
403 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
404 tile = GetImage(ORTHANC, '/wsi/tiles/%s/0/0/0' % s[0], { |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
405 'Accept' : 'image/png' |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
406 }) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
407 self.assertEqual('PNG', tile.format) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
408 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
409 tile = GetImage(ORTHANC, '/wsi/tiles/%s/0/0/0' % s[0], { |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
410 'Accept' : 'image/jp2' |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
411 }) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
412 self.assertEqual('JPEG2000', tile.format) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
413 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
414 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
415 CallDicomizer([ GetDatabasePath('Lena.jpg') ]) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
416 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
417 s = DoGet(ORTHANC, '/series') |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
418 self.assertEqual(1, len(s)) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
419 TestTransferSyntax(s, '1.2.840.10008.1.2.4.50') |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
420 TestDefaultAccept(s, 'JPEG') |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
421 TestForceAccept(s) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
422 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
423 DoDelete(ORTHANC, '/series/%s' % s[0]) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
424 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
425 CallDicomizer([ GetDatabasePath('Lena.jpg'), '--compression', 'none' ]) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
426 s = DoGet(ORTHANC, '/series') |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
427 self.assertEqual(1, len(s)) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
428 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
429 TestTransferSyntax(s, '1.2.840.10008.1.2') |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
430 TestDefaultAccept(s, 'PNG') |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
431 TestForceAccept(s) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
432 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
433 DoDelete(ORTHANC, '/series/%s' % s[0]) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
434 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
435 CallDicomizer([ GetDatabasePath('Lena.jpg'), '--compression', 'jpeg2000' ]) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
436 s = DoGet(ORTHANC, '/series') |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
437 self.assertEqual(1, len(s)) |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
438 |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
439 TestTransferSyntax(s, '1.2.840.10008.1.2.4.90') |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
440 TestDefaultAccept(s, 'PNG') |
13169c8ddc96
added test_http_accept for WSI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
511
diff
changeset
|
441 TestForceAccept(s) |
365
27cb0b60f2d3
wsi: test_pixel_spacing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
364
diff
changeset
|
442 |
569
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
443 def test_iiif(self): |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
444 CallDicomizer([ GetDatabasePath('LenaGrayscale.png'), # Image is 512x512 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
445 '--levels=3', '--tile-width=128', '--tile-height=128' ]) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
446 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
447 self.assertEqual(3, len(DoGet(ORTHANC, '/instances'))) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
448 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
449 s = DoGet(ORTHANC, '/series') |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
450 self.assertEqual(1, len(s)) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
451 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
452 uri = '/wsi/iiif/tiles/%s' % s[0] |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
453 info = DoGet(ORTHANC, '%s/info.json' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
454 self.assertEqual('http://iiif.io/api/image/3/context.json', info['@context']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
455 self.assertEqual('http://iiif.io/api/image', info['protocol']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
456 self.assertEqual('http://localhost:8042%s' % uri, info['id']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
457 self.assertEqual('level0', info['profile']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
458 self.assertEqual('ImageService3', info['type']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
459 self.assertEqual(512, info['width']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
460 self.assertEqual(512, info['height']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
461 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
462 self.assertEqual(3, len(info['sizes'])) |
670 | 463 |
464 if IsPluginVersionAbove(ORTHANC, "wsi", 2, 1, 0): # https://orthanc.uclouvain.be/hg/orthanc-wsi/rev/9dc7f1e8716d | |
465 self.assertEqual(512, info['sizes'][2]['width']) | |
466 self.assertEqual(512, info['sizes'][2]['height']) | |
467 self.assertEqual(256, info['sizes'][1]['width']) | |
468 self.assertEqual(256, info['sizes'][1]['height']) | |
469 self.assertEqual(128, info['sizes'][0]['width']) | |
470 self.assertEqual(128, info['sizes'][0]['height']) | |
471 else: | |
472 self.assertEqual(512, info['sizes'][0]['width']) | |
473 self.assertEqual(512, info['sizes'][0]['height']) | |
474 self.assertEqual(256, info['sizes'][1]['width']) | |
475 self.assertEqual(256, info['sizes'][1]['height']) | |
476 self.assertEqual(128, info['sizes'][2]['width']) | |
477 self.assertEqual(128, info['sizes'][2]['height']) | |
569
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
478 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
479 self.assertEqual(1, len(info['tiles'])) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
480 self.assertEqual(128, info['tiles'][0]['width']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
481 self.assertEqual(128, info['tiles'][0]['height']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
482 self.assertEqual([ 1, 2, 4 ], info['tiles'][0]['scaleFactors']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
483 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
484 # The list of URIs below was generated by "orthanc-wsi/Resources/TestIIIFTiles.py" |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
485 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
486 # Level 0 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
487 GetImage(ORTHANC, '/%s/0,0,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
488 GetImage(ORTHANC, '/%s/128,0,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
489 GetImage(ORTHANC, '/%s/256,0,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
490 GetImage(ORTHANC, '/%s/384,0,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
491 GetImage(ORTHANC, '/%s/0,128,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
492 GetImage(ORTHANC, '/%s/128,128,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
493 GetImage(ORTHANC, '/%s/256,128,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
494 GetImage(ORTHANC, '/%s/384,128,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
495 GetImage(ORTHANC, '/%s/0,256,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
496 GetImage(ORTHANC, '/%s/128,256,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
497 GetImage(ORTHANC, '/%s/256,256,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
498 GetImage(ORTHANC, '/%s/384,256,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
499 GetImage(ORTHANC, '/%s/0,384,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
500 GetImage(ORTHANC, '/%s/128,384,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
501 GetImage(ORTHANC, '/%s/256,384,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
502 GetImage(ORTHANC, '/%s/384,384,128,128/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
503 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
504 # Level 1 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
505 GetImage(ORTHANC, '/%s/0,0,256,256/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
506 GetImage(ORTHANC, '/%s/256,0,256,256/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
507 GetImage(ORTHANC, '/%s/0,256,256,256/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
508 GetImage(ORTHANC, '/%s/256,256,256,256/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
509 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
510 # Level 2 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
511 i = GetImage(ORTHANC, '/%s/0,0,512,512/128,128/0/default.jpg' % uri) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
512 self.assertEqual(128, i.width) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
513 self.assertEqual(128, i.height) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
514 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
515 uri2 = '/wsi/iiif/series/%s/manifest.json' % s[0] |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
516 manifest = DoGet(ORTHANC, uri2) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
517 self.assertEqual('http://iiif.io/api/presentation/3/context.json', manifest['@context']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
518 self.assertEqual('http://localhost:8042%s' % uri2, manifest['id']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
519 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
520 self.assertEqual(1, len(manifest['items'])) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
521 self.assertEqual(1, len(manifest['items'][0]['items'])) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
522 self.assertEqual(1, len(manifest['items'][0]['items'][0]['items'])) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
523 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
524 self.assertEqual('Manifest', manifest['type']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
525 self.assertEqual('Canvas', manifest['items'][0]['type']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
526 self.assertEqual('AnnotationPage', manifest['items'][0]['items'][0]['type']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
527 self.assertEqual('Annotation', manifest['items'][0]['items'][0]['items'][0]['type']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
528 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
529 self.assertEqual(512, manifest['items'][0]['width']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
530 self.assertEqual(512, manifest['items'][0]['height']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
531 |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
532 body = manifest['items'][0]['items'][0]['items'][0]['body'] |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
533 self.assertEqual(1, len(body['service'])) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
534 self.assertEqual('image/jpeg', body['format']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
535 self.assertEqual('Image', body['type']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
536 self.assertEqual(512, body['width']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
537 self.assertEqual(512, body['height']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
538 self.assertEqual('level0', body['service'][0]['profile']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
539 self.assertEqual('ImageService3', body['service'][0]['type']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
540 self.assertEqual('http://localhost:8042%s' % uri, body['service'][0]['id']) |
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
541 |
570
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
542 def test_iiif_radiology(self): |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
543 a = UploadInstance(ORTHANC, 'ColorTestMalaterre.dcm') ['ID'] |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
544 b = UploadInstance(ORTHANC, 'Multiframe.dcm') ['ID'] |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
545 c = UploadInstance(ORTHANC, 'Brainix/Epi/IM-0001-0001.dcm') ['ID'] |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
546 d = UploadInstance(ORTHANC, 'Brainix/Epi/IM-0001-0002.dcm') ['ID'] |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
547 |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
548 s1 = DoGet(ORTHANC, '/instances/%s/series' % a) ['ID'] |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
549 s2 = DoGet(ORTHANC, '/instances/%s/series' % b) ['ID'] |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
550 s3 = DoGet(ORTHANC, '/instances/%s/series' % c) ['ID'] |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
551 |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
552 manifest = DoGet(ORTHANC, '/wsi/iiif/series/%s/manifest.json' % s1) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
553 self.assertEqual(1, len(manifest['items'])) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
554 |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
555 manifest = DoGet(ORTHANC, '/wsi/iiif/series/%s/manifest.json' % s2) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
556 self.assertEqual(76, len(manifest['items'])) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
557 |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
558 manifest = DoGet(ORTHANC, '/wsi/iiif/series/%s/manifest.json' % s3) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
559 self.assertEqual(2, len(manifest['items'])) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
560 |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
561 for (i, width, height) in [ (a, 41, 41), |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
562 (b, 512, 512), |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
563 (c, 256, 256), |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
564 (d, 256, 256) ]: |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
565 uri = '/wsi/iiif/frames/%s/0' % i |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
566 info = DoGet(ORTHANC, uri + '/info.json') |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
567 self.assertEqual(8, len(info)) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
568 self.assertEqual('http://iiif.io/api/image/3/context.json', info['@context']) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
569 self.assertEqual('http://iiif.io/api/image', info['protocol']) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
570 self.assertEqual('http://localhost:8042%s' % uri, info['id']) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
571 self.assertEqual('level0', info['profile']) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
572 self.assertEqual('ImageService3', info['type']) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
573 self.assertEqual(width, info['width']) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
574 self.assertEqual(height, info['height']) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
575 self.assertEqual(1, len(info['tiles'])) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
576 self.assertEqual(3, len(info['tiles'][0])) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
577 self.assertEqual(width, info['tiles'][0]['width']) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
578 self.assertEqual(height, info['tiles'][0]['height']) |
9d41b7f18be8
WSI: added test_iiif_radiology
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
569
diff
changeset
|
579 self.assertEqual([ 1 ], info['tiles'][0]['scaleFactors']) |
569
201e69006cff
WSI: added test_iiif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
568
diff
changeset
|
580 |
251 | 581 try: |
582 print('\nStarting the tests...') | |
583 unittest.main(argv = [ sys.argv[0] ] + args.options) | |
584 | |
585 finally: | |
586 print('\nDone') |