nu_plugin_dcm
Note that this plugin works with nu 0.105. If you want to use nu 0.60, use version 0.1.8 of this plugin.
A nushell plugin to parse Dicom objects.
This plugin is in the early stage of the development. It is usable but it might not be able to cope with all Dicom objects. One notable limitation is that all Dicom objects are expected to have a preamble.
I'm still trying to figure out what is the most useful way of using this plugin. Please feel free to try it out, send feedback in Discussions or report problems in Issues.
Usage
dcm plugin reads its input from single values or from specific columns:
dcm: expects a string/filename or binary Dicom datadcm $column_name: reads a string/filename or binary Dicom data from$column. This is equivalent toget $column | dcm.
Error handling
dcm plugin works in two modes:
- default, when errors are reported as error rows,
- in custom columns when
--erroroption is used. This will report all errors in the specified column. Empty column value means no error.
Known Limitations
- Dicom objects without a preamble and DCIM header will fail to load.
- PixelData is always skipped. For now I'm considering this to be a feature that speeds up Dicom parsing.
Examples
Output Dicom file as a table
| | | | | | |
Dump Dicom file as a JSON/YAML document
| |
| |
Dump all Dicom files in the current directory to a JSON/YAML document
| |
| |
Find all files in the current directory and subdirectories, parse them and group by Modality
|
|
|
|
For each file in the current directory, show the filename, file size, SOP Instance UID and Modality, and sort by SOP Instance UID
|
|
|
|
|
) |
Note that when a file cannot be parsed, it won't have SOPInstanceUID column. The default commands makes sure that select can find the column.
You can also use each and par-each like in the following example.
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
Use par-each to process files in parallel:
|
|
|
Installation
Build and install using cargo:
and then register in nu via
plugin add <PATH-TO-nu_plugin_dcm>/nu_plugin_dcm
To start using it right away, you can import it.
plugin use nu_plugin_dcm