DB/DicomVRDict.pm

filter: Statementstmt 80.9% 17 / 21 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 75.8% 22 / 29 CC 2 SCAR 9.8
CC
2
Cov
74%
getVR
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« Util/DicomAnonymizer.pm ↑ Summary
1 ##############################################################################
2 # DicomVRDict.pm -- a module including Dicom Data Structure and Endcoding
3 #
4 # Copyright (c) 2010 Baoshe Zhang. All rights reserved.
5 # This file is part of "DicomPack". DicomReader is free software. You can
6 # redistribute it and/or modify it under the same terms as Perl itself.
7 ##############################################################################
8  
9 package DicomPack::DB::DicomVRDict;
10  
11 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use vars qw(@ISA @EXPORT_OK);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 @ISA = qw/Exporter/;
18 1 @EXPORT_OK = qw/getVR/;
19  
20 1 our $VERSION = '0.95';
21  
22 1 my $DicomVRList = {
23 "AE" => {
24 desc => "Application Entity",
25 tailing => ' ',
26 leading => ' ',
27 maxlen => 16,
28 delimiter => "\\",
29 },
30 "AS" => {
31 desc => "Age String",
32 len => 4,
33 pattern => q/^\d{3}[D|W|M|Y]$/,
34 },
35 "AT" => {
36 desc => "Attribute Tag",
37 type => "S",
38 len => 4
39 },
40 "CS" => {
41 desc => "Code String",
42 tailing => ' ',
43 leading => ' ',
44 maxlen => 16,
45 pattern => q/^[A-Z0-9\s\_]+$/,
46 delimiter => "\\",
47 },
48 "DA" => {
49 desc => "Date",
50 len => 8,
51 pattern => q/^\d{8}$/, # '-' is allowed in query and trailing SPACE for padding
52 delimiter => "\\",
53 },
54 "DS" => {
55 desc => "Decimal String",
56 tailing => ' ',
57 leading => ' ',
58 maxlen => 16,
59 pattern => q/^[+-0-9Ee\.]+$/,
60 delimiter => "\\",
61 },
62 "DT" => {
63 desc => "Date Time",
64 tailing => ' ',
65 maxlen => 26,
66 pattern => q/^[0-9+-\s\.]+$/,
67 delimiter => "\\",
68 },
69 "FL" => {
70 desc => "Floating Point Single",
71 len => 4,
72 type => "f",
73 },
74 "FD" => {
75 desc => "Floating Point Double",
76 len => 8,
77 type => "d",
78 },
79 "IS" => {
80 desc => "Integer String",
81 tailing => ' ',
82 leading => ' ',
83 maxlen => 12,
84 pattern => q/^[+-]?[0-9]+$/,
85 delimiter => "\\",
86 },
87 "LO" => {
88 desc => "Long String",
89 tailing => ' ',
90 leading => ' ',
91 maxlen => 64,
92 delimiter => "\\",
93 },
94 "LT" => {
95 desc => "Long Text",
96 tailing => ' ',
97 maxlen => 10240
98 },
99 "OB" => {
100 desc => "Other Byte String",
101 tailing => chr(0),
102 type => "C",
103 },
104 "OF" => {
105 desc => "Other Float String",
106 type => "f",
107 },
108  
109 "OW" => {
110 desc => "Other Word String",
111 type => "S",
112 },
113 "PN" => {
114 desc => "Person Name",
115 tailing => ' ',
116 leading => ' ',
117 delimiter => "\\",
118 },
119 "SH" => {
120 desc => "Short String",
121 tailing => ' ',
122 leading => ' ',
123 maxlen => 16,
124 delimiter => "\\",
125 },
126 "SL" => {
127 desc => "Signed Long",
128 len => 4,
129 type => "l",
130 },
131 "SQ" => {
132 desc => "Sequences of Items",
133 },
134 "SS" => {
135 desc => "Signed Short",
136 len => 2,
137 type => "s",
138 },
139 "ST" => {
140 desc => "Short Text",
141 tailing => ' ',
142 maxlen => 1024
143 },
144 "TM" => {
145 desc => "Time",
146 tailing => ' ',
147 maxlen => 16, # for Query, 28 bytes maximum
148 pattern => q/^[0-9\.\s]$/,
149 delimiter => "\\",
150 },
151 "UI" => {
152 desc => "Unique Identifier",
153 tailing => chr(0),
154 maxlen => 64,
155 pattern => q/^[0-9\.]+$/,
156 delimiter => "\\",
157 },
158 "UL" => {
159 desc => "Unsigned Long",
160 len => 4,
161 type => "L",
162 },
163 "UN" => {
164 desc => "Unknown",
165 },
166 "US" => {
167 desc => "Unsigned Short",
168 len => 2,
169 type => "S",
170 },
171 "UT" => {
172 desc => "Unlimited Text",
173 tailing => ' '
174 },
175 "XX" => {
176 desc => "Implicit VR",
177 },
178 };
179  
180 # get a VR structure. Input parameters: VR Name.
181 sub getVR
182 0 ▶{
Subroutine getVR: not called CC=2 SCAR=17.9
Pod documented
183 0 my $vrName = shift;
184 0 ▶ if(defined $DicomVRList->{$vrName})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $DicomVRList->{$vrName}) { } 0 0 0
185 {
186 0 return $DicomVRList->{$vrName};
187 }
188 else
189 {
190 0 die "Unsupported VR: $vrName\n";
191 }
192 }
193  
194 1 1;
195  
196 __END__
« Util/DicomAnonymizer.pm ↑ Summary