Mercurial > hg > orthanc-tests
comparison Tests/Tests.py @ 306:da2be3ff2db5 c-get
fix getscu binaries
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 20 May 2020 08:41:21 +0200 |
parents | b55b959647ed |
children | 5be63aef39b1 |
comparison
equal
deleted
inserted
replaced
296:b55b959647ed | 306:da2be3ff2db5 |
---|---|
33 from Toolbox import * | 33 from Toolbox import * |
34 from xml.dom import minidom | 34 from xml.dom import minidom |
35 | 35 |
36 _LOCAL = None | 36 _LOCAL = None |
37 _REMOTE = None | 37 _REMOTE = None |
38 | 38 _DOCKER = False |
39 | 39 |
40 def SetOrthancParameters(local, remote): | 40 |
41 global _LOCAL, _REMOTE | 41 def SetOrthancParameters(local, remote, withinDocker): |
42 global _LOCAL, _REMOTE, _DOCKER | |
42 _LOCAL = local | 43 _LOCAL = local |
43 _REMOTE = remote | 44 _REMOTE = remote |
44 | 45 _DOCKER = withinDocker |
45 | 46 |
47 | |
46 def ExtractDicomTags(rawDicom, tags): | 48 def ExtractDicomTags(rawDicom, tags): |
47 with tempfile.NamedTemporaryFile(delete = True) as f: | 49 with tempfile.NamedTemporaryFile(delete = True) as f: |
48 f.write(rawDicom) | 50 f.write(rawDicom) |
49 f.flush() | 51 f.flush() |
50 data = subprocess.check_output([ FindExecutable('dcm2xml'), f.name ]) | 52 data = subprocess.check_output([ FindExecutable('dcm2xml'), f.name ]) |
5633 self.assertEqual('1.2.840.10008.1.2.4.57', GetTransferSyntax(z.read('IMAGES/IM0'))) | 5635 self.assertEqual('1.2.840.10008.1.2.4.57', GetTransferSyntax(z.read('IMAGES/IM0'))) |
5634 | 5636 |
5635 | 5637 |
5636 | 5638 |
5637 def test_getscu(self): | 5639 def test_getscu(self): |
5638 | 5640 env = {} |
5641 if _DOCKER: | |
5642 # This is "getscu" from DCMTK 3.6.5 compiled using LSB, | |
5643 # and running in a GNU/Linux distribution running DCMTK | |
5644 # 3.6.0. Tell "getscu" where it can find the DICOM dictionary. | |
5645 env['DCMDICTPATH'] = '/usr/share/libdcmtk2/dicom.dic' | |
5646 | |
5639 # no transcoding required | 5647 # no transcoding required |
5640 UploadInstance(_REMOTE, 'DummyCT.dcm') | 5648 UploadInstance(_REMOTE, 'DummyCT.dcm') |
5641 | 5649 |
5642 if os.path.isdir('/tmp/GETSCU'): | 5650 if os.path.isdir('/tmp/GETSCU'): |
5643 shutil.rmtree('/tmp/GETSCU') | 5651 shutil.rmtree('/tmp/GETSCU') |
5644 os.makedirs('/tmp/GETSCU') | 5652 os.makedirs('/tmp/GETSCU') |
5645 | 5653 |
5646 subprocess.check_call([ FindExecutable('getscu'), | 5654 subprocess.check_call([ |
5647 _REMOTE['Server'], | 5655 FindExecutable('getscu'), |
5648 str(_REMOTE['DicomPort']), | 5656 _REMOTE['Server'], |
5649 '-aec', 'ORTHANC', | 5657 str(_REMOTE['DicomPort']), |
5650 '-aet', 'ORTHANCTEST', # pretend to be the other orthanc | 5658 '-aec', 'ORTHANC', |
5651 '-k', '0020,000d=1.2.840.113619.2.176.2025.1499492.7391.1171285944.390', | 5659 '-aet', 'ORTHANCTEST', # pretend to be the other orthanc |
5652 '-k', '0008,0052=STUDY', | 5660 '-k', '0020,000d=1.2.840.113619.2.176.2025.1499492.7391.1171285944.390', |
5653 '--output-directory', '/tmp/GETSCU/' | 5661 '-k', '0008,0052=STUDY', |
5654 ]) | 5662 '--output-directory', '/tmp/GETSCU/' |
5663 ], env = env) | |
5655 | 5664 |
5656 self.assertTrue(os.path.isfile('/tmp/GETSCU/MR.1.2.840.113619.2.176.2025.1499492.7040.1171286242.109')) | 5665 self.assertTrue(os.path.isfile('/tmp/GETSCU/MR.1.2.840.113619.2.176.2025.1499492.7040.1171286242.109')) |
5657 | 5666 |
5658 # transcoding required | 5667 # transcoding required |
5659 # UploadInstance(_REMOTE, 'Formats/JpegLossless.dcm') | 5668 # UploadInstance(_REMOTE, 'Formats/JpegLossless.dcm') |