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