Class: DICOM::DictionaryElement

Inherits:
Object
  • Object
show all
Defined in:
lib/dicom/dictionary_element.rb

Overview

This class handles the various Element types (data, file meta, directory structuring) found in the DICOM Data Dictionary.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag, name, vrs, vm, retired) ⇒ DictionaryElement

Creates a new dictionary element.

Parameters:

  • tag (String)

    the element’s tag

  • name (String)

    the element’s name

  • vrs (Array<String>)

    the element’s value representation(s)

  • vm (String)

    the element’s value multiplicity

  • retired (String)

    the element’s retired status string



27
28
29
30
31
32
33
# File 'lib/dicom/dictionary_element.rb', line 27

def initialize(tag, name, vrs, vm, retired)
  @tag = tag
  @name = name
  @vrs = vrs
  @vm = vm
  @retired = retired
end

Instance Attribute Details

#nameObject (readonly)

The element’s name, e.g. ‘SOP Instance UID’.



9
10
11
# File 'lib/dicom/dictionary_element.rb', line 9

def name
  @name
end

#retiredObject (readonly)

The element’s retired status string, i.e. an empty string or ‘R’.



11
12
13
# File 'lib/dicom/dictionary_element.rb', line 11

def retired
  @retired
end

#tagObject (readonly)

The element’s tag, e.g. ‘0010,0010’.



13
14
15
# File 'lib/dicom/dictionary_element.rb', line 13

def tag
  @tag
end

#vmObject (readonly)

The element’s value multiplicity, e.g. ‘1’, ‘2-n’.



15
16
17
# File 'lib/dicom/dictionary_element.rb', line 15

def vm
  @vm
end

#vrsObject (readonly)

The element’s value representations, e.g. [‘UL’], [‘US’, ‘SS’].



17
18
19
# File 'lib/dicom/dictionary_element.rb', line 17

def vrs
  @vrs
end

Instance Method Details

#private?Boolean

Checks if the element is private by analyzing its tag string.

Returns:

  • (Boolean)

    true if the element is private, and false if not.



39
40
41
# File 'lib/dicom/dictionary_element.rb', line 39

def private?
  @tag.private?
end

#retired?Boolean

Converts the retired status string to a boolean.

Returns:

  • (Boolean)

    true if the element is retired, and false if not.



47
48
49
# File 'lib/dicom/dictionary_element.rb', line 47

def retired?
  @retired =~ /R/ ? true : false
end

#vrString

Extracts the first (default) value representation of the element’s value representations.

Returns:

  • (String)

    the first value representation listed for this particular element



55
56
57
# File 'lib/dicom/dictionary_element.rb', line 55

def vr
  @vrs[0]
end