1dcm2pnm(1) OFFIS DCMTK dcm2pnm(1)
2
3
4
6 dcm2pnm - Convert DICOM images to PGM/PPM, PNG, TIFF or BMP
7
9 dcm2pnm [options] dcmfile-in [bitmap-out]
10
12 The dcm2pnm utility reads a DICOM image, converts the pixel data
13 according to the selected image processing options and writes back an
14 image in the well-known PGM/PPM (portable gray map / portable pix map),
15 PNG, TIFF or Windows BMP format. This utility only supports
16 uncompressed and RLE compressed DICOM images. The command line tool
17 dcmj2pnm also supports a number of JPEG compression schemes.
18
20 dcmfile-in DICOM input filename to be converted
21
22 bitmap-out output filename to be written (default: stdout)
23
25 general options
26 -h --help
27 print this help text and exit
28
29 --version
30 print version information and exit
31
32 --arguments
33 print expanded command line arguments
34
35 -q --quiet
36 quiet mode, print no warnings and errors
37
38 -v --verbose
39 verbose mode, print processing details
40
41 -d --debug
42 debug mode, print debug information
43
44 -ll --log-level [l]evel: string constant
45 (fatal, error, warn, info, debug, trace)
46 use level l for the logger
47
48 -lc --log-config [f]ilename: string
49 use config file f for the logger
50
51 input options
52 input file format:
53
54 +f --read-file
55 read file format or data set (default)
56
57 +fo --read-file-only
58 read file format only
59
60 -f --read-dataset
61 read data set without file meta information
62
63 input transfer syntax:
64
65 -t= --read-xfer-auto
66 use TS recognition (default)
67
68 -td --read-xfer-detect
69 ignore TS specified in the file meta header
70
71 -te --read-xfer-little
72 read with explicit VR little endian TS
73
74 -tb --read-xfer-big
75 read with explicit VR big endian TS
76
77 -ti --read-xfer-implicit
78 read with implicit VR little endian TS
79
80 image processing options
81 frame selection:
82
83 +F --frame [n]umber: integer
84 select specified frame (default: 1)
85
86 +Fr --frame-range [n]umber [c]ount: integer
87 select c frames beginning with frame n
88
89 +Fa --all-frames
90 select all frames
91
92 rotation:
93
94 +Rl --rotate-left
95 rotate image left (-90 degrees)
96
97 +Rr --rotate-right
98 rotate image right (+90 degrees)
99
100 +Rtd --rotate-top-down
101 rotate image top-down (180 degrees)
102
103 flipping:
104
105 +Lh --flip-horizontally
106 flip image horizontally
107
108 +Lv --flip-vertically
109 flip image vertically
110
111 +Lhv --flip-both-axes
112 flip image horizontally and vertically
113
114 scaling:
115
116 +a --recognize-aspect
117 recognize pixel aspect ratio (default)
118
119 -a --ignore-aspect
120 ignore pixel aspect ratio when scaling
121
122 +i --interpolate [n]umber of algorithm: integer
123 use interpolation when scaling (1..4, default: 1)
124
125 -i --no-interpolation
126 no interpolation when scaling
127
128 -S --no-scaling
129 no scaling, ignore pixel aspect ratio (default)
130
131 +Sxf --scale-x-factor [f]actor: float
132 scale x axis by factor, auto-compute y axis
133
134 +Syf --scale-y-factor [f]actor: float
135 scale y axis by factor, auto-compute x axis
136
137 +Sxv --scale-x-size [n]umber: integer
138 scale x axis to n pixels, auto-compute y axis
139
140 +Syv --scale-y-size [n]umber: integer
141 scale y axis to n pixels, auto-compute x axis
142
143 modality LUT transformation:
144
145 -M --no-modality
146 ignore stored modality LUT transformation
147
148 +M --use-modality
149 use modality LUT transformation (default)
150
151 VOI LUT transformation:
152
153 -W --no-windowing
154 no VOI windowing (default)
155
156 +Wi --use-window [n]umber: integer
157 use the n-th VOI window from image file
158
159 +Wl --use-voi-lut [n]umber: integer
160 use the n-th VOI look up table from image file
161
162 +Wm --min-max-window
163 compute VOI window using min-max algorithm
164
165 +Wn --min-max-window-n
166 compute VOI window using min-max algorithm,
167 ignoring extreme values
168
169 +Wr --roi-min-max-window [l]eft [t]op [w]idth [h]eight: integer
170 compute ROI window using min-max algorithm,
171 region of interest is specified by l,t,w,h
172
173 +Wh --histogram-window [n]umber: integer
174 compute VOI window using Histogram algorithm,
175 ignoring n percent
176
177 +Ww --set-window [c]enter [w]idth: float
178 compute VOI window using center c and width w
179
180 +Wfl --linear-function
181 set VOI LUT function to LINEAR
182
183 +Wfs --sigmoid-function
184 set VOI LUT function to SIGMOID
185
186 presentation LUT transformation:
187
188 +Pid --identity-shape
189 set presentation LUT shape to IDENTITY
190
191 +Piv --inverse-shape
192 set presentation LUT shape to INVERSE
193
194 +Pod --lin-od-shape
195 set presentation LUT shape to LIN OD
196
197 overlay:
198
199 -O --no-overlays
200 do not display overlays
201
202 +O --display-overlay [n]umber: integer
203 display overlay n (0..16, 0=all, default: +O 0)
204
205 +Omr --ovl-replace
206 use overlay mode "Replace"
207 (default for Graphic overlays)
208
209 +Omt --ovl-threshold
210 use overlay mode "Threshold Replace"
211
212 +Omc --ovl-complement
213 use overlay mode "Complement"
214
215 +Omv --ovl-invert
216 use overlay mode "Invert Bitmap"
217
218 +Omi --ovl-roi
219 use overlay mode "Region of Interest"
220 (default for ROI overlays)
221
222 +Osf --set-foreground [d]ensity: float
223 set overlay foreground density (0..1, default: 1)
224
225 +Ost --set-threshold [d]ensity: float
226 set overlay threshold density (0..1, default: 0.5)
227
228 display LUT transformation:
229
230 +Dm --monitor-file [f]ilename: string
231 calibrate output according to monitor characteristics
232 defined in f
233
234 +Dp --printer-file [f]ilename: string
235 calibrate output according to printer characteristics
236 defined in f
237
238 +Da --ambient-light [a]mbient light: float
239 ambient light value (cd/m^2, default: file f)
240
241 +Di --illumination [i]llumination: float
242 illumination value (cd/m^2, default: file f)
243
244 +Dn --min-density [m]inimum optical density: float
245 Dmin value (default: off, only with +Dp)
246
247 +Dx --max-density [m]aximum optical density: float
248 Dmax value (default: off, only with +Dp)
249
250 +Dg --gsd-function
251 use GSDF for calibration (default for +Dm/+Dp)
252
253 +Dc --cielab-function
254 use CIELAB function for calibration
255
256 compatibility:
257
258 +Ma --accept-acr-nema
259 accept ACR-NEMA images without photometric
260 interpretation
261
262 +Mp --accept-palettes
263 accept incorrect palette attribute tags
264 (0028,111x) and (0028,121x)
265
266 +Mc --check-lut-depth
267 check 3rd value of the LUT descriptor, compare
268 with expected bit depth based on LUT data
269
270 +Mm --ignore-mlut-depth
271 ignore 3rd value of the modality LUT descriptor,
272 determine bits per table entry automatically
273
274 +Mv --ignore-vlut-depth
275 ignore 3rd value of the VOI LUT descriptor,
276 determine bits per table entry automatically
277
278 TIFF format:
279
280 +Tl --compr-lzw
281 LZW compression (default)
282
283 +Tr --compr-rle
284 RLE compression
285
286 +Tn --compr-none
287 uncompressed
288
289 +Pd --predictor-default
290 no LZW predictor (default)
291
292 +Pn --predictor-none
293 LZW predictor 1 (no prediction)
294
295 +Ph --predictor-horz
296 LZW predictor 2 (horizontal differencing)
297
298 +Rs --rows-per-strip [r]ows: integer (default: 0)
299 rows per strip, default 8K per strip
300
301 PNG format:
302
303 +il --interlace
304 create interlaced file (default)
305
306 -il --nointerlace
307 create non-interlaced file
308
309 +mf --meta-file
310 create PNG file meta information (default)
311
312 -mf --meta-none
313 no PNG file meta information
314
315 other transformations:
316
317 +G --grayscale
318 convert to grayscale if necessary
319
320 +P --change-polarity
321 change polarity (invert pixel output)
322
323 +C --clip-region [l]eft [t]op [w]idth [h]eight: integer
324 clip image region (l, t, w, h)
325
326 output options
327 general:
328
329 -im --image-info
330 print image details (requires verbose mode)
331
332 -o --no-output
333 do not create any output (useful with -im)
334
335 image format:
336
337 +op --write-raw-pnm
338 write 8-bit binary PGM/PPM (default for files)
339
340 +opb --write-8-bit-pnm
341 write 8-bit ASCII PGM/PPM (default for stdout)
342
343 +opw --write-16-bit-pnm
344 write 16-bit ASCII PGM/PPM
345
346 +opn --write-n-bit-pnm [n]umber: integer
347 write n-bit ASCII PGM/PPM (1..32)
348
349 +ob --write-bmp
350 write 8-bit (monochrome) or 24-bit (color) BMP
351
352 +obp --write-8-bit-bmp
353 write 8-bit palette BMP (monochrome only)
354
355 +obt --write-24-bit-bmp
356 write 24-bit truecolor BMP
357
358 +obr --write-32-bit-bmp
359 write 32-bit truecolor BMP
360
361 +ot --write-tiff
362 write 8-bit (monochrome) or 24-bit (color) TIFF
363
364 +on --write-png
365 write 8-bit (monochrome) or 24-bit (color) PNG
366
368 The following preferred interpolation algorithms can be selected using
369 the --interpolate option:
370
371 · 1 = free scaling algorithm with interpolation from pbmplus toolkit
372 · 2 = free scaling algorithm with interpolation from c't magazine
373 · 3 = magnification algorithm with bilinear interpolation from Eduard
374 Stanescu
375 · 4 = magnification algorithm with bicubic interpolation from Eduard
376 Stanescu
377 The --write-tiff option is only available when DCMTK has been
378 configured and compiled with support for the external libtiff TIFF
379 library. The availability of the TIFF compression options depends on
380 the libtiff configuration. In particular, the patented LZW algorithm
381 may not be available.
382 The --write-png option is only available when DCMTK has been configured
383 and compiled with support for the external libpng PNG library. Option
384 --interlace enables progressive image view while loading the PNG file.
385 Only a few applications take care of the meta info (TEXT) in a PNG
386 file.
388 dcm2pnm supports the following transfer syntaxes for input (dcmfile-
389 in):
390 LittleEndianImplicitTransferSyntax 1.2.840.10008.1.2
391 LittleEndianExplicitTransferSyntax 1.2.840.10008.1.2.1
392 DeflatedExplicitVRLittleEndianTransferSyntax 1.2.840.10008.1.2.1.99 (*)
393 BigEndianExplicitTransferSyntax 1.2.840.10008.1.2.2
394 RLELosslessTransferSyntax 1.2.840.10008.1.2.5
395 (*) if compiled with zlib support enabled
397 The level of logging output of the various command line tools and
398 underlying libraries can be specified by the user. By default, only
399 errors and warnings are written to the standard error stream. Using
400 option --verbose also informational messages like processing details
401 are reported. Option --debug can be used to get more details on the
402 internal activity, e.g. for debugging purposes. Other logging levels
403 can be selected using option --log-level. In --quiet mode only fatal
404 errors are reported. In such very severe error events, the application
405 will usually terminate. For more details on the different logging
406 levels, see documentation of module 'oflog'.
407 In case the logging output should be written to file (optionally with
408 logfile rotation), to syslog (Unix) or the event log (Windows) option
409 --log-config can be used. This configuration file also allows for
410 directing only certain messages to a particular output stream and for
411 filtering certain messages based on the module or application where
412 they are generated. An example configuration file is provided in
413 <etcdir>/logger.cfg).
415 All command line tools use the following notation for parameters:
416 square brackets enclose optional values (0-1), three trailing dots
417 indicate that multiple values are allowed (1-n), a combination of both
418 means 0 to n values.
419 Command line options are distinguished from parameters by a leading '+'
420 or '-' sign, respectively. Usually, order and position of command line
421 options are arbitrary (i.e. they can appear anywhere). However, if
422 options are mutually exclusive the rightmost appearance is used. This
423 behaviour conforms to the standard evaluation rules of common Unix
424 shells.
425 In addition, one or more command files can be specified using an '@'
426 sign as a prefix to the filename (e.g. @command.txt). Such a command
427 argument is replaced by the content of the corresponding text file
428 (multiple whitespaces are treated as a single separator unless they
429 appear between two quotation marks) prior to any further evaluation.
430 Please note that a command file cannot contain another command file.
431 This simple but effective approach allows to summarize common
432 combinations of options/parameters and avoids longish and confusing
433 command lines (an example is provided in file <datadir>/dumppat.txt).
435 The dcm2pnm utility will attempt to load DICOM data dictionaries
436 specified in the DCMDICTPATH environment variable. By default, i.e. if
437 the DCMDICTPATH environment variable is not set, the file
438 <datadir>/dicom.dic will be loaded unless the dictionary is built into
439 the application (default for Windows).
440 The default behaviour should be preferred and the DCMDICTPATH
441 environment variable only used when alternative data dictionaries are
442 required. The DCMDICTPATH environment variable has the same format as
443 the Unix shell PATH variable in that a colon (':') separates entries.
444 On Windows systems, a semicolon (';') is used as a separator. The data
445 dictionary code will attempt to load each file specified in the
446 DCMDICTPATH environment variable. It is an error if no data dictionary
447 can be loaded.
449 <datadir>/camera.lut - sample characteristics file of a camera
450 <datadir>/monitor.lut - sample characteristics file of a monitor
451 <datadir>/printer.lut - sample characteristics file of a printer
452 <datadir>/scanner.lut - sample characteristics file of a scanner
454 dcmj2pnm(1), img2dcm(1)
456 Copyright (C) 1998-2010 by OFFIS e.V., Escherweg 2, 26121 Oldenburg,
457 Germany.
458
459
460
461Version 3.6.0 6 Jan 2011 dcm2pnm(1)