Skip to main content

A PDF to Dicom Converter

Project description

pdf2dcm

PyPI version Supported Python versionsDownloads Downloads License: MITcodecovTest PipelineRelease Pipeline

PDF to DICOM Converter

A python package for PDF to Encapsulated DCM and PDF to DICOM RGB converter

SETUP

Python Package Setup

The python package is available for use on PyPI. It can be setup simply via pip

pip install pdf2dcm

To the check the setup, simply check the version number of the pdf2dcm package by

python -c 'import pdf2dcm; print(pdf2dcm.__version__)'

Poppler Setup

Poppler is a popular project that is used for the creation of Dicom RGB Secondary Capture. You can check if you already have it installed by calling pdftoppm -h in your terminal/cmd. To install poppler these are some of the recommended ways-

Conda

conda install -c conda-forge poppler

Ubuntu

sudo apt-get install poppler-utils

MacOS

brew install poppler

PDF to Encapsulated DCM

Usage

from pdf2dcm import Pdf2EncapsDCM

converter = Pdf2EncapsDCM()
converted_dcm = converter.run(path_pdf='tests/test_data/test_file.pdf', path_template_dcm='tests/test_data/CT_small.dcm', suffix =".dcm")
print(converted_dcm)
# [ 'tests/test_data/test_file.dcm' ]

Parameters converter.run:

  • path_pdf (str): path of the pdf that needs to be encapsulated
  • path_template_dcm (str, optional): path to template for getting the repersonalisation of data.
  • suffix (str, optional): suffix of the dicom files. Defaults to ".dcm".

Returns:

  • List[Path]: list of path of the stored encapsulated dcm

PDF to RGB Secondary Capture DCM

Usage

from pdf2dcm import Pdf2RgbSC

converter = Pdf2RgbSC()
converted_dcm = converter.run(path_pdf='tests/test_data/test_file.pdf', path_template_dcm='tests/test_data/CT_small.dcm', suffix =".dcm")
print(converted_dcm)
# [ 'tests/test_data/test_file_0.dcm', 'tests/test_data/test_file_1.dcm' ]

Parameters converter.run:

  • path_pdf (str): path of the pdf that needs to be converted
  • path_template_dcm (str, optional): path to template for getting the repersonalisation of data.
  • suffix (str, optional): suffix of the dicom files. Defaults to ".dcm".

Returns:

  • List[Path]: list of paths of the stored secondary capture dcm

Notes

  • The name of the output dicom is same as the name of the input pdf
  • If no template is provided no repersonalisation takes place
  • It is possible to produce dicoms without a suffix by simply passing suffix="" to the converter.run()

Repersonalisation

It is the process of copying over data regarding the identity of the encapsualted pdf from a template dicom. Currently, the fileds that are repersonalised are-

  • PatientName
  • PatientID
  • PatientSex
  • StudyInstanceUID
  • SeriesInstanceUID
  • SOPInstanceUID

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf2dcm-0.2.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdf2dcm-0.2.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file pdf2dcm-0.2.0.tar.gz.

File metadata

  • Download URL: pdf2dcm-0.2.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.4 keyring/23.6.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.13

File hashes

Hashes for pdf2dcm-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6583374dbaf41487a5d6a6407cd5f96dda81c6adc5057da3b9edcba43082bdf0
MD5 9d8afdb0e1dcbeec8b2d466e8c7fc896
BLAKE2b-256 84fb4f20b097ec5717e5561145ab5752eaaee51f957d66c064d57d9a2c13a0b3

See more details on using hashes here.

File details

Details for the file pdf2dcm-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pdf2dcm-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.4 keyring/23.6.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.13

File hashes

Hashes for pdf2dcm-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 737136cf17f31a97221d30eec5c6d89333a5945ef8e24d77de8c11f1b4af4309
MD5 3e98040b21c3d9db7516cac4b2887a38
BLAKE2b-256 454e8b1c7447f914f5b587aae1fc0c2743d8abd4b5fa3f5beedf06f88713a0ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page