pdf2dcm


Namepdf2dcm JSON
Version 0.5.0 PyPI version JSON
download
home_pagehttps://a-parida12.github.io/pdf2dcm/pdf2dcm/
SummaryA PDF to Dicom Converter
upload_time2024-04-27 18:31:12
maintainerNone
docs_urlNone
authorAbhijeet Parida
requires_python<4.0,>=3.8
licenseMIT
keywords dicom pdf pdf2dcm pdf2dicom pydicom pdf2dicomrgb
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pdf2dcm
[![PyPI version](https://img.shields.io/pypi/v/pdf2dcm.svg?logo=pypi&logoColor=FFE873)](https://pypi.org/project/pdf2dcm/) [![Supported Python versions](https://img.shields.io/pypi/pyversions/pdf2dcm.svg?logo=python&logoColor=FFE873)](https://pypi.org/project/pdf2dcm)[![Downloads](https://static.pepy.tech/personalized-badge/pdf2dcm?period=month&units=abbreviation&left_color=brightgreen&right_color=blue&left_text=PyPi%20Velocity)](https://pepy.tech/project/pdf2dcm) [![Downloads](https://static.pepy.tech/personalized-badge/pdf2dcm?period=total&units=abbreviation&left_color=brightgreen&right_color=blue&left_text=PyPi%20Downloads)](https://pepy.tech/project/pdf2dcm)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)[![codecov](https://codecov.io/gh/a-parida12/pdf2dcm/branch/main/graph/badge.svg?token=MGY9MHRP46)](https://codecov.io/gh/a-parida12/pdf2dcm)[![Test Pipeline](https://github.com/a-parida12/pdf2dcm/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/a-parida12/pdf2dcm/actions/workflows/test.yml)[![Release Pipeline](https://github.com/a-parida12/pdf2dcm/actions/workflows/release.yml/badge.svg?branch=main)](https://github.com/a-parida12/pdf2dcm/actions/workflows/release.yml)

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

```bash
pip install pdf2dcm
```

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

```bash
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
```bash
conda install -c conda-forge poppler
```

Ubuntu
```bash
sudo apt-get install poppler-utils
```

MacOS
```bash
brew install poppler
```

## PDF to Encapsulated DCM

### Usage

```python
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

```python
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 fields that are repersonalised by default are-

- PatientName
- PatientID
- PatientSex
- StudyInstanceUID
- ~~SeriesInstanceUID~~
- ~~SOPInstanceUID~~

The fields `SeriesInstanceUID` and `SOPInstanceUID` have been removed from the repersonalization by copying as it violates the DICOM standards.

You can set the fields to repersonalize by passing repersonalisation_fields into `Pdf2EncapsDCM()`, or `Pdf2RgbSC()`

Example:

```python
fields = [
    "PatientName",
    "PatientID",
    "PatientSex",
    "StudyInstanceUID",
    "AccessionNumber"
]
converter = Pdf2RgbSC(repersonalisation_fields=fields)
```

note: this will overwrite the default fields.
            

Raw data

            {
    "_id": null,
    "home_page": "https://a-parida12.github.io/pdf2dcm/pdf2dcm/",
    "name": "pdf2dcm",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "dicom, pdf, pdf2dcm, pdf2dicom, pydicom, pdf2dicomRGB",
    "author": "Abhijeet Parida",
    "author_email": "abhijeet.parida@tum.de",
    "download_url": "https://files.pythonhosted.org/packages/fc/e5/2d3c96be12bd71de4f313c916e525b1a1787b6cacaf7aa0a76c2648c3d86/pdf2dcm-0.5.0.tar.gz",
    "platform": null,
    "description": "# pdf2dcm\n[![PyPI version](https://img.shields.io/pypi/v/pdf2dcm.svg?logo=pypi&logoColor=FFE873)](https://pypi.org/project/pdf2dcm/) [![Supported Python versions](https://img.shields.io/pypi/pyversions/pdf2dcm.svg?logo=python&logoColor=FFE873)](https://pypi.org/project/pdf2dcm)[![Downloads](https://static.pepy.tech/personalized-badge/pdf2dcm?period=month&units=abbreviation&left_color=brightgreen&right_color=blue&left_text=PyPi%20Velocity)](https://pepy.tech/project/pdf2dcm) [![Downloads](https://static.pepy.tech/personalized-badge/pdf2dcm?period=total&units=abbreviation&left_color=brightgreen&right_color=blue&left_text=PyPi%20Downloads)](https://pepy.tech/project/pdf2dcm)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)[![codecov](https://codecov.io/gh/a-parida12/pdf2dcm/branch/main/graph/badge.svg?token=MGY9MHRP46)](https://codecov.io/gh/a-parida12/pdf2dcm)[![Test Pipeline](https://github.com/a-parida12/pdf2dcm/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/a-parida12/pdf2dcm/actions/workflows/test.yml)[![Release Pipeline](https://github.com/a-parida12/pdf2dcm/actions/workflows/release.yml/badge.svg?branch=main)](https://github.com/a-parida12/pdf2dcm/actions/workflows/release.yml)\n\nPDF to DICOM Converter\n\n> A python package for PDF to Encapsulated DCM and PDF to DICOM RGB converter\n\n## SETUP\n\n### Python Package Setup\n\nThe python package is available for use on PyPI. It can be setup simply via pip\n\n```bash\npip install pdf2dcm\n```\n\nTo the check the setup, simply check the version number of the `pdf2dcm` package by\n\n```bash\npython -c 'import pdf2dcm; print(pdf2dcm.__version__)'\n```\n\n### Poppler Setup\nPoppler 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-\n\nConda\n```bash\nconda install -c conda-forge poppler\n```\n\nUbuntu\n```bash\nsudo apt-get install poppler-utils\n```\n\nMacOS\n```bash\nbrew install poppler\n```\n\n## PDF to Encapsulated DCM\n\n### Usage\n\n```python\nfrom pdf2dcm import Pdf2EncapsDCM\n\nconverter = Pdf2EncapsDCM()\nconverted_dcm = converter.run(path_pdf='tests/test_data/test_file.pdf', path_template_dcm='tests/test_data/CT_small.dcm', suffix =\".dcm\")\nprint(converted_dcm)\n# [ 'tests/test_data/test_file.dcm' ]\n```\n\nParameters `converter.run`:\n\n- `path_pdf (str)`: path of the pdf that needs to be encapsulated\n- `path_template_dcm (str, optional)`: path to template for getting the repersonalisation of data.\n- `suffix (str, optional)`: suffix of the dicom files. Defaults to \".dcm\".\n\nReturns:\n\n- `List[Path]`: list of path of the stored encapsulated dcm\n\n## PDF to RGB Secondary Capture DCM\n\n### Usage\n\n```python\nfrom pdf2dcm import Pdf2RgbSC\n\nconverter = Pdf2RgbSC()\nconverted_dcm = converter.run(path_pdf='tests/test_data/test_file.pdf', path_template_dcm='tests/test_data/CT_small.dcm', suffix =\".dcm\")\nprint(converted_dcm)\n# [ 'tests/test_data/test_file_0.dcm', 'tests/test_data/test_file_1.dcm' ]\n```\n\nParameters `converter.run`:\n\n- `path_pdf (str)`: path of the pdf that needs to be converted\n- `path_template_dcm (str, optional)`: path to template for getting the repersonalisation of data.\n- `suffix (str, optional)`: suffix of the dicom files. Defaults to \".dcm\".\n\nReturns:\n\n- `List[Path]`: list of paths of the stored secondary capture dcm\n## Notes\n\n- The name of the output dicom is same as the name of the input pdf\n- If no template is provided no repersonalisation takes place\n- It is possible to produce dicoms without a suffix by simply passing `suffix=\"\"` to the `converter.run()`\n\n## Repersonalisation\n\nIt is the process of copying over data regarding the identity of the encapsualted pdf from a template dicom. Currently, the fields that are repersonalised by default are-\n\n- PatientName\n- PatientID\n- PatientSex\n- StudyInstanceUID\n- ~~SeriesInstanceUID~~\n- ~~SOPInstanceUID~~\n\nThe fields `SeriesInstanceUID` and `SOPInstanceUID` have been removed from the repersonalization by copying as it violates the DICOM standards.\n\nYou can set the fields to repersonalize by passing repersonalisation_fields into `Pdf2EncapsDCM()`, or `Pdf2RgbSC()`\n\nExample:\n\n```python\nfields = [\n    \"PatientName\",\n    \"PatientID\",\n    \"PatientSex\",\n    \"StudyInstanceUID\",\n    \"AccessionNumber\"\n]\nconverter = Pdf2RgbSC(repersonalisation_fields=fields)\n```\n\nnote: this will overwrite the default fields.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A PDF to Dicom Converter",
    "version": "0.5.0",
    "project_urls": {
        "Homepage": "https://a-parida12.github.io/pdf2dcm/pdf2dcm/",
        "Repository": "https://github.com/a-parida12/pdf2dcm"
    },
    "split_keywords": [
        "dicom",
        " pdf",
        " pdf2dcm",
        " pdf2dicom",
        " pydicom",
        " pdf2dicomrgb"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b35daffcabf2d015b79fc6561ca0c348d19f74f43693cda5d5ff39b1534f3f22",
                "md5": "ae0c66fe60b82afb33f00a5f59644239",
                "sha256": "5c8ba6195ae59a71e303d6f38591839545972142755f22c116b001012bc5fc85"
            },
            "downloads": -1,
            "filename": "pdf2dcm-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ae0c66fe60b82afb33f00a5f59644239",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 8734,
            "upload_time": "2024-04-27T18:31:09",
            "upload_time_iso_8601": "2024-04-27T18:31:09.970584Z",
            "url": "https://files.pythonhosted.org/packages/b3/5d/affcabf2d015b79fc6561ca0c348d19f74f43693cda5d5ff39b1534f3f22/pdf2dcm-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fce52d3c96be12bd71de4f313c916e525b1a1787b6cacaf7aa0a76c2648c3d86",
                "md5": "dc727cc016ee527be98f6e4771fd986a",
                "sha256": "517d7a0d94b423bd93f2a3cd244e3a8b934e282369bb962f932e3cf4af5128e3"
            },
            "downloads": -1,
            "filename": "pdf2dcm-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "dc727cc016ee527be98f6e4771fd986a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 6757,
            "upload_time": "2024-04-27T18:31:12",
            "upload_time_iso_8601": "2024-04-27T18:31:12.051487Z",
            "url": "https://files.pythonhosted.org/packages/fc/e5/2d3c96be12bd71de4f313c916e525b1a1787b6cacaf7aa0a76c2648c3d86/pdf2dcm-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-27 18:31:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "a-parida12",
    "github_project": "pdf2dcm",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pdf2dcm"
}
        
Elapsed time: 0.36439s