branch: externals/dicom
commit f77583f36740e92ad12148778f746caede1719d9
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>

    dcm2xml - do not fail hard if file cannot be decoded
    
    The problem is that the DICOM "standard" seems to be loosely interpreted.
    Everyone does what they want. Unfortunately dcm2xml is often too strict.
---
 dicom.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/dicom.el b/dicom.el
index 00d1bafec0..9b51ca7ca4 100644
--- a/dicom.el
+++ b/dicom.el
@@ -256,14 +256,15 @@ progress:${percent-pos}%%' %s) & disown"
 (defun dicom--read (file)
   "Read DICOM FILE and return list of items."
   (with-temp-buffer
-    (unless (eq 0 (call-process "dcm2xml" nil t nil
-                                "--quiet" "--charset-assume"
-                                "latin-1" "--convert-to-utf8" file))
-      (error "DICOM: Reading DICOM metadata with dcm2xml failed"))
-    (let ((dicom-attribute-filter (mapconcat (lambda (x) (format "%s" x))
-                                             dicom-attribute-filter
-                                             "\\|")))
-      (dicom--convert (dom-child-by-tag (libxml-parse-xml-region) 
'data-set)))))
+    (if (eq 0 (call-process "dcm2xml" nil t nil
+                            "--quiet" "--charset-assume" "latin-1"
+                            "--convert-to-utf8" file))
+        (let ((dicom-attribute-filter (mapconcat (lambda (x) (format "%s" x))
+                                                 dicom-attribute-filter
+                                                 "\\|")))
+          (dicom--convert (dom-child-by-tag (libxml-parse-xml-region) 
'data-set)))
+      (message "DICOM: Reading DICOM metadata with dcm2xml failed")
+      nil)))
 
 (defun dicom--image-buffer ()
   "Return image buffer or throw an error."

Reply via email to