{"id":13541152,"url":"https://github.com/realcundo/nu_plugin_dcm","last_synced_at":"2025-04-02T08:30:59.245Z","repository":{"id":57647327,"uuid":"387520589","full_name":"realcundo/nu_plugin_dcm","owner":"realcundo","description":"A nushell plugin to parse Dicom files","archived":false,"fork":false,"pushed_at":"2022-09-08T20:44:51.000Z","size":127,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-04T19:49:14.293Z","etag":null,"topics":["dicom","nushell","nushell-plugin"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/realcundo.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}},"created_at":"2021-07-19T16:00:42.000Z","updated_at":"2024-12-31T00:47:43.000Z","dependencies_parsed_at":"2022-09-08T00:00:51.280Z","dependency_job_id":null,"html_url":"https://github.com/realcundo/nu_plugin_dcm","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realcundo%2Fnu_plugin_dcm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realcundo%2Fnu_plugin_dcm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realcundo%2Fnu_plugin_dcm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realcundo%2Fnu_plugin_dcm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/realcundo","download_url":"https://codeload.github.com/realcundo/nu_plugin_dcm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246781937,"owners_count":20832937,"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","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":["dicom","nushell","nushell-plugin"],"created_at":"2024-08-01T10:00:39.744Z","updated_at":"2025-04-02T08:30:58.937Z","avatar_url":"https://github.com/realcundo.png","language":"Rust","readme":"# nu_plugin_dcm\n\n*Note that this plugin works with nu\u003e=0.60. If you want to use nu\u003c=0.44, use version 0.1.3 of this plugin.*\n\nA [nushell](https://www.nushell.sh/) plugin to parse [Dicom](https://en.wikipedia.org/wiki/DICOM) objects.\n\nThis plugin is in the early stage of the development. It is usable but it might not be able to cope\nwith all Dicom objects. One notable limitation is that all Dicom objects are expected to have a preamble.\n\nI'm still trying to figure out what is the most useful way of using this plugin. Please feel free to try it out,\nsend feedback in [Discussions](https://github.com/realcundo/nu_plugin_dcm/discussions) or report problems in [Issues](https://github.com/realcundo/nu_plugin_dcm/issues).\n\n## Usage\n`dcm` plugin reads its input from single values or from specific columns:\n- `dcm`: expects a string/filename or binary Dicom data\n- `dcm $column_name`: reads a string/filename or binary Dicom data from `$column`. This is\n  equivalent to `get $column | dcm`.\n\n## Error handling\n\n`dcm` plugin works in two modes:\n- default, when errors are reported as error rows,\n- in custom columns when `--error` option is used. This will report all errors in the specified column. Empty column value means no error.\n\n## Known Limitations\n\n- Dicom objects without a preamble and DCIM header will fail to load.\n- PixelData is always skipped. For now I'm considering this to be a feature that speeds up Dicom parsing.\n\n\n## Examples\n\n### Output Dicom file as a table\n```sh\necho file.dcm | dcm                # uses filename/string to specify which file to open\nopen file.dcm | dcm                # pass binary data to `dcm`\nls file.dcm | dcm name             # use `name` column as the filename\necho file.dcm | wrap foo | dcm foo # use `foo` column as the filename\nopen file.dcm | wrap foo | dcm foo # use `foo` column as binary data\n```\n\n### Dump Dicom file as a JSON/YAML document\n```sh\nopen file.dcm | dcm | to json --indent 2\nopen file.dcm | dcm | to yaml\n```\n\n### Dump all Dicom files in the current directory to a JSON/YAML document\n```sh\nls *.dcm | dcm name | to json --indent 2\nls *.dcm | dcm name | to yaml\n```\n\n\n### Find all files in the current directory and subdirectories, parse them and group by Modality\n\n```sh\nls **/* |\n  where type == file |\n  dcm name -e error |\n  where error == \"\" |\n  group-by Modality\n```\n\n### For each file in the current directory, show the filename, file size, SOP Instance UID, Modality and Pixel Spacing and sort by SOP Instance UID\nPixelSpacing is an array with 2 values.\n\nTo flatten the array use `.0` and `.1` indices.\n\n```sh\nlet files = (ls | where type == file)\n\necho $files |\n  select name size |\n  merge {\n    echo $files |\n    dcm name -e error |\n    default \"\" SOPInstanceUID |\n    select SOPInstanceUID Modality PixelSpacing.0 PixelSpacing.1 error\n  } |\n  sort-by size\n```\nNote that when a file cannot be parsed, it won't have `SOPInstanceUID` column. The `default` commands makes sure that `select` can find the column.\n\nYou can also use `each` and `par-each` like in the following example.\n\n\n### For each file in all subdirectories, show filename, file size, SHA256 hash of the file, SOP Instance UID and a Dicom parsing error, if any\nUse `par-each` to process files in parallel:\n```sh\nls **/* |\n  par-each { |it| {\n    name: $it.name,\n    size: $it.size,\n    sha256: (open $it.name | hash sha256),\n    dcm: ($it.name | dcm -e error)\n   } } |\n   select name size sha256 dcm.Modality dcm.SOPInstanceUID dcm.error |\n   sort-by name\n```\n\n\n## Installation\n\nBuild and install using [cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html):\n```sh\ncargo install nu_plugin_dcm\n```\nand then register in nu via\n```sh\nregister --encoding=json \u003cPATH-TO-nu_plugin_dcm\u003e/nu_plugin_dcm\n```\nNote that you **must** use `json` encoding. `capnp` is not supported yet.","funding_links":[],"categories":["Plugins"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealcundo%2Fnu_plugin_dcm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frealcundo%2Fnu_plugin_dcm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealcundo%2Fnu_plugin_dcm/lists"}