{"id":20874465,"url":"https://github.com/imagingdatacommons/pywsidicom","last_synced_at":"2025-10-10T00:08:19.662Z","repository":{"id":176993798,"uuid":"659830241","full_name":"ImagingDataCommons/pywsidicom","owner":"ImagingDataCommons","description":null,"archived":false,"fork":false,"pushed_at":"2023-06-28T16:55:16.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-12T15:51:10.166Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ImagingDataCommons.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2023-06-28T16:46:18.000Z","updated_at":"2023-12-19T08:33:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"f708138b-589f-410b-88f6-09258055f3a1","html_url":"https://github.com/ImagingDataCommons/pywsidicom","commit_stats":null,"previous_names":["imagingdatacommons/pywsidicom"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ImagingDataCommons/pywsidicom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImagingDataCommons%2Fpywsidicom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImagingDataCommons%2Fpywsidicom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImagingDataCommons%2Fpywsidicom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImagingDataCommons%2Fpywsidicom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ImagingDataCommons","download_url":"https://codeload.github.com/ImagingDataCommons/pywsidicom/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImagingDataCommons%2Fpywsidicom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002366,"owners_count":26083355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"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":[],"created_at":"2024-11-18T06:32:50.192Z","updated_at":"2025-10-10T00:08:19.646Z","avatar_url":"https://github.com/ImagingDataCommons.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pywsidicom\n\nThis is a tiny, experimental binding for\n[libdicom](https://github.com/jcupitt/libdicom). This is a DICOM read\nlibrary focused on Whole Slide Imaging (WSI). It should be fast, and only\nneeds a little memory.\n\nThis binding was made to validate the libdicom API. It is not supposed to\nbe ready for production! There are plenty of obvious missing features and\nuseful enhancements.\n\nHaving said that, it does work, performs well, has no known memory leaks,\nand supports the whole libdicom file read API.\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# Read frames\n\nSee `read-frames.py`:\n\n```python\n#!/usr/bin/env python\n\nimport sys\nimport pywsidicom\n\nfile = pywsidicom.Filehandle.create_from_file(sys.argv[1])\nmetadata = file.get_metadata()\nnum_frames_tag = pywsidicom.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\nPrints:\n\n```\n$ ./read-frames.py sm_image.dcm \nopening libdicom ...\ninit for libdicom ...\nlibdicom version: 1.0.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\nframe 4 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 5 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 6 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 7 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 8 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 9 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 10 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 11 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 12 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 13 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 14 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 15 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 16 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 17 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 18 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 19 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 20 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 21 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 22 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 23 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 24 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\nframe 25 -\u003e \u003c10x10 pixels, 8 bits, 3 bands, RGB\u003e 300 bytes\n```\n\n# Print metadata\n\nSee `print-metadata.py`:\n\n```python\n#!/usr/bin/env python\n\nimport sys\nimport pywsidicom\n\ndef print_sequence(seq, indent=0):\n    for index in range(0, seq.count()):\n        print(f\"{' '*indent}-- Item #{index} --\")\n        print_dataset(seq.get(index), indent + 2)\n\ndef print_dataset(dataset, indent=0):\n    for tag in dataset.tags():\n        element = dataset.get(tag)\n        print(f\"{' '*indent}{element}\")\n        if element.vr_class() == pywsidicom.VRClass.SEQUENCE:\n            seq = element.get_value()\n            print_sequence(seq, indent + 2) \n\nfile = pywsidicom.Filehandle.create_from_file(sys.argv[1])\nfile_meta = file.get_file_meta()\nprint(f\"===File Meta Information===\")\nprint_dataset(file_meta)\n\nmetadata = file.get_metadata()\nprint(f\"===Dataset===\")\nprint_dataset(metadata)\n```\n\nPrints:\n\n```\n$ ./print-metadata.py sm_image.dcm \nopening libdicom ...\ninit for libdicom ...\nlibdicom version: 1.0.0\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===Dataset===\n(0008,0008) ImageType | CS | 28 | 4 | [ORIGINAL, PRIMARY, VOLUME, NONE]\n(0008,0016) SOPClassUID | UI | 30 | 1 | 1.2.840.10008.5.1.4.1.1.77.1.6\n(0008,0018) SOPInstanceUID | UI | 64 | 1 | 1.2.826.0.1.3680043.9.7433.3.12857516184849951143044513877282227\n(0008,0020) StudyDate | DA | 8 | 1 | 20190604\n(0008,0023) ContentDate | DA | 8 | 1 | 20190822\n(0008,002a) AcquisitionDateTime | DT | 14 | 1 | 20091229095915\n(0008,0030) StudyTime | TM | 6 | 1 | 101000\n(0008,0033) ContentTime | TM | 6 | 1 | 113618\n(0008,0050) AccessionNumber | SH | 12 | 1 | S19-1_A_1_1\n(0008,0051) IssuerOfAccessionNumberSequence | SQ | 34 | 1 | \u003csequence\u003e\n  -- Item #0 --\n    (0040,0032) UniversalEntityID | UT | 30 | 1 | http://test.org/specimens/2019\n    (0040,0033) UniversalEntityIDType | CS | 4 | 1 | URI\n(0008,0060) Modality | CS | 2 | 1 | SM\n(0008,0070) Manufacturer | LO | 18 | 1 | Test Manufacturer\n(0008,0090) ReferringPhysicianName | PN | 14 | 1 | Test^Physician\n(0008,1090) ManufacturerModelName | LO | 10 | 1 | Test Model\n(0008,9206) VolumetricProperties | CS | 6 | 1 | VOLUME\n...\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimagingdatacommons%2Fpywsidicom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimagingdatacommons%2Fpywsidicom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimagingdatacommons%2Fpywsidicom/lists"}