Making AI-Generated Reports Ready for Hospitals

Abhijeet Parida
3 min readAug 15, 2024

--

In the evolving world of medical technology, every tool brings us closer to improving patient care and streamlining clinical workflows. One such tool is the pdf2dcm Python package. pdf2dcm is a Python native package that seamlessly bridges the gap between AI-generated radiological reports and the digital imaging and communications in medicine (DICOM) format used by hospital picture archiving and communication system (PACS) systems.

Why pdf2dcm Matters?
- Streamlined Integration: AI-generated reports, often in PDF/TXT formats, can be effortlessly converted into DICOM files for integration with existing hospital systems.
- Enhanced Diagnostic Capabilities: By converting reports into a readily accessible format within PACS systems, `pdf2dcm` enhances the ability of radiologists to utilize AI insights effectively leading to faster patient outcomes.
- Educational Clinical Support: For educational initiatives or real-world clinical applications, pdf2dcm supports using AI technologies in radiology at the point of care making it an invaluable tool for training and practice.

This is what dall-e thinks is an appropriate image combining AI reports with the hospital ecosystem 💩

DICOM RGB Secondary Capture v/s Encapsulated DICOM

When storing radiology PDF reports on the PACS in the DICOM standardized format, two primary methods are used: DICOM RGB Secondary Capture and Encapsulated DICOM.

DICOM RGB Secondary Capture:
- Converts each PDF page into a bitmap image (RGB format).
- Stores the PDF content as an image within the DICOM file.
- Prioritizes visual consistency with other image-based data.
- Commonly used when integrating reports with images into the DICOM ecosystem.
Encapsulated DICOM:
-
Directly embeds the PDF file within the DICOM object.
- Maintains the original PDF format, allowing for text extraction and searchability.
- Emphasizes document fidelity and accessibility.
- Ideal for preserving the full content and structure of the original PDF.

Getting Started with pdf2dcm

The beauty of pdf2dcm lies in its simplicity of usage. Here’s a quick guide to getting started with this tool.

Installation

To begin, you need to install pdf2dcm. You can do this using pip:

pip install pdf2dcm

To 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 free and open-source software library for rendering PDF documents and is mainly used for the creation of DICOM RGB Secondary Capture. To set Poppler in conda:

conda install -c conda-forge poppler

Or can be set up using apt-get

sudo apt-get install poppler-utils

Examples and Usage

Here is a minimal example to get you started with the package

Encapsulated DICOM

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 a 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

DICOM RGB Secondary Capture

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

The Future of AI in Radiology

pdf2dcm is more than just a conversion tool; it is an open-source bridge between AI and radiology to deliver better physician experience and patient care. Automating the integration of AI-generated reports into DICOM systems pdf2dcm opens up new possibilities for improving diagnostic accuracy and efficiency.

As a researcher, a clinician, or a student, pdf2dcm you can help enhance your workflows and significantly improve your work with AI in radiology. To dive deeper into pdf2dcm and see it in action, check out the GitHub repository and the user documentation and make your radiology report accessible to physicians today.

--

--