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

    Go back to dcm2img by default with fallback to magick
---
 README.org |  2 +-
 dicom.el   | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/README.org b/README.org
index 7425f9c2ac..bee32e10e2 100644
--- a/README.org
+++ b/README.org
@@ -32,7 +32,7 @@ Emacs must be compiled with support for PNG, SVG and XML. The 
package relies on
 external programs from the [[https://dcmtk.org/en/dcmtk/][DCMTK]] DICOM 
toolkit, which are all widely available
 on GNU/Linux distributions.
 
-- ~dcm2xml~ from the [[https://dcmtk.org/en/dcmtk/][DCMTK]] DICOM toolkit
+- ~dcm2xml~ and ~dcm2img~ from the [[https://dcmtk.org/en/dcmtk/][DCMTK]] 
DICOM toolkit
 - ~magick~ from [[https://imagemagick.org/][ImageMagick]]
 - ~ffmpeg~ for video conversion (optional)
 - ~mpv~ for video playing (optional)
diff --git a/dicom.el b/dicom.el
index f1e87f5e15..f6dc207a52 100644
--- a/dicom.el
+++ b/dicom.el
@@ -40,7 +40,7 @@
 ;; on external programs from the dcmtk DICOM toolkit, which are widely 
available
 ;; on Linux distributions.
 
-;; - `dcm2xml' from the dcmtk DICOM toolkit
+;; - `dcm2xml' and `dcm2img' from the dcmtk DICOM toolkit
 ;; - `magick' from ImageMagick
 ;; - `ffmpeg' for video conversion (optional)
 ;; - `mpv' for video playing (optional)
@@ -374,8 +374,8 @@ The command is specified as FMT string with ARGS."
     (unless exists
       (dicom--enqueue
        (dicom--image-callback tmp dst pos)
-       "magick %s[0] -resize x200 %s || magick %s[-1] -resize x200 %s"
-       src tmp src tmp))))
+       "dcm2img --write-png --scale-y-size 200 %s %s || magick %s[0] -resize 
x200 %s || magick %s[-1] -resize x200 %s"
+       src tmp src tmp src tmp))))
 
 (defun dicom--item (level item &optional indent)
   "Insert ITEM at LEVEL into buffer."
@@ -448,8 +448,8 @@ The command is specified as FMT string with ARGS."
     (unless exists
       (dicom--enqueue
        (dicom--image-callback tmp dst pos)
-       "magick %s[0] %s || magick %s[-1] %s"
-       dicom--file tmp dicom--file tmp))))
+       "dcm2img --write-png %s %s || magick %s[0] %s || magick %s[-1] %s"
+       dicom--file tmp dicom--file tmp dicom--file tmp))))
 
 (defun dicom--setup-check ()
   "Check requirements."
@@ -461,7 +461,7 @@ The command is specified as FMT string with ARGS."
     (dolist (type '(png svg))
       (unless (image-type-available-p type)
         (push (format "lib%s" type) req)))
-    (dolist (exe '("dcm2xml" "magick"))
+    (dolist (exe '("dcm2xml" "dcm2img" "magick"))
       (unless (executable-find exe)
         (push exe req)))
     (when req
@@ -560,8 +560,8 @@ The command is specified as FMT string with ARGS."
                    (rename-file tmp dst)
                    (dicom-play))
                (delete-file tmp)))
-           "magick %s bmp:- | ffmpeg -framerate %s -i - %s"
-           dicom--file
+           "(dcm2img --all-frames --write-bmp %s || magick %s bmp:-) | ffmpeg 
-framerate %s -i - %s"
+           dicom--file dicom--file
            (or (alist-get 'RecommendedDisplayFrameRate dicom--data)
                (alist-get 'CineRate dicom--data)
                "25")

Reply via email to