1dcm2json(1) OFFIS DCMTK dcm2json(1)
2
3
4
6 dcm2json - Convert DICOM file and data set to JSON
7
8
10 dcm2json [options] dcmfile-in [jsonfile-out]
11
13 The dcm2json utility converts the contents of a DICOM file (file format
14 or raw data set) to JSON (JavaScript Object Notation). The output
15 refers to the 'DICOM JSON Model', which is found in DICOM Part 18
16 Section F.
17
18 If dcm2json reads a raw data set (DICOM data without a file format
19 meta-header) it will attempt to guess the transfer syntax by examining
20 the first few bytes of the file. It is not always possible to correctly
21 guess the transfer syntax and it is better to convert a data set to a
22 file format whenever possible (using the dcmconv utility). It is also
23 possible to use the -f and -t[ieb] options to force dcm2json to read a
24 data set with a particular transfer syntax.
25
27 dcmfile-in DICOM input filename to be converted
28
29 jsonfile-out JSON output filename (default: stdout)
30
32 general options
33 -h --help
34 print this help text and exit
35
36 --version
37 print version information and exit
38
39 --arguments
40 print expanded command line arguments
41
42 -q --quiet
43 quiet mode, print no warnings and errors
44
45 -v --verbose
46 verbose mode, print processing details
47
48 -d --debug
49 debug mode, print debug information
50
51 -ll --log-level [l]evel: string constant
52 (fatal, error, warn, info, debug, trace)
53 use level l for the logger
54
55 -lc --log-config [f]ilename: string
56 use config file f for the logger
57
58 input options
59 input file format:
60
61 +f --read-file
62 read file format or data set (default)
63
64 +fo --read-file-only
65 read file format only
66
67 -f --read-dataset
68 read data set without file meta information
69
70 input transfer syntax:
71
72 -t= --read-xfer-auto
73 use TS recognition (default)
74
75 -td --read-xfer-detect
76 ignore TS specified in the file meta header
77
78 -te --read-xfer-little
79 read with explicit VR little endian TS
80
81 -tb --read-xfer-big
82 read with explicit VR big endian TS
83
84 -ti --read-xfer-implicit
85 read with implicit VR little endian TS
86
87 output options
88 output format:
89
90 +fc --formatted-code
91 enable whitespace formatting (default)
92
93 # prints additional spaces and newlines for increased
94 # readability
95
96 -fc --compact-code
97 print only required characters
98
99 +m --write-meta
100 write data set with meta information
101 (warning: not conforming to the DICOM standard)
102
104 The basic structure of the JSON output created from a DICOM file looks
105 like the following (see DICOM Part 18 Section F for details):
106
107 {
108 "00080005": {
109 "vr": "CS",
110 "Value": [
111 "ISO_IR 192"
112 ]
113 },
114 "00080020": {
115 "vr": "DT",
116 "Value": [
117 "20130409"
118 ]
119 },
120 "00080030": {
121 "vr": "TM",
122 "Value": [
123 "131600.0000"
124 ]
125 },
126 "00080050": {
127 "vr": "SH",
128 "Value": [
129 "11235813"
130 ]
131 },
132 "00080056": {
133 "vr": "CS",
134 "Value": [
135 "ONLINE"
136 ]
137 },
138 "00080061": {
139 "vr": "CS",
140 "Value": [
141 "CT",
142 "PET"
143 ]
144 },
145 "00080090": {
146 "vr": "PN",
147 "Value": [
148 {
149 "Alphabetic": "^Bob^^Dr."
150 }
151 ]
152 },
153 "00081190": {
154 "vr": "UR",
155 "Value": [
156 "http://wado.nema.org/studies/
157 1.2.392.200036.9116.2.2.2.1762893313.1029997326.945873"
158 ]
159 },
160 "00090010": {
161 "vr": "LO",
162 "Value": [
163 "Vendor A"
164 ]
165 },
166 "00091002": {
167 "vr": "UN",
168 "InlineBinary": "z0x9c8v7"
169 },
170 "00100010": {
171 "vr": "PN",
172 "Value": [
173 {
174 "Alphabetic": "Wang^XiaoDong"
175 }
176 ]
177 },
178 "00100020": {
179 "vr": "LO",
180 "Value": [
181 "12345"
182 ]
183 },
184 "00100021": {
185 "vr": "LO",
186 "Value": [
187 "Hospital A"
188 ]
189 },
190 "00100030": {
191 "vr": "DT",
192 "Value": [
193 "19670701"
194 ]
195 },
196 "00100040": {
197 "vr": "CS",
198 "Value": [
199 "M"
200 ]
201 },
202 "00101002": {
203 "vr": "SQ",
204 "Value": [
205 {
206 "00100020": {
207 "vr": "LO",
208 "Value": [
209 "54321"
210 ]
211 },
212 "00100021": {
213 "vr": "LO",
214 "Value": [
215 "Hospital B"
216 ]
217 }
218 },
219 {
220 "00100020": {
221 "vr": "LO",
222 "Value": [
223 "24680"
224 ]
225 },
226 "00100021": {
227 "vr": "LO",
228 "Value": [
229 "Hospital C"
230 ]
231 }
232 }
233 ]
234 },
235 "0020000D": {
236 "vr": "UI",
237 "Value": [
238 "1.2.392.200036.9116.2.2.2.1762893313.1029997326.945873"
239 ]
240 },
241 "00200010": {
242 "vr": "SH",
243 "Value": [
244 "11235813"
245 ]
246 },
247 "00201206": {
248 "vr": "IS",
249 "Value": [
250 4
251 ]
252 },
253 "00201208": {
254 "vr": "IS",
255 "Value": [
256 942
257 ]
258 }
259 }
260
261 Bulk Data
262 Binary data, i.e. DICOM element values with Value Representations (VR)
263 of OB or OW, as well as OD, OF and UN values are by default not written
264 to the JSON output because of their size. Instead, for each element, a
265 new Universally Unique Identifier (UUID) is being generated and written
266 as an value of a BulkDataURI JSON element. So far, there is no
267 possibility to write an additional file to hold the binary data for
268 each of the binary data chunks.
269
271 Character Encoding
272 dcm2json always tries to output in UTF-8 encoding. If this is not
273 possible, e.g. because there is no support for character set
274 conversion, ASCII is used instead (which is a subset of UTF-8).
275
277 The level of logging output of the various command line tools and
278 underlying libraries can be specified by the user. By default, only
279 errors and warnings are written to the standard error stream. Using
280 option --verbose also informational messages like processing details
281 are reported. Option --debug can be used to get more details on the
282 internal activity, e.g. for debugging purposes. Other logging levels
283 can be selected using option --log-level. In --quiet mode only fatal
284 errors are reported. In such very severe error events, the application
285 will usually terminate. For more details on the different logging
286 levels, see documentation of module 'oflog'.
287
288 In case the logging output should be written to file (optionally with
289 logfile rotation), to syslog (Unix) or the event log (Windows) option
290 --log-config can be used. This configuration file also allows for
291 directing only certain messages to a particular output stream and for
292 filtering certain messages based on the module or application where
293 they are generated. An example configuration file is provided in
294 <etcdir>/logger.cfg.
295
297 All command line tools use the following notation for parameters:
298 square brackets enclose optional values (0-1), three trailing dots
299 indicate that multiple values are allowed (1-n), a combination of both
300 means 0 to n values.
301
302 Command line options are distinguished from parameters by a leading '+'
303 or '-' sign, respectively. Usually, order and position of command line
304 options are arbitrary (i.e. they can appear anywhere). However, if
305 options are mutually exclusive the rightmost appearance is used. This
306 behavior conforms to the standard evaluation rules of common Unix
307 shells.
308
309 In addition, one or more command files can be specified using an '@'
310 sign as a prefix to the filename (e.g. @command.txt). Such a command
311 argument is replaced by the content of the corresponding text file
312 (multiple whitespaces are treated as a single separator unless they
313 appear between two quotation marks) prior to any further evaluation.
314 Please note that a command file cannot contain another command file.
315 This simple but effective approach allows one to summarize common
316 combinations of options/parameters and avoids longish and confusing
317 command lines (an example is provided in file <datadir>/dumppat.txt).
318
320 The dcm2json utility will attempt to load DICOM data dictionaries
321 specified in the DCMDICTPATH environment variable. By default, i.e. if
322 the DCMDICTPATH environment variable is not set, the file
323 <datadir>/dicom.dic will be loaded unless the dictionary is built into
324 the application (default for Windows).
325
326 The default behavior should be preferred and the DCMDICTPATH
327 environment variable only used when alternative data dictionaries are
328 required. The DCMDICTPATH environment variable has the same format as
329 the Unix shell PATH variable in that a colon (':') separates entries.
330 On Windows systems, a semicolon (';') is used as a separator. The data
331 dictionary code will attempt to load each file specified in the
332 DCMDICTPATH environment variable. It is an error if no data dictionary
333 can be loaded.
334
336 Copyright (C) 2016-2017 by OFFIS e.V., Escherweg 2, 26121 Oldenburg,
337 Germany.
338
339
340
341Version 3.6.2 Fri Jul 14 2017 dcm2json(1)