dcm_dict 0.27.0 → 0.32.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 +4 -4
- data/CHANGELOG.md +32 -0
- data/LICENSE +1 -1
- data/README.md +78 -60
- data/bin/dcm_dict_converter.rb +3 -3
- data/lib/dcm_dict.rb +1 -1
- data/lib/dcm_dict/dictionary/base_dictionary.rb +1 -1
- data/lib/dcm_dict/dictionary/base_record.rb +1 -1
- data/lib/dcm_dict/dictionary/data_element_dictionary.rb +1 -1
- data/lib/dcm_dict/dictionary/data_element_record.rb +1 -1
- data/lib/dcm_dict/dictionary/uid_dictionary.rb +2 -4
- data/lib/dcm_dict/dictionary/uid_record.rb +6 -1
- data/lib/dcm_dict/encoder/data_to_code.rb +2 -2
- data/lib/dcm_dict/error/dictionary_error.rb +1 -1
- data/lib/dcm_dict/ext/object_extension.rb +1 -1
- data/lib/dcm_dict/refine/array_refine.rb +1 -1
- data/lib/dcm_dict/refine/data_element_refine.rb +1 -1
- data/lib/dcm_dict/refine/internal/array_refine_internal.rb +1 -1
- data/lib/dcm_dict/refine/internal/hash_refine_internal.rb +14 -1
- data/lib/dcm_dict/refine/internal/string_refine_internal.rb +1 -1
- data/lib/dcm_dict/refine/string_refine.rb +1 -1
- data/lib/dcm_dict/refine/symbol_refine.rb +2 -1
- data/lib/dcm_dict/refine/uid_refine.rb +1 -1
- data/lib/dcm_dict/rubies/rb_ext.rb +1 -1
- data/lib/dcm_dict/source_data/data_elements_data.rb +96 -7
- data/lib/dcm_dict/source_data/detached_data.rb +1 -1
- data/lib/dcm_dict/source_data/uid_values_data.rb +447 -427
- data/lib/dcm_dict/version.rb +3 -3
- data/lib/dcm_dict/xml/constant.rb +3 -2
- data/lib/dcm_dict/xml/field_data.rb +1 -1
- data/lib/dcm_dict/xml/nokogiri_tool.rb +1 -1
- data/lib/dcm_dict/xml/rexml_tool.rb +1 -1
- data/lib/dcm_dict/xml/tag_field_data.rb +1 -1
- data/lib/dcm_dict/xml/uid_field_data.rb +14 -4
- data/lib/dcm_dict/xml/xml_tool.rb +1 -1
- data/spec/data_element_sample_spec_helper.rb +12 -2
- data/spec/data_element_shared_example_spec_helper.rb +1 -1
- data/spec/dcm_dict/dictionary/data_element_dictionary_spec.rb +1 -1
- data/spec/dcm_dict/dictionary/data_element_record_spec.rb +1 -1
- data/spec/dcm_dict/dictionary/uid_dictionary_spec.rb +62 -17
- data/spec/dcm_dict/dictionary/uid_record_spec.rb +8 -4
- data/spec/dcm_dict/encoder/data_to_code_spec.rb +2 -2
- data/spec/dcm_dict/ext/object_extension_spec.rb +1 -1
- data/spec/dcm_dict/refine/array_refine_spec.rb +1 -1
- data/spec/dcm_dict/refine/internal/array_refine_internal_spec.rb +1 -1
- data/spec/dcm_dict/refine/internal/hash_refine_internal_spec.rb +19 -1
- data/spec/dcm_dict/refine/internal/string_refine_internal_spec.rb +1 -1
- data/spec/dcm_dict/refine/string_refine_spec.rb +4 -4
- data/spec/dcm_dict/refine/symbol_refine_spec.rb +26 -1
- data/spec/dcm_dict/rubies/rb_ext_spec.rb +1 -1
- data/spec/dcm_dict/source_data/data_elements_data_spec.rb +1 -1
- data/spec/dcm_dict/source_data/detached_data_spec.rb +1 -1
- data/spec/dcm_dict/source_data/uid_values_data_spec.rb +1 -1
- data/spec/dcm_dict/version_spec.rb +1 -1
- data/spec/dcm_dict/xml/tag_field_data_spec.rb +1 -1
- data/spec/dcm_dict/xml/uid_field_data_spec.rb +1 -1
- data/spec/dictionary_shared_example_spec_helper.rb +1 -1
- data/spec/refine_shared_example_spec_helper.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/xml_sample_spec_helper.rb +80 -32
- metadata +24 -24
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: da806de4712543a1c065339de2ae39f8e8a8a3b25b52450083725a36b020ff74
|
|
4
|
+
data.tar.gz: 48ad0c8dfa7cc09e7d7766a050a23034ef0d54e3f0f6924c59529c9e4b2ab4c5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6cbffc01a7cbacb2eb158ea46ed033903312ad693a2239fbaa72fc19016b3fb5ea0278beb5c1ba3158239fa73c997367054a400fde4335d812a3a4e4332d11ee
|
|
7
|
+
data.tar.gz: bf951880ff8f85df390301a5f9984b99d2d3487248153b8b5ea8e6735268162179c39de69614b521f42b4ac07ec71fa2b1421346b94c082521cc02eccae77ece
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# DcmDict project Changelog
|
|
2
2
|
|
|
3
|
+
## v0.32.0 (2021-02-07)
|
|
4
|
+
* Update to 2021a Base Standard
|
|
5
|
+
___
|
|
6
|
+
## v0.31.0 (2020-12-07)
|
|
7
|
+
* Update to 2020e Base Standard
|
|
8
|
+
___
|
|
9
|
+
## v0.30.0 (2020-10-03)
|
|
10
|
+
* Update to 2020d Base Standard
|
|
11
|
+
* Add keywords support for standard UIDs
|
|
12
|
+
___
|
|
13
|
+
## v0.29.0 (2020-07-21)
|
|
14
|
+
* Update to 2020c Base Standard
|
|
15
|
+
___
|
|
16
|
+
## v0.28.1 (2020-03-18)
|
|
17
|
+
* Updated dcm_dict.gemspec due to a security vulnerabilities into the Rake gem as defined into gemspec (>=10.3 to >=12.3.3)
|
|
18
|
+
#### Note for gemspec security report:
|
|
19
|
+
>rake vulnerability found in dcm_dict.gemspec:
|
|
20
|
+
>CVE-2020-8130 (moderate severity)
|
|
21
|
+
>Vulnerable versions: <= 12.3.2
|
|
22
|
+
>Patched version: 12.3.3
|
|
23
|
+
>There is an OS command injection vulnerability in Ruby Rake before 12.3.3 in Rake::FileList when supplying a filename that begins with the pipe character |.
|
|
24
|
+
>
|
|
25
|
+
>Remediation:
|
|
26
|
+
>Upgrade rake to version 12.3.3 or later.
|
|
27
|
+
>
|
|
28
|
+
>["OS Command Injection in Rake"](https://github.com/advisories/GHSA-jppv-gw3r-w3q8)
|
|
29
|
+
>["CVE-2020-8130 Detail"](https://nvd.nist.gov/vuln/detail/CVE-2020-8130)
|
|
30
|
+
___
|
|
31
|
+
## v0.28.0 (2020-03-18)
|
|
32
|
+
* Update to 2020b Base Standard
|
|
33
|
+
* Remove warning for deprecated method 'Kernel#open'
|
|
34
|
+
___
|
|
3
35
|
## v0.27.0 (2020-02-05)
|
|
4
36
|
* Update to 2020a Base Standard
|
|
5
37
|
___
|
data/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
DcmDict is a Ruby gem (dcm_dict) to handle
|
|
2
2
|
in a simple way the Data defined within the DICOM Standard.
|
|
3
3
|
|
|
4
|
-
Copyright (C) 2014-
|
|
4
|
+
Copyright (C) 2014-2021 Enrico Rivarola
|
|
5
5
|
|
|
6
6
|
DcmDict is free software: you can redistribute it and/or modify
|
|
7
7
|
it under the terms of the GNU General Public License as published by
|
data/README.md
CHANGED
|
@@ -46,6 +46,14 @@ as well for UIDs
|
|
|
46
46
|
=> :transfer_syntax
|
|
47
47
|
> "Implicit VR Little Endian: Default Transfer Syntax for DICOM".uid_value
|
|
48
48
|
=> "1.2.840.10008.1.2"
|
|
49
|
+
> "Verification SOP Class".uid_value
|
|
50
|
+
=> "1.2.840.10008.1.1"
|
|
51
|
+
> "1.2.840.10008.1.1".uid_type
|
|
52
|
+
=> :sop_class
|
|
53
|
+
> "Verification".uid
|
|
54
|
+
=> "1.2.840.10008.1.1"
|
|
55
|
+
> :verification.uid
|
|
56
|
+
=> "1.2.840.10008.1.1"
|
|
49
57
|
```
|
|
50
58
|
|
|
51
59
|
let see all features in detail:
|
|
@@ -92,33 +100,33 @@ For these objects is possible to access to Tag (group/element), Name, Keyword, V
|
|
|
92
100
|
|
|
93
101
|
The main methods supported are:
|
|
94
102
|
|
|
95
|
-
|Method
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
| Method | Note | Type | |
|
|
104
|
+
|:------------------|:---------------------------------:|:-------------------:|:----------------------------------:|
|
|
105
|
+
| **tag** | tag as Array | Array of two Fixnum | (alias of *tag_ary*) |
|
|
106
|
+
| **tag_name** | name of tag | String | |
|
|
107
|
+
| **tag_keyword** | keyword | String | |
|
|
108
|
+
| **tag_key** | keyword | String | |
|
|
109
|
+
| **tag_vr** | Value Representation | Array of Symbol | |
|
|
110
|
+
| **tag_vm** | Value Multiplicity | Array of Symbol | |
|
|
111
|
+
| **tag_ps** | tag as string (as standard doc) | String | |
|
|
112
|
+
| **tag_ary** | tag as Array | Array of two Fixnum | |
|
|
113
|
+
| **tag_sym** | tag as Symbol | Symbol | |
|
|
114
|
+
| **tag_ndm** | tag as in Native DICOM Model | String | |
|
|
115
|
+
| **tag_str** | tag as string (similar to tag_ps) | String | |
|
|
116
|
+
| **tag_note** | tag note | String | |
|
|
117
|
+
| **tag_multiple?** | is a multiple tag ? | boolean | (useful for 'multi tag' attribute) |
|
|
110
118
|
|
|
111
119
|
each data element is indexed by these fields:
|
|
112
120
|
|
|
113
|
-
|Field|Type|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
| Field | Type |
|
|
122
|
+
|:-------------|:------:|
|
|
123
|
+
| **tag_key** | String |
|
|
124
|
+
| **tag_ps** | String |
|
|
125
|
+
| **tag_ary** | Array |
|
|
126
|
+
| **tag_sym** | Symbol |
|
|
127
|
+
| **tag_ndm** | String |
|
|
128
|
+
| **tag_str** | String |
|
|
129
|
+
| **tag_name** | String |
|
|
122
130
|
|
|
123
131
|
By these fields is possible to access to data element informations.
|
|
124
132
|
Consider the case of the tag (0010,1005) (*Patient's Birth Name*), the primary fields are:
|
|
@@ -170,21 +178,21 @@ will produce
|
|
|
170
178
|
The library also manage 'multiple tags' such as *(0020,31XX)* (*Source Image IDs*).
|
|
171
179
|
As an example for this data element the default tag in array form is [0x0020,0x3122] and all fields are expressed as:
|
|
172
180
|
|
|
173
|
-
|Method/field
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
181
|
+
| Method/field | Value |
|
|
182
|
+
|:------------------|:------------------:|
|
|
183
|
+
| **tag** | [0x0020,0x3122] |
|
|
184
|
+
| **tag_name** | "Source Image IDs" |
|
|
185
|
+
| **tag_keyword** | 'SourceImageIDs' |
|
|
186
|
+
| **tag_key** | 'SourceImageIDs' |
|
|
187
|
+
| **tag_vr** | [:CS] |
|
|
188
|
+
| **tag_vm** | ["1-n"] |
|
|
189
|
+
| **tag_ps** | '(0020,31XX)' |
|
|
190
|
+
| **tag_ary** | [0x0020,0x3122] |
|
|
191
|
+
| **tag_sym** | :source_image_ids |
|
|
192
|
+
| **tag_ndm** | '00203122' |
|
|
193
|
+
| **tag_str** | '(0020,3122)' |
|
|
194
|
+
| **tag_note** | 'RET' |
|
|
195
|
+
| **tag_multiple?** | true |
|
|
188
196
|
|
|
189
197
|
[0x0020,0x3122] is the default value for group/element pair (*[32, 12578]*), but any valid pair of numbers for this tag will be refers that information:
|
|
190
198
|
|
|
@@ -210,38 +218,44 @@ As an example for this data element the default tag in array form is [0x0020,0x3
|
|
|
210
218
|
and so on.
|
|
211
219
|
|
|
212
220
|
## UID data in detail
|
|
213
|
-
Any UID features can be accessed from a *String* object.
|
|
221
|
+
Any UID features can be accessed from a *String* or a *Symbol* object.
|
|
214
222
|
|
|
215
223
|
### UID Values
|
|
216
224
|
For these objects is possible to access to value, name and type values for any single uid.
|
|
217
225
|
Main methods supported are:
|
|
218
226
|
|
|
219
|
-
|Method
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
227
|
+
| Method | Note | Type | |
|
|
228
|
+
|:--------------|:------------------------:|:------:|:----------------------:|
|
|
229
|
+
| **uid** | value of uid | String | (alias of *uid_value*) |
|
|
230
|
+
| **uid_value** | value of uid | String | |
|
|
231
|
+
| **uid_name** | name of uid | String | |
|
|
232
|
+
| **uid_key** | keyword of uid | String | |
|
|
233
|
+
| **uid_sym** | keyword as symbol of uid | Symbol | |
|
|
234
|
+
| **uid_type** | type of uid | Symbol | |
|
|
225
235
|
|
|
226
236
|
each uid is indexed by:
|
|
227
237
|
|
|
228
|
-
|Field|Type|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
238
|
+
| Field | Type |
|
|
239
|
+
|:--------------|:-------|
|
|
240
|
+
| **uid_value** | String |
|
|
241
|
+
| **uid_name** | String |
|
|
242
|
+
| **uid_key** | String |
|
|
243
|
+
| **uid_sym** | Symbol |
|
|
232
244
|
|
|
233
245
|
From these fields is possible to access to all uid informations.
|
|
234
|
-
Consider the case of the uid *1.2.840.10008.1.1* (*Verification SOP Class*), the primary fields are the strings **'1.2.840.10008.1.1'
|
|
235
|
-
- As
|
|
246
|
+
Consider the case of the uid *1.2.840.10008.1.1* (*Verification SOP Class*), the primary fields are the strings **'1.2.840.10008.1.1'**, **"Verification SOP Class"**, **"Verification"**.
|
|
247
|
+
- As key you may use the standard value **'1.2.840.10008.1.1'**, the uid name **"Verification SOP Class"**, the uid keyword **"Verification"** and the symbol **:verification**
|
|
236
248
|
|
|
237
249
|
For this uid all fields are expressed as:
|
|
238
250
|
|
|
239
|
-
|Method/field | Value|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
251
|
+
| Method/field | Value |
|
|
252
|
+
|:--------------|:------------------------:|
|
|
253
|
+
| **uid** | '1.2.840.10008.1.1' |
|
|
254
|
+
| **uid_value** | '1.2.840.10008.1.1' |
|
|
255
|
+
| **uid_name** | "Verification SOP Class" |
|
|
256
|
+
| **uid_key** | "Verification" |
|
|
257
|
+
| **uid_sym** | :verification |
|
|
258
|
+
| **uid_type** | :sop_class |
|
|
245
259
|
|
|
246
260
|
### example:
|
|
247
261
|
|
|
@@ -254,6 +268,10 @@ For this uid all fields are expressed as:
|
|
|
254
268
|
=> "Verification SOP Class"
|
|
255
269
|
> "Verification SOP Class".uid
|
|
256
270
|
=> "1.2.840.10008.1.1"
|
|
271
|
+
> "Verification".uid
|
|
272
|
+
=> "1.2.840.10008.1.1"
|
|
273
|
+
> :verification.uid
|
|
274
|
+
=> "1.2.840.10008.1.1"
|
|
257
275
|
```
|
|
258
276
|
|
|
259
277
|
## How data is extracted
|
|
@@ -269,7 +287,7 @@ Note: the script use the [Nokogiri][3] as XML parser if installed as gem, otherw
|
|
|
269
287
|
Check the file for other details.
|
|
270
288
|
|
|
271
289
|
## Note
|
|
272
|
-
Current library version is aligned to *DICOM Base Standard* **
|
|
290
|
+
Current library version is aligned to *DICOM Base Standard* **2021a**
|
|
273
291
|
|
|
274
292
|
## Install
|
|
275
293
|
|
|
@@ -292,7 +310,7 @@ There are many possible *candidates* for inclusion in the *dictionary*, here are
|
|
|
292
310
|
TBD
|
|
293
311
|
|
|
294
312
|
## License
|
|
295
|
-
Copyright (C) 2014-
|
|
313
|
+
Copyright (C) 2014-2021 Enrico Rivarola.
|
|
296
314
|
See the `LICENSE` and `COPYING` files for license details.
|
|
297
315
|
|
|
298
316
|
## Ruby Gem
|
data/bin/dcm_dict_converter.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# -*- ruby -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright (C) 2014-
|
|
4
|
+
# Copyright (C) 2014-2021 Enrico Rivarola
|
|
5
5
|
#
|
|
6
6
|
# This file is part of DcmDict gem (dcm_dict).
|
|
7
7
|
#
|
|
@@ -29,7 +29,7 @@ require 'dcm_dict'
|
|
|
29
29
|
require 'dcm_dict/xml/xml_tool'
|
|
30
30
|
|
|
31
31
|
LICENSE_TEXT=<<END_LICENSE
|
|
32
|
-
Copyright (C) 2014-
|
|
32
|
+
Copyright (C) 2014-2021 Enrico Rivarola
|
|
33
33
|
|
|
34
34
|
This file is part of DcmDict gem (dcm_dict).
|
|
35
35
|
|
|
@@ -89,7 +89,7 @@ class DcmDictConverter
|
|
|
89
89
|
def pull_standard_draft(url, output)
|
|
90
90
|
buffer_size = 256 * 1_024
|
|
91
91
|
trace("Downloading #{url}\n")
|
|
92
|
-
open(url, "r",
|
|
92
|
+
URI.open(url, "r",
|
|
93
93
|
:content_length_proc => lambda {|content_length| trace("Content Length: #{content_length} bytes\n.") },
|
|
94
94
|
:progress_proc => lambda { |size| trace(".") }) do |src|
|
|
95
95
|
while (buffer = src.read(buffer_size))
|
data/lib/dcm_dict.rb
CHANGED
|
@@ -25,7 +25,7 @@ module DcmDict
|
|
|
25
25
|
module Dictionary
|
|
26
26
|
using DcmDict::Refine::Internal::StringRefineInternal
|
|
27
27
|
|
|
28
|
-
UidIndexKey = [:uid_value, :uid_name]
|
|
28
|
+
UidIndexKey = [:uid_value, :uid_name, :uid_key, :uid_sym]
|
|
29
29
|
|
|
30
30
|
# Main class to handle uid data as dictionary
|
|
31
31
|
class UidDictionary < BaseDictionary
|
|
@@ -70,9 +70,7 @@ module DcmDict
|
|
|
70
70
|
|
|
71
71
|
def try_to_find_unknown_uid(uid)
|
|
72
72
|
raise "Unknown UID value" unless uid.uid_value?
|
|
73
|
-
UidRecord.new({ uid_value: uid
|
|
74
|
-
uid_name: 'Unknown UID',
|
|
75
|
-
uid_type: :unknown })
|
|
73
|
+
UidRecord.new({ uid_value: uid })
|
|
76
74
|
end
|
|
77
75
|
end
|
|
78
76
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2014-
|
|
2
|
+
# Copyright (C) 2014-2021 Enrico Rivarola
|
|
3
3
|
#
|
|
4
4
|
# This file is part of DcmDict gem (dcm_dict).
|
|
5
5
|
#
|
|
@@ -25,8 +25,12 @@ require_relative 'base_record'
|
|
|
25
25
|
|
|
26
26
|
module DcmDict
|
|
27
27
|
module Dictionary
|
|
28
|
+
using DcmDict::Refine::Internal::HashRefineInternal
|
|
29
|
+
|
|
28
30
|
UidMethodMap = {uid_value: :uid_value,
|
|
29
31
|
uid: :uid_value,
|
|
32
|
+
uid_key: :uid_key,
|
|
33
|
+
uid_sym: :uid_sym,
|
|
30
34
|
uid_name: :uid_name,
|
|
31
35
|
uid_type: :uid_type }.freeze
|
|
32
36
|
|
|
@@ -35,6 +39,7 @@ module DcmDict
|
|
|
35
39
|
# Class to handle uid record from source dictionary data
|
|
36
40
|
class UidRecord < BaseRecord
|
|
37
41
|
def initialize(data)
|
|
42
|
+
data.check_base_data_uid_field!
|
|
38
43
|
super
|
|
39
44
|
end
|
|
40
45
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2014-
|
|
2
|
+
# Copyright (C) 2014-2021 Enrico Rivarola
|
|
3
3
|
#
|
|
4
4
|
# This file is part of DcmDict gem (dcm_dict).
|
|
5
5
|
#
|
|
@@ -72,7 +72,7 @@ END
|
|
|
72
72
|
# Convert uid +data+ to Ruby code using +indent+ spaces indentation
|
|
73
73
|
def self.uid_data_to_code(data, indent=4)
|
|
74
74
|
indent = 4 unless indent
|
|
75
|
-
"#{' '*indent}{ uid_value: '#{data[:uid_value]}', uid_name:
|
|
75
|
+
"#{' '*indent}{ uid_value: '#{data[:uid_value]}', uid_name: '#{data[:uid_name]}', uid_key: '#{data[:uid_key]}', uid_sym: #{data[:uid_sym].inspect}, uid_type: #{data[:uid_type].inspect}},"
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2014-
|
|
2
|
+
# Copyright (C) 2014-2021 Enrico Rivarola
|
|
3
3
|
#
|
|
4
4
|
# This file is part of DcmDict gem (dcm_dict).
|
|
5
5
|
#
|
|
@@ -25,6 +25,7 @@ module DcmDict
|
|
|
25
25
|
module Refine
|
|
26
26
|
module Internal
|
|
27
27
|
module HashRefineInternal
|
|
28
|
+
using DcmDict::Refine::Internal::StringRefineInternal
|
|
28
29
|
|
|
29
30
|
refine Hash do
|
|
30
31
|
# Check/update content for data tag field
|
|
@@ -57,6 +58,18 @@ module DcmDict
|
|
|
57
58
|
fill_nil_or_empty_value(:tag_vm) { ['1'] }
|
|
58
59
|
end
|
|
59
60
|
|
|
61
|
+
def check_base_data_uid_field!
|
|
62
|
+
uid_value = self[:uid_value]
|
|
63
|
+
raise "Missing uid_value field" if uid_value.nil_or_empty?
|
|
64
|
+
fill_nil_or_empty_value(:uid_key) do
|
|
65
|
+
new_key = uid_value.gsub('.','_')
|
|
66
|
+
"UID_#{new_key}"
|
|
67
|
+
end
|
|
68
|
+
fill_nil_or_empty_value(:uid_sym) { self[:uid_key].tag_key_to_sym }
|
|
69
|
+
fill_nil_or_empty_value(:uid_name) { "#{self[:uid_value]} (Unknown UID)" }
|
|
70
|
+
fill_nil_or_empty_value(:uid_type) { :unknown }
|
|
71
|
+
end
|
|
72
|
+
|
|
60
73
|
private
|
|
61
74
|
def fill_nil_or_empty_value(key)
|
|
62
75
|
if self[key].nil_or_empty?
|