Class: DICOM::UID

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

Overview

This class handles the various UID types (transfer syntax, SOP Class, LDAP OID, etc) found in the DICOM Data Dictionary (Annex A: Registry of DICOM unique identifiers, Table A-1).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, name, type, retired) ⇒ UID

Creates a new UID.

Parameters:

  • value (String)

    the UID’s value

  • name (String)

    the UID’s name

  • type (String)

    the UID’s type

  • retired (String)

    the UID’s retired status string



25
26
27
28
29
30
# File 'lib/dicom/uid.rb', line 25

def initialize(value, name, type, retired)
  @value = value
  @name = name
  @type = type
  @retired = retired
end

Instance Attribute Details

#nameObject (readonly)

The UID name, e.g. ‘Verification SOP Class’.



10
11
12
# File 'lib/dicom/uid.rb', line 10

def name
  @name
end

#retiredObject (readonly)

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



12
13
14
# File 'lib/dicom/uid.rb', line 12

def retired
  @retired
end

#typeObject (readonly)

The UID type, e.g. ‘SOP Class’.



14
15
16
# File 'lib/dicom/uid.rb', line 14

def type
  @type
end

#valueObject (readonly)

The UID value, e.g. ‘1.2.840.10008.1.1’.



16
17
18
# File 'lib/dicom/uid.rb', line 16

def value
  @value
end

Instance Method Details

#big_endian?Boolean

Checks if the UID is a Transfer Syntax that big endian byte order.

Returns:

  • (Boolean)

    true if the UID indicates big endian byte order, and false if not



36
37
38
# File 'lib/dicom/uid.rb', line 36

def big_endian?
  @value == EXPLICIT_BIG_ENDIAN ? true : false
end

#compressed_pixels?Boolean

Checks if the UID is a Transfer Syntax that implies compressed pixel data.

Returns:

  • (Boolean)

    true if the UID indicates compressed pixel data, and false if not



44
45
46
# File 'lib/dicom/uid.rb', line 44

def compressed_pixels?
  transfer_syntax? ? (@name =~ /Implicit|Explicit/).nil? : false
end

#explicit?Boolean

Checks if the UID is a Transfer Syntax that implies explicit encoding.

Returns:

  • (Boolean)

    true if the UID indicates explicit encoding, and false if not



52
53
54
# File 'lib/dicom/uid.rb', line 52

def explicit?
  transfer_syntax? ? (@name =~ /Implicit/).nil? : false
end

#retired?Boolean

Converts the retired status string to a boolean.

Returns:

  • (Boolean)

    true if the UID is retired, and false if not



60
61
62
# File 'lib/dicom/uid.rb', line 60

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

#sop_class?Boolean

Checks if the UID is a SOP Class.

Returns:

  • (Boolean)

    true if the UID is of type SOP Class, and false if not



68
69
70
# File 'lib/dicom/uid.rb', line 68

def sop_class?
  @type =~ /SOP Class/ ? true : false
end

#transfer_syntax?Boolean

Checks if the UID is a Transfer Syntax.

Returns:

  • (Boolean)

    true if the UID is of type Transfer Syntax, and false if not



76
77
78
# File 'lib/dicom/uid.rb', line 76

def transfer_syntax?
  @type =~ /Transfer Syntax/ ? true : false
end