dcm_dict 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/COPYING +674 -0
  3. data/LICENSE +22 -0
  4. data/README.md +296 -0
  5. data/Rakefile +36 -0
  6. data/bin/dcm_dict_converter.rb +194 -0
  7. data/lib/dcm_dict.rb +46 -0
  8. data/lib/dcm_dict/dictionary/base_dictionary.rb +47 -0
  9. data/lib/dcm_dict/dictionary/base_record.rb +62 -0
  10. data/lib/dcm_dict/dictionary/data_element_dictionary.rb +117 -0
  11. data/lib/dcm_dict/dictionary/data_element_record.rb +93 -0
  12. data/lib/dcm_dict/dictionary/uid_dictionary.rb +82 -0
  13. data/lib/dcm_dict/dictionary/uid_record.rb +48 -0
  14. data/lib/dcm_dict/encoder/data_to_code.rb +79 -0
  15. data/lib/dcm_dict/error/dictionary_error.rb +30 -0
  16. data/lib/dcm_dict/ext/object_extension.rb +38 -0
  17. data/lib/dcm_dict/refine/array_refine.rb +34 -0
  18. data/lib/dcm_dict/refine/data_element_refine.rb +37 -0
  19. data/lib/dcm_dict/refine/internal/array_refine_internal.rb +97 -0
  20. data/lib/dcm_dict/refine/internal/hash_refine_internal.rb +71 -0
  21. data/lib/dcm_dict/refine/internal/string_refine_internal.rb +119 -0
  22. data/lib/dcm_dict/refine/string_refine.rb +35 -0
  23. data/lib/dcm_dict/refine/symbol_refine.rb +34 -0
  24. data/lib/dcm_dict/refine/uid_refine.rb +36 -0
  25. data/lib/dcm_dict/rubies/rb_ext.rb +32 -0
  26. data/lib/dcm_dict/source_data/data_elements_data.rb +3937 -0
  27. data/lib/dcm_dict/source_data/detached_data.rb +67 -0
  28. data/lib/dcm_dict/source_data/uid_values_data.rb +382 -0
  29. data/lib/dcm_dict/version.rb +27 -0
  30. data/lib/dcm_dict/xml/constant.rb +38 -0
  31. data/lib/dcm_dict/xml/field_data.rb +47 -0
  32. data/lib/dcm_dict/xml/nokogiri_tool.rb +108 -0
  33. data/lib/dcm_dict/xml/rexml_tool.rb +105 -0
  34. data/lib/dcm_dict/xml/tag_field_data.rb +96 -0
  35. data/lib/dcm_dict/xml/uid_field_data.rb +49 -0
  36. data/lib/dcm_dict/xml/xml_tool.rb +47 -0
  37. data/spec/data_element_sample_spec_helper.rb +110 -0
  38. data/spec/data_element_shared_example_spec_helper.rb +57 -0
  39. data/spec/dcm_dict/dictionary/data_element_dictionary_spec.rb +75 -0
  40. data/spec/dcm_dict/dictionary/data_element_record_spec.rb +117 -0
  41. data/spec/dcm_dict/dictionary/uid_dictionary_spec.rb +60 -0
  42. data/spec/dcm_dict/dictionary/uid_record_spec.rb +53 -0
  43. data/spec/dcm_dict/encoder/data_to_code_spec.rb +109 -0
  44. data/spec/dcm_dict/ext/object_extension_spec.rb +53 -0
  45. data/spec/dcm_dict/refine/array_refine_spec.rb +61 -0
  46. data/spec/dcm_dict/refine/internal/array_refine_internal_spec.rb +98 -0
  47. data/spec/dcm_dict/refine/internal/hash_refine_internal_spec.rb +64 -0
  48. data/spec/dcm_dict/refine/internal/string_refine_internal_spec.rb +214 -0
  49. data/spec/dcm_dict/refine/string_refine_spec.rb +87 -0
  50. data/spec/dcm_dict/refine/symbol_refine_spec.rb +41 -0
  51. data/spec/dcm_dict/rubies/rb_ext_spec.rb +46 -0
  52. data/spec/dcm_dict/source_data/data_elements_data_spec.rb +40 -0
  53. data/spec/dcm_dict/source_data/detached_data_spec.rb +55 -0
  54. data/spec/dcm_dict/source_data/uid_values_data_spec.rb +37 -0
  55. data/spec/dcm_dict/version_spec.rb +30 -0
  56. data/spec/dcm_dict/xml/tag_field_data_spec.rb +62 -0
  57. data/spec/dcm_dict/xml/uid_field_data_spec.rb +60 -0
  58. data/spec/dictionary_shared_example_spec_helper.rb +118 -0
  59. data/spec/refine_shared_example_spec_helper.rb +54 -0
  60. data/spec/spec_helper.rb +42 -0
  61. data/spec/xml_sample_spec_helper.rb +533 -0
  62. metadata +212 -0
@@ -0,0 +1,48 @@
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
+ require_relative 'base_record'
25
+
26
+ module DcmDict
27
+ module Dictionary
28
+ UidMethodMap = {uid_value: :uid_value,
29
+ uid: :uid_value,
30
+ uid_name: :uid_name,
31
+ uid_type: :uid_type }.freeze
32
+
33
+ UidMethod = UidMethodMap.flatten.uniq.freeze
34
+
35
+ # Class to handle uid record from source dictionary data
36
+ class UidRecord < BaseRecord
37
+ def initialize(data)
38
+ super
39
+ end
40
+
41
+ private
42
+ def method_map
43
+ UidMethodMap
44
+ end
45
+ end
46
+
47
+ end
48
+ end
@@ -0,0 +1,79 @@
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
+ module DcmDict
25
+ module Encoder
26
+ module DataToCode
27
+ using DcmDict::Refine::Internal::ArrayRefineInternal
28
+
29
+ # Convert data element +data+ to Ruby code using +indent+ spaces indentation
30
+ def self.data_element_data_to_code(data, indent=4)
31
+ indent = 4 unless indent
32
+ tag_ary_str = "[0x#{data[:tag_ary].tag_group_str},0x#{data[:tag_ary].tag_element_str}]"
33
+ "#{' '*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]}'},"
34
+ end
35
+
36
+ # Source data element header
37
+ def self.data_element_header
38
+ <<END
39
+ module DcmDict
40
+ module SourceData
41
+ DataElementsData = [
42
+ END
43
+ end
44
+
45
+ # Source data element footer
46
+ def self.data_element_footer
47
+ <<END
48
+ ]
49
+ end
50
+ end
51
+ END
52
+ end
53
+
54
+ # Source uid header
55
+ def self.uid_header
56
+ <<END
57
+ module DcmDict
58
+ module SourceData
59
+ UidValuesData = [
60
+ END
61
+ end
62
+
63
+ # Source uid footer
64
+ def self.uid_footer
65
+ <<END
66
+ ]
67
+ end
68
+ end
69
+ END
70
+ end
71
+
72
+ # Convert uid +data+ to Ruby code using +indent+ spaces indentation
73
+ def self.uid_data_to_code(data, indent=4)
74
+ indent = 4 unless indent
75
+ "#{' '*indent}{ uid_value: '#{data[:uid_value]}', uid_name: \"#{data[:uid_name]}\", uid_type: #{data[:uid_type].inspect}},"
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,30 @@
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
+ module DcmDict
25
+
26
+ # Dictionary Exception class
27
+ class DictionaryError < StandardError
28
+ end
29
+
30
+ end
@@ -0,0 +1,38 @@
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
+ module DcmDict
25
+ module Ext
26
+
27
+ # Extension for object class
28
+ class ::Object
29
+
30
+ # Check for nil or 'empty' object
31
+ def nil_or_empty?
32
+ return empty? if(respond_to?(:empty?))
33
+ nil?
34
+ end
35
+ end
36
+
37
+ end
38
+ end
@@ -0,0 +1,34 @@
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
+ module DcmDict
25
+ module Refine
26
+ module ArrayRefine
27
+
28
+ refine Array do
29
+ include DcmDict::Refine::DataElementRefine
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,37 @@
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
+ module DcmDict
25
+ module Refine
26
+
27
+ # Module to manage data element record data
28
+ module DataElementRefine
29
+ DcmDict::Dictionary::DataElementMethod.each do |method|
30
+ define_method(method) do
31
+ Dictionary::TheDataElementDictionary.feature_at(self, method)
32
+ end
33
+ end
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,97 @@
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
+ module DcmDict
25
+ module Refine
26
+ module Internal
27
+ module ArrayRefineInternal
28
+
29
+ refine Array do
30
+ # Tag group as number
31
+ def tag_group_num
32
+ check_dicom_tag
33
+ self[0]
34
+ end
35
+
36
+ # Tag element as number
37
+ def tag_element_num
38
+ check_dicom_tag
39
+ self[1]
40
+ end
41
+
42
+ # Tag group as string
43
+ def tag_group_str
44
+ tag_group_num.to_s(16).rjust(4, '0').upcase()
45
+ end
46
+
47
+ # Tag element as string
48
+ def tag_element_str
49
+ tag_element_num.to_s(16).rjust(4, '0').upcase()
50
+ end
51
+
52
+ # Tag as string
53
+ def to_tag_str
54
+ "(#{tag_group_str},#{tag_element_str})"
55
+ end
56
+
57
+ # Tag as Native Dicom Model tag
58
+ def to_tag_ndm
59
+ "#{tag_group_str}#{tag_element_str}"
60
+ end
61
+
62
+ # Tag as array
63
+ def to_tag_ary
64
+ [tag_group_num, tag_element_num]
65
+ end
66
+
67
+ # Check for group length tag
68
+ def group_length_tag?
69
+ tag_element_num == 0
70
+ end
71
+
72
+ # Check for private creator tag
73
+ def private_creator_tag?
74
+ (tag_group_num.odd? && (tag_element_num < 0xff))
75
+ end
76
+
77
+ private
78
+ def check_dicom_tag
79
+ return true if ( (self.size==2) &&
80
+ valid_tag_value?(0) &&
81
+ valid_tag_value?(1) )
82
+ raise "Wrong object definition for Tag Array"
83
+ end
84
+
85
+ def valid_tag_value?(index)
86
+ value = self[index]
87
+ return true if ( (value.is_a?(Integer)) &&
88
+ (value.bit_length <=16) &&
89
+ (value >=0) )
90
+ raise "Wrong value at index #{index} for Tag Array"
91
+ end
92
+ end
93
+
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,71 @@
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
+ module DcmDict
25
+ module Refine
26
+ module Internal
27
+ module HashRefineInternal
28
+
29
+ refine Hash do
30
+ # Check/update content for data tag field
31
+ def check_base_data_tag_field!
32
+ check_tag_ps!
33
+ check_placeholder_data!
34
+ self
35
+ end
36
+
37
+ # Check for mandatory :tag_ps key
38
+ def check_tag_ps!
39
+ tag_ps = self[:tag_ps]
40
+ raise "Missing tag_ps field" if tag_ps.nil_or_empty?
41
+ tag_ps.upcase!
42
+ end
43
+
44
+ # Check for place holder tag data
45
+ def check_placeholder_data!
46
+ # PS3.5:
47
+ # For some Data Elements, no Name or Keyword or VR or VM is specified;
48
+ # these are "placeholders" that are not assigned but will not be reused.
49
+ tag_ps = self[:tag_ps]
50
+ raise "Missing tag_ps field" if tag_ps.nil_or_empty?
51
+ fill_nil_or_empty_value(:tag_name) { "Placeholder #{tag_ps}" }
52
+ fill_nil_or_empty_value(:tag_key) do
53
+ new_key = tag_ps.gsub(',','_').gsub(/[\(\)]/,'')
54
+ "Placeholder_#{new_key}"
55
+ end
56
+ fill_nil_or_empty_value(:tag_vr) { [:UN] }
57
+ fill_nil_or_empty_value(:tag_vm) { ['1'] }
58
+ end
59
+
60
+ private
61
+ def fill_nil_or_empty_value(key)
62
+ if self[key].nil_or_empty?
63
+ self[key] = yield
64
+ end
65
+ end
66
+ end
67
+
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,119 @@
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 DcmDict
26
+ module Refine
27
+ module Internal
28
+ module StringRefineInternal
29
+
30
+ refine String do
31
+
32
+ # Remove zero width spaces (-> "​") and leading/trailing whitespace
33
+ def dcm_unspace
34
+ zero_width_space = "\u200B"
35
+ self.gsub(zero_width_space, '').strip
36
+ end
37
+
38
+ # Convert tag key to tag symbol -> 'PatientName' -> :patient_name
39
+ def tag_key_to_sym
40
+ self.gsub('IDs', 'IDS').gsub('3D', '_3D').
41
+ gsub(/([A-Z])([a-z])/,'_\1\2').
42
+ gsub(/([a-z])([A-Z])/,'\1_\2').
43
+ gsub(/^_/,'').
44
+ downcase.
45
+ to_sym
46
+ end
47
+
48
+ # Tag group as number
49
+ def tag_group_num
50
+ tag_group_str.hex
51
+ end
52
+
53
+ # Tag element as number
54
+ def tag_element_num
55
+ tag_element_str.hex
56
+ end
57
+
58
+ # Tag group as string
59
+ def tag_group_str
60
+ self.to_tag_ndm[0..3]
61
+ end
62
+
63
+ # Tag element as string
64
+ def tag_element_str
65
+ self.to_tag_ndm[4..7]
66
+ end
67
+
68
+ # Tag as Native Dicom Model tag ('(0010,0010)' -> '00100010')
69
+ def to_tag_ndm
70
+ check_dicom_tag
71
+ self.gsub(/[\(|\),]/, '').upcase
72
+ end
73
+
74
+ # Tag as array ('(0010,0010)' -> [0x0010, 0x0010])
75
+ def to_tag_ary
76
+ [tag_group_num, tag_element_num]
77
+ end
78
+
79
+ # Tag as string ('00100010'/'(0010,0010)' -> '(0010,0010)')
80
+ def to_tag_str
81
+ "(#{tag_group_str},#{tag_element_str})"
82
+ end
83
+
84
+ # Convert uid type to symbol
85
+ def uid_type_to_sym
86
+ self.gsub(/[ -\/]/, '_').
87
+ downcase.
88
+ to_sym
89
+ end
90
+
91
+ # Check for valid uid value
92
+ def uid_value?
93
+ (self.length <= 64) &&
94
+ (/^(([0-9][\.])|([1-9][0-9]*[\.]))*(([0-9])|([1-9][0-9]*))$/.match(self) != nil)
95
+ end
96
+
97
+ # Check for group length tag
98
+ def group_length_tag?
99
+ tag_element_num == 0
100
+ end
101
+
102
+ # Check for private creator tag
103
+ def private_creator_tag?
104
+ (tag_group_num.odd? && (tag_element_num < 0xff))
105
+ end
106
+
107
+ private
108
+ def check_dicom_tag
109
+ return true if (/^[0-9|A-F]{8}$/.match(self) ||
110
+ /^[\(][0-9a-fA-F]{4}[\)\,\(][0-9a-fA-F]{4}\)$/.match(self))
111
+ raise "wrong value for tag #{self.inspect}"
112
+ end
113
+
114
+ end
115
+
116
+ end
117
+ end
118
+ end
119
+ end