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": "DA",
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   Numbers as Strings
280       The  DICOM standard allows certain numeric DICOM value representations,
281       DS, IS, SV and UV, to be converted either to a JSON number  or  a  JSON
282       string.  dcm2json converts DS and IS values to JSON numbers if they are
283       valid decimal strings or  integer  strings,  and  to  strings  if  they
284       contain  any  illegal  character. dcm2json converts SV and UV values to
285       numbers if they are not larger than 9007199254740991ll or smaller  than
286       -9007199254740991ll,   and   to   strings  otherwise.  While  the  JSON
287       specification permits larger numbers, these are  the  largest  integers
288       that JavaScript can handle. Therefore, many JSON parsers cannot process
289       larger numbers.
290
291   Character Encoding
292       As required by the DICOM JSON encoding, dcm2json always creates  output
293       in  Unicode  UTF-8 encoding and converts DICOM datasets accordingly. If
294       this is not possible, for  example  because  DCMTK  has  been  compiled
295       without either iconv or ICU library, an error is returned.
296

LOGGING

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

COMMAND LINE

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

EXIT CODES

341       The dcm2json utility uses the following exit  codes  when  terminating.
342       This  enables  the  user  to  check  for the reason why the application
343       terminated.
344
345   general
346       EXITCODE_NO_ERROR                         0
347       EXITCODE_COMMANDLINE_SYNTAX_ERROR         1
348
349   input file errors
350       EXITCODE_CANNOT_READ_INPUT_FILE          20
351       EXITCODE_NO_INPUT_FILES                  21
352
353   output file errors
354       EXITCODE_CANNOT_WRITE_OUTPUT_FILE        40
355
356   processing errors
357       EXITCODE_CANNOT_CONVERT_TO_UNICODE       80
358       EXITCODE_CANNOT_WRITE_VALID_JSON         81
359

ENVIRONMENT

361       The dcm2json utility will  attempt  to  load  DICOM  data  dictionaries
362       specified  in the DCMDICTPATH environment variable. By default, i.e. if
363       the  DCMDICTPATH  environment   variable   is   not   set,   the   file
364       <datadir>/dicom.dic  will be loaded unless the dictionary is built into
365       the application (default for Windows).
366
367       The  default  behavior  should  be  preferred   and   the   DCMDICTPATH
368       environment  variable  only used when alternative data dictionaries are
369       required. The DCMDICTPATH environment variable has the same  format  as
370       the  Unix  shell PATH variable in that a colon (':') separates entries.
371       On Windows systems, a semicolon (';') is used as a separator. The  data
372       dictionary  code  will  attempt  to  load  each  file  specified in the
373       DCMDICTPATH environment variable. It is an error if no data  dictionary
374       can be loaded.
375
377       Copyright  (C)  2016-2022  by OFFIS e.V., Escherweg 2, 26121 Oldenburg,
378       Germany.
379
380
381
382Version 3.6.7                   Fri Apr 22 2022                    dcm2json(1)
Impressum