Transforms DICOM files using JavaScript.
dotnet tool install dcmtransform --global
dcmfind sample.dcm --script sample.js
Options
files pos. 0 Required. (Default: .) Transform these DICOM files. When missing, this option will be read from the piped input.
-s, --script Required. Script that transforms the provided DICOM file
-p, --parallelism (Default: 8) Process this many files in parallel
--help Display this help screen.
--version Display version information.
The script can be provided inline or as a path to a file. It is presumed that the script exposes one top level "main" function that accepts a single argument "dicom". This argument is a C# object exposed to JavaScript with the following signature:
public interface IJintDicom
{
string? GetString(ushort group, ushort element);
string[]? GetMultipleStrings(ushort group, ushort element);
void UpdateString(ushort group, ushort element, string value);
void DeleteTag(ushort group, ushort element);
void DeleteGroup(ushort group);
bool Contains(ushort group, ushort element);
bool HasValue(ushort group, ushort element);
int CountSequenceItems(ushort group, ushort element);
JintDicom GetSequenceItem(ushort group, ushort element, int index);
JintDicom[] GetSequenceItems(ushort group, ushort element);
JintDicom CreateAndReturnSequenceItem(ushort group, ushort element);
}
This is a sample transform script setting the accession number to 'TRANSFORMED'
function main(dicom) {
dicom.UpdateString(0x0008,0x0050,"TRANSFORMED");
}