XNAT versions 1.7.0, 1.7.1, and 1.7.2 support DicomEdit 6.0 only.
XNAT 1.7.3 and greater supports scripts in both DicomEdit 6.1 format, and DicomEdit 4.2 format.
XNAT 1.8.0 and greater supports scripts in both DicomEdit 6.3 format, and DicomEdit 4.2 format.
XNAT 1.8.7 and greater supports scripts in DicomEdit 6.4 format and the versions listed above
DicomEdit is a software library that provides the ability to read DICOM objects, transform their contents based on a scripted list of commands, and to output the transformed DICOM. Scripts are created by users in the small custom language defined by DicomEdit. Scripts can be general purpose, providing a general anonymization, or they can be customized to handle unique requirements posed by a specific project and its unique data sources.
DicomEdit 6.x is written in ANTLR and Java and is open source (BSD license). The source code is available in the XNAT DICOM DicomEdit6 code repository. It depends on the dcm4che2 DICOM Toolkit.
The language is described in detail in the DicomEdit 6.4 Language Reference. The previous version is documented here. DicomEdit 4.2 Language Reference. A FAQ will grow here.
DicomEdit version 6.0 introduced some changes to the scripting language that are not backward compatible with previous versions of DicomEdit. See the section 'Migration to version 6.0 scripts' below for details.
DicomEdit can also be packaged to provide a run-able jar providing a stand-alone command-line tool. See the instructions at DicomEdit6 code repository for instructions.
DicomEdit 6.3 Release Notes
DicomEdit 6.2 Release Notes
DicomEdit 6.1 Release Notes
Migration to version 6.1 scripts
Add the version statement to your 6.0 scripts
// DicomEdit >= 6.1 version "6.1" // DicomEdit 6.0 script below.......
DicomEdit 6.0 Release Notes
Migration to version 6.0 scripts
DicomEdit's implementation has been reworked to leverage advances in the underlying technologies. The grammar is now generated using ANTLR4. This has brought simplifications to how the scripting language's grammar is coded and the ability to simplify DicomEdit's implementation by extending a parse-tree visitor that is automatically generated by ANTLR4. Also, DicomEdit's interaction with DICOM objects has been abstracted behind an interface. This will ease the migration of DicomEdit from its use of the dcm4che2 DICOM library to dcm4ch3.
The downside of this rewrite is that some changes in the scripting language are not compatible with previous versions. This is the list of changes that you need to be aware of.
The precedence of statement order has changed. It is now true that all statements are executed in the order they are encoded in the script. It used to be true that the first operation on a tag took effect and all subsequent modifications would be ignored. Now, "last one wins". A consequence of this is illustrated below.
// DicomEdit version < 6.0 project = "Unassigned" : (0008,1030) := (0008,1030) (0008,1030) := project
This code functions like this. If the value of the variable named 'project' is "Unassigned", assign the value of (0008,1030), StudyDescription, to itself. A modification to (0008,1030) has occurred so the second statement will be ignored. If project = "Unassigned" is not true, the first assignment does not occur so the second statement is not ignored and StudyDescription will receive the value of the 'project' variable. This is more easily expressed as "change the value of StudyDescription only if the value of variable 'project' is not "Unassigned". In DicomEdit >= 6.0, this will not work as coded above. The second assignment will never be ignored and StudyDescription will always get the value of 'project'. One way to achieve this in DicomEdit >= 6.0 is as follows.
// DicomEdit >= 6.0 project != "Unassigned" ? (0008,1030) := project
Notice that this statement uses the new ternary if-then-else operator and the new not-equal operator in the condition. No action is needed if the condition is false, so the optional if-false action is not used.