dcm_dict 0.29.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.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +156 -0
  3. data/COPYING +674 -0
  4. data/LICENSE +22 -0
  5. data/README.md +327 -0
  6. data/Rakefile +36 -0
  7. data/bin/dcm_dict_converter.rb +194 -0
  8. data/lib/dcm_dict.rb +46 -0
  9. data/lib/dcm_dict/dictionary/base_dictionary.rb +47 -0
  10. data/lib/dcm_dict/dictionary/base_record.rb +62 -0
  11. data/lib/dcm_dict/dictionary/data_element_dictionary.rb +117 -0
  12. data/lib/dcm_dict/dictionary/data_element_record.rb +93 -0
  13. data/lib/dcm_dict/dictionary/uid_dictionary.rb +82 -0
  14. data/lib/dcm_dict/dictionary/uid_record.rb +48 -0
  15. data/lib/dcm_dict/encoder/data_to_code.rb +79 -0
  16. data/lib/dcm_dict/error/dictionary_error.rb +30 -0
  17. data/lib/dcm_dict/ext/object_extension.rb +38 -0
  18. data/lib/dcm_dict/refine/array_refine.rb +34 -0
  19. data/lib/dcm_dict/refine/data_element_refine.rb +37 -0
  20. data/lib/dcm_dict/refine/internal/array_refine_internal.rb +97 -0
  21. data/lib/dcm_dict/refine/internal/hash_refine_internal.rb +71 -0
  22. data/lib/dcm_dict/refine/internal/string_refine_internal.rb +135 -0
  23. data/lib/dcm_dict/refine/string_refine.rb +35 -0
  24. data/lib/dcm_dict/refine/symbol_refine.rb +34 -0
  25. data/lib/dcm_dict/refine/uid_refine.rb +36 -0
  26. data/lib/dcm_dict/rubies/rb_ext.rb +32 -0
  27. data/lib/dcm_dict/source_data/data_elements_data.rb +4945 -0
  28. data/lib/dcm_dict/source_data/detached_data.rb +67 -0
  29. data/lib/dcm_dict/source_data/uid_values_data.rb +467 -0
  30. data/lib/dcm_dict/version.rb +27 -0
  31. data/lib/dcm_dict/xml/constant.rb +38 -0
  32. data/lib/dcm_dict/xml/field_data.rb +47 -0
  33. data/lib/dcm_dict/xml/nokogiri_tool.rb +108 -0
  34. data/lib/dcm_dict/xml/rexml_tool.rb +105 -0
  35. data/lib/dcm_dict/xml/tag_field_data.rb +96 -0
  36. data/lib/dcm_dict/xml/uid_field_data.rb +60 -0
  37. data/lib/dcm_dict/xml/xml_tool.rb +47 -0
  38. data/spec/data_element_sample_spec_helper.rb +203 -0
  39. data/spec/data_element_shared_example_spec_helper.rb +57 -0
  40. data/spec/dcm_dict/dictionary/data_element_dictionary_spec.rb +76 -0
  41. data/spec/dcm_dict/dictionary/data_element_record_spec.rb +138 -0
  42. data/spec/dcm_dict/dictionary/uid_dictionary_spec.rb +82 -0
  43. data/spec/dcm_dict/dictionary/uid_record_spec.rb +53 -0
  44. data/spec/dcm_dict/encoder/data_to_code_spec.rb +109 -0
  45. data/spec/dcm_dict/ext/object_extension_spec.rb +53 -0
  46. data/spec/dcm_dict/refine/array_refine_spec.rb +60 -0
  47. data/spec/dcm_dict/refine/internal/array_refine_internal_spec.rb +98 -0
  48. data/spec/dcm_dict/refine/internal/hash_refine_internal_spec.rb +64 -0
  49. data/spec/dcm_dict/refine/internal/string_refine_internal_spec.rb +228 -0
  50. data/spec/dcm_dict/refine/string_refine_spec.rb +87 -0
  51. data/spec/dcm_dict/refine/symbol_refine_spec.rb +41 -0
  52. data/spec/dcm_dict/rubies/rb_ext_spec.rb +46 -0
  53. data/spec/dcm_dict/source_data/data_elements_data_spec.rb +40 -0
  54. data/spec/dcm_dict/source_data/detached_data_spec.rb +55 -0
  55. data/spec/dcm_dict/source_data/uid_values_data_spec.rb +37 -0
  56. data/spec/dcm_dict/version_spec.rb +30 -0
  57. data/spec/dcm_dict/xml/tag_field_data_spec.rb +62 -0
  58. data/spec/dcm_dict/xml/uid_field_data_spec.rb +60 -0
  59. data/spec/dictionary_shared_example_spec_helper.rb +118 -0
  60. data/spec/refine_shared_example_spec_helper.rb +54 -0
  61. data/spec/spec_helper.rb +42 -0
  62. data/spec/xml_sample_spec_helper.rb +567 -0
  63. metadata +216 -0
@@ -0,0 +1,82 @@
1
+ #
2
+ # This file is part of DcmDict gem (dcm_dict).
3
+ #
4
+ # DcmDict is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # DcmDict is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with DcmDict. If not, see <http://www.gnu.org/licenses/>.
16
+ #
17
+ # This software has neither been tested nor approved for clinical use
18
+ # or for incorporation in a medical device.
19
+ # It is the redistributor's or user's responsibility to comply with any
20
+ # applicable local, state, national or international regulations.
21
+ #
22
+ require 'spec_helper'
23
+
24
+ describe DcmDict::Dictionary::UidDictionary do
25
+
26
+ include_examples "Map all source data",
27
+ [:uid_value, :uid_name],
28
+ DcmDict::SourceData::UidValuesData,
29
+ DcmDict::Dictionary::TheUidDictionary,
30
+ DcmDict::Dictionary::UidRecord,
31
+ [:uid_value, :uid_name, :uid_type]
32
+
33
+ {
34
+ '1.2.3.4.5.6' => { :uid_value => '1.2.3.4.5.6',
35
+ :uid_name => 'Unknown UID',
36
+ :uid_type => :unknown },
37
+ '1.2.840.10008.5.1.4.1.1.12.77' => { :uid_value => '1.2.840.10008.5.1.4.1.1.12.77',
38
+ :uid_name => '1.2.840.10008.5.1.4.1.1.12.77 (Retired)',
39
+ :uid_type => :sop_class },
40
+ '1.2.840.10008.5.1.4.1.1.40' => { :uid_value => '1.2.840.10008.5.1.4.1.1.40',
41
+ :uid_name => '1.2.840.10008.5.1.4.1.1.40 (Retired)',
42
+ :uid_type => :sop_class },
43
+ '1.2.840.10008.5.1.4.39.3' => { :uid_value => '1.2.840.10008.5.1.4.39.3',
44
+ :uid_name => 'Color Palette Query/Retrieve Information Model - MOVE',
45
+ :uid_type => :sop_class },
46
+ '1.2.840.10008.5.1.4.34.6.5' => { :uid_value => '1.2.840.10008.5.1.4.34.6.5',
47
+ :uid_name => 'Unified Procedure Step - Query SOP Class',
48
+ :uid_type => :sop_class },
49
+ '1.2.840.10008.1.2.4.70' => { :uid_value => '1.2.840.10008.1.2.4.70',
50
+ :uid_name => "JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1]): Default Transfer Syntax for Lossless JPEG Image Compression",
51
+ :uid_type => :transfer_syntax},
52
+ '1.2.840.10008.1.2.4.60' => { :uid_value => '1.2.840.10008.1.2.4.60',
53
+ :uid_name => 'JPEG Extended, Hierarchical (Process 17 & 19) (Retired)',
54
+ :uid_type => :transfer_syntax },
55
+ '1.2.840.10008.5.1.4.1.1.481.19'=> { :uid_value => '1.2.840.10008.5.1.4.1.1.481.19',
56
+ :uid_name => "C-Arm Photon-Electron Radiation Record Storage",
57
+ :uid_type => :sop_class},
58
+ }.each do |uid, data|
59
+ include_examples "Handle specific record", data[:uid_name],
60
+ uid, data, DcmDict::Dictionary::TheUidDictionary
61
+ end
62
+
63
+ [
64
+ '1.2.abc.3.4', 'this string is not a valid uid', '1.2.3.04.5'
65
+ ].each do |uid|
66
+ include_examples "Dictionary with wrong key",
67
+ uid, [:uid_value, :uid_name, :uid_type],
68
+ DcmDict::Dictionary::TheUidDictionary
69
+ end
70
+
71
+ include_examples "Dictionary Data not modifiable",
72
+ '1.2.840.10008.1.2', :uid_value, DcmDict::Dictionary::TheUidDictionary
73
+
74
+
75
+ include_examples "Concurrency support",
76
+ '1.2.840.10008.1.2',
77
+ DcmDict::Dictionary::TheUidDictionary,
78
+ {uid_value: '1.2.840.10008.1.2',
79
+ uid_name: "Implicit VR Little Endian: Default Transfer Syntax for DICOM",
80
+ uid_type: :transfer_syntax}
81
+
82
+ end
@@ -0,0 +1,53 @@
1
+ #
2
+ # Copyright (C) 2014-2020 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
+ require 'spec_helper'
25
+
26
+ describe DcmDict::Dictionary::UidRecord do
27
+ [
28
+ { uid_value: '1.2.840.10008.1.2',
29
+ uid_name: "Implicit VR Little Endian: Default Transfer Syntax for DICOM",
30
+ uid_type: :transfer_syntax }
31
+ ].each do |data|
32
+ it "Handle Data Element Data correctly" do
33
+ ur = DcmDict::Dictionary::UidRecord.new(data.dup)
34
+ expect(ur.uid_value).to eq(data[:uid_value])
35
+ expect(ur.uid).to eq(data[:uid_value])
36
+ expect(ur.uid_name).to eq(data[:uid_name])
37
+ expect(ur.uid_type).to eq(data[:uid_type])
38
+ end
39
+
40
+
41
+ include_examples "Record handle methods correctly",
42
+ DcmDict::Dictionary::UidRecord.new(data),
43
+ data
44
+
45
+ it "data should be not modifiable" do
46
+ uid = DcmDict::Dictionary::UidRecord.new(data.dup)
47
+ old_value = uid.uid_value.dup
48
+ expect{uid.uid_value << 'aaa'}.to raise_error(RuntimeError)
49
+ expect(uid.uid_value).to eq(old_value)
50
+ end
51
+
52
+ end
53
+ end
@@ -0,0 +1,109 @@
1
+ #
2
+ # Copyright (C) 2014-2020 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
+ require 'spec_helper'
25
+ require 'xml_sample_spec_helper'
26
+
27
+ describe DcmDict::Encoder::DataToCode do
28
+ describe "should print out data element with" do
29
+ it "data elements header code" do
30
+ header = DcmDict::Encoder::DataToCode.data_element_header
31
+ expected_header = <<END
32
+ module DcmDict
33
+ module SourceData
34
+ DataElementsData = [
35
+ END
36
+ expect(header).to eq(expected_header)
37
+ end
38
+
39
+ it "data elements footer code" do
40
+ footer = DcmDict::Encoder::DataToCode.data_element_footer
41
+ expected_footer=<<END
42
+ ]
43
+ end
44
+ end
45
+ END
46
+ expect(footer).to eq(expected_footer)
47
+ end
48
+
49
+ describe "data element data field" do
50
+ using DcmDict::Refine::Internal::ArrayRefineInternal
51
+
52
+ XmlSampleSpecHelper.xml_tag_single_set.each do |xml_string, data|
53
+ it "for data element sample as #{data[:tag_ps].inspect}" do
54
+ indent = 4
55
+ tag_ary_str = "[0x#{data[:tag_ary].tag_group_str},0x#{data[:tag_ary].tag_element_str}]"
56
+ src_text = "#{' '*indent}{ tag_ps: '#{data[:tag_ps]}', tag_name: \"#{data[:tag_name]}\", tag_key: '#{data[:tag_key]}', tag_vr: #{data[:tag_vr]}, tag_vm: #{data[:tag_vm]}, tag_str: '#{data[:tag_str]}', tag_sym: #{data[:tag_sym].inspect}, tag_ndm: '#{data[:tag_ndm]}', tag_ary: #{tag_ary_str}, tag_multiple: #{data[:tag_multiple].inspect}, tag_note: '#{data[:tag_note]}'},"
57
+ src_line = DcmDict::Encoder::DataToCode.data_element_data_to_code(data)
58
+ expect(src_line).to eq(src_text)
59
+ src_line = DcmDict::Encoder::DataToCode.data_element_data_to_code(data, indent)
60
+ expect(src_line).to eq(src_text)
61
+ indent = 6
62
+ src_line = DcmDict::Encoder::DataToCode.data_element_data_to_code(data, indent)
63
+ expect(src_line.start_with?("#{' '*indent}{")).to be true
64
+ end
65
+ end
66
+
67
+ end
68
+ end
69
+
70
+ describe "should print out uid with" do
71
+ it "uid header code" do
72
+ header = DcmDict::Encoder::DataToCode.uid_header
73
+ expected_header = <<END
74
+ module DcmDict
75
+ module SourceData
76
+ UidValuesData = [
77
+ END
78
+ expect(header).to eq(expected_header)
79
+ end
80
+
81
+ it "uid footer code" do
82
+ footer = DcmDict::Encoder::DataToCode.uid_footer
83
+ expected_footer=<<END
84
+ ]
85
+ end
86
+ end
87
+ END
88
+ expect(footer).to eq(expected_footer)
89
+ end
90
+
91
+ describe "uid data field" do
92
+ XmlSampleSpecHelper.xml_uid_set.each do |xml_string, data|
93
+ it "for uid sample as #{data[:uid_value].inspect}" do
94
+ indent = 4
95
+ src_text = "#{' '*indent}{ uid_value: '#{data[:uid_value]}', uid_name: \"#{data[:uid_name]}\", uid_type: #{data[:uid_type].inspect}},"
96
+ src_line = DcmDict::Encoder::DataToCode.uid_data_to_code(data)
97
+ expect(src_line).to eq(src_text)
98
+ src_line = DcmDict::Encoder::DataToCode.uid_data_to_code(data, indent)
99
+ expect(src_line).to eq(src_text)
100
+ indent = 6
101
+ src_line = DcmDict::Encoder::DataToCode.uid_data_to_code(data, indent)
102
+ expect(src_line.start_with?("#{' '*indent}{")).to be true
103
+ end
104
+ end
105
+ end
106
+
107
+ end
108
+
109
+ end
@@ -0,0 +1,53 @@
1
+ #
2
+ # Copyright (C) 2014-2020 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
+ require 'spec_helper'
25
+
26
+ describe "Object extension" do
27
+
28
+ describe "should check object for nil or empty status" do
29
+ describe "for class with empty? method" do
30
+ it "as string object" do
31
+ expect("bla bla".nil_or_empty?).to be_falsy
32
+ expect("".nil_or_empty?).to be_truthy
33
+ end
34
+
35
+ it "as array object" do
36
+ expect([1, 2].nil_or_empty?).to be_falsy
37
+ expect([].nil_or_empty?).to be_truthy
38
+ end
39
+
40
+ end
41
+
42
+ describe "for class without empty? method" do
43
+ it "as fixnum object" do
44
+ expect(5.nil_or_empty?).to be_falsy
45
+ end
46
+
47
+ it "as nil object" do
48
+ expect(nil.nil_or_empty?).to be_truthy
49
+ end
50
+ end
51
+
52
+ end
53
+ end
@@ -0,0 +1,60 @@
1
+ #
2
+ # Copyright (C) 2014-2020 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
+ require 'spec_helper'
25
+
26
+ describe "Array refinement" do
27
+ using DcmDict::Refine::ArrayRefine
28
+
29
+ describe "should permit access to single data element dictionary information" do
30
+
31
+ include_examples "refinement for standard tag",
32
+ [[0x0010,0x1005], [0x0028,0x1200], [0x0014,0x3050]],
33
+ Proc.new{|tag| tag}
34
+
35
+
36
+ multi_data = { [0x6046,0x0040] => {
37
+ tag_name: "Overlay Type",
38
+ tag_multiple: true,
39
+ tag_keyword: "OverlayType",
40
+ tag_key: "OverlayType",
41
+ tag_vr: [:CS], tag_vm: ["1"],
42
+ tag: [0x6046, 0x0040], tag_ary: [0x6046, 0x0040],
43
+ tag_ps: "(60XX,0040)",
44
+ tag_sym: :overlay_type,
45
+ tag_ndm: "60460040",
46
+ tag_str: "(6046,0040)",
47
+ tag_group: 0x6046,
48
+ tag_element: 0x0040 } }
49
+
50
+ include_examples "refinement for multiple tag",
51
+ multi_data,
52
+ Proc.new {|tag| tag}
53
+
54
+ end
55
+
56
+ include_examples "Raise exception for wrong input",
57
+ [ [0,1,2,3], [-0x0010,-0x0010], [0x1ffff,0x0010], [0x1ffff,0x10010], [0x0010, 0x1ffff]],
58
+ [],
59
+ Proc.new {|tag| tag}
60
+ end
@@ -0,0 +1,98 @@
1
+ #
2
+ # Copyright (C) 2014-2020 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
+ require 'spec_helper'
25
+
26
+ describe "Array Refinement" do
27
+
28
+ using DcmDict::Refine::Internal::ArrayRefineInternal
29
+ it "should implement tag_ary metod" do
30
+ expect([0x0010,0x0020].to_tag_ary).to eq([0x0010,0x0020])
31
+ end
32
+
33
+ describe "should extract group and element from 'array tag'" do
34
+ it "for correct object" do
35
+ expect([0x0010,0x0020].tag_group_num).to eq(0x0010)
36
+ expect([0x0010,0x0020].tag_element_num).to eq(0x0020)
37
+ end
38
+
39
+ describe "and for wrong array must be raise error" do
40
+ [
41
+ [0x0010],
42
+ [0x0010,0x0020,0x0030],
43
+ ['0010', '0020'],
44
+ [16.0, 0x0020],
45
+ [0x1ffff,0x10000],
46
+ [-1,-2]
47
+ ].each do |tag|
48
+ it "as #{tag.inspect}" do
49
+ expect{ tag.tag_group_num }.to raise_error(RuntimeError)
50
+ expect{ tag.tag_element_num }.to raise_error(RuntimeError)
51
+
52
+ end
53
+ end
54
+ end
55
+
56
+ end
57
+
58
+ describe "should convert group and element to hex string" do
59
+ {
60
+ [0xfffe,0xe0dd] => {group: 'FFFE', element: 'E0DD', tag_str: '(FFFE,E0DD)', tag_ndm: 'FFFEE0DD'},
61
+ [0x0010,0x0020] => {group: '0010', element: '0020', tag_str: '(0010,0020)', tag_ndm: '00100020'}
62
+ }.each do |tag, value|
63
+ it "for #{tag.inspect}" do
64
+ expect(tag.tag_group_str).to eq(value[:group])
65
+ expect(tag.tag_element_str).to eq(value[:element])
66
+ expect(tag.to_tag_str).to eq(value[:tag_str])
67
+ expect(tag.to_tag_ndm).to eq(value[:tag_ndm])
68
+ end
69
+ end
70
+ end
71
+
72
+ describe "should check for group-length tag" do
73
+ {
74
+ [0x0010, 0x0020] => false,
75
+ [0x0010, 0x0000] => true,
76
+ [0x0000, 0x0002] => false,
77
+ [0x0000, 0x0000] => true
78
+ }.each do |tag, value|
79
+ it "for #{tag.inspect}" do
80
+ expect(tag.group_length_tag?).to eq(value)
81
+ end
82
+ end
83
+ end
84
+
85
+ describe "should check for private-creator tag" do
86
+ {
87
+ [0x0010, 0x0010] => false,
88
+ [0x0011, 0x0010] => true,
89
+ [0x0011, 0x0110] => false,
90
+ [0x0028, 0x2468] => false
91
+ }.each do |tag, value|
92
+ it "for #{tag.inspect}" do
93
+ expect(tag.private_creator_tag?).to eq(value)
94
+ end
95
+ end
96
+ end
97
+
98
+ end