Dicom_UID 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dicom_uid.rb +10 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2598742649426f416a4829dddc2e383492f65a37eabfbe8f38936420eae981ee
|
4
|
+
data.tar.gz: 91af01a8d1ae77d0c6c2ecf206dc94ba10e68d78e80780fb3a621b49e2ea9e96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9a3bcba499f0ff002926d06766584cab15dd100be2a5f6c8e7e1075ae53cf5afdc5581e89429045b5e43113e114dc2d90f904fe7746c0063bcb6795ee2053e6
|
7
|
+
data.tar.gz: 4334079996de6849f8821f7e4f74f313004963f8a62080451a0901a81aab062698619ed18c893359305503d88fc43aba2a81aef67f358d85f1b312f469491e72
|
data/lib/dicom_uid.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
# lib/dicom_uid.rb
|
2
|
+
|
3
|
+
# DICOM UID Generator according to the DICOM documentation
|
4
|
+
# http://dicom.nema.org/dicom/2013/output/chtml/part05/chapter_9.html
|
2
5
|
class DicomUID
|
3
6
|
|
4
7
|
|
@@ -13,7 +16,13 @@ class DicomUID
|
|
13
16
|
end
|
14
17
|
|
15
18
|
# randing the component
|
16
|
-
(rand ('9' * length_component).to_i).to_s
|
19
|
+
component = (rand ('9' * length_component).to_i).to_s
|
20
|
+
if component[-1].to_i % 2 == 1# if odd number
|
21
|
+
component << 'O'
|
22
|
+
component = component[1..-1]# removing first int
|
23
|
+
end
|
24
|
+
|
25
|
+
component
|
17
26
|
end
|
18
27
|
|
19
28
|
|