Latest 0.2.0
License MIT
Platforms ios 8.0, osx 10.9, requires ARC
Dependencies Unbox

CI Status


DCDicom is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'DCDicom'


Lasse Porsch, [email protected]


DCDicom is available under the MIT license. See the LICENSE file for more info.


Creating a DicomObject

You can create a DicomObject instance from a URL, from Data or from any InputStream.

let dicomObject = DicomObject(url: fileURL)

Getting the raw DICOM contents

DICOMs are hierarchical data structures consisting of Data Elements. Once a DicomObject is instantiated,
you have direct access to all of its root-level data elements:

dicomObject.dataElements.forEach {
    print("Found DataElement with ($0.tag) and value ($0.stringValue)")

Accessing typed values

While each Data Element normally has a raw value of type Data and most have a string representation of this raw value,
you can also "introspect" the actual" data type of the Data Element and get a Swift-typed value.
The Data Element’s Value Representation is used for this. However, it is only available if it is explicitly mentioned in the DICOM object.
If the Dicom Object uses implicit Value Representations, you have to manually convert the raw data into a typed value based on the semantics
of the specific Dicom Object as per the corresponding DICOM Conformance Statement.

guard let vr = dataElement.vr else {
    print("Implicit Value Representation. Cannot determine value type without more context")
switch vr {
    case .FD: // Double
        if let doubleValue = (dataElement as! DicomDataElementFD).value {
            print(String(format: "Double value = %f", doubleValue))
        } else {
            print("Empty value")
    case .FL: // Float
        if let floatValue = (dataElement as! DicomDataElementFL).value {
            print(String(format: "Float value = %f", floatValue))
        } else {
            print("Empty value")
    case .DA: // Date
        if let dateValue = (dataElement as! DicomDataElementDA).value {
            let formatter = DateFormatter()
            formatter.dateStyle = .full
            print(String(format: "Date value = %@", formatter.string(from: dateValue)))
        } else {
            print("Empty value")

Latest podspec

    "name": "DCDicom",
    "version": "0.2.0",
    "summary": "A DICOM reader written in Swift.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Lasse Porsch": "lasse.p[email protected]"
    "platforms": {
        "ios": "8.0",
        "osx": "10.9"
    "source": {
        "git": "",
        "tag": "0.2.0"
    "source_files": "Sources/**/*.swift",
    "requires_arc": true,
    "resources": "Resources/**/*.*",
    "swift_version": "4.2",
    "dependencies": {
        "Unbox": [

Pin It on Pinterest

Share This