dcm_dict 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/COPYING +674 -0
- data/LICENSE +22 -0
- data/README.md +296 -0
- data/Rakefile +36 -0
- data/bin/dcm_dict_converter.rb +194 -0
- data/lib/dcm_dict.rb +46 -0
- data/lib/dcm_dict/dictionary/base_dictionary.rb +47 -0
- data/lib/dcm_dict/dictionary/base_record.rb +62 -0
- data/lib/dcm_dict/dictionary/data_element_dictionary.rb +117 -0
- data/lib/dcm_dict/dictionary/data_element_record.rb +93 -0
- data/lib/dcm_dict/dictionary/uid_dictionary.rb +82 -0
- data/lib/dcm_dict/dictionary/uid_record.rb +48 -0
- data/lib/dcm_dict/encoder/data_to_code.rb +79 -0
- data/lib/dcm_dict/error/dictionary_error.rb +30 -0
- data/lib/dcm_dict/ext/object_extension.rb +38 -0
- data/lib/dcm_dict/refine/array_refine.rb +34 -0
- data/lib/dcm_dict/refine/data_element_refine.rb +37 -0
- data/lib/dcm_dict/refine/internal/array_refine_internal.rb +97 -0
- data/lib/dcm_dict/refine/internal/hash_refine_internal.rb +71 -0
- data/lib/dcm_dict/refine/internal/string_refine_internal.rb +119 -0
- data/lib/dcm_dict/refine/string_refine.rb +35 -0
- data/lib/dcm_dict/refine/symbol_refine.rb +34 -0
- data/lib/dcm_dict/refine/uid_refine.rb +36 -0
- data/lib/dcm_dict/rubies/rb_ext.rb +32 -0
- data/lib/dcm_dict/source_data/data_elements_data.rb +3937 -0
- data/lib/dcm_dict/source_data/detached_data.rb +67 -0
- data/lib/dcm_dict/source_data/uid_values_data.rb +382 -0
- data/lib/dcm_dict/version.rb +27 -0
- data/lib/dcm_dict/xml/constant.rb +38 -0
- data/lib/dcm_dict/xml/field_data.rb +47 -0
- data/lib/dcm_dict/xml/nokogiri_tool.rb +108 -0
- data/lib/dcm_dict/xml/rexml_tool.rb +105 -0
- data/lib/dcm_dict/xml/tag_field_data.rb +96 -0
- data/lib/dcm_dict/xml/uid_field_data.rb +49 -0
- data/lib/dcm_dict/xml/xml_tool.rb +47 -0
- data/spec/data_element_sample_spec_helper.rb +110 -0
- data/spec/data_element_shared_example_spec_helper.rb +57 -0
- data/spec/dcm_dict/dictionary/data_element_dictionary_spec.rb +75 -0
- data/spec/dcm_dict/dictionary/data_element_record_spec.rb +117 -0
- data/spec/dcm_dict/dictionary/uid_dictionary_spec.rb +60 -0
- data/spec/dcm_dict/dictionary/uid_record_spec.rb +53 -0
- data/spec/dcm_dict/encoder/data_to_code_spec.rb +109 -0
- data/spec/dcm_dict/ext/object_extension_spec.rb +53 -0
- data/spec/dcm_dict/refine/array_refine_spec.rb +61 -0
- data/spec/dcm_dict/refine/internal/array_refine_internal_spec.rb +98 -0
- data/spec/dcm_dict/refine/internal/hash_refine_internal_spec.rb +64 -0
- data/spec/dcm_dict/refine/internal/string_refine_internal_spec.rb +214 -0
- data/spec/dcm_dict/refine/string_refine_spec.rb +87 -0
- data/spec/dcm_dict/refine/symbol_refine_spec.rb +41 -0
- data/spec/dcm_dict/rubies/rb_ext_spec.rb +46 -0
- data/spec/dcm_dict/source_data/data_elements_data_spec.rb +40 -0
- data/spec/dcm_dict/source_data/detached_data_spec.rb +55 -0
- data/spec/dcm_dict/source_data/uid_values_data_spec.rb +37 -0
- data/spec/dcm_dict/version_spec.rb +30 -0
- data/spec/dcm_dict/xml/tag_field_data_spec.rb +62 -0
- data/spec/dcm_dict/xml/uid_field_data_spec.rb +60 -0
- data/spec/dictionary_shared_example_spec_helper.rb +118 -0
- data/spec/refine_shared_example_spec_helper.rb +54 -0
- data/spec/spec_helper.rb +42 -0
- data/spec/xml_sample_spec_helper.rb +533 -0
- metadata +212 -0
@@ -0,0 +1,118 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2014 Enrico Rivarola
|
3
|
+
#
|
4
|
+
# This file is part of DcmDict gem (dcm_dict).
|
5
|
+
#
|
6
|
+
# DcmDict is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# DcmDict is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with DcmDict. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#
|
19
|
+
# This software has neither been tested nor approved for clinical use
|
20
|
+
# or for incorporation in a medical device.
|
21
|
+
# It is the redistributor's or user's responsibility to comply with any
|
22
|
+
# applicable local, state, national or international regulations.
|
23
|
+
#
|
24
|
+
|
25
|
+
FrozenStringExMessage = (RUBY_ENGINE == 'rbx') ? "can't modify frozen instance of String" : "can't modify frozen String"
|
26
|
+
|
27
|
+
RSpec.shared_examples "Record handle methods correctly" do |obj, data|
|
28
|
+
it "Handle methods correctly" do
|
29
|
+
data.each do |key, expected_val|
|
30
|
+
expect(obj.respond_to?(key.to_sym)).to be true
|
31
|
+
expect(obj.respond_to?(key.to_s)).to be true
|
32
|
+
end
|
33
|
+
|
34
|
+
expect(obj.respond_to?(:undefined_method_for_record)).to be false
|
35
|
+
expect(obj.respond_to?(:undefined_method_for_record.to_s)).to be false
|
36
|
+
expect{ obj.undefined_method_for_record }.to raise_error(NoMethodError)
|
37
|
+
expect{ obj.send("undefined_method_for_record") }.to raise_error(NoMethodError)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
RSpec.shared_examples "Concurrency support" do |key, dictionary, expected_values|
|
42
|
+
it "should support concurrency" do
|
43
|
+
#start = Time.now
|
44
|
+
max_threads = 128
|
45
|
+
times_for_threads = 1_024
|
46
|
+
idx = Random.rand(0...expected_values.size)
|
47
|
+
rnd_key = expected_values.keys[idx]
|
48
|
+
rnd_val = expected_values[rnd_key]
|
49
|
+
Thread.abort_on_exception = true
|
50
|
+
th = (1..max_threads).map do |n|
|
51
|
+
Thread.new do
|
52
|
+
Thread.stop
|
53
|
+
times_for_threads.times do |t|
|
54
|
+
Thread.current[:obj] = dictionary.record_at(key)
|
55
|
+
expect( Thread.current[:obj].send(rnd_key) ).to eq(rnd_val)
|
56
|
+
expect( dictionary.feature_at(key, rnd_key) ).to eq(rnd_val)
|
57
|
+
Thread.pass
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
sleep 0.01 while th[max_threads-1].status!='sleep'
|
62
|
+
th.map(&:run).map(&:join)
|
63
|
+
#warn "Example 'should support concurrency' finish in #{Time.now-start}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
RSpec.shared_examples "Map all source data" do |index_keys, record_data, dictionary, record_type, field_list|
|
68
|
+
it "should map all source data" do
|
69
|
+
record_data.each do |record|
|
70
|
+
index_keys.each do |key|
|
71
|
+
obj = dictionary.record_at(record[key])
|
72
|
+
expect(obj).not_to be_nil, "#{key.inspect} > #{record[key].inspect}"
|
73
|
+
expect(obj).to be_a(record_type)
|
74
|
+
expect(obj).to be_frozen
|
75
|
+
field_list.each do |field|
|
76
|
+
feature = dictionary.feature_at(record[key], field)
|
77
|
+
expect(feature).to eq(record[field])
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
RSpec.shared_examples "Handle specific record" do |note, record_key, record_data, dictionary|
|
85
|
+
it "should handle specific record as #{record_key.inspect} (#{note})" do
|
86
|
+
obj = dictionary.record_at(record_key)
|
87
|
+
expect(obj).not_to be_nil, "#{record_key.inspect} not found into dictionary #{dictionary.class}"
|
88
|
+
record_data.each do |key, value|
|
89
|
+
field = obj.send(key)
|
90
|
+
expect(field).to eq(value)
|
91
|
+
feature = dictionary.feature_at(record_key, key)
|
92
|
+
expect(feature).to eq(value)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
RSpec.shared_examples "Dictionary Data not modifiable" do |record_key, key, dictionary|
|
98
|
+
it "data should be not modifiable" do
|
99
|
+
expect(dictionary).to be_frozen
|
100
|
+
obj = dictionary.record_at(record_key)
|
101
|
+
expect(obj).to be_frozen
|
102
|
+
expect{ eval("obj.#{key} << 'aaa'") }.
|
103
|
+
to raise_error(RuntimeError, FrozenStringExMessage)
|
104
|
+
expect{ eval("dictionary.feature_at('#{record_key}', #{key.inspect}) << 'aaa'") }.
|
105
|
+
to raise_error(RuntimeError, FrozenStringExMessage)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
RSpec.shared_examples "Dictionary with wrong key" do |record_key, field_list, dictionary|
|
110
|
+
it "should raise exception for wrong value as #{record_key.inspect}" do
|
111
|
+
expect{dictionary.record_at(record_key)}.
|
112
|
+
to raise_error(DcmDict::DictionaryError)
|
113
|
+
field_list.each do |field|
|
114
|
+
expect { dictionary.feature_at(record_key, field) }.
|
115
|
+
to raise_error(DcmDict::DictionaryError)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2014 Enrico Rivarola
|
3
|
+
#
|
4
|
+
# This file is part of DcmDict gem (dcm_dict).
|
5
|
+
#
|
6
|
+
# DcmDict is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# DcmDict is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with DcmDict. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#
|
19
|
+
# This software has neither been tested nor approved for clinical use
|
20
|
+
# or for incorporation in a medical device.
|
21
|
+
# It is the redistributor's or user's responsibility to comply with any
|
22
|
+
# applicable local, state, national or international regulations.
|
23
|
+
#
|
24
|
+
using DcmDict::Refine::ArrayRefine
|
25
|
+
using DcmDict::Refine::StringRefine
|
26
|
+
using DcmDict::Refine::SymbolRefine
|
27
|
+
|
28
|
+
RSpec.shared_examples "Raise exception for wrong input" do |tags, uids, tag_proc|
|
29
|
+
describe "should raise exception for wrong input" do
|
30
|
+
describe "for data element" do
|
31
|
+
tags.each do |tag|
|
32
|
+
DcmDict::Dictionary::DataElementMethod.each do |method|
|
33
|
+
expr = "#{tag_proc.call(tag)}.#{method.to_s}"
|
34
|
+
it "with #{expr}" do
|
35
|
+
# expect{eval(expr)}.to raise_error(DcmDict::DictionaryError, "Unable to find reference for tag '#{tag}' as #{tag.class}")
|
36
|
+
expect{eval(expr)}.to raise_error(DcmDict::DictionaryError)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "and for uid" do
|
43
|
+
uids.each do |uid|
|
44
|
+
DcmDict::Dictionary::UidMethod.each do |method|
|
45
|
+
expr = "#{uid.inspect}.#{method.to_s}"
|
46
|
+
it "with #{expr}" do
|
47
|
+
# expect{eval(expr)}.to raise_error(DcmDict::DictionaryError, "Unable to find reference for uid '#{uid}' as #{uid.class}")
|
48
|
+
expect{eval(expr)}.to raise_error(DcmDict::DictionaryError)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2014 Enrico Rivarola
|
3
|
+
#
|
4
|
+
# This file is part of DcmDict gem (dcm_dict).
|
5
|
+
#
|
6
|
+
# DcmDict is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# DcmDict is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with DcmDict. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#
|
19
|
+
# This software has neither been tested nor approved for clinical use
|
20
|
+
# or for incorporation in a medical device.
|
21
|
+
# It is the redistributor's or user's responsibility to comply with any
|
22
|
+
# applicable local, state, national or international regulations.
|
23
|
+
#
|
24
|
+
if ENV['COVERAGE']
|
25
|
+
begin
|
26
|
+
require 'simplecov'
|
27
|
+
SimpleCov.start
|
28
|
+
rescue LoadError
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
if (RUBY_ENGINE == 'rbx')
|
33
|
+
require 'dcm_dict/rubies/rb_ext'
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'dcm_dict'
|
37
|
+
require 'dcm_dict/xml/nokogiri_tool'
|
38
|
+
require 'dictionary_shared_example_spec_helper'
|
39
|
+
require 'data_element_shared_example_spec_helper'
|
40
|
+
require 'refine_shared_example_spec_helper'
|
41
|
+
require 'dcm_dict/xml/rexml_tool'
|
42
|
+
require 'dcm_dict/xml/xml_tool'
|
@@ -0,0 +1,533 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 Enrico Rivarola
|
4
|
+
#
|
5
|
+
# This file is part of DcmDict gem (dcm_dict).
|
6
|
+
#
|
7
|
+
# DcmDict is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# DcmDict is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with DcmDict. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
# This software has neither been tested nor approved for clinical use
|
21
|
+
# or for incorporation in a medical device.
|
22
|
+
# It is the redistributor's or user's responsibility to comply with any
|
23
|
+
# applicable local, state, national or international regulations.
|
24
|
+
#
|
25
|
+
module XmlSampleSpecHelper
|
26
|
+
def self.xml_tag_sample_standard
|
27
|
+
xml_string=<<END
|
28
|
+
<book xmlns="http://docbook.org/ns/docbook">
|
29
|
+
<tr valign="top">
|
30
|
+
<td align="center" colspan="1" rowspan="1">
|
31
|
+
<para>
|
32
|
+
<emphasis role="italic">(0008,0010)</emphasis>
|
33
|
+
</para>
|
34
|
+
</td>
|
35
|
+
<td align="left" colspan="1" rowspan="1">
|
36
|
+
<para>
|
37
|
+
<emphasis role="italic">Recognition Code</emphasis>
|
38
|
+
</para>
|
39
|
+
</td>
|
40
|
+
<td align="left" colspan="1" rowspan="1">
|
41
|
+
<para>
|
42
|
+
<emphasis role="italic">RecognitionCode</emphasis>
|
43
|
+
</para>
|
44
|
+
</td>
|
45
|
+
<td align="center" colspan="1" rowspan="1">
|
46
|
+
<para>
|
47
|
+
<emphasis role="italic">SH</emphasis>
|
48
|
+
</para>
|
49
|
+
</td>
|
50
|
+
<td align="center" colspan="1" rowspan="1">
|
51
|
+
<para>
|
52
|
+
<emphasis role="italic">1</emphasis>
|
53
|
+
</para>
|
54
|
+
</td>
|
55
|
+
<td align="center" colspan="1" rowspan="1">
|
56
|
+
<para>
|
57
|
+
<emphasis role="italic">RET</emphasis>
|
58
|
+
</para>
|
59
|
+
</td>
|
60
|
+
</tr>
|
61
|
+
</book>
|
62
|
+
END
|
63
|
+
data = {tag_ps: '(0008,0010)',
|
64
|
+
tag_str: '(0008,0010)',
|
65
|
+
tag_ary: [0x0008,0x0010],
|
66
|
+
tag_sym: :recognition_code,
|
67
|
+
tag_ndm: '00080010',
|
68
|
+
tag_name: 'Recognition Code',
|
69
|
+
tag_key: 'RecognitionCode',
|
70
|
+
tag_vr: [:SH],
|
71
|
+
tag_vm: ['1'],
|
72
|
+
tag_note: 'RET',
|
73
|
+
tag_multiple: false}
|
74
|
+
{xml_string => data}
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.xml_tag_sample_standard_empty_note
|
78
|
+
xml_string = <<END
|
79
|
+
<book xmlns="http://docbook.org/ns/docbook">
|
80
|
+
<tr valign="top">
|
81
|
+
<td align="center" colspan="1" rowspan="1">
|
82
|
+
<para>(0008,0012)</para>
|
83
|
+
</td>
|
84
|
+
<td align="left" colspan="1" rowspan="1">
|
85
|
+
<para>Instance Creation Date</para>
|
86
|
+
</td>
|
87
|
+
<td align="left" colspan="1" rowspan="1">
|
88
|
+
<para>InstanceCreationDate</para>
|
89
|
+
</td>
|
90
|
+
<td align="center" colspan="1" rowspan="1">
|
91
|
+
<para>DA</para>
|
92
|
+
</td>
|
93
|
+
<td align="center" colspan="1" rowspan="1">
|
94
|
+
<para>1</para>
|
95
|
+
</td>
|
96
|
+
<td align="center" colspan="1" rowspan="1">
|
97
|
+
<para/>
|
98
|
+
</td>
|
99
|
+
</tr>
|
100
|
+
</book>
|
101
|
+
END
|
102
|
+
data = {tag_ps: '(0008,0012)',
|
103
|
+
tag_str: '(0008,0012)',
|
104
|
+
tag_ary: [0x0008,0x0012],
|
105
|
+
tag_sym: :instance_creation_date,
|
106
|
+
tag_ndm: '00080012',
|
107
|
+
tag_name: 'Instance Creation Date',
|
108
|
+
tag_key: 'InstanceCreationDate',
|
109
|
+
tag_vr: [:DA],
|
110
|
+
tag_vm: ['1'],
|
111
|
+
tag_note: '',
|
112
|
+
tag_multiple: false}
|
113
|
+
{xml_string => data}
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.xml_tag_sample_multiple_tag
|
117
|
+
xml_string=<<END
|
118
|
+
<book xmlns="http://docbook.org/ns/docbook">
|
119
|
+
<tr valign="top">
|
120
|
+
<td align="center" colspan="1" rowspan="1">
|
121
|
+
<para>(60xx,0040)</para>
|
122
|
+
</td>
|
123
|
+
<td align="left" colspan="1" rowspan="1">
|
124
|
+
<para>Overlay Type</para>
|
125
|
+
</td>
|
126
|
+
<td align="left" colspan="1" rowspan="1">
|
127
|
+
<para>OverlayType</para>
|
128
|
+
</td>
|
129
|
+
<td align="center" colspan="1" rowspan="1">
|
130
|
+
<para>CS</para>
|
131
|
+
</td>
|
132
|
+
<td align="center" colspan="1" rowspan="1">
|
133
|
+
<para>1</para>
|
134
|
+
</td>
|
135
|
+
<td align="center" colspan="1" rowspan="1">
|
136
|
+
<para/>
|
137
|
+
</td>
|
138
|
+
</tr>
|
139
|
+
</book>
|
140
|
+
END
|
141
|
+
|
142
|
+
data = {tag_ps: '(60XX,0040)',
|
143
|
+
tag_str: '(6022,0040)',
|
144
|
+
tag_ary: [0x6022,0x0040],
|
145
|
+
tag_sym: :overlay_type,
|
146
|
+
tag_ndm: '60220040',
|
147
|
+
tag_name: 'Overlay Type',
|
148
|
+
tag_key: 'OverlayType',
|
149
|
+
tag_vr: [:CS],
|
150
|
+
tag_vm: ['1'],
|
151
|
+
tag_note: '',
|
152
|
+
tag_multiple: true}
|
153
|
+
{xml_string => data}
|
154
|
+
end
|
155
|
+
|
156
|
+
def self.xml_tag_sample_no_note
|
157
|
+
xml_string=<<END
|
158
|
+
<book xmlns="http://docbook.org/ns/docbook">
|
159
|
+
<tr valign="top">
|
160
|
+
<td align="center" colspan="1" rowspan="1">
|
161
|
+
<para>(0018,1202)</para>
|
162
|
+
</td>
|
163
|
+
<td align="left" colspan="1" rowspan="1">
|
164
|
+
<para>DateTime of Last Calibration</para>
|
165
|
+
</td>
|
166
|
+
<td align="left" colspan="1" rowspan="1">
|
167
|
+
<para>DateTimeOfLastCalibration</para>
|
168
|
+
</td>
|
169
|
+
<td align="left" colspan="1" rowspan="1">
|
170
|
+
<para>DT</para>
|
171
|
+
</td>
|
172
|
+
<td align="left" colspan="1" rowspan="1">
|
173
|
+
<para>1</para>
|
174
|
+
</td>
|
175
|
+
</tr>
|
176
|
+
</book>
|
177
|
+
END
|
178
|
+
data = {tag_ps: '(0018,1202)',
|
179
|
+
tag_str: '(0018,1202)',
|
180
|
+
tag_ary: [0x0018,0x1202],
|
181
|
+
tag_sym: :date_time_of_last_calibration,
|
182
|
+
tag_ndm: '00181202',
|
183
|
+
tag_name: 'DateTime of Last Calibration',
|
184
|
+
tag_key: 'DateTimeOfLastCalibration',
|
185
|
+
tag_vr: [:DT],
|
186
|
+
tag_vm: ['1'],
|
187
|
+
tag_note: '',
|
188
|
+
tag_multiple: false}
|
189
|
+
{xml_string => data}
|
190
|
+
end
|
191
|
+
|
192
|
+
def self.xml_tag_sample_multi_vr_vm
|
193
|
+
xml_string = <<END
|
194
|
+
<book xmlns="http://docbook.org/ns/docbook">
|
195
|
+
<tr valign="top">
|
196
|
+
<td align="center" colspan="1" rowspan="1">
|
197
|
+
<para>
|
198
|
+
<emphasis role="italic">(0028,1200)</emphasis>
|
199
|
+
</para>
|
200
|
+
</td>
|
201
|
+
<td align="left" colspan="1" rowspan="1">
|
202
|
+
<para>
|
203
|
+
<emphasis role="italic">Gray Lookup Table Data</emphasis>
|
204
|
+
</para>
|
205
|
+
</td>
|
206
|
+
<td align="left" colspan="1" rowspan="1">
|
207
|
+
<para>
|
208
|
+
<emphasis role="italic">GrayLookupTableData</emphasis>
|
209
|
+
</para>
|
210
|
+
</td>
|
211
|
+
<td align="center" colspan="1" rowspan="1">
|
212
|
+
<para>
|
213
|
+
<emphasis role="italic">US or SS or OW</emphasis>
|
214
|
+
</para>
|
215
|
+
</td>
|
216
|
+
<td align="center" colspan="1" rowspan="1">
|
217
|
+
<para>
|
218
|
+
<emphasis role="italic">1-n or 1</emphasis>
|
219
|
+
</para>
|
220
|
+
</td>
|
221
|
+
<td align="center" colspan="1" rowspan="1">
|
222
|
+
<para>
|
223
|
+
<emphasis role="italic">RET</emphasis>
|
224
|
+
</para>
|
225
|
+
</td>
|
226
|
+
</tr>
|
227
|
+
</book>
|
228
|
+
END
|
229
|
+
data = {tag_ps: '(0028,1200)',
|
230
|
+
tag_str: '(0028,1200)',
|
231
|
+
tag_ary: [0x0028,0x1200],
|
232
|
+
tag_sym: :gray_lookup_table_data,
|
233
|
+
tag_ndm: '00281200',
|
234
|
+
tag_name: 'Gray Lookup Table Data',
|
235
|
+
tag_key: 'GrayLookupTableData',
|
236
|
+
tag_vr: [:US, :SS, :OW],
|
237
|
+
tag_vm: ['1-n', '1'],
|
238
|
+
tag_note: 'RET',
|
239
|
+
tag_multiple: false}
|
240
|
+
{xml_string => data}
|
241
|
+
end
|
242
|
+
|
243
|
+
def self.xml_tag_sample_no_vr
|
244
|
+
xml_string = <<END
|
245
|
+
<book xmlns="http://docbook.org/ns/docbook">
|
246
|
+
<tr valign="top">
|
247
|
+
<td align="center" colspan="1" rowspan="1">
|
248
|
+
<para>(FFFE,E000)</para>
|
249
|
+
</td>
|
250
|
+
<td align="left" colspan="1" rowspan="1">
|
251
|
+
<para>Item</para>
|
252
|
+
</td>
|
253
|
+
<td align="left" colspan="1" rowspan="1">
|
254
|
+
<para>Item</para>
|
255
|
+
</td>
|
256
|
+
<td align="center" colspan="1" rowspan="1">
|
257
|
+
<para>See Note <xref linkend="note_6_2"/></para>
|
258
|
+
</td>
|
259
|
+
<td align="center" colspan="1" rowspan="1">
|
260
|
+
<para>1</para>
|
261
|
+
</td>
|
262
|
+
<td align="center" colspan="1" rowspan="1">
|
263
|
+
<para/>
|
264
|
+
</td>
|
265
|
+
</tr>
|
266
|
+
</book>
|
267
|
+
END
|
268
|
+
data = {tag_ps: '(FFFE,E000)',
|
269
|
+
tag_str: '(FFFE,E000)',
|
270
|
+
tag_ary: [0xfffe,0xe000],
|
271
|
+
tag_sym: :item,
|
272
|
+
tag_ndm: 'FFFEE000',
|
273
|
+
tag_name: 'Item',
|
274
|
+
tag_key: 'Item',
|
275
|
+
tag_vr: [:"See Note"],
|
276
|
+
tag_vm: ['1'],
|
277
|
+
tag_note: '',
|
278
|
+
tag_multiple: false}
|
279
|
+
{xml_string => data}
|
280
|
+
end
|
281
|
+
|
282
|
+
def self.xml_tag_sample_multi_vr
|
283
|
+
xml_string = <<END
|
284
|
+
<book xmlns="http://docbook.org/ns/docbook">
|
285
|
+
<tr valign="top">
|
286
|
+
<td align="center" colspan="1" rowspan="1">
|
287
|
+
<para>(0014,3050)</para>
|
288
|
+
</td>
|
289
|
+
<td align="left" colspan="1" rowspan="1">
|
290
|
+
<para>Dark Current Counts</para>
|
291
|
+
</td>
|
292
|
+
<td align="left" colspan="1" rowspan="1">
|
293
|
+
<para>DarkCurrentCounts</para>
|
294
|
+
</td>
|
295
|
+
<td align="center" colspan="1" rowspan="1">
|
296
|
+
<para>OB or OW</para>
|
297
|
+
</td>
|
298
|
+
<td align="center" colspan="1" rowspan="1">
|
299
|
+
<para>1</para>
|
300
|
+
</td>
|
301
|
+
<td align="center" colspan="1" rowspan="1">
|
302
|
+
<para>DICONDE</para>
|
303
|
+
</td>
|
304
|
+
</tr>
|
305
|
+
</book>
|
306
|
+
END
|
307
|
+
data = {tag_ps: '(0014,3050)',
|
308
|
+
tag_str: '(0014,3050)',
|
309
|
+
tag_ary: [0x0014,0x3050],
|
310
|
+
tag_sym: :dark_current_counts,
|
311
|
+
tag_ndm: '00143050',
|
312
|
+
tag_name: 'Dark Current Counts',
|
313
|
+
tag_key: 'DarkCurrentCounts',
|
314
|
+
tag_vr: [:OB, :OW],
|
315
|
+
tag_vm: ['1'],
|
316
|
+
tag_note: 'DICONDE',
|
317
|
+
tag_multiple: false}
|
318
|
+
{xml_string => data}
|
319
|
+
end
|
320
|
+
|
321
|
+
def self.xml_tag_sample_empty
|
322
|
+
xml_string=<<END
|
323
|
+
<book xmlns="http://docbook.org/ns/docbook">
|
324
|
+
<tr valign="top">
|
325
|
+
<td align="center" colspan="1" rowspan="1">
|
326
|
+
<para>
|
327
|
+
<emphasis role="italic">(0018,9445)</emphasis>
|
328
|
+
</para>
|
329
|
+
</td>
|
330
|
+
<td align="center" colspan="1" rowspan="1">
|
331
|
+
<para/>
|
332
|
+
</td>
|
333
|
+
<td align="center" colspan="1" rowspan="1">
|
334
|
+
<para/>
|
335
|
+
</td>
|
336
|
+
<td align="center" colspan="1" rowspan="1">
|
337
|
+
<para/>
|
338
|
+
</td>
|
339
|
+
<td align="center" colspan="1" rowspan="1">
|
340
|
+
<para/>
|
341
|
+
</td>
|
342
|
+
<td align="center" colspan="1" rowspan="1">
|
343
|
+
<para>
|
344
|
+
<emphasis role="italic">RET - See Note <xref linkend="note_6_3"/></emphasis>
|
345
|
+
</para>
|
346
|
+
</td>
|
347
|
+
</tr>
|
348
|
+
</book>
|
349
|
+
END
|
350
|
+
data = {tag_ps: '(0018,9445)',
|
351
|
+
tag_str: '(0018,9445)',
|
352
|
+
tag_ary: [0x0018,0x9445],
|
353
|
+
tag_sym: :placeholder_0018_9445,
|
354
|
+
tag_ndm: '00189445',
|
355
|
+
tag_name: 'Placeholder (0018,9445)',
|
356
|
+
tag_key: 'Placeholder_0018_9445',
|
357
|
+
tag_vr: [:UN],
|
358
|
+
tag_vm: ['1'],
|
359
|
+
tag_note: 'RET - See Note',
|
360
|
+
tag_multiple: false}
|
361
|
+
{xml_string => data}
|
362
|
+
end
|
363
|
+
|
364
|
+
def self.xml_tag_sample_lowercase_tag
|
365
|
+
xml_string = <<END
|
366
|
+
<book xmlns="http://docbook.org/ns/docbook">
|
367
|
+
<tr valign="top">
|
368
|
+
<td align="center" colspan="1" rowspan="1">
|
369
|
+
<para>(0074,100a)</para>
|
370
|
+
</td>
|
371
|
+
<td align="left" colspan="1" rowspan="1">
|
372
|
+
<para>Contact URI</para>
|
373
|
+
</td>
|
374
|
+
<td align="left" colspan="1" rowspan="1">
|
375
|
+
<para>ContactURI</para>
|
376
|
+
</td>
|
377
|
+
<td align="center" colspan="1" rowspan="1">
|
378
|
+
<para>ST</para>
|
379
|
+
</td>
|
380
|
+
<td align="center" colspan="1" rowspan="1">
|
381
|
+
<para>1</para>
|
382
|
+
</td>
|
383
|
+
<td align="center" colspan="1" rowspan="1">
|
384
|
+
<para/>
|
385
|
+
</td>
|
386
|
+
</tr>
|
387
|
+
</book>
|
388
|
+
END
|
389
|
+
data = {tag_ps: '(0074,100A)',
|
390
|
+
tag_str: '(0074,100A)',
|
391
|
+
tag_ary: [0x0074,0x100a],
|
392
|
+
tag_sym: :contact_uri,
|
393
|
+
tag_ndm: '0074100A',
|
394
|
+
tag_name: 'Contact URI',
|
395
|
+
tag_key: 'ContactURI',
|
396
|
+
tag_vr: [:ST],
|
397
|
+
tag_vm: ['1'],
|
398
|
+
tag_note: '',
|
399
|
+
tag_multiple: false}
|
400
|
+
{xml_string => data}
|
401
|
+
end
|
402
|
+
|
403
|
+
def self.xml_tag_multiline_note_set
|
404
|
+
xml_string = <<END
|
405
|
+
<book xmlns="http://docbook.org/ns/docbook">
|
406
|
+
<tr valign="top">
|
407
|
+
<td align="center" colspan="1" rowspan="1">
|
408
|
+
<para>(0000,0700)</para>
|
409
|
+
</td>
|
410
|
+
<td align="left" colspan="1" rowspan="1">
|
411
|
+
<para>Priority</para>
|
412
|
+
</td>
|
413
|
+
<td align="left" colspan="1" rowspan="1">
|
414
|
+
<para>Priority</para>
|
415
|
+
</td>
|
416
|
+
<td align="center" colspan="1" rowspan="1">
|
417
|
+
<para>US</para>
|
418
|
+
</td>
|
419
|
+
<td align="center" colspan="1" rowspan="1">
|
420
|
+
<para>1</para>
|
421
|
+
</td>
|
422
|
+
<td align="left" colspan="1" rowspan="1">
|
423
|
+
<para>The priority shall be set to one of the following values:</para>
|
424
|
+
<para>LOW = 0002H</para>
|
425
|
+
<para>MEDIUM = 0000H</para>
|
426
|
+
<para>HIGH = 0001H</para>
|
427
|
+
</td>
|
428
|
+
</tr>
|
429
|
+
</book>
|
430
|
+
END
|
431
|
+
note = <<NOTE.chop
|
432
|
+
The priority shall be set to one of the following values:
|
433
|
+
LOW = 0002H
|
434
|
+
MEDIUM = 0000H
|
435
|
+
HIGH = 0001H
|
436
|
+
NOTE
|
437
|
+
data = {tag_ps: '(0000,0700)',
|
438
|
+
tag_str: '(0000,0700)',
|
439
|
+
tag_ary: [0x0000,0x0700],
|
440
|
+
tag_sym: :priority,
|
441
|
+
tag_ndm: '00000700',
|
442
|
+
tag_name: 'Priority',
|
443
|
+
tag_key: 'Priority',
|
444
|
+
tag_vr: [:US],
|
445
|
+
tag_vm: ['1'],
|
446
|
+
tag_note: note,
|
447
|
+
tag_multiple: false}
|
448
|
+
{xml_string => data}
|
449
|
+
end
|
450
|
+
|
451
|
+
def self.xml_tag_complex_note
|
452
|
+
xml_string= <<END
|
453
|
+
<book xmlns="http://docbook.org/ns/docbook">
|
454
|
+
<tr valign="top">
|
455
|
+
<td align="center" colspan="1" rowspan="1">
|
456
|
+
<para>(0000,0900)</para>
|
457
|
+
</td>
|
458
|
+
<td align="left" colspan="1" rowspan="1">
|
459
|
+
<para>Status</para>
|
460
|
+
</td>
|
461
|
+
<td align="left" colspan="1" rowspan="1">
|
462
|
+
<para>Status</para>
|
463
|
+
</td>
|
464
|
+
<td align="center" colspan="1" rowspan="1">
|
465
|
+
<para>US</para>
|
466
|
+
</td>
|
467
|
+
<td align="center" colspan="1" rowspan="1">
|
468
|
+
<para>1</para>
|
469
|
+
</td>
|
470
|
+
<td align="left" colspan="1" rowspan="1">
|
471
|
+
<para>Confirmation status of the operation. See <xref linkend="chapter_C" xrefstyle="template: Annex %n"/>.</para>
|
472
|
+
</td>
|
473
|
+
</tr>
|
474
|
+
</book>
|
475
|
+
END
|
476
|
+
data = {tag_ps: '(0000,0900)',
|
477
|
+
tag_str: '(0000,0900)',
|
478
|
+
tag_ary: [0x0000,0x0900],
|
479
|
+
tag_sym: :status,
|
480
|
+
tag_ndm: '00000900',
|
481
|
+
tag_name: 'Status',
|
482
|
+
tag_key: 'Status',
|
483
|
+
tag_vr: [:US],
|
484
|
+
tag_vm: ['1'],
|
485
|
+
tag_note: "Confirmation status of the operation. See .",
|
486
|
+
tag_multiple: false}
|
487
|
+
{xml_string => data}
|
488
|
+
end
|
489
|
+
|
490
|
+
def self.xml_tag_single_set
|
491
|
+
{ }.merge(xml_tag_sample_standard).
|
492
|
+
merge(xml_tag_multiline_note_set).
|
493
|
+
merge(xml_tag_sample_standard_empty_note).
|
494
|
+
merge(xml_tag_complex_note).
|
495
|
+
merge(xml_tag_sample_multiple_tag).
|
496
|
+
merge(xml_tag_sample_no_note).
|
497
|
+
merge(xml_tag_sample_multi_vr_vm).
|
498
|
+
merge(xml_tag_sample_no_vr).
|
499
|
+
merge(xml_tag_sample_multi_vr).
|
500
|
+
merge(xml_tag_sample_empty).
|
501
|
+
merge(xml_tag_sample_lowercase_tag)
|
502
|
+
end
|
503
|
+
|
504
|
+
def self.uid_single_standard
|
505
|
+
xml_string=<<END
|
506
|
+
<book xmlns="http://docbook.org/ns/docbook">
|
507
|
+
<tr valign="top">
|
508
|
+
<td align="left" colspan="1" rowspan="1">
|
509
|
+
<para>1.2.840.10008.1.2</para>
|
510
|
+
</td>
|
511
|
+
<td align="left" colspan="1" rowspan="1">
|
512
|
+
<para>Implicit VR Little Endian: Default Transfer Syntax for DICOM</para>
|
513
|
+
</td>
|
514
|
+
<td align="left" colspan="1" rowspan="1">
|
515
|
+
<para>Transfer Syntax</para>
|
516
|
+
</td>
|
517
|
+
<td align="center" colspan="1" rowspan="1">
|
518
|
+
<para><olink targetdoc="PS3.5" targetptr="PS3.5" xrefstyle="select: labelnumber"/></para>
|
519
|
+
</td>
|
520
|
+
</tr>
|
521
|
+
</book>
|
522
|
+
END
|
523
|
+
data = {uid_value: "1.2.840.10008.1.2",
|
524
|
+
uid_name: "Implicit VR Little Endian: Default Transfer Syntax for DICOM",
|
525
|
+
uid_type: :transfer_syntax}
|
526
|
+
{xml_string => data}
|
527
|
+
end
|
528
|
+
|
529
|
+
def self.xml_uid_set
|
530
|
+
{}.merge(uid_single_standard)
|
531
|
+
end
|
532
|
+
|
533
|
+
end
|