1dcmcjpeg(1) OFFIS DCMTK dcmcjpeg(1)
2
3
4
6 dcmcjpeg - Encode DICOM file to JPEG transfer syntax
7
9 dcmcjpeg [options] dcmfile-in dcmfile-out
10
12 The dcmcjpeg utility reads an uncompressed DICOM image (dcmfile-in),
13 performs a JPEG compression (i. e. conversion to an encapsulated DICOM
14 transfer syntax) and writes the converted image to an output file
15 (dcmfile-out).
16
18 dcmfile-in DICOM input filename to be converted
19
20 dcmfile-out DICOM output filename
21
23 general options
24 -h --help
25 print this help text and exit
26
27 --version
28 print version information and exit
29
30 --arguments
31 print expanded command line arguments
32
33 -q --quiet
34 quiet mode, print no warnings and errors
35
36 -v --verbose
37 verbose mode, print processing details
38
39 -d --debug
40 debug mode, print debug information
41
42 -ll --log-level [l]evel: string constant
43 (fatal, error, warn, info, debug, trace)
44 use level l for the logger
45
46 -lc --log-config [f]ilename: string
47 use config file f for the logger
48
49 input options
50 input file format:
51
52 +f --read-file
53 read file format or data set (default)
54
55 +fo --read-file-only
56 read file format only
57
58 -f --read-dataset
59 read data set without file meta information
60
61 input transfer syntax:
62
63 -t= --read-xfer-auto
64 use TS recognition (default)
65
66 -td --read-xfer-detect
67 ignore TS specified in the file meta header
68
69 -te --read-xfer-little
70 read with explicit VR little endian TS
71
72 -tb --read-xfer-big
73 read with explicit VR big endian TS
74
75 -ti --read-xfer-implicit
76 read with implicit VR little endian TS
77
78 compatibility (ignored by +tl):
79
80 +Ma --accept-acr-nema
81 accept ACR-NEMA images without photometric interpretation
82
83 # Enables compatibility for old ACR-NEMA images without photometric
84 # information (only pseudo lossless encoder)
85
86 +Mp --accept-palettes
87 accept incorrect palette attribute tags (0028,111x) and
88 (0028,121x)
89
90 # If enabled, incorrect palette attribute tags are accepted
91 # (only pseudo lossless encoder)
92
93 JPEG encoding options
94 JPEG process:
95
96 +e1 --encode-lossless-sv1
97 encode lossless sv1 (default)
98
99 # This option selects the JPEG Lossless, Non-Hierarchical, First-Order
100 # Prediction (Process 14 Selection Value 1) Transfer Syntax for
101 # Lossless JPEG Image Compression.
102
103 +el --encode-lossless
104 encode lossless
105
106 # This option selects the JPEG Lossless, Non-Hierarchical (Process 14)
107 # Transfer Syntax for Lossless JPEG Image Compression.
108
109 +eb --encode-baseline
110 encode baseline
111
112 # This option selects the JPEG Baseline (Process 1) Transfer Syntax
113 # for Lossy JPEG 8 Bit Image Compression.
114
115 +ee --encode-extended
116 encode extended sequential
117
118 # This option selects the JPEG Extended (Process 2 & 4) Transfer
119 # Syntax for Lossy JPEG Image Compression.
120
121 +es --encode-spectral
122 encode spectral selection
123
124 # This option selects the JPEG Spectral Selection, Non-Hierarchical
125 # (Process 6 & 8) Transfer Syntax for Lossy JPEG Image Compression.
126
127 +ep --encode-progressive
128 encode progressive
129
130 # This option selects the JPEG Full Progression, Non-Hierarchical
131 # (Process 10 & 12) Transfer Syntax for Lossy JPEG Image Compression.
132
133 lossless JPEG codec selection:
134
135 +tl --true-lossless
136 true lossless codec (default)
137
138 # This option selects an encoder, that guarantees truely lossless
139 # image compression. See NOTES for further information.
140
141 +pl --pseudo-lossless
142 old pseudo-lossless codec
143
144 # Old encoder, that uses lossless compression algorithms, but can
145 # cause lossy images because of internal color space transformations
146 # etc. Higher compression ratio than --true-lossless in most cases.
147
148 lossless JPEG representation:
149
150 +sv --selection-value [sv]: integer (1..7, default: 6)
151 use selection value sv only with --encode-lossless
152
153 # This option selects the selection value for lossless JPEG.
154
155 +pt --point-transform [pt]: integer (0..15, default: 0)
156 use point transform pt
157
158 # This option selects the point transform for lossless JPEG.
159 # WARNING: Using this option with a value other than zero causes
160 # a loss of precision, i. e. makes the compression "lossy".
161
162 lossy JPEG representation:
163
164 +q --quality [q]: integer (0..100, default: 90)
165 use quality factor q
166
167 # This option selects the quality factor used to determine the
168 # quantization table inside the JPEG compressor, which affects
169 # compression ratio and image quality in lossy JPEG.
170 # See documentation of the Independent JPEG Group for details.
171
172 +sm --smooth [s]: integer (0..100, default: 0)
173 use smoothing factor s
174
175 # This option enables a smoothing (low-pass filter) of the image data
176 # prior to compression. Increases the compression ratio at the expense
177 # of image quality.
178
179 other JPEG options:
180
181 +ho --huffman-optimize
182 optimize huffman tables (default)
183
184 # This option enables an optimization of the huffman tables during
185 # image compression. It results in a slightly smaller image at a small
186 # increase of CPU time. Always on if bits/sample is larger than 8.
187
188 -ho --huffman-standard
189 use standard huffman tables if 8 bits/sample
190
191 # This option disables an optimization of the huffman tables during
192 # image compression.
193
194 compressed bits per sample (always +ba with +tl):
195
196 +ba --bits-auto
197 choose bits/sample automatically (default)
198
199 +be --bits-force-8
200 force 8 bits/sample
201
202 +bt --bits-force-12
203 force 12 bits/sample (not with baseline)
204
205 +bs --bits-force-16
206 force 16 bits/sample (lossless only)
207
208 compression color space conversion (overriden by +tl):
209
210 +cy --color-ybr
211 use YCbCr for color images if lossy (default)
212
213 # This option enables a transformation of the color space to YCbCr
214 # prior to image compression for color images in lossy JPEG.
215
216 +cr --color-rgb
217 use RGB for color images if lossy
218
219 # This option prevents the transformation of the color space to YCbCr
220 # prior to image compression for color images in lossy JPEG. It causes
221 # lossy image compression in the RGB color space which is not
222 # recommendable.
223
224 +cm --monochrome
225 convert color images to monochrome
226
227 # This option forces a conversion of color images to monochrome
228 # prior to compression.
229
230 decompression color space conversion
231 (if input is compressed; always +cn with +tl):
232
233 +cp --conv-photometric
234 convert if YCbCr photometric interpretation (default)
235
236 # This option describes the behavior of dcmcjpeg when a compressed
237 # image is read and decompressed prior to re-compression. If the
238 # compressed image uses YBR_FULL or YBR_FULL_422 photometric
239 # interpretation, it is converted to RGB during decompression.
240
241 +cl --conv-lossy
242 convert YCbCr to RGB if lossy JPEG
243
244 # If the compressed image is encoded in lossy JPEG, assume YCbCr
245 # color model and convert to RGB.
246
247 +cg --conv-guess
248 convert to RGB if YCbCr is guessed by library
249
250 # If the underlying JPEG library "guesses" the color space of the
251 # compressed image to be YCbCr, convert to RGB.
252
253 +cgl --conv-guess-lossy
254 convert to RGB if lossy JPEG and YCbCr is
255 guessed by the underlying JPEG library
256
257 # If the compressed image is encoded in lossy JPEG and the underlying
258 # JPEG library "guesses" the color space to be YCbCr, convert to RGB.
259
260 +ca --conv-always
261 always convert YCbCr to RGB
262
263 # If the compressed image is a color image, assume YCbCr color model
264 # and convert to RGB.
265
266 +cn --conv-never
267 never convert color space
268
269 # Never convert color space during decompression.
270
271 standard YCbCr component subsampling (not with +tl):
272
273 +s4 --sample-444
274 4:4:4 sampling with YBR_FULL (default)
275
276 # This option disables color component subsampling for compression in
277 # the YCbCr color space. The DICOM photometric interpretation is
278 # encoded as YBR_FULL.
279
280 +s2 --sample-422
281 4:2:2 subsampling with YBR_FULL_422
282
283 # This option enables a 4:2:2 color component subsampling for
284 # compression in the YCbCr color space. The DICOM photometric
285 # interpretation is encoded as YBR_FULL.
286
287 non-standard YCbCr component subsampling (not with +tl):
288
289 +n2 --nonstd-422-full
290 4:2:2 subsampling with YBR_FULL
291
292 # This option enables a 4:2:2 color component subsampling for
293 # compression in the YCbCr color space. The DICOM photometric
294 # interpretation is encoded as YBR_FULL which violates DICOM rules.
295
296 +n1 --nonstd-411-full
297 4:1:1 subsampling with YBR_FULL
298
299 # This option enables a 4:1:1 color component subsampling for
300 # compression in the YCbCr color space. The DICOM photometric
301 # interpretation is encoded as YBR_FULL which violates DICOM rules.
302
303 +np --nonstd-411
304 4:1:1 subsampling with YBR_FULL_422
305
306 # This option enables a 4:1:1 color component subsampling for
307 # compression in the YCbCr color space. The DICOM photometric
308 # interpretation is encoded as YBR_FULL_422 which violates DICOM rules.
309
310 encapsulated pixel data encoding options
311 encapsulated pixel data fragmentation:
312
313 +ff --fragment-per-frame
314 encode each frame as one fragment (default)
315
316 # This option causes the creation of one compressed fragment for each
317 # frame (recommended).
318
319 +fs --fragment-size [s]ize: integer
320 limit fragment size to s kbytes
321
322 # This option limits the fragment size which may cause the creation of
323 # multiple fragments per frame.
324
325 basic offset table encoding:
326
327 +ot --offset-table-create
328 create offset table (default)
329
330 # This option causes the creation of a valid offset table for the
331 # compressed JPEG fragments.
332
333 -ot --offset-table-empty
334 leave offset table empty
335
336 # This option causes the creation of an empty offset table
337 # for the compressed JPEG fragments.
338
339 VOI windowing for monochrome images (not with +tl):
340
341 -W --no-windowing
342 no VOI windowing (default)
343
344 # No window level/width is "burned" into monochrome images prior to
345 # compression. See notes below on pixel scaling and rescale slope
346 # and intercept encoding.
347
348 +Wi --use-window [n]umber: integer
349 use the n-th VOI window from image file
350
351 # Apply the n-th window center/width encoded in the image data prior
352 # to compression.
353
354 +Wl --use-voi-lut [n]umber: integer
355 use the n-th VOI look up table from image file
356
357 # Apply the n-th VOI LUT encoded in the image data prior
358 # to compression.
359
360 +Wm --min-max-window
361 compute VOI window using min-max algorithm
362
363 # Compute and apply a window center and width that covers the
364 # range from the smallest to the largest occuring pixel value.
365
366 +Wn --min-max-window-n
367 compute VOI window using min-max algorithm,
368 ignoring extreme values
369
370 # Compute and apply a window center and width that covers the
371 # range from the second smallest to the second largest occuring
372 # pixel value. This is useful if the background is set to an
373 # artificial black (padding value) or if white overlays are burned
374 # into the image data which should not be considered for the window
375 # computation.
376
377 +Wr --roi-min-max-window [l]eft [t]op [w]idth [h]eight: integer
378 compute ROI window using min-max algorithm,
379 region of interest is specified by l,t,w,h
380
381 # This option works like --min-max-window but only considers the given
382 # region of interest inside the image.
383
384 +Wh --histogram-window [n]umber: integer
385 compute VOI window using Histogram algorithm,
386 ignoring n percent
387
388 # Compute a histogram of the image data and apply window center
389 # and width such than n% of the image data are ignored for the window
390 # computation
391
392 +Ww --set-window [c]enter [w]idth: float
393 compute VOI window using center c and width w
394
395 # Apply the given window center/width prior to compression.
396
397 pixel scaling for monochrome images (--no-windowing; ignored by +tl):
398
399 +sp --scaling-pixel
400 scale using min/max pixel value (default)
401
402 # Monochrome image pixel values are always scaled to make use of the
403 # pixel range available with the selected JPEG process as good as
404 # possible. This option selects a scaling based on the minimum and
405 # maximum pixel value occuring in the image. This often leads to
406 # significantly better image quality, but may cause different
407 # compressed images within one series to have different values for
408 # rescale slope and intercept, which is a problem if a presentation
409 # state for one series is to be created.
410
411 +sr --scaling-range
412 scale using min/max range
413
414 # This options selects a scaling based on the pixel range as defined
415 # by the stored bits, pixel representation and modality transform,
416 # without consideration of the minimum and maximum value really
417 # used within the image.
418
419 rescale slope/intercept encoding for monochrome (-W; ignored by +tl):
420
421 +ri --rescale-identity
422 encode identity modality rescale (default)
423 Never used for CT images
424
425 # This options prevents the creation of a modality transformation
426 # other than an identity transformation (which is required for
427 # many DICOM IODs). Window center/width settings encoded
428 # in the image are adapted, VOI LUTs are removed.
429
430 +rm --rescale-map
431 use modality rescale to scale pixel range
432 Never used for XA/RF/XA Biplane images
433
434 # This option causes the creation of a modality rescale slope and
435 # intercept that maps the decompressed image data back to their
436 # original range. This keeps all VOI transformations valid but
437 # requires that the DICOM IOD supports a modality rescale slope
438 # and intercept transformation other than identity.
439
440 SOP Class UID:
441
442 +cd --class-default
443 keep SOP Class UID (default)
444
445 # Keep the SOP Class UID of the source image.
446
447 +cs --class-sc
448 convert to Secondary Capture Image (implies --uid-always)
449
450 # Convert the image to Secondary Capture. In addition to the SOP
451 # Class UID, all attributes required for a valid secondary capture
452 # image are added. A new SOP instance UID is always assigned.
453
454 SOP Instance UID:
455
456 +ud --uid-default
457 assign new UID if lossy compression (default)
458
459 # Assigns a new SOP instance UID if the compression is lossy.
460
461 +ua --uid-always
462 always assign new UID
463
464 # Unconditionally assigns a new SOP instance UID.
465
466 +un --uid-never
467 never assign new UID
468
469 # Never assigns a new SOP instance UID.
470
471 output options
472 post-1993 value representations:
473
474 +u --enable-new-vr
475 enable support for new VRs (UN/UT) (default)
476
477 -u --disable-new-vr
478 disable support for new VRs, convert to OB
479
480 group length encoding:
481
482 +g= --group-length-recalc
483 recalculate group lengths if present (default)
484
485 +g --group-length-create
486 always write with group length elements
487
488 -g --group-length-remove
489 always write without group length elements
490
491 length encoding in sequences and items:
492
493 +e --length-explicit
494 write with explicit lengths (default)
495
496 -e --length-undefined
497 write with undefined lengths
498
499 data set trailing padding:
500
501 -p= --padding-retain
502 do not change padding (default)
503
504 -p --padding-off
505 no padding
506
507 +p --padding-create [f]ile-pad [i]tem-pad: integer
508 align file on multiple of f bytes
509 and items on multiple of i bytes
510
512 The dcmcjpeg utility compresses DICOM images of all SOP classes.
513 Special handling has been implemented for CT images (where the modality
514 transformation is required to create Hounsfield units) and the
515 XA/RF/Biplane SOP classes (where the modality transformation has
516 'inversed' semantics). However, dcmcjpeg does not attempt to ensure
517 that the compressed image still complies with all restrictions of the
518 object's IOD.
519
520 A few examples:
521
522 · MR images are required to have BitsAllocated=16.
523 · NM Images can only be encoded with MONOCHROME2 or PALETTE COLOR
524 photometric interpretation but not with RGB or YBR_FULL (which
525 effectively prevents compression).
526 · Hardcopy Color images must have RGB color model which is a problem if
527 lossy compression is to be performed.
528 The user is responsible for making sure that the compressed images he
529 creates are compliant with the DICOM standard. If in question, the
530 dcmcjpeg utility allows to convert an image to secondary capture - this
531 SOP class does not pose restrictions as the ones mentioned above.
532 With version DCMTK 3.5.4 a new encoder for truely lossless JPEG
533 compression was added (--true-lossless). Compared to the old (--pseudo-
534 lossless) encoder, that creates slightly lossy images caused from
535 internal color space conversions, windowing etc., there are a some
536 issues to consider:
537 · Only source images with Bits Allocated 8 or 16 are supported
538 · Options for color space conversions, windowing or pixel scaling are
539 ignored or overriden
540 · Photometric Interpretations YBR_FULL_422, YBR_PARTIAL_422,
541 YBR_PARTIAL_420, YBR_ICT, YBR_RCT are not supported
542 · The encoder changes automatically Planar Configuration from 1 to 0 if
543 necessary
544 · The compression ratio can be lower than in --pseudo-lossless mode
545 However, when using the new encoder (default), you can be sure, that
546 compression does not affect image quality.
547 In order to be on the safe side, the Lossy Compression Flag is always
548 set to '01' and a new SOP instance UID is assigned (by default) for the
549 old pseudo-lossless encoder. The output of the old and new lossless
550 encoder can also be distinguished by the Derivation Description in the
551 resulting DICOM image, which contains the term 'Lossless JPEG
552 compression' for the new and 'Pseudo-Lossless JPEG compression' for the
553 old encoder.
555 dcmcjpeg supports the following transfer syntaxes for input (dcmfile-
556 in):
557 LittleEndianImplicitTransferSyntax 1.2.840.10008.1.2
558 LittleEndianExplicitTransferSyntax 1.2.840.10008.1.2.1
559 DeflatedExplicitVRLittleEndianTransferSyntax 1.2.840.10008.1.2.1.99 (*)
560 BigEndianExplicitTransferSyntax 1.2.840.10008.1.2.2
561 JPEGProcess1TransferSyntax 1.2.840.10008.1.2.4.50
562 JPEGProcess2_4TransferSyntax 1.2.840.10008.1.2.4.51
563 JPEGProcess6_8TransferSyntax 1.2.840.10008.1.2.4.53
564 JPEGProcess10_12TransferSyntax 1.2.840.10008.1.2.4.55
565 JPEGProcess14TransferSyntax 1.2.840.10008.1.2.4.57
566 JPEGProcess14SV1TransferSyntax 1.2.840.10008.1.2.4.70
567 (*) if compiled with zlib support enabled
568 dcmcjpeg supports the following transfer syntaxes for output (dcmfile-
569 out):
570 JPEGProcess1TransferSyntax 1.2.840.10008.1.2.4.50
571 JPEGProcess2_4TransferSyntax 1.2.840.10008.1.2.4.51
572 JPEGProcess6_8TransferSyntax 1.2.840.10008.1.2.4.53
573 JPEGProcess10_12TransferSyntax 1.2.840.10008.1.2.4.55
574 JPEGProcess14TransferSyntax 1.2.840.10008.1.2.4.57
575 JPEGProcess14SV1TransferSyntax 1.2.840.10008.1.2.4.70
577 The level of logging output of the various command line tools and
578 underlying libraries can be specified by the user. By default, only
579 errors and warnings are written to the standard error stream. Using
580 option --verbose also informational messages like processing details
581 are reported. Option --debug can be used to get more details on the
582 internal activity, e.g. for debugging purposes. Other logging levels
583 can be selected using option --log-level. In --quiet mode only fatal
584 errors are reported. In such very severe error events, the application
585 will usually terminate. For more details on the different logging
586 levels, see documentation of module 'oflog'.
587 In case the logging output should be written to file (optionally with
588 logfile rotation), to syslog (Unix) or the event log (Windows) option
589 --log-config can be used. This configuration file also allows for
590 directing only certain messages to a particular output stream and for
591 filtering certain messages based on the module or application where
592 they are generated. An example configuration file is provided in
593 <etcdir>/logger.cfg).
595 All command line tools use the following notation for parameters:
596 square brackets enclose optional values (0-1), three trailing dots
597 indicate that multiple values are allowed (1-n), a combination of both
598 means 0 to n values.
599 Command line options are distinguished from parameters by a leading '+'
600 or '-' sign, respectively. Usually, order and position of command line
601 options are arbitrary (i.e. they can appear anywhere). However, if
602 options are mutually exclusive the rightmost appearance is used. This
603 behaviour conforms to the standard evaluation rules of common Unix
604 shells.
605 In addition, one or more command files can be specified using an '@'
606 sign as a prefix to the filename (e.g. @command.txt). Such a command
607 argument is replaced by the content of the corresponding text file
608 (multiple whitespaces are treated as a single separator unless they
609 appear between two quotation marks) prior to any further evaluation.
610 Please note that a command file cannot contain another command file.
611 This simple but effective approach allows to summarize common
612 combinations of options/parameters and avoids longish and confusing
613 command lines (an example is provided in file <datadir>/dumppat.txt).
615 The dcmcjpeg utility will attempt to load DICOM data dictionaries
616 specified in the DCMDICTPATH environment variable. By default, i.e. if
617 the DCMDICTPATH environment variable is not set, the file
618 <datadir>/dicom.dic will be loaded unless the dictionary is built into
619 the application (default for Windows).
620 The default behaviour should be preferred and the DCMDICTPATH
621 environment variable only used when alternative data dictionaries are
622 required. The DCMDICTPATH environment variable has the same format as
623 the Unix shell PATH variable in that a colon (':') separates entries.
624 On Windows systems, a semicolon (';') is used as a separator. The data
625 dictionary code will attempt to load each file specified in the
626 DCMDICTPATH environment variable. It is an error if no data dictionary
627 can be loaded.
629 dcmdjpeg(1)
631 Copyright (C) 2001-2010 by OFFIS e.V., Escherweg 2, 26121 Oldenburg,
632 Germany.
633
634
635
636Version 3.6.0 6 Jan 2011 dcmcjpeg(1)