9 unstable releases (3 breaking)
0.8.0 | Nov 6, 2024 |
---|---|
0.7.0 | Apr 25, 2024 |
0.2.2 | Oct 31, 2023 |
0.2.0 | Jul 23, 2023 |
0.1.1 | Jul 19, 2022 |
#2359 in Command line utilities
2MB
33K
SLoC
DICOM-rs fromimage
This command line tool takes a base DICOM file of the image module and replaces the various DICOM attributes with those of another file.
This tool is part of the DICOM-rs project.
Usage
Usage: dicom-fromimage [OPTIONS] <DCM_FILE> <IMG_FILE>
Arguments:
<DCM_FILE> Path to the base DICOM file to read
<IMG_FILE> Path to the image file to replace the DICOM file
Options:
-o, --out <OUTPUT>
Path to the output image (default is to replace input extension with `.new.dcm`)
--transfer-syntax <TRANSFER_SYNTAX>
Override the transfer syntax UID
--encapsulate
Encapsulate the image file raw data in a fragment sequence instead of writing native pixel data
--retain-implementation
Retain the implementation class UID and version name from base DICOM
-v, --verbose
Print more information about the image and the output file
-h, --help
Print help
-V, --version
Print version
Example
Given a template DICOM file base.dcm
,
replace the image data with the image in image.png
:
dicom-fromimage base.dcm image.png -o image.dcm
This will read the image file in the second argument
and save it as native pixel data in Explicit VR Little Endian to image.dcm
.
You can also encapsulate the image file into a pixel data fragment, without converting to native pixel data. This allows you to create a DICOM file in JPEG baseline:
dicom-fromimage base.dcm image.jpg --transfer-syntax 1.2.840.10008.1.2.4.50 --encapsulate -o image.dcm
Note: --transfer-syntax
is just a UID override,
it will not automatically transcode the pixel data
to conform to the given transfer syntax.
To transcode files between transfer syntaxes,
see dicom-transcode
.
Dependencies
~33MB
~537K SLoC