{"id":37436604,"url":"https://github.com/exini/dicom-streams-js","last_synced_at":"2026-01-16T06:40:52.357Z","repository":{"id":53559972,"uuid":"177842042","full_name":"exini/dicom-streams-js","owner":"exini","description":"A streaming and non-blocking API for reading and processing DICOM data","archived":false,"fork":false,"pushed_at":"2024-09-04T13:48:56.000Z","size":2128,"stargazers_count":34,"open_issues_count":3,"forks_count":6,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2025-08-28T00:44:05.214Z","etag":null,"topics":["backpressure","dicom","node","streams"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/exini.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":"2019-03-26T17:58:07.000Z","updated_at":"2025-06-17T07:37:26.000Z","dependencies_parsed_at":"2024-04-29T17:28:06.065Z","dependency_job_id":"3e4e734e-1c76-4522-b08e-73733d22dd85","html_url":"https://github.com/exini/dicom-streams-js","commit_stats":{"total_commits":167,"total_committers":7,"mean_commits":"23.857142857142858","dds":0.3892215568862275,"last_synced_commit":"ed387eabbf3e4e18b38d3d3d654b31ac6fbfd611"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/exini/dicom-streams-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exini%2Fdicom-streams-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exini%2Fdicom-streams-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exini%2Fdicom-streams-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exini%2Fdicom-streams-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exini","download_url":"https://codeload.github.com/exini/dicom-streams-js/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exini%2Fdicom-streams-js/sbom","scorecard":{"id":387932,"data":{"date":"2025-08-11","repo":{"name":"github.com/exini/dicom-streams-js","commit":"74e0620a898d2c1245b51adba033505e7b6a85f1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":3,"reason":"Found 5/16 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/exini/dicom-streams-js/test.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/exini/dicom-streams-js/test.yml/develop?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":5,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'develop'","Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'develop'","Info: 'force pushes' disabled on branch 'master'","Warn: 'branch protection settings apply to administrators' is disabled on branch 'develop'","Warn: 'branch protection settings apply to administrators' is disabled on branch 'master'","Warn: 'stale review dismissal' is disabled on branch 'develop'","Warn: 'stale review dismissal' is disabled on branch 'master'","Warn: required approving review count is 1 on branch 'develop'","Warn: required approving review count is 1 on branch 'master'","Warn: codeowners review is not required on branch 'develop'","Warn: codeowners review is not required on branch 'master'","Warn: 'last push approval' is disabled on branch 'develop'","Warn: 'last push approval' is disabled on branch 'master'","Warn: no status checks found to merge onto branch 'develop'","Warn: no status checks found to merge onto branch 'master'","Info: PRs are required in order to make changes on branch 'develop'","Info: PRs are required in order to make changes on branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 19 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"10 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T17:07:17.966Z","repository_id":53559972,"created_at":"2025-08-18T17:07:17.966Z","updated_at":"2025-08-18T17:07:17.966Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28477913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["backpressure","dicom","node","streams"],"created_at":"2026-01-16T06:40:51.736Z","updated_at":"2026-01-16T06:40:52.347Z","avatar_url":"https://github.com/exini.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dicom-streams-js\n\n[![Build Status](https://travis-ci.org/exini/dicom-streams-js.svg?branch=develop)](https://travis-ci.org/exini/dicom-streams-js)\n[![Coverage Status](https://coveralls.io/repos/exini/dicom-streams-js/badge.svg)](https://coveralls.io/r/exini/dicom-streams-js)\n\nThe purpose of this project is to create a streaming API for reading and processing DICOM data using [node-streams](https://nodejs.org/api/stream.html). It can be used both on the backend using Node, as well as on the frontend. Advantages of streaming DICOM data include better control over resource allocation such as memory via strict bounds on DICOM data chunk size and network utilization using back-pressure.\n\nThis project is a port of the [dicom-streams](https://github.com/exini/dicom-streams) project which is written in Scala using Akka-streams.\n\n### Setup\n\nThe dicom-streams-js library is deployed to NPM. Install it using `npm install -s @exini/dicom-streams-js`. Time and date handling using `js-joda` is marked as an external dependency in dicom-streams-js. If you want to read and modify times and dates, install this using `npm install -s js-joda`.\n\n### Data Model\n\nStreaming binary DICOM data may originate from many different sources such as files, a HTTP POST request (on the server side), or a read from a database. Streaming data arrives in chunks (`Buffer`s). In the Node Streams nomenclature, chunks originate from _readables_, they are processed in _transforms_ and and folded into a non-streaming plain objects using _writables_. Synonyms for these terms are _sources_, _flows_ and _sinks_. These latter terms are used in the docs and throughout the code.\n\nThis library provides flows for parsing binary DICOM data into DICOM parts (represented by the `DicomPart` abstraction) - small objects representing a part of a data element. These DICOM parts are bounded in size by a user specified chunk size parameter. Flows of DICOM parts can be processed using a series of flows in this library. There are flows for filtering based on tag path conditions, flows for converting between transfer syntaxes, flows for re-encoding sequences and items, etc.\n\nThe `Element` interface provides a set of higher level data classes, each roughly corresponding to one row in a textual dump of a DICOM files. Here, chunks are aggregated into complete data elements. There are representations for standard tag-value elements, sequence and item start elements, sequence and item delimitation elements, fragments start elements, etc. A `DicomPart` stream is transformed into an `Element` stream via the `elementFlow` flow.\n\nA flow of `Element`s can be materialized into a representation of a dataset called an `Elements` using the `elementSink` sink. For processing of large sets of data, one should strive for a fully streaming DICOM pipeline, however, in some cases it can be convenient to work with a plain dataset; `Elements` serves this purpose. Internally, the sink aggregates\n`Element`s into `ElementSet`s, each with an asssociated tag number (value elements, sequences and fragments). `Elements` implements a straight-forward data hierarchy:\n\n-   An `Elements` holds a list of `ElementSet`s (`ValueElement`, `Sequence` and `Fragments`)\n-   A `ValueElement` is a standard attribute with tag number and binary value\n-   A `Sequence` holds a list of `Item`s\n    -   An `Item` contains zero or one `Elements` (note the recursion)\n-   A `Fragments` holds a list of `Fragment`s\n    -   A `Fragment` holds a binary value.\n\nThe following diagram shows an overview of the data model at the `DicomPart`, `Element` and `ElementSet` levels.\n\n![Data model](example/data-model.png)\n\nAs seen, a standard attribute, represented by the `ValueElement` class is composed by one `HeaderPart` followed by zero,\none or more `ValueChunk`s of data. Likewise, ecapsulated data such as a jpeg image is composed by one `FragmentsPart`\nfollowed by, for each fragment, one `ItemPart` followed by `ValueChunk`s of data, and ends with a\n`SequenceDelimitationPart`.\n\n### Examples\n\nThe following example reads the DICOM file provided as input argument, folds its contents first into a stream of `Element`s, and then into a concrete `Elements` object and logs the result to the console\n\n```javascript\nconst fs = require('fs');\nconst { parseFlow, elementFlow, elementSink, pipe, VR } = require('@exini/dicom-streams-js');\n\nconst src = fs.createReadStream(process.argv[2]);\n\npipe(\n    src,\n    parseFlow(),\n    elementFlow(),\n    elementSink((elements) =\u003e {\n        console.log(elements.toString());\n    }),\n);\n```\n\nThe next, longer, example reads the file specified by the first input argument then passes the data through the following flows:\n\n1. Parsing the binary data into `DicomPart`s for further processing\n2. Re-encoding the data to always use indeterminate length sequences and items with explicit sequence and item delimitations\n3. Re-encoding the data to use the UTF-8 character set\n4. Filtering of the elements to preserve only those on a allow list specified as an array of `TagTree`s (trees of pointers into a dataset)\n5. Filtering of the remaining elements according to a deny list of tag trees\n6. Modification of the remaining elements to set Patient Name to `Anon 001`, add or modifiy the attribute Patient Identity Removed to `YES`, and leave other elements unmodified\n7. Map the resulting elements to their corresponding byte representations\n8. Write the results to disk using the file name specified by the second input argument.\n\n```javascript\nconst fs = require('fs');\nconst {\n    TagPath,\n    TagTree,\n    parseFlow,\n    toBytesFlow,\n    allowFilter,\n    denyFilter,\n    toUtf8Flow,\n    toIndeterminateLengthSequences,\n    modifyFlow,\n    TagModification,\n    TagInsertion,\n    pipe,\n} = require('@exini/dicom-streams-js');\n\nconst src = fs.createReadStream(process.argv[2]);\nconst dest = fs.createWriteStream(process.argv[3]);\n\npipe(\n    src,\n    parseFlow(),\n    toIndeterminateLengthSequences(),\n    toUtf8Flow(),\n    allowFilter([\n        TagTree.fromTag(Tag.SpecificCharacterSet),\n        TagTree.fromTag(Tag.PatientName),\n        TagTree.fromTag(Tag.PatientName),\n        TagTree.fromTag(Tag.StudyDescription),\n        TagTree.fromTag(Tag.SeriesDate),\n        TagTree.fromAnyItem(Tag.MACParametersSequence),\n    ]),\n    denyFilter([TagTree.fromAnyItem(Tag.MACParametersSequence).thenTag(Tag.DataElementsSigned)]),\n    modifyFlow(\n        [TagModification.equals(TagPath.fromTag(Tag.PatientName), () =\u003e Buffer.from('Anon 001'))],\n        [new TagInsertion(TagPath.fromTag(Tag.PatientIdentityRemoved), () =\u003e Buffer.from('YES'))],\n    ),\n    toBytesFlow(),\n    dest,\n);\n```\n\n### Custom Processing\n\nNew non-trivial DICOM flows can be built using a modular system of capabilities that are mixed in as appropriate with a core class implementing a common base interface. The base abstraction for DICOM flows is `DicomFlow` and new flows are created using the `DicomFlow.createFlow` method. The `DicomFlow` interface defines a series of events, one for each type of `DicomPart` that is produced when parsing DICOM data with `DicomParseFlow`. The core events are:\n\n```javascript\n  public onPreamble(part: PreamblePart): DicomPart[]\n  public onHeader(part: HeaderPart): DicomPart[]\n  public onValueChunk(part: ValueChunk): DicomPart[]\n  public onSequence(part: SequencePart): DicomPart[]\n  public onSequenceDelimitation(part: SequenceDelimitationPart): DicomPart[]\n  public onFragments(part: FragmentsPart): DicomPart[]\n  public onItem(part: ItemPart): DicomPart[]\n  public onItemDelimitation(part: ItemDelimitationPart): DicomPart[]\n  public onDeflatedChunk(part: DeflatedChunk): DicomPart[]\n  public onUnknown(part: UnknownPart): DicomPart[]\n  public onPart(part: DicomPart): DicomPart[]\n```\n\nDefault behavior to these events are implemented in core classes. The most natural behavior is to simply pass parts on\ndown the stream, e.g.\n\n```javascript\n  public onPreamble(part: PreamblePart): DicomPart[] { return [part]; }\n  public onHeader(part: HeaderPart): DicomPart[] { return [part]; }\n  ...\n```\n\nThis behavior is implemented in the `IdentityFlow` core class. Another option is to defer handling to the `onPart` method which is implemented in the `DeferToPartFlow` core class. This is appropriate for flows which define a common behavior for all part types.\n\nTo give an example of a custom flow, here is the implementation of a filter that removes nested sequences from a dataset. We define a nested dataset as a sequence with `depth \u003e 1` given that the root dataset\nhas `depth = 0`.\n\n```javascript\n  public nestedSequencesFilter() = createFlow(new class extends TagPathTracking(GuaranteedValueEvent(GuaranteedDelimitationEvents(InFragments(DeferToPartFlow)))) {\n    public onPart(part: DicomPart): DicomPart[] { return this.tagPath.depth() \u003e 1 ? [] : [part];\n  }());\n```\n\nIn this example, we chose to use `DeferToPartFlow` as the core class and mixed in the `TagPathTracking` capability (along with its dependencies `GuaranteedValueEvent`, `GuaranteedDelimitationEvents` and `InFragments`) which gives access to a `tagPath: TagPath` variable at all times which is automatically updated as the flow progresses.\n\n### License\n\nThis project is released under the [Apache License, version 2.0](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexini%2Fdicom-streams-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexini%2Fdicom-streams-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexini%2Fdicom-streams-js/lists"}