OFFIS DCMTK  Version 3.6.0
img2dcm.man
1 /*!
2 
3 \if MANPAGES
4 \page img2dcm Convert standard image formats into DICOM format
5 \else
6 \page img2dcm img2dcm: Convert standard image formats into DICOM format
7 \endif
8 
9 \section synopsis SYNOPSIS
10 
11 \verbatim
12 img2dcm [options] imgfile-in dcmfile-out
13 \endverbatim
14 
15 \section description DESCRIPTION
16 
17 The \b img2dcm tool serves as a conversion tool from a standard image format
18 like JPEG or BMP to DICOM. Different output SOP Classes can be selected. The
19 additional information (regarding patients, series, etc.) stored in the DICOM
20 output file can be extracted from other DICOM files which serve as a "template"
21 for the resulting DICOM object. \b img2dcm can also be configured to invent
22 missing DICOM type 1 and type 2 attributes to work even without any template
23 dataset.
24 
25 \section parameters PARAMETERS
26 \verbatim
27 imgfile-in image file to be imported
28 
29 dcmfile-out DICOM output file
30 \endverbatim
31 
32 \section options OPTIONS
33 \subsection general_options general options
34 \verbatim
35  -h --help
36  print this help text and exit
37 
38  --version
39  print version information and exit
40 
41  --arguments
42  print expanded command line arguments
43 
44  -q --quiet
45  quiet mode, print no warnings and errors
46 
47  -v --verbose
48  verbose mode, print processing details
49 
50  -d --debug
51  debug mode, print debug information
52 
53  -ll --log-level [l]evel: string constant
54  (fatal, error, warn, info, debug, trace)
55  use level l for the logger
56 
57  -lc --log-config [f]ilename: string
58  use config file f for the logger
59 \endverbatim
60 
61 \subsection input_options input options
62 \verbatim
63 general:
64 
65  -i --input-format [i]nput file format: string
66  supported formats: JPEG (default), BMP
67 
68  -df --dataset-from [f]ilename: string
69  use dataset from DICOM file f
70 
71  -stf --study-from [f]ilename: string
72  read patient/study from DICOM file f
73 
74  -sef --series-from [f]ilename: string
75  read patient/study/series from DICOM file f
76 
77  -ii --instance-inc
78  increase instance number read from DICOM file
79 
80 JPEG format:
81 
82  -dp --disable-progr
83  disable support for progressive JPEG
84 
85  -de --disable-ext
86  disable support for extended sequential JPEG
87 
88  -jf --insist-on-jfif
89  insist on JFIF header existence
90 
91  -ka --keep-appn
92  keep APPn sections (except JFIF)
93 \endverbatim
94 
95 \subsection processing_options processing options
96 \verbatim
97 attribute checking:
98 
99  --do-checks
100  enable attribute validity checking (default)
101 
102  --no-checks
103  disable attribute validity checking
104 
105  +i2 --insert-type2
106  insert missing type 2 attributes (default)
107  (only with --do-checks)
108 
109  -i2 --no-type2-insert
110  do not insert missing type 2 attributes
111  (only with --do-checks)
112 
113  +i1 --invent-type1
114  invent missing type 1 attributes
115  (only with --do-checks)
116 
117  -i1 --no-type1-invent
118  do not invent missing type 1 attributes
119  (only with --do-checks)
120 
121 character set:
122 
123  +l1 --latin1
124  set latin-1 as standard character set (default)
125 
126  -l1 --no-latin1
127  keep 7-bit ASCII as standard character set
128 
129 other processing options:
130 
131  -k --key [k]ey: gggg,eeee="str", path or dictionary name="str"
132  add further attribute
133 \endverbatim
134 
135 \subsection output_options output options
136 \verbatim
137 target SOP class:
138 
139  -sc --sec-capture
140  write Secondary Capture SOP class
141 
142  -nsc --new-sc
143  write new Secondary Capture SOP classes
144 
145  -vlp --vl-photo
146  write Visible Light Photographic SOP class (default)
147 
148 output file format:
149 
150  +F --write-file
151  write file format (default)
152 
153  -F --write-dataset
154  write data set without file meta information
155 
156 group length encoding:
157 
158  +g= --group-length-recalc
159  recalculate group lengths if present (default)
160 
161  +g --group-length-create
162  always write with group length elements
163 
164  -g --group-length-remove
165  always write without group length elements
166 
167 length encoding in sequences and items:
168 
169  +e --length-explicit
170  write with explicit lengths (default)
171 
172  -e --length-undefined
173  write with undefined lengths
174 
175 data set trailing padding (not with --write-dataset):
176 
177  -p --padding-off
178  no padding (implicit if --write-dataset)
179 
180  +p --padding-create [f]ile-pad [i]tem-pad: integer
181  align file on multiple of f bytes
182  and items on multiple of i bytes
183 \endverbatim
184 
185 \section notes NOTES
186 
187 \subsection attribute_sources Attribute Sources
188 
189 For converting a general image format into DICOM format, the \b img2dcm
190 application may be fed with some additional input for filling mandatory (and
191 optional) attributes in the new DICOM file like patient, study and series
192 information. This information can be collected using different approaches,
193 which can be combined and are applied to the result file in the following
194 order:
195 
196 \li Using the \e --dataset-from option \b img2dcm is forced to import
197  attributes from an existing DICOM file. The given DICOM file is fully
198  imported and serves as the basis for all further export operations.
199  As an exception, the SOP Instance UID is not copied by this option.
200  Also image related data like Rows, Columns etc. is exchanged during
201  conversion. Note that \b img2dcm does not check any other attribute
202  values for validity, e. g. it does not look into sequences to adapt any
203  attributes to the new object (referenced images etc.). Therefore, it is
204  recommended to use the templates in the data directory for (old) SC and
205  VLP objects. See also section "Input Templates".
206 
207 \li The \e --study-from and \e --series-from options (mutually exclusive) can
208  be used to import patient, study and series information from an existing
209  DICOM file. If \e --series-from is specified, then the given DICOM file
210  is opened by \b img2dcm and all mandatory information down to the series
211  level is imported. Note that this includes patient, study and series
212  information. In case of \e --study-from, the series information is
213  excluded. The following attributes are taken over:
214  \verbatim
215  Patient Level:
216  Patient's Name
217  Patient ID
218  Patient's Sex
219  Patient's Birth Date
220  Specific Character Set
221 
222  Study Level:
223  Study Instance UID
224  Study Date
225  Study Time
226  Referring Physician's Name
227  Study ID
228  Accession Number
229 
230  Series Level (only in case of option --series-from):
231  Series Instance UID
232  Series Number
233  Manufacturer
234  \endverbatim
235 
236 \li With the \e --insert-type2 and \e --invent-type1 options (both enabled per
237  default), missing attributes (type 2 attributes) and/or missing attribute
238  values (for type 1 attributes) are automatically added and invented by
239  \b img2dcm. Please note that these options are only evaluated if option
240  \e --do-checks is enabled (default). If the \e --no-checks options is
241  enabled, no automatic attribute insertion will take place.
242 
243 \li The \e --key option can be used to add further attributes to the DICOM
244  output file. This option is applied at the very end, just before saving the
245  DICOM file. It is also possible to specify sequences, items and nested
246  attributes using the \e --key option. In these cases, a special "path"
247  notation has to be used. Details on this path notation can be found in the
248  documentation of \b dcmodify.
249 
250 \subsection uids UIDs
251 
252 New Study and Series Instance UIDs are generated <b>if necessary</b> after
253 applying the \e --study-from and \e --series options. If Study Instance UID or
254 Series Instance UID are not present after these steps, they are newly generated,
255 independently from each other.
256 A contrary behaviour is choosen for the SOP Instance UID that one could expect
257 to be taken over when using the \e --dataset-from option. This is \b not the
258 case, the SOP Instance UID is \b not copied to the new object. This should
259 be the desirable behaviour for most use cases. However, if a certain SOP
260 Instance UID should be inserted into the new object, the \e --key option should
261 be used.
262 
263 \subsection inputtemplates Input Templates
264 
265 For supporting the conversion into DICOM, \b img2dcm comes with some
266 pre-defined templates which can be used for the \e --dataset-from option (see
267 sample files \e SC.dump and \e VLP.dump). These templates should be filled with
268 the desired values and then must be dumped (converted) to a DICOM file before
269 actually being used with \b img2dcm. Use \b dump2dcm to convert the dump to
270 DICOM. Example:
271 \verbatim
272  dump2dcm SC.dump SC.dcm
273 \endverbatim
274 
275 It is possible to use any DICOM file as a template. Please note that the
276 complete DICOM dataset is imported; hence, it should be assured that only
277 attributes are present which should be part of the constructed DICOM object.
278 The SOP Class UID and the Pixel Data attributes (including attributes like
279 Rows, Columns etc.) are not copied but replaced by \b img2dcm during conversion.
280 
281 \subsection inputplugins Input Plugins
282 
283 The \b img2dcm application currently supports the JPEG and the BMP image format
284 as input.
285 
286 \subsubsection jpeginputplugin JPEG Input Plugin
287 
288 For JPEG, the original JPEG from the source file is not decoded but extracted
289 and slightly transformed (e. g. JFIF header is cut off) to allow fast
290 conversion of even big JPEG files without the need of decoding and re-encoding.
291 The JPEG plugin chooses the necessary output transfer syntax automatically
292 depending on the actual encoding of the data inside the JPEG file. Therefore,
293 the following Transfer Syntaxes (and their corresponding JPEG encodings) are used
294 by the JPEG plugin:
295 
296 \li JPEG Coding Process 1
297  Baseline, Lossy, Non-Hierarchical, Sequential, DCT, Huffman, 8 Bit
298  SOP Class = 1.2.840.10008.1.2.4.50
299 
300 \li JPEG Coding Process 2 (8-bit) and 4 (12-bit)
301  Extended, Lossy, Non-Hierarchical, Sequential, DCT, Huffman, 8/12 Bit
302  SOP Class = 1.2.840.10008.1.2.4.51
303 
304 \li JPEG Coding Process 10 (8-bit) and 12 (12-bit)
305  Full Progression, lossy, Non-Hierarch., Progressive, DCT, Huffman, 8/12 Bit
306  SOP Class = 1.2.840.10008.1.2.4.55
307 
308 Color and grayscale images are supported.
309 
310 The support for the Extended JPEG Transfer Syntax can be disabled
311 (\e --disable-ext option) as well as the support for the (retired) Progressive
312 JPEG Transfer Syntax (\e --disable-progr option).
313 
314 JPEG lossless encoding as well as any arithmethic or hierarchical JPEG encoding
315 modes are not supported by the plugin.
316 
317 JFIF (JPEG File Interchange Format) information facilitates optional APPn
318 markers in a JPEG file. Many digital cameras do not integrate such JFIF
319 information into the JPEG output they create. For example, JFIF contains
320 information about the pixel aspect ratio of the compressed image. If you want
321 the \b img2dcm application to insist on a JFIF header in the JPEG stream, you
322 can use the option \e --insist-on-jfif which will abort if no JFIF information
323 can be found. By default, missing JFIF information is ignored.
324 
325 For DICOM it is kind of a "gray zone", whether the integration of JFIF (or any
326 other APPn) data into the DICOM object's internal JPEG stream is allowed or
327 not. However, the most reliable approach is to cut those markers and their
328 information off the JPEG stream. This approach is also taken by the \b img2dcm
329 application. By default, all APPn markers are cut off from the original JPEG
330 stream. However, if you want to keep other APPn markers than JFIF (e. g.
331 EXIF information) inside the DICOM stream, the option \e --keep-appn
332 does the trick. It should also be slightly faster than cutting off APPn
333 information, because it is not necessary to scan the whole JPEG stream for
334 such data. JFIF information is \b always removed by \b img2dcm.
335 
336 \subsubsection bmpinputplugin BMP Input Plugin
337 
338 \b img2dcm supports BMP as input format. However, so far only the most commmon
339 BMP images are supported. In particular, BMP images which use bitfields or
340 run length encoding will be rejected. Such images are uncommon. All input images
341 will be converted into a DICOM image with RGB color model and a bit depth of 24.
342 There are no specific options for fine-tuning BMP format conversion.
343 
344 \subsection outputplugins Output Plugins
345 
346 The desired output SOP Class can be selected on the command line. Currently,
347 an export plugin for the Secondary Capture Image SOP class (default, option
348 \e -sc), the new Secondary Capture Image SOP classes (option \e -nsc) and
349 Visible Light Photographic Image SOP class (option \e -vl) are available.
350 Please note that the first one is deprecated according to the DICOM standard
351 but is selected as a default because it is widely supported. Future versions
352 of \b img2dcm might provide further output plugins for other SOP Classes.
353 
354 For the new Secondary Capture SOP classes, it is not possible to specifiy which
355 specific SOP class should be used for output. That is because these new SOP
356 classes are differentiated from each other by colour depth (1/8/16) and the
357 fact whether the image is black/white or colour. That is why \b img2dcm decides
358 during conversion, which output SOP class is suitable for a given source image.
359 
360 \section examples EXAMPLES
361 
362 Here are some examples that show how the \b img2dcm application can be used.
363 
364 <ol>
365 
366 <li>
367 img2dcm image.jpg out.dcm
368 <br>Read JPEG file "image.jpg", convert to the old Secondary Capture SOP class
369 and save the result to DICOM file "out.dcm". This is the easiest way of using
370 \b img2dcm. Any type 1 and type 2 attributes required for writing valid objects
371 of this SOP class are inserted automatically.
372 </li>
373 
374 <li>
375 img2dcm -i BMP image.bmp out.dcm
376 <br>Same as above but tells img2dcm to read a BMP file instead of JPEG.
377 </li>
378 
379 <li>
380 img2dcm image.jpg out.dcm -vlp -k "PatientName=Bond^James"
381 <br>Same as first example, but writes Visible Light Photographic Image object
382 to "out.dcm" and sets PatientName to "Bond^James" which otherwise would be
383 left empty.
384 </li>
385 
386 <li>
387 img2dcm image.jpg out.dcm --series-from template.dcm -k
388 "PatientName=Bond^James"
389 <br>Same as 1), but imports patient/study/series infomation from DICOM file
390 "template.dcm". Please note that attribute PatientName will contain
391 "Bond^James" at the end, any value from "template.dcm" will be overwritten.
392 That is, because the -k option is applied at the very end of the conversion
393 pipeline (see above).
394 </li>
395 
396 <li>
397 img2dcm image.jpg out.dcm --no-checks
398 <br>Same as 1), but does not perform any attribute checking and no type 1 and
399 type 2 attribute insertion! So in this case, an invalid DICOM object would be
400 generated. This can be interesting if the output file is not meant to be
401 completed but will undergo further transformations, e. g. adding attributes
402 using \b dcmodify. Only use option \e --no-checks if you know what you are
403 doing!
404 </li>
405 
406 <li>
407 img2dcm image.jpg out.dcm --no-type1-invent
408 <br>Same as 1), but does not insert missing type 1 attributes and/or their
409 values. Type 2 attributes will be inserted. Note that in this case it must be
410 assured that all type 1 attributes are provided by other means, i. e. by adding
411 them with the \e --key option. Otherwise, \b img2dcm will report an error and
412 will stop converting.
413 </li>
414 
415 <li>
416 img2dcm image.jpg out.dcm --keep-appn --insist-on-jfif
417 <br>Same as 1), but takes over APPn information like EXIF into the DICOM
418 object's resulting JPEG stream. Further, \e --insist-on-jfif will force
419 \b img2dcm to abort if no JFIF information is existent in the source file.
420 </li>
421 
422 </ol>
423 
424 \section logging LOGGING
425 
426 The level of logging output of the various command line tools and underlying
427 libraries can be specified by the user. By default, only errors and warnings
428 are written to the standard error stream. Using option \e --verbose also
429 informational messages like processing details are reported. Option
430 \e --debug can be used to get more details on the internal activity, e.g. for
431 debugging purposes. Other logging levels can be selected using option
432 \e --log-level. In \e --quiet mode only fatal errors are reported. In such
433 very severe error events, the application will usually terminate. For more
434 details on the different logging levels, see documentation of module "oflog".
435 
436 In case the logging output should be written to file (optionally with logfile
437 rotation), to syslog (Unix) or the event log (Windows) option \e --log-config
438 can be used. This configuration file also allows for directing only certain
439 messages to a particular output stream and for filtering certain messages
440 based on the module or application where they are generated. An example
441 configuration file is provided in <em><etcdir>/logger.cfg</em>).
442 
443 \section command_line COMMAND LINE
444 
445 All command line tools use the following notation for parameters: square
446 brackets enclose optional values (0-1), three trailing dots indicate that
447 multiple values are allowed (1-n), a combination of both means 0 to n values.
448 
449 Command line options are distinguished from parameters by a leading '+' or '-'
450 sign, respectively. Usually, order and position of command line options are
451 arbitrary (i.e. they can appear anywhere). However, if options are mutually
452 exclusive the rightmost appearance is used. This behaviour conforms to the
453 standard evaluation rules of common Unix shells.
454 
455 In addition, one or more command files can be specified using an '@' sign as a
456 prefix to the filename (e.g. <em>\@command.txt</em>). Such a command argument
457 is replaced by the content of the corresponding text file (multiple
458 whitespaces are treated as a single separator unless they appear between two
459 quotation marks) prior to any further evaluation. Please note that a command
460 file cannot contain another command file. This simple but effective approach
461 allows to summarize common combinations of options/parameters and avoids
462 longish and confusing command lines (an example is provided in file
463 <em><datadir>/dumppat.txt</em>).
464 
465 \section environment ENVIRONMENT
466 
467 The \b img2dcm utility will attempt to load DICOM data dictionaries specified
468 in the \e DCMDICTPATH environment variable. By default, i.e. if the
469 \e DCMDICTPATH environment variable is not set, the file
470 <em><datadir>/dicom.dic</em> will be loaded unless the dictionary is built
471 into the application (default for Windows).
472 
473 The default behaviour should be preferred and the \e DCMDICTPATH environment
474 variable only used when alternative data dictionaries are required. The
475 \e DCMDICTPATH environment variable has the same format as the Unix shell
476 \e PATH variable in that a colon (":") separates entries. On Windows systems,
477 a semicolon (";") is used as a separator. The data dictionary code will
478 attempt to load each file specified in the \e DCMDICTPATH environment variable.
479 It is an error if no data dictionary can be loaded.
480 
481 \section files FILES
482 
483 <em><datadir>/SC.dump</em> - Sample dump file for Secondary Capture images
484 \n<em><datadir>/VLP.dump</em> - Sample dump file for Visible Light Photographic
485 images
486 
487 \section see_also SEE ALSO
488 
489 <b>dcm2pnm</b>(1), <b>dcmj2pnm</b>(1), <b>dump2dcm</b>(1), <b>dcmconv</b>(1),
490 <b>dcmodify</b>(1)
491 
492 \section copyright COPYRIGHT
493 
494 Copyright (C) 2007-2010 by OFFIS e.V., Escherweg 2, 26121 Oldenburg, Germany.
495 
496 */


Generated on Wed Dec 14 2016 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.11