File: dcmcjpeg.man

package info (click to toggle)
dcmtk 3.6.0-12
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 32,976 kB
  • sloc: cpp: 193,852; ansic: 46,292; sh: 4,020; makefile: 3,969; perl: 3,278; lex: 94
file content (673 lines) | stat: -rw-r--r-- 23,481 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
/*!

\if MANPAGES
\page dcmcjpeg Encode DICOM file to JPEG transfer syntax
\else
\page dcmcjpeg dcmcjpeg: Encode DICOM file to JPEG transfer syntax
\endif

\section synopsis SYNOPSIS

\verbatim
dcmcjpeg [options] dcmfile-in dcmfile-out
\endverbatim

\section description DESCRIPTION

The \b dcmcjpeg utility reads an uncompressed DICOM image (\e dcmfile-in),
performs a JPEG compression (i. e. conversion to an encapsulated DICOM transfer
syntax) and writes the converted image to an output file (\e dcmfile-out).

\section parameters PARAMETERS

\verbatim
dcmfile-in   DICOM input filename to be converted

dcmfile-out  DICOM output filename
\endverbatim

\section options OPTIONS

\subsection general_options general options
\verbatim
  -h    --help
          print this help text and exit

        --version
          print version information and exit

        --arguments
          print expanded command line arguments

  -q    --quiet
          quiet mode, print no warnings and errors

  -v    --verbose
          verbose mode, print processing details

  -d    --debug
          debug mode, print debug information

  -ll   --log-level  [l]evel: string constant
          (fatal, error, warn, info, debug, trace)
          use level l for the logger

  -lc   --log-config  [f]ilename: string
          use config file f for the logger
\endverbatim

\subsection input_options input options
\verbatim
input file format:

  +f    --read-file
          read file format or data set (default)

  +fo   --read-file-only
          read file format only

  -f    --read-dataset
          read data set without file meta information

input transfer syntax:

  -t=   --read-xfer-auto
          use TS recognition (default)

  -td   --read-xfer-detect
          ignore TS specified in the file meta header

  -te   --read-xfer-little
          read with explicit VR little endian TS

  -tb   --read-xfer-big
          read with explicit VR big endian TS

  -ti   --read-xfer-implicit
          read with implicit VR little endian TS

compatibility (ignored by +tl):

  +Ma   --accept-acr-nema
          accept ACR-NEMA images without photometric interpretation

  # Enables compatibility for old ACR-NEMA images without photometric
  # information (only pseudo lossless encoder)

  +Mp   --accept-palettes
          accept incorrect palette attribute tags (0028,111x) and
          (0028,121x)

  # If enabled, incorrect palette attribute tags are accepted
  # (only pseudo lossless encoder)
\endverbatim

\subsection JPEG_encoding_options JPEG encoding options
\verbatim
JPEG process:

  +e1   --encode-lossless-sv1
          encode lossless sv1 (default)

  # This option selects the JPEG Lossless, Non-Hierarchical, First-Order
  # Prediction (Process 14 Selection Value 1) Transfer Syntax for
  # Lossless JPEG Image Compression.

  +el   --encode-lossless
          encode lossless

  # This option selects the JPEG Lossless, Non-Hierarchical (Process 14)
  # Transfer Syntax for Lossless JPEG Image Compression.

  +eb   --encode-baseline
          encode baseline

  # This option selects the JPEG Baseline (Process 1) Transfer Syntax
  # for Lossy JPEG 8 Bit Image Compression.

  +ee   --encode-extended
          encode extended sequential

  # This option selects the JPEG Extended (Process 2 & 4) Transfer
  # Syntax for Lossy JPEG Image Compression.

  +es   --encode-spectral
          encode spectral selection

  # This option selects the JPEG Spectral Selection, Non-Hierarchical
  # (Process 6 & 8) Transfer Syntax for Lossy JPEG Image Compression.

  +ep   --encode-progressive
          encode progressive

  # This option selects the JPEG Full Progression, Non-Hierarchical
  # (Process 10 & 12) Transfer Syntax for Lossy JPEG Image Compression.

lossless JPEG codec selection:

  +tl   --true-lossless
          true lossless codec (default)

  # This option selects an encoder, that guarantees truely lossless
  # image compression. See NOTES for further information.

  +pl   --pseudo-lossless
          old pseudo-lossless codec

  # Old encoder, that uses lossless compression algorithms, but can
  # cause lossy images because of internal color space transformations
  # etc. Higher compression ratio than --true-lossless in most cases.

lossless JPEG representation:

  +sv   --selection-value  [sv]: integer (1..7, default: 6)
          use selection value sv only with --encode-lossless

  # This option selects the selection value for lossless JPEG.

  +pt   --point-transform  [pt]: integer (0..15, default: 0)
          use point transform pt

  # This option selects the point transform for lossless JPEG.
  # WARNING: Using this option with a value other than zero causes
  # a loss of precision, i. e. makes the compression "lossy".

lossy JPEG representation:

  +q    --quality  [q]: integer (0..100, default: 90)
          use quality factor q

  # This option selects the quality factor used to determine the
  # quantization table inside the JPEG compressor, which affects
  # compression ratio and image quality in lossy JPEG.
  # See documentation of the Independent JPEG Group for details.

  +sm   --smooth  [s]: integer (0..100, default: 0)
          use smoothing factor s

  # This option enables a smoothing (low-pass filter) of the image data
  # prior to compression. Increases the compression ratio at the expense
  # of image quality.

other JPEG options:

  +ho   --huffman-optimize
          optimize huffman tables (default)

  # This option enables an optimization of the huffman tables during
  # image compression. It results in a slightly smaller image at a small
  # increase of CPU time. Always on if bits/sample is larger than 8.

  -ho   --huffman-standard
          use standard huffman tables if 8 bits/sample

  # This option disables an optimization of the huffman tables during
  # image compression.

compressed bits per sample (always +ba with +tl):

  +ba   --bits-auto
          choose bits/sample automatically (default)

  +be   --bits-force-8
          force 8 bits/sample

  +bt   --bits-force-12
          force 12 bits/sample (not with baseline)

  +bs   --bits-force-16
          force 16 bits/sample (lossless only)

compression color space conversion (overriden by +tl):

  +cy   --color-ybr
          use YCbCr for color images if lossy (default)

  # This option enables a transformation of the color space to YCbCr
  # prior to image compression for color images in lossy JPEG.

  +cr   --color-rgb
          use RGB for color images if lossy

  # This option prevents the transformation of the color space to YCbCr
  # prior to image compression for color images in lossy JPEG. It causes
  # lossy image compression in the RGB color space which is not
  # recommendable.

  +cm   --monochrome
          convert color images to monochrome

  # This option forces a conversion of color images to monochrome
  # prior to compression.

decompression color space conversion
(if input is compressed; always +cn with +tl):

  +cp   --conv-photometric
          convert if YCbCr photometric interpretation (default)

  # This option describes the behavior of dcmcjpeg when a compressed
  # image is read and decompressed prior to re-compression.  If the
  # compressed image uses YBR_FULL or YBR_FULL_422 photometric
  # interpretation, it is converted to RGB during decompression.

  +cl   --conv-lossy
          convert YCbCr to RGB if lossy JPEG

  # If the compressed image is encoded in lossy JPEG, assume YCbCr
  # color model and convert to RGB.

  +cg   --conv-guess
          convert to RGB if YCbCr is guessed by library

  # If the underlying JPEG library "guesses" the color space of the
  # compressed image to be YCbCr, convert to RGB.

  +cgl  --conv-guess-lossy
          convert to RGB if lossy JPEG and YCbCr is
          guessed by the underlying JPEG library

  # If the compressed image is encoded in lossy JPEG and the underlying
  # JPEG library "guesses" the color space to be YCbCr, convert to RGB.

  +ca   --conv-always
          always convert YCbCr to RGB

  # If the compressed image is a color image, assume YCbCr color model
  # and convert to RGB.

  +cn   --conv-never
          never convert color space

  # Never convert color space during decompression.

standard YCbCr component subsampling (not with +tl):

  +s4   --sample-444
          4:4:4 sampling with YBR_FULL (default)

  # This option disables color component subsampling for compression in
  # the YCbCr color space. The DICOM photometric interpretation is
  # encoded as YBR_FULL.

  +s2   --sample-422
          4:2:2 subsampling with YBR_FULL_422

  # This option enables a 4:2:2 color component subsampling for
  # compression in the YCbCr color space. The DICOM photometric
  # interpretation is encoded as YBR_FULL.

non-standard YCbCr component subsampling (not with +tl):

  +n2   --nonstd-422-full
          4:2:2 subsampling with YBR_FULL

  # This option enables a 4:2:2 color component subsampling for
  # compression in the YCbCr color space. The DICOM photometric
  # interpretation is encoded as YBR_FULL which violates DICOM rules.

  +n1   --nonstd-411-full
          4:1:1 subsampling with YBR_FULL

  # This option enables a 4:1:1 color component subsampling for
  # compression in the YCbCr color space. The DICOM photometric
  # interpretation is encoded as YBR_FULL which violates DICOM rules.

  +np   --nonstd-411
          4:1:1 subsampling with YBR_FULL_422

  # This option enables a 4:1:1 color component subsampling for
  # compression in the YCbCr color space. The DICOM photometric
  # interpretation is encoded as YBR_FULL_422 which violates DICOM rules.
\endverbatim

\subsection enc_pix_data_encoding_opt encapsulated pixel data encoding options:
\verbatim
encapsulated pixel data fragmentation:

  +ff   --fragment-per-frame
          encode each frame as one fragment (default)

  # This option causes the creation of one compressed fragment for each
  # frame (recommended).

  +fs   --fragment-size  [s]ize: integer
          limit fragment size to s kbytes

  # This option limits the fragment size which may cause the creation of
  # multiple fragments per frame.

basic offset table encoding:

  +ot   --offset-table-create
          create offset table (default)

  # This option causes the creation of a valid offset table for the
  # compressed JPEG fragments.

  -ot   --offset-table-empty
          leave offset table empty

  # This option causes the creation of an empty offset table
  # for the compressed JPEG fragments.

VOI windowing for monochrome images (not with +tl):

  -W    --no-windowing
          no VOI windowing (default)

  # No window level/width is "burned" into monochrome images prior to
  # compression.  See notes below on pixel scaling and rescale slope
  # and intercept encoding.

  +Wi   --use-window  [n]umber: integer
          use the n-th VOI window from image file

  # Apply the n-th window center/width encoded in the image data prior
  # to compression.

  +Wl   --use-voi-lut  [n]umber: integer
          use the n-th VOI look up table from image file

  # Apply the n-th VOI LUT encoded in the image data prior
  # to compression.

  +Wm   --min-max-window
          compute VOI window using min-max algorithm

  # Compute and apply a window center and width that covers the
  # range from the smallest to the largest occuring pixel value.

  +Wn   --min-max-window-n
          compute VOI window using min-max algorithm,
          ignoring extreme values

  # Compute and apply a window center and width that covers the
  # range from the second smallest to the second largest occuring
  # pixel value. This is useful if the background is set to an
  # artificial black (padding value) or if white overlays are burned
  # into the image data which should not be considered for the window
  # computation.

  +Wr   --roi-min-max-window  [l]eft [t]op [w]idth [h]eight: integer
          compute ROI window using min-max algorithm,
          region of interest is specified by l,t,w,h

  # This option works like --min-max-window but only considers the given
  # region of interest inside the image.

  +Wh   --histogram-window  [n]umber: integer
          compute VOI window using Histogram algorithm,
          ignoring n percent

  # Compute a histogram of the image data and apply window center
  # and width such than n% of the image data are ignored for the window
  # computation

  +Ww   --set-window  [c]enter [w]idth: float
          compute VOI window using center c and width w

  # Apply the given window center/width prior to compression.

pixel scaling for monochrome images (--no-windowing; ignored by +tl):

  +sp   --scaling-pixel
          scale using min/max pixel value (default)

  # Monochrome image pixel values are always scaled to make use of the
  # pixel range available with the selected JPEG process as good as
  # possible. This option selects a scaling based on the minimum and
  # maximum pixel value occuring in the image.  This often leads to
  # significantly better image quality, but may cause different
  # compressed images within one series to have different values for
  # rescale slope and intercept, which is a problem if a presentation
  # state for one series is to be created.

  +sr   --scaling-range
          scale using min/max range

  # This options selects a scaling based on the pixel range as defined
  # by the stored bits, pixel representation and modality transform,
  # without consideration of the minimum and maximum value really
  # used within the image.

rescale slope/intercept encoding for monochrome (-W; ignored by +tl):

  +ri   --rescale-identity
          encode identity modality rescale (default)
          Never used for CT images

  # This options prevents the creation of a modality transformation
  # other than an identity transformation (which is required for
  # many DICOM IODs).  Window center/width settings encoded
  # in the image are adapted, VOI LUTs are removed.

  +rm   --rescale-map
          use modality rescale to scale pixel range
          Never used for XA/RF/XA Biplane images

  # This option causes the creation of a modality rescale slope and
  # intercept that maps the decompressed image data back to their
  # original range.  This keeps all VOI transformations valid but
  # requires that the DICOM IOD supports a modality rescale slope
  # and intercept transformation other than identity.

SOP Class UID:

  +cd   --class-default
          keep SOP Class UID (default)

  # Keep the SOP Class UID of the source image.

  +cs   --class-sc
          convert to Secondary Capture Image (implies --uid-always)

  # Convert the image to Secondary Capture.  In addition to the SOP
  # Class UID, all attributes required for a valid secondary capture
  # image are added. A new SOP instance UID is always assigned.

SOP Instance UID:

  +ud   --uid-default
          assign new UID if lossy compression (default)

  # Assigns a new SOP instance UID if the compression is lossy.

  +ua   --uid-always
          always assign new UID

  # Unconditionally assigns a new SOP instance UID.

  +un   --uid-never
          never assign new UID

  # Never assigns a new SOP instance UID.
\endverbatim

\subsection output_options output options
\verbatim
post-1993 value representations:

  +u    --enable-new-vr
          enable support for new VRs (UN/UT) (default)

  -u    --disable-new-vr
          disable support for new VRs, convert to OB

group length encoding:

  +g=   --group-length-recalc
          recalculate group lengths if present (default)

  +g    --group-length-create
          always write with group length elements

  -g    --group-length-remove
          always write without group length elements

length encoding in sequences and items:

  +e    --length-explicit
          write with explicit lengths (default)

  -e    --length-undefined
          write with undefined lengths

data set trailing padding:

  -p=   --padding-retain
          do not change padding (default)

  -p    --padding-off
          no padding

  +p    --padding-create  [f]ile-pad [i]tem-pad: integer
          align file on multiple of f bytes
          and items on multiple of i bytes
\endverbatim

\section notes NOTES

The \b dcmcjpeg utility compresses DICOM images of all SOP classes.  Special
handling has been implemented for CT images (where the modality transformation
is required to create Hounsfield units) and the XA/RF/Biplane SOP classes
(where the modality transformation has "inversed" semantics).  However,
\b dcmcjpeg does not attempt to ensure that the compressed image still complies
with all restrictions of the object's IOD.

A few examples:

\li MR images are required to have BitsAllocated=16.
\li NM Images can only be encoded with MONOCHROME2 or PALETTE COLOR photometric
    interpretation but not with RGB or YBR_FULL (which effectively prevents
    compression).
\li Hardcopy Color images must have RGB color model which is a problem if lossy
    compression is to be performed.

The user is responsible for making sure that the compressed images he creates
are compliant with the DICOM standard.  If in question, the \b dcmcjpeg utility
allows to convert an image to secondary capture - this SOP class does not pose
restrictions as the ones mentioned above.

With version DCMTK 3.5.4 a new encoder for truely lossless JPEG compression was
added (\e --true-lossless).  Compared to the old (\e --pseudo-lossless) encoder,
that creates slightly lossy images caused from internal color space conversions,
windowing etc., there are a some issues to consider:

\li Only source images with Bits Allocated 8 or 16 are supported
\li Options for color space conversions, windowing or pixel scaling are
    ignored or overriden
\li Photometric Interpretations YBR_FULL_422, YBR_PARTIAL_422, YBR_PARTIAL_420,
    YBR_ICT, YBR_RCT are not supported
\li The encoder changes automatically Planar Configuration from 1 to 0 if
    necessary
\li The compression ratio can be lower than in \e --pseudo-lossless mode

However, when using the new encoder (default), you can be sure, that
compression does not affect image quality.

In order to be on the safe side, the Lossy Compression Flag is always set to
"01" and a new SOP instance UID is assigned (by default) for the old
pseudo-lossless encoder.  The output of the old and new lossless encoder can
also be distinguished by the Derivation Description in the resulting DICOM
image, which contains the term "Lossless JPEG compression" for the new and
"Pseudo-Lossless JPEG compression" for the old encoder.

\section transfer_syntaxes TRANSFER SYNTAXES

\b dcmcjpeg supports the following transfer syntaxes for input
(\e dcmfile-in):

\verbatim
LittleEndianImplicitTransferSyntax             1.2.840.10008.1.2
LittleEndianExplicitTransferSyntax             1.2.840.10008.1.2.1
DeflatedExplicitVRLittleEndianTransferSyntax   1.2.840.10008.1.2.1.99 (*)
BigEndianExplicitTransferSyntax                1.2.840.10008.1.2.2
JPEGProcess1TransferSyntax                     1.2.840.10008.1.2.4.50
JPEGProcess2_4TransferSyntax                   1.2.840.10008.1.2.4.51
JPEGProcess6_8TransferSyntax                   1.2.840.10008.1.2.4.53
JPEGProcess10_12TransferSyntax                 1.2.840.10008.1.2.4.55
JPEGProcess14TransferSyntax                    1.2.840.10008.1.2.4.57
JPEGProcess14SV1TransferSyntax                 1.2.840.10008.1.2.4.70
\endverbatim

(*) if compiled with zlib support enabled

\b dcmcjpeg supports the following transfer syntaxes for output
(\e dcmfile-out):

\verbatim
JPEGProcess1TransferSyntax                     1.2.840.10008.1.2.4.50
JPEGProcess2_4TransferSyntax                   1.2.840.10008.1.2.4.51
JPEGProcess6_8TransferSyntax                   1.2.840.10008.1.2.4.53
JPEGProcess10_12TransferSyntax                 1.2.840.10008.1.2.4.55
JPEGProcess14TransferSyntax                    1.2.840.10008.1.2.4.57
JPEGProcess14SV1TransferSyntax                 1.2.840.10008.1.2.4.70
\endverbatim

\section logging LOGGING

The level of logging output of the various command line tools and underlying
libraries can be specified by the user.  By default, only errors and warnings
are written to the standard error stream.  Using option \e --verbose also
informational messages like processing details are reported.  Option
\e --debug can be used to get more details on the internal activity, e.g. for
debugging purposes.  Other logging levels can be selected using option
\e --log-level.  In \e --quiet mode only fatal errors are reported.  In such
very severe error events, the application will usually terminate.  For more
details on the different logging levels, see documentation of module "oflog".

In case the logging output should be written to file (optionally with logfile
rotation), to syslog (Unix) or the event log (Windows) option \e --log-config
can be used.  This configuration file also allows for directing only certain
messages to a particular output stream and for filtering certain messages
based on the module or application where they are generated.  An example
configuration file is provided in <em>\<etcdir\>/logger.cfg</em>).

\section command_line COMMAND LINE

All command line tools use the following notation for parameters: square
brackets enclose optional values (0-1), three trailing dots indicate that
multiple values are allowed (1-n), a combination of both means 0 to n values.

Command line options are distinguished from parameters by a leading '+' or '-'
sign, respectively.  Usually, order and position of command line options are
arbitrary (i.e. they can appear anywhere).  However, if options are mutually
exclusive the rightmost appearance is used.  This behaviour conforms to the
standard evaluation rules of common Unix shells.

In addition, one or more command files can be specified using an '@' sign as a
prefix to the filename (e.g. <em>\@command.txt</em>).  Such a command argument
is replaced by the content of the corresponding text file (multiple
whitespaces are treated as a single separator unless they appear between two
quotation marks) prior to any further evaluation.  Please note that a command
file cannot contain another command file.  This simple but effective approach
allows to summarize common combinations of options/parameters and avoids
longish and confusing command lines (an example is provided in file
<em>\<datadir\>/dumppat.txt</em>).

\section environment ENVIRONMENT

The \b dcmcjpeg utility will attempt to load DICOM data dictionaries specified
in the \e DCMDICTPATH environment variable.  By default, i.e. if the
\e DCMDICTPATH environment variable is not set, the file
<em>\<datadir\>/dicom.dic</em> will be loaded unless the dictionary is built
into the application (default for Windows).

The default behaviour should be preferred and the \e DCMDICTPATH environment
variable only used when alternative data dictionaries are required.  The
\e DCMDICTPATH environment variable has the same format as the Unix shell
\e PATH variable in that a colon (":") separates entries.  On Windows systems,
a semicolon (";") is used as a separator.  The data dictionary code will
attempt to load each file specified in the \e DCMDICTPATH environment variable.
It is an error if no data dictionary can be loaded.

\section see_also SEE ALSO

<b>dcmdjpeg</b>(1)

\section copyright COPYRIGHT

Copyright (C) 2001-2010 by OFFIS e.V., Escherweg 2, 26121 Oldenburg, Germany.

*/