Mercurial > hg > orthanc-tests
changeset 234:93cd4fdd4a67
test_anonymize_relationships_4
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 05 Apr 2019 17:04:37 +0200 |
parents | ce0b19a2c807 |
children | 9929e4af2b7a |
files | Database/HierarchicalAnonymization/2019-03-28/CR000000.dcm Database/HierarchicalAnonymization/2019-03-28/PR000000.dcm Database/Issue137.cfg Tests/Tests.py |
diffstat | 4 files changed, 50 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Database/Issue137.cfg Fri Apr 05 17:04:37 2019 +0200 @@ -0,0 +1,19 @@ +## +## Command to upload: +## +## $ storescu localhost 4242 -xf ./Issue137.cfg Default ./Issue137.dcm +## + + +[[TransferSyntaxes]] +[Uncompressed] +TransferSyntax1 = LittleEndianExplicit + +[[PresentationContexts]] +[StorageCompressedAndUncompressed] +PresentationContext1 = 1.2.840.10008.5.1.4.1.1.104.3\Uncompressed +#PresentationContext1 = EncapsulatedSTLStorage\Uncompressed + +[[Profiles]] +[Default] +PresentationContexts = StorageCompressedAndUncompressed
--- a/Tests/Tests.py Fri Apr 05 13:34:41 2019 +0200 +++ b/Tests/Tests.py Fri Apr 05 17:04:37 2019 +0200 @@ -4609,3 +4609,34 @@ patientNames = re.findall('\(0010,0010\).*?\[(.*?)\]', i) self.assertEqual(1, len(patientNames)) self.assertEqual('John Doe', patientNames[0]) + + + def test_anonymize_relationships_4(self): + # https://groups.google.com/d/msg/orthanc-users/UkcsqyTpszE/bXUpzU0vAAAJ + sr1 = UploadInstance(_REMOTE, 'HierarchicalAnonymization/2019-03-28/CR000000.dcm')['ID'] + mr1 = UploadInstance(_REMOTE, 'HierarchicalAnonymization/2019-03-28/PR000000.dcm')['ID'] + study = '0c923249-d52121a9-2b7167f7-6b85534f-0943697e' + + anonymized = DoPost(_REMOTE, '/studies/%s/anonymize' % study, '{}', + 'application/json')['ID'] + series = DoGet(_REMOTE, '/studies/%s/series' % anonymized) + self.assertEqual(2, len(series)) + + cr = list(filter(lambda x: x['MainDicomTags']['Modality'] == 'CR', series)) + pr = list(filter(lambda x: x['MainDicomTags']['Modality'] == 'PR', series)) + self.assertEqual(1, len(cr)) + self.assertEqual(1, len(pr)) + self.assertEqual(1, len(cr[0]['Instances'])) + self.assertEqual(1, len(pr[0]['Instances'])) + + crinstance = DoGet(_REMOTE, '/instances/%s' % cr[0]['Instances'][0]) + tags = DoGet(_REMOTE, '/instances/%s/tags?short' % pr[0]['Instances'][0]) + + self.assertEqual(tags['0008,1115'][0]['0008,1140'][0]['0008,1155'], + crinstance['MainDicomTags']['SOPInstanceUID']) + self.assertEqual(tags['0008,1115'][0]['0008,1140'][0]['0008,1150'], + '1.2.840.10008.5.1.4.1.1.1') # SOP class for CR Image Storage + + # This fails on Orthanc <= 1.5.6 + self.assertEqual(tags['0008,1115'][0]['0020,000e'], + cr[0]['MainDicomTags']['SeriesInstanceUID'])