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

NAME

6       dcmj2pnm - Convert DICOM images to PGM/PPM, PNG, TIFF, JPEG or BMP
7
8

SYNOPSIS

10       dcmj2pnm [options] dcmfile-in [bitmap-out]
11

DESCRIPTION

13       The  dcmj2pnm  utility  reads  a  DICOM  image, converts the pixel data
14       according to the selected image processing options and writes  back  an
15       image in the well-known PGM/PPM (portable gray map / portable pix map),
16       PNG, TIFF, JPEG (Joint  Photographic  Experts  Group)  or  Windows  BMP
17       format.  This  utility  supports  uncompressed  as well as JPEG and RLE
18       compressed DICOM images.
19

PARAMETERS

21       dcmfile-in  DICOM input filename to be converted
22
23       bitmap-out  output filename to be written (default: stdout)
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       input file format:
54
55         +f    --read-file
56                 read file format or data set (default)
57
58         +fo   --read-file-only
59                 read file format only
60
61         -f    --read-dataset
62                 read data set without file meta information
63
64       input transfer syntax:
65
66         -t=   --read-xfer-auto
67                 use TS recognition (default)
68
69         -td   --read-xfer-detect
70                 ignore TS specified in the file meta header
71
72         -te   --read-xfer-little
73                 read with explicit VR little endian TS
74
75         -tb   --read-xfer-big
76                 read with explicit VR big endian TS
77
78         -ti   --read-xfer-implicit
79                 read with implicit VR little endian TS
80
81   image processing options
82       frame selection:
83
84         +F    --frame  [n]umber: integer
85                 select specified frame (default: 1)
86
87         +Fr   --frame-range  [n]umber [c]ount: integer
88                 select c frames beginning with frame n
89
90         +Fa   --all-frames
91                 select all frames
92
93       rotation:
94
95         +Rl   --rotate-left
96                 rotate image left (-90 degrees)
97
98         +Rr   --rotate-right
99                 rotate image right (+90 degrees)
100
101         +Rtd  --rotate-top-down
102                 rotate image top-down (180 degrees)
103
104       flipping:
105
106         +Lh   --flip-horizontally
107                 flip image horizontally
108
109         +Lv   --flip-vertically
110                 flip image vertically
111
112         +Lhv  --flip-both-axes
113                 flip image horizontally and vertically
114
115       scaling:
116
117         +a    --recognize-aspect
118                 recognize pixel aspect ratio when scaling (default)
119
120         -a    --ignore-aspect
121                 ignore pixel aspect ratio when scaling
122
123         +i    --interpolate  [n]umber of algorithm: integer
124                 use interpolation when scaling (1..4, default: 1)
125
126         -i    --no-interpolation
127                 no interpolation when scaling
128
129         -S    --no-scaling
130                 no scaling, ignore pixel aspect ratio (default)
131
132         +Sxf  --scale-x-factor  [f]actor: float
133                 scale x axis by factor, auto-compute y axis
134
135         +Syf  --scale-y-factor  [f]actor: float
136                 scale y axis by factor, auto-compute x axis
137
138         +Sxv  --scale-x-size  [n]umber: integer
139                 scale x axis to n pixels, auto-compute y axis
140
141         +Syv  --scale-y-size  [n]umber: integer
142                 scale y axis to n pixels, auto-compute x axis
143
144       color space conversion (JPEG compressed images only):
145
146         +cp   --conv-photometric
147                 convert if YCbCr photometric interpretation (default)
148
149         +cl   --conv-lossy
150                 convert YCbCr to RGB if lossy JPEG
151
152         +cg   --conv-guess
153                 convert to RGB if YCbCr is guessed by library
154
155         +cgl  --conv-guess-lossy
156                 convert to RGB if lossy JPEG and YCbCr is
157                 guessed by the underlying JPEG library
158
159         +ca   --conv-always
160                 always convert YCbCr to RGB
161
162         +cn   --conv-never
163                 never convert color space
164
165       workaround options for incorrect encodings (JPEG compressed images only):
166
167         +w6   --workaround-pred6
168                 enable workaround for JPEG lossless images
169                 with overflow in predictor 6
170
171         # DICOM images with 16 bits/pixel have been observed "in the wild"
172         # that are compressed with lossless JPEG and need special handling
173         # because the encoder produced an 16-bit integer overflow in predictor
174         # 6, which needs to be compensated (reproduced) during decompression.
175         # This flag enables a correct decompression of such faulty images, but
176         # at the same time will cause an incorrect decompression of correctly
177         # compressed images. Use with care.
178
179         +wi   --workaround-incpl
180                 enable workaround for incomplete JPEG data
181
182         # This option causes dcmj2pnm to ignore incomplete JPEG data
183         # at the end of a compressed fragment and to start decompressing
184         # the next frame from the next fragment (if any). This permits
185         # images with incomplete JPEG data to be decoded.
186
187         +wc   --workaround-cornell
188                 enable workaround for 16-bit JPEG lossless
189                 Cornell images with Huffman table overflow
190
191         # One of the first open-source implementations of lossless JPEG
192         # compression, the "Cornell" library, has a well-known bug that leads
193         # to invalid values in the Huffmann table when images with 16 bit/sample
194         # are compressed. This flag enables a workaround that permits such
195         # images to be decoded correctly.
196
197       modality LUT transformation:
198
199         -M    --no-modality
200                 ignore stored modality LUT transformation
201
202         +M    --use-modality
203                 use modality LUT transformation (default)
204
205       VOI LUT transformation:
206
207         -W    --no-windowing
208                 no VOI windowing (default)
209
210         +Wi   --use-window  [n]umber: integer
211                 use the n-th VOI window from image file
212
213         +Wl   --use-voi-lut  [n]umber: integer
214                 use the n-th VOI look up table from image file
215
216         +Wm   --min-max-window
217                 compute VOI window using min-max algorithm
218
219         +Wn   --min-max-window-n
220                 compute VOI window using min-max algorithm,
221                 ignoring extreme values
222
223         +Wr   --roi-min-max-window  [l]eft [t]op [w]idth [h]eight: integer
224                 compute ROI window using min-max algorithm,
225                 region of interest is specified by l,t,w,h
226
227         +Wh   --histogram-window  [n]umber: integer
228                 compute VOI window using Histogram algorithm,
229                 ignoring n percent
230
231         +Ww   --set-window  [c]enter [w]idth: float
232                 compute VOI window using center c and width w
233
234         +Wfl  --linear-function
235                 set VOI LUT function to LINEAR
236
237         +Wfs  --sigmoid-function
238                 set VOI LUT function to SIGMOID
239
240       presentation LUT transformation:
241
242         +Pid  --identity-shape
243                 set presentation LUT shape to IDENTITY
244
245         +Piv  --inverse-shape
246                 set presentation LUT shape to INVERSE
247
248         +Pod  --lin-od-shape
249                 set presentation LUT shape to LIN OD
250
251       overlay:
252
253         -O    --no-overlays
254                 do not display overlays
255
256         +O    --display-overlay  [n]umber: integer
257                 display overlay n (0..16, 0=all, default: +O 0)
258
259         +Omr  --ovl-replace
260                 use overlay mode "Replace"
261                 (default for Graphic overlays)
262
263         +Omt  --ovl-threshold
264                 use overlay mode "Threshold Replace"
265
266         +Omc  --ovl-complement
267                 use overlay mode "Complement"
268
269         +Omv  --ovl-invert
270                 use overlay mode "Invert Bitmap"
271
272         +Omi  --ovl-roi
273                 use overlay mode "Region of Interest"
274                 (default for ROI overlays)
275
276         +Osf  --set-foreground  [d]ensity: float
277                 set overlay foreground density (0..1, default: 1)
278
279         +Ost  --set-threshold  [d]ensity: float
280                 set overlay threshold density (0..1, default: 0.5)
281
282       display LUT transformation:
283
284         +Dm   --monitor-file  [f]ilename: string
285                 calibrate output according to monitor characteristics
286                 defined in f
287
288         +Dp   --printer-file  [f]ilename: string
289                 calibrate output according to printer characteristics
290                 defined in f
291
292         +Da   --ambient-light  [a]mbient light: float
293                 ambient light value (cd/m^2, default: file f)
294
295         +Di   --illumination  [i]llumination: float
296                 illumination value (cd/m^2, default: file f)
297
298         +Dn   --min-density  [m]inimum optical density: float
299                 Dmin value (default: off, only with +Dp)
300
301         +Dx   --max-density  [m]aximum optical density: float
302                 Dmax value (default: off, only with +Dp)
303
304         +Dg   --gsd-function
305                 use GSDF for calibration (default for +Dm/+Dp)
306
307         +Dc   --cielab-function
308                 use CIELAB function for calibration
309
310       compatibility:
311
312         +Ma   --accept-acr-nema
313                 accept ACR-NEMA images without photometric
314                 interpretation
315
316         +Mp   --accept-palettes
317                 accept incorrect palette attribute tags
318                 (0028,111x) and (0028,121x)
319
320         +Mc   --check-lut-depth
321                 check 3rd value of the LUT descriptor, compare
322                 with expected bit depth based on LUT data
323
324         +Mm   --ignore-mlut-depth
325                 ignore 3rd value of the modality LUT descriptor,
326                 determine bits per table entry automatically
327
328         +Mv   --ignore-vlut-depth
329                 ignore 3rd value of the VOI LUT descriptor,
330                 determine bits per table entry automatically
331
332       TIFF format:
333
334         +Tl   --compr-lzw
335                 LZW compression (default)
336
337         +Tr   --compr-rle
338                 RLE compression
339
340         +Tn   --compr-none
341                 uncompressed
342
343         +Pd   --predictor-default
344                 no LZW predictor (default)
345
346         +Pn   --predictor-none
347                 LZW predictor 1 (no prediction)
348
349         +Ph   --predictor-horz
350                 LZW predictor 2 (horizontal differencing)
351
352         +Rs   --rows-per-strip  [r]ows: integer (default: 0)
353                 rows per strip, default 8K per strip
354
355       PNG format:
356
357         +il   --interlace
358                 create interlaced file (default)
359
360         -il   --nointerlace
361                 create non-interlaced file
362
363         +mf   --meta-file
364                 create PNG file meta information (default)
365
366         -mf   --meta-none
367                 no PNG file meta information
368
369       JPEG format:
370
371         +Jq   --compr-quality  [q]uality: integer (0..100, default: 90)
372                 quality value for compression (in percent)
373
374         +Js4  --sample-444
375                 4:4:4 sampling (no subsampling)
376
377         +Js2  --sample-422
378                 4:2:2 subsampling (horizontal subsampling of
379                 chroma components, default)
380
381         +Js1  --sample-411
382                 4:1:1 subsampling (horizontal and vertical
383                 subsampling of chroma components)
384
385       other transformations:
386
387         +G    --grayscale
388                 convert color image to grayscale (monochrome)
389
390         +P    --change-polarity
391                 change polarity (invert pixel output)
392
393         +C    --clip-region  [l]eft [t]op [w]idth [h]eight: integer
394                 clip image region (l, t, w, h)
395
396   output options
397       general:
398
399         -im   --image-info
400                 print image details (requires verbose mode)
401
402         -o    --no-output
403                 do not create any output (useful with -im)
404
405       filename generation (only with --frame-range or --all-frames):
406
407         +Fc   --use-frame-counter
408                 use 0-based counter for filenames (default)
409
410         +Fn   --use-frame-number
411                 use absolute frame number for filenames
412
413       image format:
414
415         +op   --write-raw-pnm
416                 write 8-bit binary PGM/PPM (default for files)
417
418         +opb  --write-8-bit-pnm
419                 write 8-bit ASCII PGM/PPM (default for stdout)
420
421         +opw  --write-16-bit-pnm
422                 write 16-bit ASCII PGM/PPM
423
424         +opn  --write-n-bit-pnm  [n]umber: integer
425                 write n-bit ASCII PGM/PPM (1..32)
426
427         +ob   --write-bmp
428                 write 8-bit (monochrome) or 24-bit (color) BMP
429
430         +obp  --write-8-bit-bmp
431                 write 8-bit palette BMP (monochrome only)
432
433         +obt  --write-24-bit-bmp
434                 write 24-bit truecolor BMP
435
436         +obr  --write-32-bit-bmp
437                 write 32-bit truecolor BMP
438
439         +ot   --write-tiff
440                 write 8-bit (monochrome) or 24-bit (color) TIFF
441
442         +on   --write-png
443                 write 8-bit (monochrome) or 24-bit (color) PNG
444
445         +on2  --write-16-bit-png
446                 write 16-bit (monochrome) or 48-bit (color) PNG
447
448         +oj   --write-jpeg
449                 write 8-bit lossy JPEG (baseline)
450

NOTES

452       The following preferred interpolation algorithms can be selected  using
453       the --interpolate option:
454
455       • 1 = free scaling algorithm with interpolation from pbmplus toolkit
456       • 2 = free scaling algorithm with interpolation from c't magazine
457       • 3  =  magnification algorithm with bilinear interpolation from Eduard
458         Stanescu
459       • 4 = magnification algorithm with bicubic  interpolation  from  Eduard
460         Stanescu
461       The   --write-tiff  option  is  only  available  when  DCMTK  has  been
462       configured and compiled with support  for  the  external  libtiff  TIFF
463       library.  The  availability  of the TIFF compression options depends on
464       the libtiff configuration. In particular, the  patented  LZW  algorithm
465       may not be available.
466       The --write-png option is only available when DCMTK has been configured
467       and compiled with support for the external libpng PNG  library.  Option
468       --interlace  enables progressive image view while loading the PNG file.
469       Only a few applications take care of the meta  info  (TEXT)  in  a  PNG
470       file.

TRANSFER SYNTAXES

472       dcmj2pnm  supports  the following transfer syntaxes for input (dcmfile-
473       in):
474       LittleEndianImplicitTransferSyntax             1.2.840.10008.1.2
475       LittleEndianExplicitTransferSyntax             1.2.840.10008.1.2.1
476       DeflatedExplicitVRLittleEndianTransferSyntax   1.2.840.10008.1.2.1.99 (*)
477       BigEndianExplicitTransferSyntax                1.2.840.10008.1.2.2
478       JPEGProcess1TransferSyntax                     1.2.840.10008.1.2.4.50
479       JPEGProcess2_4TransferSyntax                   1.2.840.10008.1.2.4.51
480       JPEGProcess6_8TransferSyntax                   1.2.840.10008.1.2.4.53
481       JPEGProcess10_12TransferSyntax                 1.2.840.10008.1.2.4.55
482       JPEGProcess14TransferSyntax                    1.2.840.10008.1.2.4.57
483       JPEGProcess14SV1TransferSyntax                 1.2.840.10008.1.2.4.70
484       RLELosslessTransferSyntax                      1.2.840.10008.1.2.5
485       (*) if compiled with zlib support enabled

LOGGING

487       The level of logging output of  the  various  command  line  tools  and
488       underlying  libraries  can  be  specified by the user. By default, only
489       errors and warnings are written to the  standard  error  stream.  Using
490       option  --verbose  also  informational messages like processing details
491       are reported. Option --debug can be used to get  more  details  on  the
492       internal  activity,  e.g.  for debugging purposes. Other logging levels
493       can be selected using option --log-level. In --quiet  mode  only  fatal
494       errors  are reported. In such very severe error events, the application
495       will usually terminate. For  more  details  on  the  different  logging
496       levels, see documentation of module 'oflog'.
497       In  case  the logging output should be written to file (optionally with
498       logfile rotation), to syslog (Unix) or the event log  (Windows)  option
499       --log-config  can  be  used.  This  configuration  file also allows for
500       directing only certain messages to a particular output stream  and  for
501       filtering  certain  messages  based  on the module or application where
502       they are generated.  An  example  configuration  file  is  provided  in
503       <etcdir>/logger.cfg.

COMMAND LINE

505       All  command  line  tools  use  the  following notation for parameters:
506       square brackets enclose optional  values  (0-1),  three  trailing  dots
507       indicate  that multiple values are allowed (1-n), a combination of both
508       means 0 to n values.
509       Command line options are distinguished from parameters by a leading '+'
510       or  '-' sign, respectively. Usually, order and position of command line
511       options are arbitrary (i.e. they  can  appear  anywhere).  However,  if
512       options  are  mutually exclusive the rightmost appearance is used. This
513       behavior conforms to the  standard  evaluation  rules  of  common  Unix
514       shells.
515       In  addition,  one  or more command files can be specified using an '@'
516       sign as a prefix to the filename (e.g. @command.txt).  Such  a  command
517       argument  is  replaced  by  the  content of the corresponding text file
518       (multiple whitespaces are treated as a  single  separator  unless  they
519       appear  between  two  quotation marks) prior to any further evaluation.
520       Please note that a command file cannot contain  another  command  file.
521       This  simple  but  effective  approach  allows  one to summarize common
522       combinations of options/parameters and  avoids  longish  and  confusing
523       command lines (an example is provided in file <datadir>/dumppat.txt).

ENVIRONMENT

525       The  dcmj2pnm  utility  will  attempt  to  load DICOM data dictionaries
526       specified in the DCMDICTPATH environment variable. By default, i.e.  if
527       the   DCMDICTPATH   environment   variable   is   not   set,  the  file
528       <datadir>/dicom.dic will be loaded unless the dictionary is built  into
529       the application (default for Windows).
530       The   default   behavior   should  be  preferred  and  the  DCMDICTPATH
531       environment variable only used when alternative data  dictionaries  are
532       required.  The  DCMDICTPATH environment variable has the same format as
533       the Unix shell PATH variable in that a colon (':')  separates  entries.
534       On  Windows systems, a semicolon (';') is used as a separator. The data
535       dictionary code will  attempt  to  load  each  file  specified  in  the
536       DCMDICTPATH  environment variable. It is an error if no data dictionary
537       can be loaded.

FILES

539       <datadir>/camera.lut - sample characteristics file of a camera
540       <datadir>/monitor.lut - sample characteristics file of a monitor
541       <datadir>/printer.lut - sample characteristics file of a printer
542       <datadir>/scanner.lut - sample characteristics file of a scanner

SEE ALSO

544       dcm2pnm(1), img2dcm(1)
546       Copyright (C) 2001-2021 e.V., Escherweg 2, 26121 Oldenburg, Germany.
547
548
549
550Version 3.6.6                   Thu Jan 14 2021                    dcmj2pnm(1)
Impressum