comparison Tests/Tests.py @ 307:5be63aef39b1 c-get

fix test_getscu
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 May 2020 16:31:54 +0200
parents da2be3ff2db5
children 2565d39dd36c
comparison
equal deleted inserted replaced
306:da2be3ff2db5 307:5be63aef39b1
5635 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')))
5636 5636
5637 5637
5638 5638
5639 def test_getscu(self): 5639 def test_getscu(self):
5640 def CleanTarget():
5641 if os.path.isdir('/tmp/GETSCU'):
5642 shutil.rmtree('/tmp/GETSCU')
5643 os.makedirs('/tmp/GETSCU')
5644
5640 env = {} 5645 env = {}
5641 if _DOCKER: 5646 if _DOCKER:
5642 # This is "getscu" from DCMTK 3.6.5 compiled using LSB, 5647 # This is "getscu" from DCMTK 3.6.5 compiled using LSB,
5643 # and running in a GNU/Linux distribution running DCMTK 5648 # and running in a GNU/Linux distribution running DCMTK
5644 # 3.6.0. Tell "getscu" where it can find the DICOM dictionary. 5649 # 3.6.0. Tell "getscu" where it can find the DICOM dictionary.
5645 env['DCMDICTPATH'] = '/usr/share/libdcmtk2/dicom.dic' 5650 env['DCMDICTPATH'] = '/usr/share/libdcmtk2/dicom.dic'
5646 5651
5647 # no transcoding required 5652 # no transcoding required
5648 UploadInstance(_REMOTE, 'DummyCT.dcm') 5653 UploadInstance(_REMOTE, 'Brainix/Flair/IM-0001-0001.dcm')['ID']
5649 5654
5650 if os.path.isdir('/tmp/GETSCU'): 5655 CleanTarget()
5651 shutil.rmtree('/tmp/GETSCU')
5652 os.makedirs('/tmp/GETSCU')
5653 5656
5654 subprocess.check_call([ 5657 subprocess.check_call([
5655 FindExecutable('getscu'), 5658 FindExecutable('getscu'),
5656 _REMOTE['Server'], 5659 _REMOTE['Server'],
5657 str(_REMOTE['DicomPort']), 5660 str(_REMOTE['DicomPort']),
5658 '-aec', 'ORTHANC', 5661 '-aec', 'ORTHANC',
5659 '-aet', 'ORTHANCTEST', # pretend to be the other orthanc 5662 '-aet', 'ORTHANCTEST', # pretend to be the other orthanc
5660 '-k', '0020,000d=1.2.840.113619.2.176.2025.1499492.7391.1171285944.390', 5663 '-k', '0020,000d=2.16.840.1.113669.632.20.1211.10000357775',
5661 '-k', '0008,0052=STUDY', 5664 '-k', '0008,0052=STUDY',
5662 '--output-directory', '/tmp/GETSCU/' 5665 '--output-directory', '/tmp/GETSCU/'
5663 ], env = env) 5666 ], env = env)
5664 5667
5665 self.assertTrue(os.path.isfile('/tmp/GETSCU/MR.1.2.840.113619.2.176.2025.1499492.7040.1171286242.109')) 5668 self.assertTrue(os.path.isfile('/tmp/GETSCU/MR.1.3.46.670589.11.0.0.11.4.2.0.8743.5.5396.2006120114314079549'))
5669 CleanTarget()
5670 return
5666 5671
5667 # transcoding required 5672 # transcoding required
5668 # UploadInstance(_REMOTE, 'Formats/JpegLossless.dcm') 5673 UploadInstance(_REMOTE, 'Formats/JpegLossless.dcm')
5669 5674
5670 # subprocess.check_call([ FindExecutable('getscu'), 5675 subprocess.check_call([
5671 # _REMOTE['Server'], 5676 FindExecutable('getscu'),
5672 # str(_REMOTE['DicomPort']), 5677 _REMOTE['Server'],
5673 # '-aec', 'ORTHANC', 5678 str(_REMOTE['DicomPort']),
5674 # '-aet', 'ORTHANCTEST', # pretend to be the other orthanc 5679 '-aec', 'ORTHANC',
5675 # '-k', '0020,000d=1.2.276.0.7230010.3.1.2.2831176407.19977.1434973482.75580', 5680 '-aet', 'ORTHANCTEST', # pretend to be the other orthanc
5676 # '-k', '0008,0052=STUDY', 5681 '-k', '0020,000d=2.16.840.1.113669.632.20.1211.10000357775\\1.2.276.0.7230010.3.1.2.2831176407.19977.1434973482.75580',
5677 # '--output-directory', '/tmp/GETSCU/' 5682 '-k', '0008,0052=STUDY',
5678 # ]) 5683 '--output-directory', '/tmp/GETSCU/'
5679 5684 ], env = env)
5680 # self.assertTrue(os.path.isfile('/tmp/GETSCU/MR.1.2.276.0.7230010.3.1.4.2831176407.19977.1434973482.75579')) 5685
5681 5686 os.system('ls -l /tmp/GETSCU')
5682 5687 self.assertTrue(os.path.isfile('/tmp/GETSCU/MR.1.3.46.670589.11.0.0.11.4.2.0.8743.5.5396.2006120114314079549'))
5683 5688 self.assertTrue(os.path.isfile('/tmp/GETSCU/MR.1.2.276.0.7230010.3.1.4.2831176407.19977.1434973482.75579'))
5689
5690
5691