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

NAME

6       img2dcm - Convert standard image formats into DICOM format
7

SYNOPSIS

9       img2dcm [options] imgfile-in dcmfile-out
10

DESCRIPTION

12       The  img2dcm  tool  serves  as  a conversion tool from a standard image
13       format like JPEG or BMP to DICOM. Different output SOP Classes  can  be
14       selected. The additional information (regarding patients, series, etc.)
15       stored in the DICOM output file can be extracted from other DICOM files
16       which serve as a 'template' for the resulting DICOM object. img2dcm can
17       also be configured to invent missing DICOM type 1 and type 2 attributes
18       to work even without any template dataset.
19

PARAMETERS

21       imgfile-in   image file to be imported
22
23       dcmfile-out  DICOM output file
24

OPTIONS

26   general options
27         -h    --help
28                 print this help text and exit
29
30               --version
31                 print version information and exit
32
33               --arguments
34                 print expanded command line arguments
35
36         -q    --quiet
37                 quiet mode, print no warnings and errors
38
39         -v    --verbose
40                 verbose mode, print processing details
41
42         -d    --debug
43                 debug mode, print debug information
44
45         -ll   --log-level  [l]evel: string constant
46                 (fatal, error, warn, info, debug, trace)
47                 use level l for the logger
48
49         -lc   --log-config  [f]ilename: string
50                 use config file f for the logger
51
52   input options
53       general:
54
55         -i    --input-format  [i]nput file format: string
56                 supported formats: JPEG (default), BMP
57
58         -df   --dataset-from  [f]ilename: string
59                 use dataset from DICOM file f
60
61         -stf  --study-from  [f]ilename: string
62                 read patient/study from DICOM file f
63
64         -sef  --series-from  [f]ilename: string
65                 read patient/study/series from DICOM file f
66
67         -ii   --instance-inc
68                 increase instance number read from DICOM file
69
70       JPEG format:
71
72         -dp   --disable-progr
73                 disable support for progressive JPEG
74
75         -de   --disable-ext
76                 disable support for extended sequential JPEG
77
78         -jf   --insist-on-jfif
79                 insist on JFIF header existence
80
81         -ka   --keep-appn
82                 keep APPn sections (except JFIF)
83
84   processing options
85       attribute checking:
86
87               --do-checks
88                 enable attribute validity checking (default)
89
90               --no-checks
91                 disable attribute validity checking
92
93         +i2   --insert-type2
94                 insert missing type 2 attributes (default)
95                 (only with --do-checks)
96
97         -i2   --no-type2-insert
98                 do not insert missing type 2 attributes
99                 (only with --do-checks)
100
101         +i1   --invent-type1
102                 invent missing type 1 attributes
103                 (only with --do-checks)
104
105         -i1   --no-type1-invent
106                 do not invent missing type 1 attributes
107                 (only with --do-checks)
108
109       character set:
110
111         +l1   --latin1
112                 set latin-1 as standard character set (default)
113
114         -l1   --no-latin1
115                 keep 7-bit ASCII as standard character set
116
117       other processing options:
118
119         -k    --key  [k]ey: gggg,eeee="str", path or dictionary name="str"
120                 add further attribute
121
122   output options
123       target SOP class:
124
125         -sc   --sec-capture
126                 write Secondary Capture SOP class
127
128         -nsc  --new-sc
129                 write new Secondary Capture SOP classes
130
131         -vlp  --vl-photo
132                 write Visible Light Photographic SOP class (default)
133
134       output file format:
135
136         +F    --write-file
137                 write file format (default)
138
139         -F    --write-dataset
140                 write data set without file meta information
141
142       group length encoding:
143
144         +g=   --group-length-recalc
145                 recalculate group lengths if present (default)
146
147         +g    --group-length-create
148                 always write with group length elements
149
150         -g    --group-length-remove
151                 always write without group length elements
152
153       length encoding in sequences and items:
154
155         +e    --length-explicit
156                 write with explicit lengths (default)
157
158         -e    --length-undefined
159                 write with undefined lengths
160
161       data set trailing padding (not with --write-dataset):
162
163         -p    --padding-off
164                 no padding (implicit if --write-dataset)
165
166         +p    --padding-create  [f]ile-pad [i]tem-pad: integer
167                 align file on multiple of f bytes
168                 and items on multiple of i bytes
169

NOTES

171   Attribute Sources
172       For  converting  a  general image format into DICOM format, the img2dcm
173       application may be fed with some additional input for filling mandatory
174       (and optional) attributes in the new DICOM file like patient, study and
175       series information. This information can be collected  using  different
176       approaches, which can be combined and are applied to the result file in
177       the following order:
178
179       · Using  the  --dataset-from  option  img2dcm  is  forced   to   import
180         attributes from an existing DICOM file. The given DICOM file is fully
181         imported and serves as the basis for all further  export  operations.
182         As  an  exception, the SOP Instance UID is not copied by this option.
183         Also image related data like Rows, Columns etc. is  exchanged  during
184         conversion.  Note  that  img2dcm  does  not check any other attribute
185         values for validity, e. g. it does not look into sequences  to  adapt
186         any attributes to the new object (referenced images etc.). Therefore,
187         it is recommended to use the templates  in  the  data  directory  for
188         (old) SC and VLP objects. See also section 'Input Templates'.
189       · The  --study-from  and --series-from options (mutually exclusive) can
190         be used to import patient,  study  and  series  information  from  an
191         existing  DICOM  file.  If --series-from is specified, then the given
192         DICOM file is opened by img2dcm and all mandatory information down to
193         the  series level is imported. Note that this includes patient, study
194         and  series  information.  In  case  of  --study-from,   the   series
195         information is excluded. The following attributes are taken over:
196             Patient Level:
197               Patient's Name
198               Patient ID
199               Patient's Sex
200               Patient's Birth Date
201               Specific Character Set
202
203             Study Level:
204               Study Instance UID
205               Study Date
206               Study Time
207               Referring Physician's Name
208               Study ID
209               Accession Number
210
211             Series Level (only in case of option --series-from):
212               Series Instance UID
213               Series Number
214               Manufacturer
215
216       · With  the --insert-type2 and --invent-type1 options (both enabled per
217         default), missing  attributes  (type  2  attributes)  and/or  missing
218         attribute  values (for type 1 attributes) are automatically added and
219         invented  by  img2dcm.  Please  note  that  these  options  are  only
220         evaluated  if  option  --do-checks is enabled (default). If the --no-
221         checks options is enabled, no automatic attribute insertion will take
222         place.
223       · The  --key  option can be used to add further attributes to the DICOM
224         output file. This option is applied at  the  very  end,  just  before
225         saving  the  DICOM  file.  It  is also possible to specify sequences,
226         items and nested attributes using the --key option. In these cases, a
227         special 'path' notation has to be used. Details on this path notation
228         can be found in the documentation of dcmodify.
229   UIDs
230       New Study and Series Instance UIDs are  generated  if  necessary  after
231       applying  the  --study-from and --series options. If Study Instance UID
232       or Series Instance UID are not present  after  these  steps,  they  are
233       newly generated, independently from each other. A contrary behaviour is
234       choosen for the SOP Instance UID that one could expect to be taken over
235       when  using  the  --dataset-from  option. This is not the case, the SOP
236       Instance UID is not copied to  the  new  object.  This  should  be  the
237       desirable  behaviour  for  most  use  cases.  However, if a certain SOP
238       Instance UID should be inserted into the new object, the  --key  option
239       should be used.
240   Input Templates
241       For  supporting the conversion into DICOM, img2dcm comes with some pre-
242       defined templates which can be used for the --dataset-from option  (see
243       sample  files  SC.dump  and VLP.dump). These templates should be filled
244       with the desired values and then must be dumped (converted) to a  DICOM
245       file  before  actually being used with img2dcm. Use dump2dcm to convert
246       the dump to DICOM. Example:
247         dump2dcm SC.dump SC.dcm
248
249       It is possible to use any DICOM file as a template.  Please  note  that
250       the  complete  DICOM  dataset  is imported; hence, it should be assured
251       that  only  attributes  are  present  which  should  be  part  of   the
252       constructed  DICOM  object.  The  SOP  Class  UID  and  the  Pixel Data
253       attributes (including attributes  like  Rows,  Columns  etc.)  are  not
254       copied but replaced by img2dcm during conversion.
255   Input Plugins
256       The  img2dcm  application currently supports the JPEG and the BMP image
257       format as input.
258   JPEG Input Plugin
259       For JPEG, the original JPEG from the source file  is  not  decoded  but
260       extracted  and  slightly  transformed (e. g. JFIF header is cut off) to
261       allow fast conversion of even  big  JPEG  files  without  the  need  of
262       decoding  and re-encoding. The JPEG plugin chooses the necessary output
263       transfer syntax automatically depending on the actual encoding  of  the
264       data  inside  the JPEG file. Therefore, the following Transfer Syntaxes
265       (and their corresponding JPEG encodings) are used by the JPEG plugin:
266       · JPEG Coding Process 1 Baseline, Lossy, Non-Hierarchical,  Sequential,
267         DCT, Huffman, 8 Bit SOP Class = 1.2.840.10008.1.2.4.50
268       · JPEG  Coding  Process  2 (8-bit) and 4 (12-bit) Extended, Lossy, Non-
269         Hierarchical,  Sequential,  DCT,  Huffman,  8/12  Bit  SOP  Class   =
270         1.2.840.10008.1.2.4.51
271       · JPEG  Coding  Process  10  (8-bit)  and 12 (12-bit) Full Progression,
272         lossy, Non-Hierarch., Progressive, DCT, Huffman, 8/12 Bit SOP Class =
273         1.2.840.10008.1.2.4.55
274       Color and grayscale images are supported.
275       The  support  for  the  Extended  JPEG  Transfer Syntax can be disabled
276       (--disable-ext option)  as  well  as  the  support  for  the  (retired)
277       Progressive JPEG Transfer Syntax (--disable-progr option).
278       JPEG  lossless encoding as well as any arithmethic or hierarchical JPEG
279       encoding modes are not supported by the plugin.
280       JFIF (JPEG File Interchange Format)  information  facilitates  optional
281       APPn markers in a JPEG file. Many digital cameras do not integrate such
282       JFIF information into the JPEG output they create.  For  example,  JFIF
283       contains  information  about  the  pixel aspect ratio of the compressed
284       image. If you want the img2dcm application to insist on a  JFIF  header
285       in  the JPEG stream, you can use the option --insist-on-jfif which will
286       abort if no JFIF information can be found.  By  default,  missing  JFIF
287       information is ignored.
288       For  DICOM it is kind of a 'gray zone', whether the integration of JFIF
289       (or any other APPn) data into the DICOM object's internal  JPEG  stream
290       is  allowed or not. However, the most reliable approach is to cut those
291       markers and their information off the JPEG  stream.  This  approach  is
292       also taken by the img2dcm application. By default, all APPn markers are
293       cut off from the original JPEG stream. However, if  you  want  to  keep
294       other  APPn markers than JFIF (e. g. EXIF information) inside the DICOM
295       stream, the option --keep-appn  does  the  trick.  It  should  also  be
296       slightly  faster  than  cutting off APPn information, because it is not
297       necessary to scan the whole JPEG stream for such data. JFIF information
298       is always removed by img2dcm.
299   BMP Input Plugin
300       img2dcm  supports  BMP  as  input format. However, so far only the most
301       commmon BMP images are supported. In particular, BMP images  which  use
302       bitfields  or  run  length  encoding  will be rejected. Such images are
303       uncommon. All input images will be converted into a  DICOM  image  with
304       RGB  color  model  and a bit depth of 24. There are no specific options
305       for fine-tuning BMP format conversion.
306   Output Plugins
307       The desired output SOP Class can  be  selected  on  the  command  line.
308       Currently,  an  export plugin for the Secondary Capture Image SOP class
309       (default, option -sc), the new  Secondary  Capture  Image  SOP  classes
310       (option  -nsc)  and  Visible Light Photographic Image SOP class (option
311       -vl) are available. Please  note  that  the  first  one  is  deprecated
312       according to the DICOM standard but is selected as a default because it
313       is widely supported. Future versions of img2dcm might  provide  further
314       output plugins for other SOP Classes.
315       For  the  new  Secondary  Capture  SOP  classes,  it is not possible to
316       specifiy which specific SOP class should be used for  output.  That  is
317       because  these  new  SOP  classes are differentiated from each other by
318       colour depth (1/8/16) and the fact whether the image is black/white  or
319       colour. That is why img2dcm decides during conversion, which output SOP
320       class is suitable for a given source image.

EXAMPLES

322       Here are some examples that show how the  img2dcm  application  can  be
323       used.
324       1.  img2dcm image.jpg out.dcm
325           Read  JPEG  file  'image.jpg', convert to the old Secondary Capture
326           SOP class and save the result to DICOM file 'out.dcm'. This is  the
327           easiest  way  of  using  img2dcm.  Any type 1 and type 2 attributes
328           required for writing valid objects of this SOP class  are  inserted
329           automatically.
330       2.  img2dcm -i BMP image.bmp out.dcm
331           Same as above but tells img2dcm to read a BMP file instead of JPEG.
332       3.  img2dcm image.jpg out.dcm -vlp -k 'PatientName=Bond^James'
333           Same  as first example, but writes Visible Light Photographic Image
334           object to 'out.dcm' and  sets  PatientName  to  'Bond^James'  which
335           otherwise would be left empty.
336       4.  img2dcm    image.jpg    out.dcm   --series-from   template.dcm   -k
337           'PatientName=Bond^James'
338           Same as 1), but imports patient/study/series infomation from  DICOM
339           file  'template.dcm'.  Please  note that attribute PatientName will
340           contain 'Bond^James' at the end, any value from 'template.dcm' will
341           be  overwritten.  That  is, because the -k option is applied at the
342           very end of the conversion pipeline (see above).
343       5.  img2dcm image.jpg out.dcm --no-checks
344           Same as 1), but does not perform any attribute checking and no type
345           1 and type 2 attribute insertion! So in this case, an invalid DICOM
346           object would be generated. This can be interesting  if  the  output
347           file  is  not  meant  to  be  completed  but  will  undergo further
348           transformations, e. g. adding attributes using dcmodify.  Only  use
349           option --no-checks if you know what you are doing!
350       6.  img2dcm image.jpg out.dcm --no-type1-invent
351           Same  as  1),  but does not insert missing type 1 attributes and/or
352           their values. Type 2 attributes will be inserted. Note that in this
353           case  it must be assured that all type 1 attributes are provided by
354           other means, i. e. by adding them with the --key option. Otherwise,
355           img2dcm will report an error and will stop converting.
356       7.  img2dcm image.jpg out.dcm --keep-appn --insist-on-jfif
357           Same  as  1),  but  takes  over APPn information like EXIF into the
358           DICOM object's resulting  JPEG  stream.  Further,  --insist-on-jfif
359           will  force  img2dcm to abort if no JFIF information is existent in
360           the source file.

LOGGING

362       The level of logging output of  the  various  command  line  tools  and
363       underlying  libraries  can  be  specified by the user. By default, only
364       errors and warnings are written to the  standard  error  stream.  Using
365       option  --verbose  also  informational messages like processing details
366       are reported. Option --debug can be used to get  more  details  on  the
367       internal  activity,  e.g.  for debugging purposes. Other logging levels
368       can be selected using option --log-level. In --quiet  mode  only  fatal
369       errors  are reported. In such very severe error events, the application
370       will usually terminate. For  more  details  on  the  different  logging
371       levels, see documentation of module 'oflog'.
372       In  case  the logging output should be written to file (optionally with
373       logfile rotation), to syslog (Unix) or the event log  (Windows)  option
374       --log-config  can  be  used.  This  configuration  file also allows for
375       directing only certain messages to a particular output stream  and  for
376       filtering  certain  messages  based  on the module or application where
377       they are generated.  An  example  configuration  file  is  provided  in
378       <etcdir>/logger.cfg).

COMMAND LINE

380       All  command  line  tools  use  the  following notation for parameters:
381       square brackets enclose optional  values  (0-1),  three  trailing  dots
382       indicate  that multiple values are allowed (1-n), a combination of both
383       means 0 to n values.
384       Command line options are distinguished from parameters by a leading '+'
385       or  '-' sign, respectively. Usually, order and position of command line
386       options are arbitrary (i.e. they  can  appear  anywhere).  However,  if
387       options  are  mutually exclusive the rightmost appearance is used. This
388       behaviour conforms to the standard  evaluation  rules  of  common  Unix
389       shells.
390       In  addition,  one  or more command files can be specified using an '@'
391       sign as a prefix to the filename (e.g. @command.txt).  Such  a  command
392       argument  is  replaced  by  the  content of the corresponding text file
393       (multiple whitespaces are treated as a  single  separator  unless  they
394       appear  between  two  quotation marks) prior to any further evaluation.
395       Please note that a command file cannot contain  another  command  file.
396       This   simple   but  effective  approach  allows  to  summarize  common
397       combinations of options/parameters and  avoids  longish  and  confusing
398       command lines (an example is provided in file <datadir>/dumppat.txt).

ENVIRONMENT

400       The  img2dcm  utility  will  attempt  to  load  DICOM data dictionaries
401       specified in the DCMDICTPATH environment variable. By default, i.e.  if
402       the   DCMDICTPATH   environment   variable   is   not   set,  the  file
403       <datadir>/dicom.dic will be loaded unless the dictionary is built  into
404       the application (default for Windows).
405       The   default   behaviour  should  be  preferred  and  the  DCMDICTPATH
406       environment variable only used when alternative data  dictionaries  are
407       required.  The  DCMDICTPATH environment variable has the same format as
408       the Unix shell PATH variable in that a colon (':')  separates  entries.
409       On  Windows systems, a semicolon (';') is used as a separator. The data
410       dictionary code will  attempt  to  load  each  file  specified  in  the
411       DCMDICTPATH  environment variable. It is an error if no data dictionary
412       can be loaded.

FILES

414       <datadir>/SC.dump - Sample dump file for Secondary Capture images
415       <datadir>/VLP.dump - Sample dump file for  Visible  Light  Photographic
416       images

SEE ALSO

418       dcm2pnm(1), dcmj2pnm(1), dump2dcm(1), dcmconv(1), dcmodify(1)
420       Copyright  (C)  2007-2010  by OFFIS e.V., Escherweg 2, 26121 Oldenburg,
421       Germany.
422
423
424
425Version 3.6.0                     6 Jan 2011                        img2dcm(1)
Impressum