branch: externals/dicom
commit 1d5325263a2c52e8007fc19fbcb431cc81b57ecd
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
Use dcmj2pnm for all conversions
---
README.org | 21 ++++++++++++---------
dicom.el | 12 ++++--------
2 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/README.org b/README.org
index 9251129b42..8cd2e9eee3 100644
--- a/README.org
+++ b/README.org
@@ -19,19 +19,22 @@ files and DICOM images (file extension *.dcm or *.ima).
Furthermore the command
Dicom.el is available from [[https://elpa.gnu.org/packages/dicom.html][GNU
ELPA]]. You can install it directly via ~M-x package-install RET dicom RET~.
After installation, you can open ~DICOMDIR~ and DICOM image files.
-The package relies on a few external programs, which are all widely available
on
-Linux distributions.
+The package relies on external programs from the dcmtk DICOM toolkit, which are
+all widely available on Linux distributions.
-- ~convert~ from the ImageMagick suite
- ~dcm2xml~ and ~dcmj2pnm~ from the dcmtk DICOM toolkit
- ~ffmpeg~ for video conversion (optional)
- ~mpv~ for video playing (optional)
* Supported files
-The DICOM format is quite diverse. Since ~dcm2xml~ from the DICOM toolkit is
used
-to read the metadata, most uncorrupted DICOM files can be read. However the
-ImageMagick ~convert~ program cannot handle all images embedded in DICOM
files, in
-particular not some lossless JPEG files. Therefore it can happen that the DICOM
-viewer is unable to display such files. Help with improving the image
conversion
-process is welcome.
+The DICOM format is quite diverse. Since ~dcm2xml~ tool from the DICOM toolkit
is
+used to read the metadata, most uncorrupted DICOM files can be read. It can
+still happen that the DICOM viewer is unable to display files nicely, if the
+metadata records are not interpreted properly. Any help improving the package
is
+welcome.
+
+* Contributions
+
+Since this package is part of [[https://elpa.gnu.org/packages/dicom.html][GNU
ELPA]] contributions require a copyright
+assignment to the FSF.
diff --git a/dicom.el b/dicom.el
index d7925e6dcd..6fad477a6e 100644
--- a/dicom.el
+++ b/dicom.el
@@ -37,18 +37,15 @@
;; image files interactively.
;; Emacs must be compiled with support for PNG, XML and SVG. The package
relies
-;; on a few external programs, which are all widely available on Linux
-;; distributions.
+;; on external programs from the dcmtk DICOM toolkit, which are all widely
+;; available on Linux distributions.
-;; - `convert' from the ImageMagick suite
;; - `dcm2xml' and `dcmj2pnm' from the dcmtk DICOM toolkit
;; - `ffmpeg' for video conversion (optional)
;; - `mpv' for video playing (optional)
;;; Code:
-;; TODO Lossless JPEG DICOM cannot be converted by ImageMagick
-
(require 'compat)
(require 'dom)
(require 'outline)
@@ -307,8 +304,7 @@ progress:${percent-pos}%%' %s) & disown"
(unless (memq name dicom-hidden-fields)
(setq hidden nil))
(push (cons name (replace-regexp-in-string
- "\\s-+" " "
- (string-replace "^" " " (dom-text elem))))
+ "[ \t\n^]" " " (dom-text elem)))
alist))))
(unless hidden
(push (sort alist (lambda (x y) (string< (car x) (car y)))) items))))
@@ -446,7 +442,7 @@ REUSE can be a buffer name to reuse."
(dicom-play))
(delete-file tmp)))
"sh" "-c"
- (format "convert %s ppm:- | ffmpeg -framerate %s -i - %s"
+ (format "dcmj2pnm --all-frames --write-bmp %s | ffmpeg -framerate %s
-i - %s"
(shell-quote-argument dicom--file)
rate
(shell-quote-argument tmp)))))))))