1dcm2json(1)                       OFFIS DCMTK                      dcm2json(1)
2
3
4

NAME

6       dcm2json - Convert DICOM file and data set to JSON
7
8

SYNOPSIS

10       dcm2json [options] dcmfile-in [jsonfile-out]
11

DESCRIPTION

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

PARAMETERS

27       dcmfile-in    DICOM input filename to be converted
28
29       jsonfile-out  JSON output filename (default: stdout)
30

OPTIONS

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   processing options
88       encoding of infinity and not-a-number:
89         -es  --encode-strict
90                report error for 'inf' and 'nan' (default)
91
92         -ee  --encode-extended
93                permit 'inf' and 'nan' in JSON numbers
94
95   output options
96       output format:
97
98         +fc  --formatted-code
99                enable whitespace formatting (default)
100
101                # prints additional spaces and newlines for increased
102                # readability
103
104         -fc  --compact-code
105                print only required characters
106
107         +m   --write-meta
108                write data set with meta information
109                (warning: not conforming to the DICOM standard)
110

JSON Format

112       The basic structure of the JSON output created from a DICOM file  looks
113       like the following (see DICOM Part 18 Section F for details):
114
115       {
116           "00080005": {
117               "vr": "CS",
118               "Value": [
119                   "ISO_IR 192"
120               ]
121           },
122           "00080020": {
123               "vr": "DT",
124               "Value": [
125                   "20130409"
126               ]
127           },
128           "00080030": {
129               "vr": "TM",
130               "Value": [
131                   "131600.0000"
132               ]
133           },
134           "00080050": {
135               "vr": "SH",
136               "Value": [
137                   "11235813"
138               ]
139           },
140           "00080056": {
141               "vr": "CS",
142               "Value": [
143                   "ONLINE"
144               ]
145           },
146           "00080061": {
147               "vr": "CS",
148               "Value": [
149                   "CT",
150                   "PET"
151               ]
152           },
153           "00080090": {
154               "vr": "PN",
155               "Value": [
156                 {
157                   "Alphabetic": "^Bob^^Dr."
158                 }
159               ]
160           },
161           "00081190": {
162               "vr": "UR",
163               "Value": [
164                   "http://wado.nema.org/studies/
165                   1.2.392.200036.9116.2.2.2.1762893313.1029997326.945873"
166               ]
167           },
168           "00090010": {
169               "vr": "LO",
170               "Value": [
171                   "Vendor A"
172               ]
173           },
174           "00091002": {
175               "vr": "UN",
176               "InlineBinary": "z0x9c8v7"
177           },
178           "00100010": {
179               "vr": "PN",
180               "Value": [
181                 {
182                   "Alphabetic": "Wang^XiaoDong"
183                 }
184               ]
185           },
186           "00100020": {
187               "vr": "LO",
188               "Value": [
189                   "12345"
190               ]
191           },
192           "00100021": {
193               "vr": "LO",
194               "Value": [
195                   "Hospital A"
196               ]
197           },
198           "00100030": {
199               "vr": "DT",
200               "Value": [
201                   "19670701"
202               ]
203           },
204           "00100040": {
205               "vr": "CS",
206               "Value": [
207                   "M"
208               ]
209           },
210           "00101002": {
211               "vr": "SQ",
212               "Value": [
213                   {
214                       "00100020": {
215                           "vr": "LO",
216                           "Value": [
217                               "54321"
218                           ]
219                       },
220                       "00100021": {
221                           "vr": "LO",
222                           "Value": [
223                               "Hospital B"
224                           ]
225                       }
226                   },
227                   {
228                       "00100020": {
229                           "vr": "LO",
230                           "Value": [
231                               "24680"
232                           ]
233                       },
234                       "00100021": {
235                           "vr": "LO",
236                           "Value": [
237                               "Hospital C"
238                           ]
239                       }
240                   }
241               ]
242           },
243           "0020000D": {
244               "vr": "UI",
245               "Value": [
246                   "1.2.392.200036.9116.2.2.2.1762893313.1029997326.945873"
247               ]
248           },
249           "00200010": {
250               "vr": "SH",
251               "Value": [
252                   "11235813"
253               ]
254           },
255           "00201206": {
256               "vr": "IS",
257               "Value": [
258                   4
259               ]
260           },
261           "00201208": {
262               "vr": "IS",
263               "Value": [
264                   942
265               ]
266           }
267       }
268
269   Bulk Data
270       Binary  data, i.e. DICOM element values with Value Representations (VR)
271       of OB or OW, as well as OD, OF, OL, OV and UN values are always written
272       as  'InlineBinary'  (base64  encoding)  to  the  JSON  output. A future
273       version of this tool might optionally use a 'BulkDataURI' instead, i.e.
274       the  WADO-RS  URL  of a bulk data item that contains the element value.
275       This would be particularly useful for large amounts of  data,  such  as
276       pixel data.
277

NOTES

279   Character Encoding
280       As  required by the DICOM JSON encoding, dcm2json always creates output
281       in Unicode UTF-8 encoding and converts DICOM datasets  accordingly.  If
282       this  is  not  possible,  for  example  because DCMTK has been compiled
283       without either iconv or ICU library, an error is returned.
284

LOGGING

286       The level of logging output of  the  various  command  line  tools  and
287       underlying  libraries  can  be  specified by the user. By default, only
288       errors and warnings are written to the  standard  error  stream.  Using
289       option  --verbose  also  informational messages like processing details
290       are reported. Option --debug can be used to get  more  details  on  the
291       internal  activity,  e.g.  for debugging purposes. Other logging levels
292       can be selected using option --log-level. In --quiet  mode  only  fatal
293       errors  are reported. In such very severe error events, the application
294       will usually terminate. For  more  details  on  the  different  logging
295       levels, see documentation of module 'oflog'.
296
297       In  case  the logging output should be written to file (optionally with
298       logfile rotation), to syslog (Unix) or the event log  (Windows)  option
299       --log-config  can  be  used.  This  configuration  file also allows for
300       directing only certain messages to a particular output stream  and  for
301       filtering  certain  messages  based  on the module or application where
302       they are generated.  An  example  configuration  file  is  provided  in
303       <etcdir>/logger.cfg.
304

COMMAND LINE

306       All  command  line  tools  use  the  following notation for parameters:
307       square brackets enclose optional  values  (0-1),  three  trailing  dots
308       indicate  that multiple values are allowed (1-n), a combination of both
309       means 0 to n values.
310
311       Command line options are distinguished from parameters by a leading '+'
312       or  '-' sign, respectively. Usually, order and position of command line
313       options are arbitrary (i.e. they  can  appear  anywhere).  However,  if
314       options  are  mutually exclusive the rightmost appearance is used. This
315       behavior conforms to the  standard  evaluation  rules  of  common  Unix
316       shells.
317
318       In  addition,  one  or more command files can be specified using an '@'
319       sign as a prefix to the filename (e.g. @command.txt).  Such  a  command
320       argument  is  replaced  by  the  content of the corresponding text file
321       (multiple whitespaces are treated as a  single  separator  unless  they
322       appear  between  two  quotation marks) prior to any further evaluation.
323       Please note that a command file cannot contain  another  command  file.
324       This  simple  but  effective  approach  allows  one to summarize common
325       combinations of options/parameters and  avoids  longish  and  confusing
326       command lines (an example is provided in file <datadir>/dumppat.txt).
327

EXIT CODES

329       The  dcm2json  utility  uses the following exit codes when terminating.
330       This enables the user to check  for  the  reason  why  the  application
331       terminated.
332
333   general
334       EXITCODE_NO_ERROR                         0
335       EXITCODE_COMMANDLINE_SYNTAX_ERROR         1
336
337   input file errors
338       EXITCODE_CANNOT_READ_INPUT_FILE          20
339       EXITCODE_NO_INPUT_FILES                  21
340
341   output file errors
342       EXITCODE_CANNOT_WRITE_OUTPUT_FILE        40
343
344   processing errors
345       EXITCODE_CANNOT_CONVERT_TO_UNICODE       80
346       EXITCODE_CANNOT_WRITE_VALID_JSON         81
347

ENVIRONMENT

349       The  dcm2json  utility  will  attempt  to  load DICOM data dictionaries
350       specified in the DCMDICTPATH environment variable. By default, i.e.  if
351       the   DCMDICTPATH   environment   variable   is   not   set,  the  file
352       <datadir>/dicom.dic will be loaded unless the dictionary is built  into
353       the application (default for Windows).
354
355       The   default   behavior   should  be  preferred  and  the  DCMDICTPATH
356       environment variable only used when alternative data  dictionaries  are
357       required.  The  DCMDICTPATH environment variable has the same format as
358       the Unix shell PATH variable in that a colon (':')  separates  entries.
359       On  Windows systems, a semicolon (';') is used as a separator. The data
360       dictionary code will  attempt  to  load  each  file  specified  in  the
361       DCMDICTPATH  environment variable. It is an error if no data dictionary
362       can be loaded.
363
365       Copyright (C) 2016-2021 e.V., Escherweg 2, 26121 Oldenburg, Germany.
366
367
368
369Version 3.6.6                   Thu Jan 14 2021                    dcm2json(1)
Impressum