Giter Club home page Giter Club logo

dicom-fhir-converter's Introduction

dicom-fhir-converter

DICOM FHIR converter is an open source python library that accepts a DICOM directory as an input. It processes all files (instances) within that directory. It expects that directory will only contain files for a single study. If multiple studies detected, an exception is raised. Using the usual convention, if file cannot be read, it will be skipped assuming it is not a dicom file (no error raised).

This library utilizes the following projects:

The library does not rely on the terminology service therefore, any coding that requires a look-up were coded with "userSelected=True" values.

Usage

dicom2fhir.process_dicom_2_fhir("study directory")

The dicom file represents a single instance within DICOM study. A study is a collection of instances grouped by series. The assumption is that all instances are copied into a single folder prior to calling this function. The flattened structure is then consolidated into a single FHIR Imaging Study resource.

Structure

The FHIR Imaging Study id is being generated internally within the library. The DICOM Study UID is actually stored as part of the "identifier" (see "system":"urn:dicom:uid" object for DICOM study uid.

The model is meant to be self-inclusive (to mimic the DICOM structure), it does not produce separate resources for other resource types. Instead, it uses "contained" resource to include all of the supporting data. (See "subject" with "reference": "#patient.contained.inline"

This approach will allow downstream systems to map inline resources to new or existing FHIR resource types replacing inline references to actual object within FHIR Server. Until such time, all of the a data is included within a single resource.

Sample Output

{
    "id": "011d5e1b-0402-445a-b417-21b86af500dc",
    "identifier": [
        {
            "type": {
                "coding": [
                    {
                        "code": "ACSN",
                        "system": "http://terminology.hl7.org/CodeSystem/v2-0203"
                    }
                ]
            },
            "use": "usual",
            "value": "DAC007_CRLAT"
        },
        {
            "system": "urn:dicom:uid",
            "value": "urn:oid:1.3.6.1.4.1.5962.99.1.2008629345.2009981611.1359218327649.129.0"
        }
    ],,
    "started": "2005-09-06T16:39:26",
    "status": "available",
    "subject": {
        "reference": "#patient.contained.inline"
    },
    "resourceType": "ImagingStudy"
    "endpoint": [
        {
            "reference": "file:///dcm1"
        }
    ],
    "modality": [
        {
            "code": "CR",
            "system": "http://dicom.nema.org/resources/ontology/DCM"
        }
    ],
    "numberOfInstances": 1,
    "numberOfSeries": 1,
    "contained": [
        {
            "id": "patient.contained.inline",
            "active": true,
            "gender": "unknown",
            "identifier": [
                {
                    "type": {
                        "coding": [
                            {
                                "code": "MR",
                                "system": "http://terminology.hl7.org/CodeSystem/v2-0203"
                            }
                        ]
                    },
                    "use": "usual",
                    "value": "DAC007_CRLAT"
                }
            ],
            "name": [
                {
                    "family": "LastName",
                    "given": [
                        "Mary"
                    ]
                }
            ],
            "resourceType": "Patient"
        }
    ],
    "series": [
        {
            "bodySite": {
                "code": "CHEST",
                "userSelected": true
            },
            "instance": [
                {
                    "number": 1,
                    "sopClass": {
                        "code": "urn:oid:1.2.840.10008.5.1.4.1.1.1",
                        "system": "urn:ietf:rfc:3986"
                    },
                    "title": "DERIVED\\PRIMARY\\IT",
                    "uid": "1.3.6.1.4.1.5962.99.1.2008629345.2009981611.1359218327649.128.0"
                }
            ],
            "modality": {
                "code": "CR",
                "system": "http://dicom.nema.org/resources/ontology/DCM"
            },
            "number": 1,
            "numberOfInstances": 1,
            "started": "2005-09-06T16:39:28",
            "uid": "1.3.6.1.4.1.5962.99.1.2008629345.2009981611.1359218327649.130.0"
        }
    ]
}

dicom-fhir-converter's People

Contributors

evbaron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dicom-fhir-converter's Issues

No fhir output generated after run test

Hello, I am new to this python lib and have a question need your support:

  1. after clone the repo and install it, i run the test as following steps:
    1.1. create a new file test1.py at the root folder - the folder contains setup.py
    1.2. add the following code into the test1.py :

from dicom2fhir.tests import test_dicom2fhir

test = test_dicom2fhir.testDicom2FHIR()
test.test_instance_dicom2fhir()

1.3 run it with command "python test1.py"
=> it run ok but there is no output found anywhere.
I expected there should be a fhir json output generated somewhere.

I am not sure this is an issue or just my mistake when run the test. please help me.

Regards,
thuan.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.