Text functions

Top  Previous  Next

Most DICOM tags return text or number values.  In this topic, we will list out the available text functions to help you write your search conditions.

 

Function

Description

Examples

(0010,1030 is modality, 0008,0080 is institution name)

 

equality symbol (=)

This compares the tag value against the entered value, and is case sensitive.

 

Note that some tags may contain a space character before or after the text value, so an equality condition may not return the desired results.

 

For e.g. the Manufacturer tag (0008,0070) may contain SIEMENS_, where _ is a space character.

 

An equality search like this:

 

(Image.Tag('0008,0070') = 'SIEMENS')

 

will not return the desired images.  Only the following search will return the desired results.

 

(Image.Tag('0008,0070') = 'SIEMENS ')

 

To work around this, use the MATCH function where possible e.g.

 

(Image.Tag('0008,0070').Match('SIEMENS')

 

The MATCH function looks for a partial match.

 

(Image.Tag('0008,0060') = 'US')

 

(Image.Tag('0008,0060') = 'US')

OR

(Image.Tag('0008,0060') = 'MR')

 

IN

This compares the tag value against values in a list, and is case-sensitive.  Separate each value with a comma.

 

Note the use of square brackets to contain the list of text values to compare against.

 

Like the equality function (=) above, each match is exact and case-sensitive.

 

(Image.Tag('0008,0060') IN ['US', 'MR'])

inequality symbol (<>)

This returns true when the tag value is not equal to the entered value.  The comparison is case-sensitive.

 

(Image.Tag('0008,0060') <> 'US')

 

(Image.Tag('0008,0060') <> 'US')

AND

(Image.Tag('0008,0060') <> 'MR')

 

MATCH

This compares the tag value against values in a list, and is not case-sensitive.  Separate each value with a comma.

(Image.Tag('0008,0060').Match('US'))

 

(Image.Tag('0008,0060').Match('US, MR'))

 

STARTWITH

This compares the tag value against values in a list, and is true when the tag value begins with any values in the list.  This function is not case-sensitive.  Separate each value with a comma.

(Image.Tag('0008,0080').StartWith('JIRA'))

 

(Image.Tag('0008,0080').StartWith('JIRA, UCLA'))

 

CONTAIN

This compares the tag value against values in a list, and is true when any values in the list matches part of the tag value.  This function is not case-sensitive.  Separate each value with a comma.

(Image.Tag('0008,0080').Contain('hospital'))

 

(Image.Tag('0008,0080').Contain('hospital, research'))

 

ENDWITH

This compares the tag value against values in a list, and is true when the tag value ends with any values in the list.  This function is not case-sensitive.  Separate each value with a comma.

(Image.Tag('0008,0080').EndWith('center'))

 

(Image.Tag('0008,0080').EndWith('center, JP'))

 

NOT

Use this function to reverse the results of the 'inner' function.

 

For e.g. say we want to find all images where the modality is not ultrasound and not MRI.  We can write the search condition as follows:

 

(NOT (Image.Tag('0008,0060').Match('US, MR')))

 

(NOT (Image.Tag('0008,0060').Match('US, MR')))

 

(NOT (Image.Tag('0008,0080').Match('JIRA, UCLA')))

 

(NOT (Image.Tag('0008,0080').Contain('hospital, research')))