The CTP DICOM Filter

From MircWiki
Jump to navigation Jump to search

The CTP DicomFilter is a pipeline stage that provides preprocessing of DicomObjects, quarantining those which do not meet the conditions of a script program. This article describes the script language. The intended audience for this article is CTP administrators setting up a processing pipeline.

The Script Language

The script language interrogates a received DICOM object and computes a boolean result that, if true, results in the object being accepted for further processing in the pipeline, and if false, results in the object being quarantined, aborting further processing.

An expression in the language consists of terms separated by operators and/or parentheses. There are three operators, listed in order of increasing precedence:

  • + is logical or
  • * is logical and
  • ! is unary logical negation

Examples:

  • term
  • term + term * term
  • term * (term + term) + term * !term

Terms in the language are either reserved words (true. or false.) (note the periods after the words) or expressions in the form:

identifier.method("string")

An identifier is either a DICOM element name as defined in the CTP DICOM Anonymizer (e.g. SOPInstanceUID) or a DICOM tag, specified in square brackets (e.g. [0008,0018]). No spaces are permitted in identifiers, and tags are required to contain all eight hexadecimal digits identifying the group and element.

The language supports these methods:

  • equals returns true if the value of the identifier exactly equals the string argument; otherwise, it returns false.
  • matches returns true if the value of the identifier matches the regular expression specified in the string argument; otherwise, it returns false.
  • contains returns true if the value of the identifier contains the the string argument anywhere within it; otherwise, it returns false.
  • startsWith returns true if the value of the identifier starts with the string argument; otherwise, it returns false.
  • endsWith returns true if the value of the identifier ends with the string argument; otherwise, it returns false.

The value of an identifier is the string value stored in the received DICOM object in the element associated with the identifier. If an identifier is missing from the received DICOM object, an empty string is provided.