dicom 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +312 -290
- data/COPYING +674 -674
- data/Gemfile +3 -0
- data/dicom.gemspec +31 -0
- data/lib/dicom.rb +53 -51
- data/lib/dicom/anonymizer.rb +98 -123
- data/lib/dicom/audit_trail.rb +104 -116
- data/lib/dicom/constants.rb +219 -170
- data/lib/dicom/d_client.rb +122 -150
- data/lib/dicom/d_library.rb +219 -287
- data/lib/dicom/d_object.rb +451 -539
- data/lib/dicom/d_read.rb +151 -245
- data/lib/dicom/d_server.rb +329 -359
- data/lib/dicom/d_write.rb +327 -395
- data/lib/dicom/deprecated.rb +1 -72
- data/lib/dicom/dictionary/elements.txt +3646 -0
- data/lib/dicom/dictionary/uids.txt +334 -0
- data/lib/dicom/dictionary_element.rb +61 -0
- data/lib/dicom/element.rb +278 -218
- data/lib/dicom/elemental.rb +21 -27
- data/lib/dicom/file_handler.rb +121 -121
- data/lib/dicom/image_item.rb +819 -861
- data/lib/dicom/image_processor.rb +24 -15
- data/lib/dicom/image_processor_mini_magick.rb +21 -23
- data/lib/dicom/image_processor_r_magick.rb +39 -34
- data/lib/dicom/item.rb +133 -120
- data/lib/dicom/link.rb +1531 -1532
- data/lib/dicom/logging.rb +155 -158
- data/lib/dicom/parent.rb +782 -847
- data/lib/dicom/ruby_extensions.rb +248 -229
- data/lib/dicom/sequence.rb +109 -92
- data/lib/dicom/stream.rb +480 -511
- data/lib/dicom/uid.rb +82 -0
- data/lib/dicom/variables.rb +9 -9
- data/lib/dicom/version.rb +5 -5
- data/rakefile.rb +29 -0
- metadata +130 -76
- data/lib/dicom/dictionary.rb +0 -3280
data/lib/dicom/audit_trail.rb
CHANGED
@@ -1,117 +1,105 @@
|
|
1
|
-
module DICOM
|
2
|
-
|
3
|
-
# The AuditTrail class handles key/value storage for the Anonymizer.
|
4
|
-
# When using the advanced Anonymization options such as enumeration
|
5
|
-
# and UID replacement, the AuditTrail class keeps track of key/value
|
6
|
-
# pairs and dumps this information to a text file using the json format.
|
7
|
-
# This enables us to ensure a unique relationship between the anonymized
|
8
|
-
# values and the original values, as well as preserving this relationship
|
9
|
-
# for later restoration of original values.
|
10
|
-
#
|
11
|
-
class AuditTrail
|
12
|
-
|
13
|
-
# The hash used for storing the key/value pairs of this instace.
|
14
|
-
attr_reader :dictionary
|
15
|
-
|
16
|
-
# Creates a new AuditTrail instance by loading the information stored
|
17
|
-
# in the specified file.
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
|
23
|
-
|
24
|
-
audit_trail
|
25
|
-
audit_trail
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
#
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
#
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
#
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
#
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
#
|
96
|
-
#
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
#
|
106
|
-
#
|
107
|
-
# === Parameters
|
108
|
-
#
|
109
|
-
# * <tt>file_name</tt> -- The file name string to be used for storing & retrieving key/value pairs on disk.
|
110
|
-
#
|
111
|
-
def write(file_name)
|
112
|
-
str = JSON.pretty_generate(@dictionary)
|
113
|
-
File.open(file_name, 'w') {|f| f.write(str) }
|
114
|
-
end
|
115
|
-
|
116
|
-
end
|
1
|
+
module DICOM
|
2
|
+
|
3
|
+
# The AuditTrail class handles key/value storage for the Anonymizer.
|
4
|
+
# When using the advanced Anonymization options such as enumeration
|
5
|
+
# and UID replacement, the AuditTrail class keeps track of key/value
|
6
|
+
# pairs and dumps this information to a text file using the json format.
|
7
|
+
# This enables us to ensure a unique relationship between the anonymized
|
8
|
+
# values and the original values, as well as preserving this relationship
|
9
|
+
# for later restoration of original values.
|
10
|
+
#
|
11
|
+
class AuditTrail
|
12
|
+
|
13
|
+
# The hash used for storing the key/value pairs of this instace.
|
14
|
+
attr_reader :dictionary
|
15
|
+
|
16
|
+
# Creates a new AuditTrail instance by loading the information stored
|
17
|
+
# in the specified file.
|
18
|
+
#
|
19
|
+
# @param [String] file_name the path to a file containing a previously stored audit trail
|
20
|
+
# @return [AuditTrail] the created AuditTrail instance
|
21
|
+
#
|
22
|
+
def self.read(file_name)
|
23
|
+
audit_trail = AuditTrail.new
|
24
|
+
audit_trail.load(file_name)
|
25
|
+
return audit_trail
|
26
|
+
end
|
27
|
+
|
28
|
+
# Creates a new AuditTrail instance.
|
29
|
+
#
|
30
|
+
def initialize
|
31
|
+
# The AuditTrail requires JSON for serialization:
|
32
|
+
require 'json'
|
33
|
+
# Define the key/value hash used for tag records:
|
34
|
+
@dictionary = Hash.new
|
35
|
+
end
|
36
|
+
|
37
|
+
# Adds a tag record to the log.
|
38
|
+
#
|
39
|
+
# @param [String] tag the tag string (e.q. '0010,0010')
|
40
|
+
# @param [String, Integer, Float] original the original value (e.q. 'John Doe')
|
41
|
+
# @param [String, Integer, Float] replacement the replacement value (e.q. 'Patient1')
|
42
|
+
#
|
43
|
+
def add_record(tag, original, replacement)
|
44
|
+
@dictionary[tag] = Hash.new unless @dictionary.key?(tag)
|
45
|
+
@dictionary[tag][original] = replacement
|
46
|
+
end
|
47
|
+
|
48
|
+
# Loads the key/value dictionary hash from a specified file.
|
49
|
+
#
|
50
|
+
# @param [String] file_name the path to a file containing a previously stored audit trail
|
51
|
+
#
|
52
|
+
def load(file_name)
|
53
|
+
@dictionary = JSON.load(File.new(file_name, "r:UTF-8"))
|
54
|
+
end
|
55
|
+
|
56
|
+
# Retrieves the original value used for the given combination of tag & replacement value.
|
57
|
+
#
|
58
|
+
# @param [String] tag the tag string (e.q. '0010,0010')
|
59
|
+
# @param [String, Integer, Float] replacement the replacement value (e.q. 'Patient1')
|
60
|
+
# @return [String, Integer, Float] the original value of the given tag
|
61
|
+
#
|
62
|
+
def original(tag, replacement)
|
63
|
+
original = nil
|
64
|
+
if @dictionary.key?(tag)
|
65
|
+
original = @dictionary[tag].key(replacement)
|
66
|
+
end
|
67
|
+
return original
|
68
|
+
end
|
69
|
+
|
70
|
+
# Gives the key/value pairs for a specific tag.
|
71
|
+
#
|
72
|
+
# @param [String] tag the tag string (e.q. '0010,0010')
|
73
|
+
# @return [Hash] the key/value pairs of a specific tag
|
74
|
+
#
|
75
|
+
def records(tag)
|
76
|
+
if @dictionary.key?(tag)
|
77
|
+
return @dictionary[tag]
|
78
|
+
else
|
79
|
+
return Hash.new
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Retrieves the replacement value used for the given combination of tag & original value.
|
84
|
+
#
|
85
|
+
# @param [String] tag the tag string (e.q. '0010,0010')
|
86
|
+
# @param [String, Integer, Float] original the original value (e.q. 'John Doe')
|
87
|
+
# @return [String, Integer, Float] the replacement value of the given tag
|
88
|
+
#
|
89
|
+
def replacement(tag, original)
|
90
|
+
replacement = nil
|
91
|
+
replacement = @dictionary[tag][original] if @dictionary.key?(tag)
|
92
|
+
return replacement
|
93
|
+
end
|
94
|
+
|
95
|
+
# Dumps the key/value pairs to a json string which is written to the specified file.
|
96
|
+
#
|
97
|
+
# @param [String] file_name the path to be used for storing key/value pairs on disk
|
98
|
+
#
|
99
|
+
def write(file_name)
|
100
|
+
str = JSON.pretty_generate(@dictionary)
|
101
|
+
File.open(file_name, 'w') {|f| f.write(str) }
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
117
105
|
end
|
data/lib/dicom/constants.rb
CHANGED
@@ -1,170 +1,219 @@
|
|
1
|
-
module DICOM
|
2
|
-
|
3
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
#
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
#
|
30
|
-
|
31
|
-
|
32
|
-
#
|
33
|
-
|
34
|
-
|
35
|
-
#
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
#
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
#
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
#
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
#
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
#
|
115
|
-
|
116
|
-
|
117
|
-
#
|
118
|
-
|
119
|
-
|
120
|
-
#
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
#
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
1
|
+
module DICOM
|
2
|
+
|
3
|
+
# Defines the gem root directory in the file system.
|
4
|
+
ROOT_DIR = "#{File.dirname(__FILE__)}"
|
5
|
+
|
6
|
+
# Ruby DICOM's registered DICOM UID root (Implementation Class UID).
|
7
|
+
UID_ROOT = "1.2.826.0.1.3680043.8.641"
|
8
|
+
# Ruby DICOM name & version (max 16 characters).
|
9
|
+
NAME = "RUBY_DCM_" + DICOM::VERSION
|
10
|
+
|
11
|
+
# Item tag.
|
12
|
+
ITEM_TAG = "FFFE,E000"
|
13
|
+
# All Item related tags (includes both types of delimitation items).
|
14
|
+
ITEM_TAGS = ["FFFE,E000", "FFFE,E00D", "FFFE,E0DD"]
|
15
|
+
# Item delimiter tag.
|
16
|
+
ITEM_DELIMITER = "FFFE,E00D"
|
17
|
+
# Sequence delimiter tag.
|
18
|
+
SEQUENCE_DELIMITER = "FFFE,E0DD"
|
19
|
+
# All delimiter tags.
|
20
|
+
DELIMITER_TAGS = ["FFFE,E00D", "FFFE,E0DD"]
|
21
|
+
|
22
|
+
# The VR used for the item elements.
|
23
|
+
ITEM_VR = " "
|
24
|
+
|
25
|
+
# Pixel tag.
|
26
|
+
PIXEL_TAG = "7FE0,0010"
|
27
|
+
# Name of the pixel tag when holding encapsulated data.
|
28
|
+
ENCAPSULATED_PIXEL_NAME = "Encapsulated Pixel Data"
|
29
|
+
# Name of encapsulated items.
|
30
|
+
PIXEL_ITEM_NAME = "Pixel Data Item"
|
31
|
+
|
32
|
+
# File meta group.
|
33
|
+
META_GROUP = "0002"
|
34
|
+
|
35
|
+
# Group length element.
|
36
|
+
GROUP_LENGTH = "0000"
|
37
|
+
|
38
|
+
# Implicit, little endian (the default transfer syntax).
|
39
|
+
IMPLICIT_LITTLE_ENDIAN = "1.2.840.10008.1.2"
|
40
|
+
# Explicit, little endian transfer syntax.
|
41
|
+
EXPLICIT_LITTLE_ENDIAN = "1.2.840.10008.1.2.1"
|
42
|
+
# Explicit, big endian transfer syntax.
|
43
|
+
EXPLICIT_BIG_ENDIAN = "1.2.840.10008.1.2.2"
|
44
|
+
|
45
|
+
# Verification SOP class UID.
|
46
|
+
VERIFICATION_SOP = "1.2.840.10008.1.1"
|
47
|
+
# Application context SOP class UID.
|
48
|
+
APPLICATION_CONTEXT = "1.2.840.10008.3.1.1.1"
|
49
|
+
|
50
|
+
# Network transmission successful.
|
51
|
+
SUCCESS = 0
|
52
|
+
# Network proposition accepted.
|
53
|
+
ACCEPTANCE = 0
|
54
|
+
# Presentation context rejected by abstract syntax.
|
55
|
+
ABSTRACT_SYNTAX_REJECTED = 3
|
56
|
+
# Presentation context rejected by transfer syntax.
|
57
|
+
TRANSFER_SYNTAX_REJECTED = 4
|
58
|
+
|
59
|
+
# Some network command element codes:
|
60
|
+
C_STORE_RQ = 1 # (encodes to 0001H as US)
|
61
|
+
C_GET_RQ = 16 # (encodes to 0010H as US)
|
62
|
+
C_FIND_RQ = 32 # (encodes to 0020H as US)
|
63
|
+
C_MOVE_RQ = 33 # (encodes to 0021H as US)
|
64
|
+
C_ECHO_RQ = 48 # (encodes to 0030 as US)
|
65
|
+
C_CANCEL_RQ = 4095 # (encodes to 0FFFH as US)
|
66
|
+
C_STORE_RSP = 32769 # (encodes to 8001H as US)
|
67
|
+
C_GET_RSP = 32784 # (encodes to 8010H as US)
|
68
|
+
C_FIND_RSP = 32800 # (encodes to 8020H as US)
|
69
|
+
C_MOVE_RSP = 32801 # (encodes to 8021H as US)
|
70
|
+
C_ECHO_RSP = 32816 # (encodes to 8030H as US)
|
71
|
+
NO_DATA_SET_PRESENT = 257 # (encodes to 0101H as US)
|
72
|
+
DATA_SET_PRESENT = 1
|
73
|
+
DEFAULT_MESSAGE_ID = 1
|
74
|
+
|
75
|
+
# The network communication flags:
|
76
|
+
DATA_MORE_FRAGMENTS = "00"
|
77
|
+
COMMAND_MORE_FRAGMENTS = "01"
|
78
|
+
DATA_LAST_FRAGMENT = "02"
|
79
|
+
COMMAND_LAST_FRAGMENT = "03"
|
80
|
+
|
81
|
+
# Network communication PDU types:
|
82
|
+
PDU_ASSOCIATION_REQUEST = "01"
|
83
|
+
PDU_ASSOCIATION_ACCEPT = "02"
|
84
|
+
PDU_ASSOCIATION_REJECT = "03"
|
85
|
+
PDU_DATA = "04"
|
86
|
+
PDU_RELEASE_REQUEST = "05"
|
87
|
+
PDU_RELEASE_RESPONSE = "06"
|
88
|
+
PDU_ABORT = "07"
|
89
|
+
|
90
|
+
# Network communication item types:
|
91
|
+
ITEM_APPLICATION_CONTEXT = "10"
|
92
|
+
ITEM_PRESENTATION_CONTEXT_REQUEST = "20"
|
93
|
+
ITEM_PRESENTATION_CONTEXT_RESPONSE = "21"
|
94
|
+
ITEM_ABSTRACT_SYNTAX = "30"
|
95
|
+
ITEM_TRANSFER_SYNTAX = "40"
|
96
|
+
ITEM_USER_INFORMATION = "50"
|
97
|
+
ITEM_MAX_LENGTH = "51"
|
98
|
+
ITEM_IMPLEMENTATION_UID = "52"
|
99
|
+
ITEM_MAX_OPERATIONS_INVOKED = "53"
|
100
|
+
ITEM_ROLE_NEGOTIATION = "54"
|
101
|
+
ITEM_IMPLEMENTATION_VERSION = "55"
|
102
|
+
|
103
|
+
# Varaibles used to determine endianness.
|
104
|
+
x = 0xdeadbeef
|
105
|
+
endian_type = {
|
106
|
+
Array(x).pack("V*") => false, # Little
|
107
|
+
Array(x).pack("N*") => true # Big
|
108
|
+
}
|
109
|
+
# System (CPU) Endianness.
|
110
|
+
CPU_ENDIAN = endian_type[Array(x).pack("L*")]
|
111
|
+
|
112
|
+
# Custom string used for (un)packing big endian signed short.
|
113
|
+
CUSTOM_SS = "k*"
|
114
|
+
# Custom string used for (un)packing big endian signed long.
|
115
|
+
CUSTOM_SL = "r*"
|
116
|
+
|
117
|
+
# ruby-dicom's library instance (data dictionary).
|
118
|
+
LIBRARY = DICOM::DLibrary.new
|
119
|
+
|
120
|
+
# Transfer Syntaxes (taken from the DICOM Specification PS 3.5, Chapter 10).
|
121
|
+
|
122
|
+
# General
|
123
|
+
TXS_IMPLICIT_LITTLE_ENDIAN = '1.2.840.10008.1.2' # also defined as IMPLICIT_LITTLE_ENDIAN, default transfer syntax
|
124
|
+
TXS_EXPLICIT_LITTLE_ENDIAN = '1.2.840.10008.1.2.1' # also defined as EXPLICIT_LITTLE_ENDIAN
|
125
|
+
TXS_EXPLICIT_BIG_ENDIAN = '1.2.840.10008.1.2.2' # also defined as EXPLICIT_BIG_ENDIAN
|
126
|
+
|
127
|
+
# TRANSFER SYNTAXES FOR ENCAPSULATION OF ENCODED PIXEL DATA
|
128
|
+
TXS_JPEG_BASELINE = '1.2.840.10008.1.2.4.50'
|
129
|
+
TXS_JPEG_EXTENDED = '1.2.840.10008.1.2.4.51'
|
130
|
+
TXS_JPEG_LOSSLESS_NH = '1.2.840.10008.1.2.4.57' # NH: non-hirarchical
|
131
|
+
TXS_JPEG_LOSSLESS_NH_FOP = '1.2.840.10008.1.2.4.70' # NH: non-hirarchical, FOP: first-order prediction
|
132
|
+
|
133
|
+
TXS_JPEG_LS_LOSSLESS = '1.2.840.10008.1.2.4.80'
|
134
|
+
TXS_JPEG_LS_NEAR_LOSSLESS = '1.2.840.10008.1.2.4.81'
|
135
|
+
|
136
|
+
TXS_JPEG_2000_PART1_LOSSLESS = '1.2.840.10008.1.2.4.90'
|
137
|
+
TXS_JPEG_2000_PART1_LOSSLESS_OR_LOSSY = '1.2.840.10008.1.2.4.91'
|
138
|
+
TXS_JPEG_2000_PART2_LOSSLESS = '1.2.840.10008.1.2.4.92'
|
139
|
+
TXS_JPEG_2000_PART2_LOSSLESS_OR_LOSSY = '1.2.840.10008.1.2.4.93'
|
140
|
+
|
141
|
+
TXS_MPEG2_MP_ML = '1.2.840.10008.1.2.4.100'
|
142
|
+
TXS_MPEG2_MP_HL = '1.2.840.10008.1.2.4.101'
|
143
|
+
|
144
|
+
TXS_DEFLATED_LITTLE_ENDIAN = '1.2.840.10008.1.2.1.99' # ZIP Compression
|
145
|
+
|
146
|
+
TXS_JPIP = '1.2.840.10008.1.2.4.94'
|
147
|
+
TXS_JPIP_DEFLATE = '1.2.840.10008.1.2.4.95'
|
148
|
+
|
149
|
+
TXS_RLE = '1.2.840.10008.1.2.5'
|
150
|
+
|
151
|
+
|
152
|
+
# Photometric Interpretations
|
153
|
+
# Taken from DICOM Specification PS 3.3 C.7.6.3.1.2 Photometric Interpretation
|
154
|
+
|
155
|
+
PI_MONOCHROME1 = 'MONOCHROME1'
|
156
|
+
PI_MONOCHROME2 = 'MONOCHROME2'
|
157
|
+
PI_PALETTE_COLOR = 'PALETTE COLOR'
|
158
|
+
PI_RGB = 'RGB'
|
159
|
+
PI_YBR_FULL = 'YBR_FULL'
|
160
|
+
PI_YBR_FULL_422 = 'YBR_FULL_422 '
|
161
|
+
PI_YBR_PARTIAL_422 = 'YBR_PARTIAL_422'
|
162
|
+
PI_YBR_PARTIAL_420 = 'YBR_PARTIAL_420'
|
163
|
+
PI_YBR_ICT = 'YBR_ICT'
|
164
|
+
PI_YBR_RCT = 'YBR_RCT'
|
165
|
+
|
166
|
+
# Retired Photometric Interpretations, are those needed to be supported?
|
167
|
+
PI_HSV = 'HSV'
|
168
|
+
PI_ARGB = 'ARGB'
|
169
|
+
PI_CMYK = 'CMYK'
|
170
|
+
|
171
|
+
# The relationship between DICOM Character Set and Encoding name.
|
172
|
+
ENCODING_NAME = {
|
173
|
+
'ISO_IR 100' => 'ISO-8859-1',
|
174
|
+
'ISO_IR 101' => 'ISO-8859-2',
|
175
|
+
'ISO_IR 109' => 'ISO-8859-3',
|
176
|
+
'ISO_IR 110' => 'ISO-8859-4',
|
177
|
+
'ISO_IR 144' => 'ISO-8859-5',
|
178
|
+
'ISO_IR 127' => 'ISO-8859-6',
|
179
|
+
'ISO_IR 126' => 'ISO-8859-7',
|
180
|
+
'ISO_IR 138' => 'ISO-8859-8',
|
181
|
+
'ISO_IR 148' => 'ISO-8859-9',
|
182
|
+
'ISO_IR 13' => 'JIS_X0201',
|
183
|
+
'ISO_IR 166' => 'ISO-8859-11',
|
184
|
+
'GB18030' => 'GB18030',
|
185
|
+
'ISO_IR 192' => 'UTF-8'
|
186
|
+
}
|
187
|
+
|
188
|
+
# The type conversion (method) used for the various value representations.
|
189
|
+
VALUE_CONVERSION = {
|
190
|
+
'BY' => :to_i,
|
191
|
+
'US' => :to_i,
|
192
|
+
'SS' => :to_i,
|
193
|
+
'UL' => :to_i,
|
194
|
+
'SL' => :to_i,
|
195
|
+
'OB' => :to_i,
|
196
|
+
'OW' => :to_i,
|
197
|
+
'OF' => :to_f,
|
198
|
+
'FL' => :to_f,
|
199
|
+
'FD' => :to_f,
|
200
|
+
'AT' => :to_s,
|
201
|
+
'AE' => :to_s,
|
202
|
+
'AS' => :to_s,
|
203
|
+
'CS' => :to_s,
|
204
|
+
'DA' => :to_s,
|
205
|
+
'DS' => :to_s,
|
206
|
+
'DT' => :to_s,
|
207
|
+
'IS' => :to_s,
|
208
|
+
'LO' => :to_s,
|
209
|
+
'LT' => :to_s,
|
210
|
+
'PN' => :to_s,
|
211
|
+
'SH' => :to_s,
|
212
|
+
'ST' => :to_s,
|
213
|
+
'TM' => :to_s,
|
214
|
+
'UI' => :to_s,
|
215
|
+
'UT' => :to_s
|
216
|
+
}
|
217
|
+
|
218
|
+
end
|
219
|
+
|