{"id":20874426,"url":"https://github.com/imagingdatacommons/libdicom","last_synced_at":"2026-06-06T13:00:53.665Z","repository":{"id":44697017,"uuid":"383951991","full_name":"ImagingDataCommons/libdicom","owner":"ImagingDataCommons","description":"C library for reading DICOM files","archived":false,"fork":false,"pushed_at":"2026-06-05T20:09:09.000Z","size":1610,"stargazers_count":35,"open_issues_count":3,"forks_count":12,"subscribers_count":7,"default_branch":"main","last_synced_at":"2026-06-05T21:17:09.956Z","etag":null,"topics":["c","dicom","medical-imaging"],"latest_commit_sha":null,"homepage":"https://libdicom.readthedocs.io","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ImagingDataCommons.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-07-07T23:54:41.000Z","updated_at":"2026-06-04T13:18:38.000Z","dependencies_parsed_at":"2023-02-09T16:10:11.428Z","dependency_job_id":"fc089695-f9fd-406c-9737-484a98e0e562","html_url":"https://github.com/ImagingDataCommons/libdicom","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/ImagingDataCommons/libdicom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImagingDataCommons%2Flibdicom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImagingDataCommons%2Flibdicom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImagingDataCommons%2Flibdicom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImagingDataCommons%2Flibdicom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ImagingDataCommons","download_url":"https://codeload.github.com/ImagingDataCommons/libdicom/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImagingDataCommons%2Flibdicom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33983046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-06T02:00:07.033Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","dicom","medical-imaging"],"created_at":"2024-11-18T06:32:24.367Z","updated_at":"2026-06-06T13:00:53.660Z","avatar_url":"https://github.com/ImagingDataCommons.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build\nStatus](https://github.com/ImagingDataCommons/libdicom/actions/workflows/run_unit_tests.yml/badge.svg)](https://github.com/ImagingDataCommons/libdicom/actions)\n[![Documentation Status](https://readthedocs.org/projects/libdicom/badge/?version=latest)](https://libdicom.readthedocs.io/en/latest/?badge=latest)\n[![Conan Center](https://img.shields.io/conan/v/libdicom)](https://conan.io/center/recipes/libdicom)\n\n# libdicom\n\nlibdicom is a C library and a set of command-line tools\nfor reading DICOM WSI files. It is free (MIT licensed), fast,\ncross-platform, uses little memory, has no dependencies, [includes API\ndocumentation](https://libdicom.readthedocs.io), and is [easy to use from\nlanguages like Python](https://github.com/jcupitt/pylibdicom).\n\n![A DICOM WSI being viewed via OpenSlide 4.0](data/vipsdisp.png)\n\nlibdicom returns compressed frame data, not RGB pixel arrays. OpenSlide 4.0\nand later use libdicom to implement DICOM support and is a better choice\nif you want to process image files.\n\nlibdicom aims to support most popular DICOM WSI variants. If you have a\nsample file which does not work well, please [open an issue and we'll try\nto add support](https://github.com/ImagingDataCommons/libdicom/issues).\n\n## Building from source\n\n```shell\ncd libdicom-1.3.0\nmeson setup builddir --buildtype release\nmeson compile -C builddir\nmeson install -C builddir\n```\nSee [the installation\ndocumentation](https://libdicom.readthedocs.io/en/latest/installation.html)\nfor build dependencies and installation options.\n\n## Sample code\n\nSee [the documentation](https://libdicom.readthedocs.io) for full details.\n\n```c\n#include \u003cstdlib.h\u003e\n#include \u003cdicom/dicom.h\u003e\n\nint main() {\n    const char *file_path = \"/path/to/file.dcm\";\n    DcmError *error = NULL;\n\n    DcmFilehandle *filehandle = dcm_filehandle_create_from_file(\u0026error, file_path);\n    if (filehandle == NULL) {\n        dcm_error_log(error);\n        dcm_error_clear(\u0026error);\n        return 1;\n    }\n\n    const DcmDataSet *metadata =\n        dcm_filehandle_get_metadata_subset(\u0026error, filehandle);\n    if (metadata == NULL) {\n        dcm_error_log(error);\n        dcm_error_clear(\u0026error);\n        dcm_filehandle_destroy(filehandle);\n        return 1;\n    }\n\n    const char *num_frames;\n    uint32_t tag = dcm_dict_tag_from_keyword(\"NumberOfFrames\");\n    DcmElement *element = dcm_dataset_get(\u0026error, metadata, tag);\n    if (element == NULL ||\n        !dcm_element_get_value_string(\u0026error, element, 0, \u0026num_frames)) {\n        dcm_error_log(error);\n        dcm_error_clear(\u0026error);\n        dcm_filehandle_destroy(filehandle);\n        return 1;\n    }\n\n    printf(\"NumberOfFrames == %s\\n\", num_frames);\n\n    dcm_filehandle_destroy(filehandle);\n\n    return 0;\n}\n```\n\nOr in Python:\n\n```python\nimport sys\nimport pylibdicom\n\nfile = pylibdicom.Filehandle.create_from_file(sys.argv[1])\nmetadata = file.get_metadata_subset()\nnum_frames_tag = pylibdicom.Tag.create_from_keyword(\"NumberOfFrames\")\nnum_frames = int(metadata.get(num_frames_tag).get_value()[0])\nfor frame_number in range(1, num_frames + 1):\n    frame = file.read_frame(frame_number)\n    value = frame.get_value()\n    print(f\"frame {frame_number} -\u003e {frame} {len(value)} bytes\")\n\n# you can also read frames by (x, y) tile position ... this works for\n# TILED_FULL and for sparse images\nframe = file.read_frame_position(2, 7)\nvalue = frame.get_value()\nprint(f\"frame {2, 7} -\u003e {frame} {len(value)} bytes\")\n```\n\nThis will print:\n\n```python\n$ ./read-frames.py sm_image.dcm\nopening libdicom ...\ninit for libdicom ...\nlibdicom version: 1.1.0\nframe 1 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 2 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 3 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\n...\n```\n\n## Command-line tools\n\nlibdicom comes with two small command-line tools which can be useful for\ntesting.\n\n`dcm-dump` will print all metadata from a DICOM file. It's fast, and can\ndump DICOM files of any size while using only a small amount of memory.\n\nFor example:\n\n```!\n$ dcm-dump sm_image.dcm\n===File Meta Information===\n(0002,0001) FileMetaInformationVersion | OB | 2 | 1 | 00 01\n(0002,0002) MediaStorageSOPClassUID | UI | 30 | 1 | 1.2.840.10008.5.1.4.1.1.77.1.6\n(0002,0003) MediaStorageSOPInstanceUID | UI | 64 | 1 | 1.2.826.0.1.3680043.9.7433.3.12857516184849951143044513877282227\n(0002,0010) TransferSyntaxUID | UI | 20 | 1 | 1.2.840.10008.1.2.1\n(0002,0012) ImplementationClassUID | UI | 28 | 1 | 1.2.826.0.1.3680043.9.7433.1\n(0002,0013) ImplementationVersionName | SH | 14 | 1 | wsiget v0.0.1\n...\n```\n\n`dcm-getframe` will read a single frame from a DICOM file.\n\nFor example:\n\n```shell\ndcm-getframe -o tile.raw data/test_files/sm_image.dcm 12\n```\n\nTo read frame 12.\n\n## Thanks\n\nDevelopment of this library was supported by [NCI Imaging Data\nCommons](https://imaging.datacommons.cancer.gov/), and has been funded in\nwhole or in part with Federal funds from the National Cancer Institute,\nNational Institutes of Health, under Task Order No. HHSN26110071 under\nContract No. HHSN261201500003l.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimagingdatacommons%2Flibdicom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimagingdatacommons%2Flibdicom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimagingdatacommons%2Flibdicom/lists"}