diff Tests/Toolbox.py @ 291:cfa785074c64

test_modify_transcode
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 07 May 2020 15:33:40 +0200
parents 943166deebcb
children b8399213b840
line wrap: on
line diff
--- a/Tests/Toolbox.py	Thu May 07 11:37:42 2020 +0200
+++ b/Tests/Toolbox.py	Thu May 07 15:33:40 2020 +0200
@@ -26,6 +26,7 @@
 import re
 import signal
 import subprocess
+import tempfile
 import threading
 import sys
 import time
@@ -379,3 +380,12 @@
 
     else:
         self.assertAlmostEqual(a, b, places = places)
+
+
+def GetTransferSyntax(dicom):
+    with tempfile.NamedTemporaryFile(delete = True) as f:
+        f.write(dicom)
+        f.flush()
+        data = subprocess.check_output([ FindExecutable('dcm2xml'), f.name ])
+
+    return re.search('<data-set xfer="(.*?)"', data).group(1)