Skip to main content

dcmagick

PyPI version MIT licensed Build Status

dcmagick is a cli tool for finding, dumping and converting DICOM images. This is insipired by DCMTK, GDCM and imagemagick.

Installation

$ pypi install dcmagick

Feature

Dump

Dump DICOM tags and images on terminal via various format.

Dump by PRETTYE

$ dcmagick dump --format PRETTY ~/dcms/CT_small.dcm 2> /dev/null
(0008, 0005) Specific Character Set              CS: 'ISO_IR 100'
(0008, 0008) Image Type                          CS: ['ORIGINAL', 'PRIMARY', 'AXIAL']
(0008, 0012) Instance Creation Date              DA: '20040119'
(0008, 0013) Instance Creation Time              TM: '072731'
(0008, 0014) Instance Creator UID                UI: 1.3.6.1.4.1.5962.3
(0008, 0016) SOP Class UID                       UI: CT Image Storage
(0008, 0018) SOP Instance UID                    UI: 1.3.6.1.4.1.5962.1.1.1.1.1.20040119072730.12322
(0008, 0020) Study Date                          DA: '20040119'
(0008, 0021) Series Date                         DA: '19970430'
(0008, 0022) Acquisition Date                    DA: '19970430'
(0008, 0023) Content Date                        DA: '19970430'
(0008, 0030) Study Time                          TM: '072730'
(0008, 0031) Series Time                         TM: '112749'
(0008, 0032) Acquisition Time                    TM: '112936'
(0008, 0033) Content Time                        TM: '113008'
(0008, 0050) Accession Number                    SH: ''
(0008, 0060) Modality                            CS: 'CT'
...

Dump by JSON

$ dcmagick dump --format JSON ~/dcms/CT_small.dcm 2> /dev/null | jq .
{
  "0008, 0005": {
    "vr": "CS",
    "description": "Specific Character Set",
    "value": [
      "ISO_IR 100"
    ]
  },
  "0008, 0008": {
    "vr": "CS",
    "description": "Image Type",
    "value": [
      "ORIGINAL",
      "PRIMARY",
      "AXIAL"
    ]
  },
  "0008, 0012": {
    "vr": "DA",
    "description": "Instance Creation Date",
    "value": "20040119"
  },
  "0008, 0013": {
    "vr": "TM",
    "description": "Instance Creation Time",
    "value": "072731"
  },
  "0008, 0014": {
    "vr": "UI",
    "description": "Instance Creator UID",
    "value": "1.3.6.1.4.1.5962.3"
  },
...

Dump by BRAILLE

$ dcmagick dump --format BRAILLE ~/dcms/CT_small.dcm 2> /dev/null
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠌⢆⠕⡌⡢⡑⡐⢌⠢⠑⢌⠪⡪⡪⡪⡪⡪⣪⢪⡪⡪⡪⡪⡪⡪⡪⡪⣪⢪⢪⢂⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡌⡊⢆⢕⢜⡬⣪⣎⣎⢜⢌⠢⡑⢕⢕⢝⢜⢎⢎⢎⢎⢎⢇⢏⢎⢮⢪⢣⡣⡣⡣⡣⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢪⢨⢪⣞⡾⣫⢻⢜⡎⡟⡾⣆⢇⠪⡪⡪⡪⡪⡪⡪⡪⡪⡣⡳⡱⡣⡣⡳⡱⡕⡝⡜⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠢⡱⣸⡽⡳⡹⣜⢜⡕⡕⡝⡎⡯⣳⡕⡌⡪⡪⡪⡣⡫⡪⡣⡣⡇⣇⢗⢕⢝⡜⡜⡜⠌⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡢⡑⡵⣝⢎⢧⢫⢎⢮⢺⢸⡪⡺⡸⡪⡻⣆⠪⡘⢜⢜⢜⢼⢸⢜⢎⢎⢮⢪⢣⠣⢃⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢐⠌⡎⣞⢜⢎⡎⡮⡪⡳⡹⣜⢜⢕⢝⢜⢭⡳⡕⢌⠢⡑⡱⡑⡕⢕⢕⢕⢕⢑⠁⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢆⢣⢳⢝⢜⢕⢕⢕⢵⢹⡪⡺⡜⣕⡳⡹⡸⡸⣽⢰⠐⢔⠢⡑⠜⠌⠂⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠢⠢⡃⣗⢝⢕⢝⢎⡇⣏⢮⡺⣪⢳⡱⣕⢽⢸⢜⠼⡕⡅⠕⡨⠨⢈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⡎⡪⡑⣕⢽⡪⡇⡗⣗⢽⡸⡱⡕⡕⣳⢹⢜⢮⢳⡹⡪⣏⢎⡂⡢⠑⠄⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡐⡕⡝⡜⡌⡎⣯⡺⣝⢞⡼⡪⣎⢮⡪⡪⣪⡫⣝⢵⡳⣝⢝⣮⢣⢃⢪⢘⢌⠪⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⡘⡜⡜⡜⡜⢔⢕⡷⣝⢮⣳⣽⢽⢹⠱⡙⢎⠞⣞⢮⡳⣝⢮⡳⣕⢇⠣⡑⠜⢔⢑⠅⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢰⢡⢣⠱⡑⢜⢸⠨⢢⢿⣯⣿⢟⠜⡌⢆⢣⢑⢅⢕⠌⡎⡟⡷⣷⣽⠺⡘⢌⢂⠣⡑⡅⢕⢑⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢰⠸⡘⢜⠌⡪⠨⡊⡔⡅⣗⢽⢝⡧⡣⡱⡘⡌⢆⢣⠱⡰⡑⡌⡪⡪⡺⡸⡨⢂⠕⢌⢊⢢⠡⡑⢔⠨⡠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⡀⡆⡣⡑⢅⠕⡡⢪⢨⡪⡪⣪⣺⣪⢷⣝⣎⢆⢪⠢⡱⡑⢅⢣⠢⡃⢎⠢⡑⡕⢕⢱⢑⠜⢌⢢⢡⠱⡡⡑⢌⠢⡑⢄⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⡠⡰⣑⢑⢔⠰⡨⡢⡪⡺⡼⣕⢗⣽⣺⣾⣿⣿⣿⣿⣾⣌⢊⠆⢕⠡⡅⠕⢌⢢⢱⢼⣼⣷⣷⣷⣯⣎⢢⠡⡱⠰⡘⠄⠕⠨⡂⠥⡑⢄⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢀⢄⢢⢗⡏⡮⡢⡣⡪⡪⡪⡪⣪⢳⢝⡾⣽⣾⢷⣷⣻⣞⡿⡽⣿⣿⣷⣿⣼⣬⣶⣽⣮⣮⣿⢿⡿⣿⢿⣿⣿⣟⢆⠕⢌⢌⢂⠣⡑⢅⠢⠡⡂⡑⢔⠰⡀⡀⠀⠀⠀⠀⠀⠀
⠢⡑⡝⡜⡪⡯⡪⡺⣝⢜⢎⢞⢜⡜⡮⡫⢣⢑⠕⡌⢝⢻⢿⣯⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣻⣽⣯⣿⢿⠫⡣⠱⡨⡊⢆⢂⢪⠨⠢⡑⢌⠪⡰⠨⡂⡢⢊⠔⡡⠠⡀⠀⠀⠀
⡑⡌⡌⢎⠪⡣⡱⡹⡜⡜⡜⣜⢜⢜⠰⡡⡑⡌⡪⡐⡅⢕⠍⡫⡞⣿⣿⣿⣯⢿⢽⢽⣽⣾⢟⡯⡻⡘⢔⢑⢌⠪⡰⡘⢔⢑⠔⡅⡃⡊⡢⢃⠎⡊⢆⠪⠢⡱⠨⡊⠔⠅⢕⠠
⢌⢆⠕⡅⡣⡱⢸⢸⢸⢸⢮⡺⠜⡔⠕⡌⡢⣑⠢⡑⢌⢢⢱⢐⠕⢜⢜⣷⣿⡽⣽⣿⢯⢏⢇⢣⢑⢌⠆⡕⢔⠱⡨⠪⡘⢌⠜⡐⡑⠌⡢⠡⡑⡑⢕⢑⠕⢜⠸⡨⠪⡑⡅⡪
⢢⠢⢣⢊⠆⢎⢊⢆⠣⡑⡕⡸⡨⡪⡘⡌⡪⡂⡣⡑⡅⢕⠌⡆⡣⡑⢕⠸⢽⡿⣿⢫⠫⡘⢔⢑⠔⢅⠕⢌⠆⢇⠎⡪⢊⢢⢑⠱⡘⡌⠆⡕⢌⢌⠢⢅⢣⢑⢕⢘⢌⢢⢑⢌
⡊⢎⠪⡢⢩⢊⢢⢑⢅⢕⢅⠎⡔⢕⠸⡨⠢⡣⡑⡕⢜⢔⢱⢨⠢⡣⡑⢕⢑⢝⢕⢑⢕⢑⢅⢣⢑⢅⢣⢑⠕⢅⠇⢎⠪⡘⡌⡪⢂⢎⠪⣘⢐⢅⢕⢡⢱⢨⠢⡑⡅⡕⢜⢐
⢜⢌⢪⢨⠢⡣⡑⢅⢣⢊⢆⢣⠱⡑⡑⢕⢑⠕⡌⡪⢢⢑⢢⢑⠕⡌⡊⣊⠢⡑⡐⡱⡘⢌⢊⢢⢑⢅⠇⡕⡱⡡⢣⢑⠅⢇⠪⡌⡆⡕⡱⡐⢕⢌⢆⢣⠱⡨⡊⢆⢊⠔⡡⡡
⡢⡱⡨⢢⠣⡒⢌⠪⡢⢱⢘⠔⡕⢅⢣⠣⡑⡕⢌⠎⡜⢌⢊⢆⢕⢌⠜⡐⢕⢨⠨⠢⡑⢅⢣⠱⡐⡢⠣⡊⢆⢣⢑⠢⡑⢅⢇⠪⡢⢱⢨⠸⡐⡅⢆⢣⢑⢕⢘⢌⠄⡕⢌⢆
⢢⢱⠸⡰⡑⡅⡣⡑⢌⠢⡡⡃⡪⡨⡂⡣⢑⠜⢌⠎⢌⠢⢑⠐⢅⢢⠡⢣⢱⢱⡹⡨⢌⠢⡑⡅⡣⡑⡕⡑⡅⡣⠡⡡⠨⠢⡡⡃⡊⡢⡑⡅⢇⢕⠱⡡⠣⡪⠸⡐⢅⠊⢆⠕
⢅⢣⠱⡸⡐⢕⢑⠌⡆⢕⠰⡨⢂⠢⡂⡊⢔⠨⠢⡡⡱⢨⢂⢇⢣⠢⡣⡑⢌⠢⡊⢔⢅⠕⡌⡢⡡⡑⡌⡌⢌⠢⢑⠌⢌⢊⠢⡪⠨⡂⢎⢌⠢⢢⢃⢎⠪⡘⢌⠢⡢⡡⡑⡌
⡊⢆⢣⠱⡸⡘⢜⠸⡨⢢⠣⡪⢪⢘⢌⢪⠢⡣⢣⠣⡪⠪⡂⢇⠪⡊⢆⢊⠢⡑⢌⢒⠢⡣⡱⢨⠪⡨⢢⢊⢢⢑⠔⢌⠢⡂⢕⠨⡌⣊⢢⠡⡣⠱⡘⢔⢕⠱⡑⡕⢜⠔⢕⠱
⢸⢨⢢⠣⡪⡨⡢⢣⠪⡢⡣⡑⡅⡣⢪⢂⢇⠕⢅⠣⡪⢊⠪⡨⠊⠌⡂⠅⢅⢊⠐⢌⢊⠢⡑⢅⠣⡊⢎⠜⡌⢆⢍⠎⡊⣊⠪⠪⡘⢔⠅⡇⡣⢍⢎⠪⡢⢣⢱⠸⡰⡩⡊⢎
⡑⡅⡣⡱⠸⡐⠕⢅⠣⣊⢢⢑⠕⢜⢔⠱⡐⠅⡃⡑⠌⡂⡑⠄⠅⠕⡨⠨⢂⠢⠡⡑⡐⡐⠄⢅⠣⡑⡑⢕⠸⡐⢕⢸⠨⡢⡹⡘⡌⢆⢣⠱⡘⡔⢅⢣⢑⢱⠨⣊⢢⠱⡘⡌
⠸⡐⢕⠸⡘⡌⡣⢃⠣⡊⢌⠢⢑⠡⢂⢑⠌⠌⠢⠨⠨⡐⠨⠨⡈⡂⠢⠡⡑⠌⡊⡐⡐⠌⠌⠢⠨⡐⠨⡠⡑⠌⡌⢆⠣⡱⢨⠢⡣⢱⠡⡣⢱⢘⠜⡔⡱⢡⠣⡢⢣⠱⡡⠣
⠡⢃⠅⠅⢅⢂⢊⠔⡁⡂⠅⢌⢂⠅⡢⢂⠊⠌⠌⢌⠌⡂⡑⡡⠨⠂⠅⠕⡐⠅⡢⢁⠊⠌⢌⠌⠢⠨⠨⠐⢄⠑⢄⠑⢌⢐⠡⠑⠌⡊⢌⠊⢆⠣⠱⡘⢌⢊⠪⡨⠢⡃⠕⡉
⢈⠢⡈⡊⠔⡐⡐⡨⢐⠨⡈⠢⡐⠨⠐⠄⠅⡃⠅⢅⢂⠢⢂⠢⠡⠡⡡⢑⠨⠨⡐⠄⠕⠡⡁⡊⠌⡊⠌⢌⢂⢑⢐⠡⢂⢂⢊⠌⢌⢂⠢⢑⢐⠡⠑⢄⢑⠄⠕⡠⠑⢄⢑⢐
⢐⢁⢂⠢⠡⢂⢂⢂⠢⠡⡈⠢⠨⠨⠨⠊⠌⢄⢑⢐⠄⠕⡐⠡⠡⡑⠄⢕⠨⢊⢐⠅⠅⠕⡐⡐⡡⠨⡨⢂⢂⠢⢂⢑⢐⠔⡐⢌⠐⢄⢑⢐⠔⠡⠡⠡⢂⠊⠔⡨⢈⠢⡁⠢

Dump by HALFBLOCK

$ dcmagick dump --format HALFBLOCK ~/dcms/CT_small.dcm 2> /dev/null

Dump by HALFBLOCK

Dump by ITERM2

$ dcmagick dump --format ITERM2 ~/dcms/CT_small.dcm 2> /dev/null

Dump by ITERM2

Find

Find DICOM images by MongpDB like query to its tags.

$ dcmagick find --query '{"Modality": "MR"}' --name '*.dcm' ~/dcms/ 2> /dev/null
/home/argon/dcms/MR_small_bigendian.dcm
/home/argon/dcms/emri_small_jpeg_2k_lossless.dcm
/home/argon/dcms/MR_small_RLE.dcm
/home/argon/dcms/emri_small.dcm
/home/argon/dcms/emri_small_big_endian.dcm
/home/argon/dcms/MR_small_jp2klossless.dcm
/home/argon/dcms/MR_small_implicit.dcm
/home/argon/dcms/MR_small_expb.dcm
/home/argon/dcms/emri_small_jpeg_ls_lossless.dcm
/home/argon/dcms/MR_small.dcm
/home/argon/dcms/MR_truncated.dcm
/home/argon/dcms/emri_small_RLE.dcm
/home/argon/dcms/MR_small_jpeg_ls_lossless.dcm

Convert

Convert DICOM images into PNG or JPEG, and vice versa.

DICOM to PNG.

$ dcmagick convert ~/dcms/CT_small.dcm ~/out.png 2> /dev/null
$ file out.png
/home/argon/out.png: PNG image data, 128 x 128, 8-bit grayscale, non-interlaced

PNG to DICOM.

$ dcmagick convert ~/out.png ~/out.dcm 2> /dev/null
$ file out.dcm
/home/argon/out.dcm: DICOM medical imaging data

License

This software is released under the MIT License, see LICENSE.

Metadata

Release files for dcmagick 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dcmagick 0.1.0
File Size Uploaded Provenance Actions
dcmagick-0.1.0.tar.gz 18.5 kB Without provenance Details for dcmagick-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dcmagick 0.1.0
File Interpreter ABI Platform Actions
dcmagick-0.1.0-py3-none-any.whl Python 3 none any Details for dcmagick-0.1.0-py3-none-any.whl

Total release size: 36.9 kB

Release files / dcmagick-0.1.0.tar.gz

Download URL dcmagick-0.1.0.tar.gz
Size 18.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b8eead28831bd2d06e67e059cd5093a547239b7c2ade681508dc3830615a02ee
BLAKE2b-256 checksum
How to use checksums
7b8db444c546590d6d1709a14df4b0b5840582a3b3d46fa6848b42103ef1c57c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.3 CPython/3.6.9 Linux/4.15.0-74-generic

Release files / dcmagick-0.1.0-py3-none-any.whl

Download URL dcmagick-0.1.0-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49385c16e371236ae2a62b824c5b9fef3d2c7f2144c1206dce89e00e29b8f051
BLAKE2b-256 checksum
How to use checksums
80da6c55ae4b47b1c4a74075bbd78745700a9a24a6fd7d8699b3f3fa235c590e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.3 CPython/3.6.9 Linux/4.15.0-74-generic

Security for dcmagick 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page