comparison Tests/Tests.py @ 191:bc8bc83465dc

testing C-FIND optimization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Dec 2018 11:42:18 +0100
parents 11719f19bd62
children 6ff9d035b26b
comparison
equal deleted inserted replaced
190:40c167db0e11 191:bc8bc83465dc
1159 # Test the "CaseSentitivePN" flag (false by default) 1159 # Test the "CaseSentitivePN" flag (false by default)
1160 i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', 'PatientName=anonymized' ]) 1160 i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', 'PatientName=anonymized' ])
1161 series = re.findall('\(0010,0010\).*?\[\s*(.*?)\s*\]', i) 1161 series = re.findall('\(0010,0010\).*?\[\s*(.*?)\s*\]', i)
1162 self.assertEqual(1, len(series)) 1162 self.assertEqual(1, len(series))
1163 1163
1164 # Test returning sequence values (only since Orthanc 0.9.5)
1165 i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', '0008,2112' ]) # "ColorTestImageJ" has this sequence tag
1166 sequences = re.findall('\(0008,2112\)', i)
1167 self.assertEqual(1, len(sequences))
1168
1169 # Test range search (buggy if Orthanc <= 0.9.6) 1164 # Test range search (buggy if Orthanc <= 0.9.6)
1170 i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', 'StudyDate=19980312-' ]) 1165 i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', 'StudyDate=19980312-' ])
1171 studies = re.findall('\(0008,0020\).*?\[\s*(.*?)\s*\]', i) 1166 studies = re.findall('\(0008,0020\).*?\[\s*(.*?)\s*\]', i)
1172 self.assertEqual(2, len(studies)) 1167 self.assertEqual(2, len(studies))
1173 self.assertTrue('20070208' in studies) 1168 self.assertTrue('20070208' in studies)
1180 studies = re.findall('\(0008,0020\).*?\[\s*(.*?)\s*\]', i) 1175 studies = re.findall('\(0008,0020\).*?\[\s*(.*?)\s*\]', i)
1181 self.assertEqual(1, len(studies)) 1176 self.assertEqual(1, len(studies))
1182 self.assertTrue('19980312' in studies) 1177 self.assertTrue('19980312' in studies)
1183 1178
1184 1179
1180 def test_incoming_findscu_2(self):
1181 # This test fails if "LookupMode_DatabaseOnly" is used
1182 # (sequences are not available in this mode, and only main
1183 # DICOM tags are returned)
1184 UploadInstance(_REMOTE, 'Multiframe.dcm')
1185 UploadInstance(_REMOTE, 'ColorTestImageJ.dcm')
1186
1187 # Test returning sequence values (only since Orthanc 0.9.5)
1188 i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', '0008,2112' ]) # "ColorTestImageJ" has this sequence tag
1189 sequences = re.findall('\(0008,2112\)', i)
1190 self.assertEqual(1, len(sequences))
1191
1192 # Test returning a non-main DICOM tag,
1193 # "SecondaryCaptureDeviceID" (0018,1010), whose value is
1194 # "MEDPC" in "ColorTestImageJ.dcm"
1195 i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', '0018,1010' ])
1196 tags = re.findall('\(0018,1010\).*MEDPC', i)
1197 self.assertEqual(1, len(tags))
1198
1199
1200 def test_incoming_findscu_3(self):
1201 # This test fails if "LookupMode_DatabaseOnly" or
1202 # "LookupMode_DiskOnAnswer" is used, as
1203 # "SecondaryCaptureDeviceID" (0018,1010) is not a main DICOM
1204 # tag, as thus a constraint cannot be applied to it
1205 UploadInstance(_REMOTE, 'ColorTestImageJ.dcm')
1206
1207 i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', '0018,1010=MEDPC' ])
1208 sequences = re.findall('\(0018,1010\)', i)
1209 self.assertEqual(1, len(sequences))
1210
1211
1185 def test_incoming_movescu(self): 1212 def test_incoming_movescu(self):
1186 UploadInstance(_REMOTE, 'Multiframe.dcm') 1213 UploadInstance(_REMOTE, 'Multiframe.dcm')
1187 1214
1188 # No matching patient, so no job is created 1215 # No matching patient, so no job is created
1189 self.assertEqual(0, len(DoGet(_LOCAL, '/patients'))) 1216 self.assertEqual(0, len(DoGet(_LOCAL, '/patients')))