GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - aurabx/dicomweb-parser: A PHP library for parsing DICOMWeb JSON responses into structured PHP objects.

BranchesTags
Open more actions menu

Latest commit

 

History

20 Commits
20 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
composer.json
composer.json
 
 
composer.lock
composer.lock
 
 
example.php
example.php
 
 
phpunit.ini
phpunit.ini
 
 
readme.md
readme.md
 
 

Repository files navigation

DICOMWeb Parser for PHP

A PHP library for parsing DICOMWeb JSON responses into structured PHP objects.

Requirements

  • PHP 8.2 or higher
  • aurabx/dicom-data

Installation

composer require aurabx/dicomweb-parser

Usage

Basic Usage

<?php

use Aurabx\DicomWebParser\Parser;

// Your DICOMWeb JSON response
dollarjsonData = file_get_contents('dicom_response.json');

// Create a parser instance
$parser = new Parser();

// Parse the JSON into DICOM instances
$instances = $parser->parseInstances($jsonData);

// Display information about the first instance
$firstInstance = $instances[0];
echo "SOP Instance UID: " . $firstInstance->getSopInstanceUid() . "\n";
echo "Study Instance UID: " . $firstInstance->getStudyInstanceUid() . "\n";
echo "Series Instance UID: " . $firstInstance->getSeriesInstanceUid() . "\n";
echo "Modality: " . $firstInstance->getModality() . "\n";

// Access any DICOM tag by its tag ID
$patientId = $firstInstance->getElementFirstValue('00100020');
echo "Patient ID: " . $patientId . "\n";

// Access a DICOM tag by its standard name
$modality = $firstInstance->getElementFirstValueByKeyword('Modality');
echo "Modality: " . $modality . "\n";

// Parse the response into a study structure
$study = $parser->parseStudy($jsonData);
echo "Study has " . $study->getSeriesCount() . " series and " .
     $study->getTotalInstanceCount() . " total instances\n";

Working with Series and Studies

<?php

use Aurabx\DicomWebParser\Parser;

$jsonData = file_get_contents('dicom_response.json');
$parser = new Parser();
$study = $parser->parseStudy($jsonData);

// Get all series in the study
$seriesList = $study->getSeries();

foreach ($seriesList as $series) {
    echo "Series UID: " . $series->getSeriesInstanceUid() . "\n";
    echo "Series has " . $series->getInstanceCount() . " instances\n";

    // Sort instances by instance number
    $series->sortInstancesByNumber();

    // Get all instances in this series
    $instances = $series->getInstances();

    foreach ($instances as $instance) {
        echo "  Instance UID: " . $instance->getSopInstanceUid() . "\n";
    }
}

Using Tag Utilities

<?php

use Aurabx\DicomData\DicomTag;

// Get the descriptive name for a tag
$tagName = DicomTag::getName('00100010');  // Returns "PatientName"

// Format a tag with a separator
$formattedTag = DicomTag::formatTag('00100010', 'comma');  // Returns "0010,0010"
$formattedTag = DicomTag::formatTag('00100010', 'both');   // Returns "(0010,0010)"

// Get the meaning of a Value Representation code
$vrMeaning = DicomTag::getVRMeaning('PN');  // Returns "Person Name"

Key Features

  • Parse DICOMWeb JSON responses into structured PHP objects
  • Full support for DICOM instances, series, and studies
  • Access DICOM elements by tag ID or friendly name
  • Preload tag dictionaries for testing or performance
  • Includes tag metadata lookup, name resolution, VR decoding
  • Fully type hinted (PHP 8.2+ recommended)

Class Structure

  • Parser - Main parser for DICOMWeb JSON
  • DicomElement - Represents a DICOM attribute
  • DicomInstance - Single DICOM SOP instance
  • DicomSeries - Group of instances
  • DicomStudy - Group of series
  • DicomTag - Static utilities for tags
  • DicomTagLoader - Loads tag metadata from JSON
  • DicomDictionary - Global tag lookup facade
  • ParserException - Exception class

License

MIT

About

A PHP library for parsing DICOMWeb JSON responses into structured PHP objects.

Resources

Readme
Activity
Custom properties

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.