A simple DICOM object

Properties

HL7Connect.Dicom.DataElementList Elements;
   List of DICOM data elements made up this DICOM object


Methods

uint Size();
   The size of the object when parsed.

The size will be 0 if the object is being built instead of parsed.

The size of the object may be wrong if script has modified it's contents after parsing

HL7Connect.Dicom.DataElementList Query(string path);
   Query a Dicom Object for one or more contained elements. Whether more than one element can be returned will depend on the query string.

The format for query string is a repeating series of tag[filter] specifiers, with a seperator. This format is loosely based on XPath.

"tag" is any dicom tag, in hex, such as 0002,0010 (which is File Transfer Syntax UID). Wild cards such as 1000,xxx0 are allowed. Also the tag value '*' is allowed, which matches any tag (and is synonymous with xxxx,xxxx)

The seperator "/" means to match only immediate children of the existing set of matching node. The seperator "//" means to match any descendent element. While the query may start with a seperator, the query is always executed from the context of the current object (Unlike XPath. a starting "/" is redundant and ignored, but a starting "//" means "any descendent of the current object"

The filter is a formula. The outcome from the formula can either be a boolean, a numerical value, or a list of elements. If the outcome of the formula is a boolean (e.g 0018,6011[0018,6012 = 1], select any US regions that have a spacial format of 1) then an element will be included in the match list if the formula evaluates to true for it. If the formula returns a list of data elements, then an element will be included in the match list if any of the elements in the filter formula have a value (e.g. 0018,6011[0018,6012], which selects any US region that has a specified spacial format. Finally, if the return value is a numerical value, then the value is treated as an index in the sibling list of matching elements (e.g 0018,6011[2] means the second US region).

The formula can use the following operators: =, !=, <>, >, <, <=, >=, +, -, \, * In addition, & means string concatenation, ++ means integer addition (i.e. null if there's an error), and == means case-insensitive comparison. OIDs are treated as strings.

The following formulas are defined:

  position() -  the index of the element in tag match list (the list of elements that match the tag specification, irrespective of the filter)
  last() - the index number of the last element in the tag match list (count() - 1)
  count() - the number of tag matches
  contains()
  substring(value, start, end)
  substring-before(value, offset)
  substring-after(value, offset)
  starts-with(value, possible-start-value)
  ends-with(value, possible-start-value)
  string-length(value)
  upper-case(value)
  lower-case(value)
  if(test,value-if-true,value-if-false)

All the values can be a nested query, a string or numerical constant, an OID, or another formula.

You can combine queries using the | character.

void Tag(string sTag, string sValue);
   Tag the object: ensure that the object has an element corresponding to the tag (add it if required) and set it's value to to the provided value

value format:

  PN: use Dicom.PN(family, given, middle, prefix, suffix)
  AT: use tag 0000,0000
  UN, OB, OW: mime encoded binary
  other: as expected

void TagN(string sTag, string sValue);
   Tag the object: ensure that the object has an element corresponding to the tag (add it if required) and then add the provided value to it's values

value format:

  PN: use Dicom.PN(family, given, middle, prefix, suffix)
  AT: use tag 0000,0000
  UN, OB, OW: mime encoded binary
  other: as expected

HL7Connect.Dicom.DicomObject Sequence(string sTag);
   ensure that the object has an element corresponding to the tag (add it if required) and then add an object to it's sequence, and return the object for it's values to be filled out

string ElementAsString(string tagId);
   A short cut method to get a simple tag as a plain string.

The method will return a null string if

  • the element doesn't exist
  • the element is empty
  • elements that are sequences (type SQ)
If the element has multiple values, they will be returned separated by " | ".

The element will be returned as a single string, for DICOM types PN and AT, this will be in their native DICOM format. For PN, see DICOM.PNPart.

string v(string tagId);
   A short cut method to get a simple tag as a plain string (same as "ElementAsString" but just a shorter name, due to the ubiquity of it's use)

The method will return a null string if

  • the element doesn't exist
  • the element is empty
  • elements that are sequences (type SQ)
If the element has multiple values, they will be returned separated by " | ".

The element will be returned as a single string, for DICOM types PN and AT, this will be in their native DICOM format. For PN, see DICOM.PNPart.


© Kestral Computing P/L 2000 - 2003. HL7Connect v2.00-063 generated on 30-Nov 2015.
Keywords: Size, ElementAsString, Elements, Query, Sequence, Tag, TagN, v, HL7Connect.Dicom.DicomObject, DicomObject