Mercurial > hg > orthanc-tests
comparison Plugins/WSI/Run.py @ 365:27cb0b60f2d3
wsi: test_pixel_spacing
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 13 Jan 2021 16:46:18 +0100 |
parents | 6fa8218cf8db |
children | e769bcf2b94f |
comparison
equal
deleted
inserted
replaced
364:6fa8218cf8db | 365:27cb0b60f2d3 |
---|---|
332 else: | 332 else: |
333 self.assertEqual('1', t2['0020,9162']) | 333 self.assertEqual('1', t2['0020,9162']) |
334 self.assertEqual('0', t2['0020,9228']) | 334 self.assertEqual('0', t2['0020,9228']) |
335 self.assertEqual('2', t1['0020,9162']) | 335 self.assertEqual('2', t1['0020,9162']) |
336 self.assertEqual('2', t1['0020,9228']) | 336 self.assertEqual('2', t1['0020,9228']) |
337 | 337 |
338 | |
339 def test_pixel_spacing(self): | |
340 # https://bugs.orthanc-server.com/show_bug.cgi?id=139 | |
341 CallDicomizer([ GetDatabasePath('LenaGrayscale.png'), # Image is 512x512 | |
342 '--levels=4', '--tile-width=64', '--tile-height=64', '--max-size=0', | |
343 '--imaged-width=20', '--imaged-height=10' ]) | |
344 | |
345 instances = DoGet(ORTHANC, '/instances') | |
346 self.assertEqual(4, len(instances)) | |
347 | |
348 spacings = {} | |
349 for i in instances: | |
350 t = DoGet(ORTHANC, '/instances/%s/tags?short' % i) | |
351 spacings[t['0028,0008']] = t['5200,9229'][0]['0028,9110'][0]['0028,0030'] | |
352 | |
353 self.assertEqual(4, len(spacings)) | |
354 for i in range(4): | |
355 s = spacings[str(4 ** i)].split('\\') | |
356 self.assertEqual(2, len(s)) | |
357 self.assertEqual(20.0 / 512.0 * (2.0 ** (3 - i)), float(s[0])) | |
358 self.assertEqual(10.0 / 512.0 * (2.0 ** (3 - i)), float(s[1])) | |
359 | |
360 | |
338 try: | 361 try: |
339 print('\nStarting the tests...') | 362 print('\nStarting the tests...') |
340 unittest.main(argv = [ sys.argv[0] ] + args.options) | 363 unittest.main(argv = [ sys.argv[0] ] + args.options) |
341 | 364 |
342 finally: | 365 finally: |