comparison Tests/Tests.py @ 295:946b2199f481 c-get

added test for c-get
author Alain Mazy <alain@mazy.be>
date Tue, 12 May 2020 13:21:38 +0200
parents 281a32ecc5c1
children b55b959647ed
comparison
equal deleted inserted replaced
287:2dc6ab42f401 295:946b2199f481
24 import base64 24 import base64
25 import copy 25 import copy
26 import pprint 26 import pprint
27 import tempfile 27 import tempfile
28 import unittest 28 import unittest
29 import shutil
29 30
30 from PIL import ImageChops 31 from PIL import ImageChops
31 from Toolbox import * 32 from Toolbox import *
32 from xml.dom import minidom 33 from xml.dom import minidom
33 34
5447 self.assertEqual('1.2.840.113619.2.176.2025.1499492.7040.1171286242.109', 5448 self.assertEqual('1.2.840.113619.2.176.2025.1499492.7040.1171286242.109',
5448 answer['SOPInstanceUID']) 5449 answer['SOPInstanceUID'])
5449 5450
5450 self.assertEqual(1, len(DoGet(_LOCAL, '/instances'))) 5451 self.assertEqual(1, len(DoGet(_LOCAL, '/instances')))
5451 self.assertEqual(0, len(DoGet(_REMOTE, '/instances'))) 5452 self.assertEqual(0, len(DoGet(_REMOTE, '/instances')))
5453
5454 def test_getscu(self):
5455
5456 # no transcoding required
5457 UploadInstance(_REMOTE, 'DummyCT.dcm')
5458
5459 if os.path.isdir('/tmp/GETSCU'):
5460 shutil.rmtree('/tmp/GETSCU')
5461 os.makedirs('/tmp/GETSCU')
5462
5463 subprocess.check_call([ FindExecutable('getscu'),
5464 _REMOTE['Server'],
5465 str(_REMOTE['DicomPort']),
5466 '-aec', 'ORTHANC',
5467 '-aet', 'ORTHANCTEST', # pretend to be the other orthanc
5468 '-k', '0020,000d=1.2.840.113619.2.176.2025.1499492.7391.1171285944.390',
5469 '-k', '0008,0052=STUDY',
5470 '--output-directory', '/tmp/GETSCU/'
5471 ])
5472
5473 self.assertTrue(os.path.isfile('/tmp/GETSCU/MR.1.2.840.113619.2.176.2025.1499492.7040.1171286242.109'))
5474
5475 # transcoding required
5476 # UploadInstance(_REMOTE, 'Formats/JpegLossless.dcm')
5477
5478 # subprocess.check_call([ FindExecutable('getscu'),
5479 # _REMOTE['Server'],
5480 # str(_REMOTE['DicomPort']),
5481 # '-aec', 'ORTHANC',
5482 # '-aet', 'ORTHANCTEST', # pretend to be the other orthanc
5483 # '-k', '0020,000d=1.2.276.0.7230010.3.1.2.2831176407.19977.1434973482.75580',
5484 # '-k', '0008,0052=STUDY',
5485 # '--output-directory', '/tmp/GETSCU/'
5486 # ])
5487
5488 # self.assertTrue(os.path.isfile('/tmp/GETSCU/MR.1.2.276.0.7230010.3.1.4.2831176407.19977.1434973482.75579'))
5489
5490
5491