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

    Use dcmj2pnm
---
 README.org |  2 +-
 dicom.el   | 20 +++++++++-----------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/README.org b/README.org
index bd0bf1b6c2..9251129b42 100644
--- a/README.org
+++ b/README.org
@@ -23,7 +23,7 @@ The package relies on a few external programs, which are all 
widely available on
 Linux distributions.
 
 - ~convert~ from the ImageMagick suite
-- ~dcm2xml~ from the dcmtk DICOM toolkit
+- ~dcm2xml~ and ~dcmj2pnm~ from the dcmtk DICOM toolkit
 - ~ffmpeg~ for video conversion (optional)
 - ~mpv~ for video playing (optional)
 
diff --git a/dicom.el b/dicom.el
index 9d4208ab86..345ff9d4c9 100644
--- a/dicom.el
+++ b/dicom.el
@@ -41,7 +41,7 @@
 ;; distributions.
 
 ;; - `convert' from the ImageMagick suite
-;; - `dcm2xml' from the dcmtk DICOM toolkit
+;; - `dcm2xml' and `dcmj2pnm' from the dcmtk DICOM toolkit
 ;; - `ffmpeg' for video conversion (optional)
 ;; - `mpv' for video playing (optional)
 
@@ -242,7 +242,7 @@ progress:${percent-pos}%%' %s) & disown"
                      (rename-file tmp dst)
                      (dicom--put-image pos dst))
                  (delete-file tmp)))
-             "convert" src "-delete" "1--1" "-thumbnail" "x200" tmp)))))))
+             "dcmj2pnm" "--write-png" "--scale-y-size" "200" src tmp)))))))
 
 (defun dicom--button (label action)
   "Insert button with LABEL and ACTION."
@@ -281,7 +281,7 @@ progress:${percent-pos}%%' %s) & disown"
                (rename-file tmp dst)
                (dicom--put-image pos dst))
            (delete-file tmp)))
-       "convert" dicom--file "-delete" "1--1" tmp)))))
+       "dcmj2pnm" "--write-png" dicom--file tmp)))))
 
 (defun dicom--read (file)
   "Read DICOM FILE and return list of items."
@@ -453,16 +453,14 @@ REUSE can be a buffer name to reuse."
   (let (req)
     (unless (display-graphic-p)
       (push "graphical display" req))
-    (unless (image-type-available-p 'png)
-      (push "libpng" req))
-    (unless (image-type-available-p 'svg)
-      (push "libsvg" req))
     (unless (libxml-available-p)
       (push "libxml" req))
-    (unless (executable-find "dcm2xml")
-      (push "dcm2xml" req))
-    (unless (executable-find "convert")
-      (push "convert" req))
+    (dolist (type '(png svg))
+      (unless (image-type-available-p type)
+        (push (format "lib%s" type) req)))
+    (dolist (exe '("dcm2xml" "dcmj2pnm" "convert"))
+      (unless (executable-find exe)
+        (push exe req)))
     (when req
       (error "DICOM: %s required to proceed" (string-join req ", ")))))
 

Reply via email to