Data coercion rules

 

General Syntax:

<lvalue>=<expression>

 

lvalues:

DICOM Tag – This is in the form, “(gggg,eeee)”. It represents the target attribute. After the expression is evaluated, the results are assigned to this attribute.

 

Expressions: Can be either a Value or a Function.

Values

Functions

In the evaluation of expressions, NULL is not the same as the empty string, “”. If a DICOM attribute does not exist, it is NULL. If it exists, but contains a 0-length value, it is the empty string, “”.

 

An example of a coercion rule to insert a prefix, “PFX”, before the Accession Number (0008,0050). If the attribute 0008,0050 exists, even if it contains a 0-length value, insert “PFX” into the beginning of the existing value and assign it back to the original attribute. If the original attribute does not exist, return NULL(), which prevents it from being added to the object.

 

(0008,0050)=if( (0008,0050) , concat(“PFX”,(0008,0050)) , NULL() )

 

Another example is to coerce a patient name, (0010,0010), defined as “LASTNAME,FIRSTNAME[,MI]” into DICOM-compliant syntax, “LASTNAME^FIRSTNAME[^MI]”. Note that the line break is inserted for readability only. To work, this needs to be entered on a single line.

 

(0010,0010)=concat(split((0010,0010), ”,”, 1), “^”, split((0010,0010), ”,”, 2),

if(split((0010,0010), ”,”, 3), “^”, “”), split((0010,0010), ”,”, 3) )