aurabx/dicom-data

1.1.1 2025-04-22 03:37 UTC

This package is auto-updated.

Last update: 2025-05-22 03:49:48 UTC


README

Aurabx\DicomData is a PHP 8.2+ library for managing and resolving DICOM tag metadata. It provides an interface for loading DICOM dictionaries and resolving tag names with ease. Designed for integration with medical imaging platforms or DICOMWeb services.

This module effectively utilises the excellent DICOM data source from https://github.com/innolitics/dicom-standard and makes it available for PHP sources. \

By default, the DicomDictionary will load a PHP source, which is intended to help memory management, however the original JSON sources are also available. Unlike the Innolitics source, we rekey these so they are easier to use.

Requirements

  • PHP 8.2 or higher
  • ext-json

Installation

composer require aurabx/dicom-data

Usage

use Aurabx\DicomData\DicomDictionary;

// Lookup tag ID by name
$tagId = DicomDictionary::getTagIdByName('ImagingFrequency');  // Returns '00180084'

// Get full metadata
$info = DicomDictionary::getAttributeInfo('00180084');

// Get tag VR or keyword
$vr = DicomDictionary::getAttributeVr('00180084');
$desc = DicomDictionary::getAttributeKeyword('00180084');

Testing with Custom Tags

use Aurabx\DicomData\DicomDictionary;
use Aurabx\DicomData\DicomTagLoader;

$loader = new DicomTagLoader();
$loader->loadFromArray([
    '00100020' => ['keyword' => 'PatientID', 'valueRepresentation' => 'LO'],
    '00180084' => ['keyword' => 'ImagingFrequency', 'valueRepresentation' => 'DS'],
]);

DicomDictionary::preload($loader);

Development

Update the standards from the Innolitics source

python -m venv venv
source venv/bin/activate
pip install pydicom

python utils/update_dicom_dict.py

Run tests

composer test

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT – see LICENSE for details.