Mercurial > hg > orthanc-tests
comparison Tests/Tests.py @ 54:c5f8a6b0d85e
test_incoming_movescu_accession
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 20 Oct 2015 11:21:24 +0200 |
parents | e0d1ee04119f |
children | a395fd51cc4f |
comparison
equal
deleted
inserted
replaced
53:e0d1ee04119f | 54:c5f8a6b0d85e |
---|---|
73 d = a[i] - b[i] | 73 d = a[i] - b[i] |
74 if abs(d) >= 0.51: # Add some tolerance for rounding errors | 74 if abs(d) >= 0.51: # Add some tolerance for rounding errors |
75 return False | 75 return False |
76 | 76 |
77 return True | 77 return True |
78 | |
79 | |
80 def CallMoveScu(args): | |
81 subprocess.check_call([ FindExecutable('movescu'), | |
82 '--move', _LOCAL['DicomAet'], # Target AET (i.e. storescp) | |
83 '--call', _REMOTE['DicomAet'], # Called AET (i.e. Orthanc) | |
84 '--aetitle', _LOCAL['DicomAet'], # Calling AET (i.e. storescp) | |
85 _REMOTE['Server'], str(_REMOTE['DicomPort']) ] + args, | |
86 stderr=subprocess.PIPE) | |
78 | 87 |
79 | 88 |
80 | 89 |
81 def GenerateTestSequence(): | 90 def GenerateTestSequence(): |
82 return [ | 91 return [ |
1036 series = re.findall('\(0010,0010\).*?\[\s*(.*?)\s*\]', i) | 1045 series = re.findall('\(0010,0010\).*?\[\s*(.*?)\s*\]', i) |
1037 self.assertEqual(1, len(series)) | 1046 self.assertEqual(1, len(series)) |
1038 | 1047 |
1039 | 1048 |
1040 def test_incoming_movescu(self): | 1049 def test_incoming_movescu(self): |
1041 def CallMoveScu(args): | |
1042 subprocess.check_call([ FindExecutable('movescu'), | |
1043 '--move', _LOCAL['DicomAet'], # Target AET (i.e. storescp) | |
1044 '--call', _REMOTE['DicomAet'], # Called AET (i.e. Orthanc) | |
1045 '--aetitle', _LOCAL['DicomAet'], # Calling AET (i.e. storescp) | |
1046 _REMOTE['Server'], str(_REMOTE['DicomPort']) ] + args, | |
1047 stderr=subprocess.PIPE) | |
1048 | |
1049 UploadInstance(_REMOTE, 'Multiframe.dcm') | 1050 UploadInstance(_REMOTE, 'Multiframe.dcm') |
1050 | 1051 |
1051 self.assertEqual(0, len(DoGet(_LOCAL, '/patients'))) | 1052 self.assertEqual(0, len(DoGet(_LOCAL, '/patients'))) |
1052 CallMoveScu([ '--patient', '-k', '0008,0052=PATIENT', '-k', 'PatientID=none' ]) | 1053 CallMoveScu([ '--patient', '-k', '0008,0052=PATIENT', '-k', 'PatientID=none' ]) |
1053 self.assertEqual(0, len(DoGet(_LOCAL, '/patients'))) | 1054 self.assertEqual(0, len(DoGet(_LOCAL, '/patients'))) |
2450 self.assertEqual(2, len(o['Slices'])) | 2451 self.assertEqual(2, len(o['Slices'])) |
2451 self.assertEqual('/instances/%s/file' % i, o['Dicom'][0]) | 2452 self.assertEqual('/instances/%s/file' % i, o['Dicom'][0]) |
2452 self.assertEqual('/instances/%s/file' % j, o['Dicom'][1]) | 2453 self.assertEqual('/instances/%s/file' % j, o['Dicom'][1]) |
2453 self.assertEqual('/instances/%s/frames/0' % i, o['Slices'][0]) | 2454 self.assertEqual('/instances/%s/frames/0' % i, o['Slices'][0]) |
2454 self.assertEqual('/instances/%s/frames/0' % j, o['Slices'][1]) | 2455 self.assertEqual('/instances/%s/frames/0' % j, o['Slices'][1]) |
2456 | |
2457 | |
2458 def test_incoming_movescu_accession(self): | |
2459 UploadInstance(_REMOTE, 'Knee/T1/IM-0001-0001.dcm') | |
2460 | |
2461 self.assertEqual(0, len(DoGet(_LOCAL, '/patients'))) | |
2462 CallMoveScu([ '--study', '-k', '0008,0052=STUDY', '-k', 'AccessionNumber=nope' ]) | |
2463 self.assertEqual(0, len(DoGet(_LOCAL, '/patients'))) | |
2464 CallMoveScu([ '--study', '-k', '0008,0052=PATIENT', '-k', 'AccessionNumber=A10003245599' ]) | |
2465 self.assertEqual(0, len(DoGet(_LOCAL, '/patients'))) | |
2466 CallMoveScu([ '--study', '-k', '0008,0052=STUDY', '-k', 'AccessionNumber=A10003245599' ]) | |
2467 self.assertEqual(1, len(DoGet(_LOCAL, '/patients'))) | |
2468 |