dcmp2pgm(1)

πŸ’… dcmp2pgm(1) β€” the OFFIS DCMTK girlies' cut

okay so welcome to dcmp2pgm, a member of the OFFIS DCMTK family πŸ’– this is her manual page, and yes we're gonna read the whole thing together, bestie. grab a strawberry πŸ“


✨ NAME ✨

dcmp2pgm β€” read a DICOM image plus a presentation state, and render a bitmap. that's it, that's the whole vibe πŸŽ€


🌸 SYNOPSIS 🌸

dcmp2pgm [options] dcmimage-in [bitmap-out]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so picture this: the dcmp2pgm utility renders a monochrome DICOM image into a monochrome bitmap with 8 bits/pixel, and it does this under the control of a grayscale softcopy presentation state object β€” like the presentation state is the director and the image is the main character, honestly πŸ‘‘

the bitmap gets stored either as a "Portable Gray Map" (PGM) or as a DICOM secondary capture image object. your call, no pressure.

and here's the cute part: if no presentation state is read from file, a default presentation state is created. she's got a backup plan, she's thriving πŸ’…

the utility also lets you read a configuration file of the Softcopy Presentation State Viewer upon startup ✨ in that case, the settings from the configuration file that affect the rendering of the presentation state get used. for example, a correction of the gray scale range according to Barten's model (DICOM part 14) can be performed β€” but only if the characteristic curve of the display system is available and defined in the configuration file. iykyk 🌈


🧚 PARAMETERS 🧚

  • dcmimage-in β€” the input DICOM image (- for stdin). yes bestie, a literal dash means stdin, she's flexible like that 🫢
  • bitmap-out β€” the output DICOM image or PGM bitmap.

πŸ’œ OPTIONS πŸ’œ

general options πŸŽ€

  • -h, --help β€” print this help text and exit. the classic "what does anything do" move 😭
  • --version β€” print version information and exit.
  • --arguments β€” print expanded command line arguments. love a receipts moment.
  • -q, --quiet β€” quiet mode, print no warnings and errors. she's not taking questions πŸ™ˆ
  • -v, --verbose β€” verbose mode, print processing details. she IS taking questions and answering all of them πŸ”₯
  • -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.

processing options ⭐

  • -p, --pstate [f]ilename: string β€” process using presentation state file.
  • -c, --config [f]ilename: string β€” process using settings from configuration file.
  • -f, --frame [f]rame: integer β€” process using image frame f (default: 1).

output format 🌸

  • -D, --pgm β€” save image as PGM (default).
  • +D, --dicom β€” save image as DICOM secondary capture.

output options πŸ¦‹

  • +S, --save-pstate [f]ilename: string β€” save presentation state to file.

πŸ’€ NOTES πŸ’€

limitations 😭

bestie, real talk. please note that the dcmp2pgm tool does not render all aspects that are defined by the Grayscale Softcopy Presentation State (GSPS) object β€” only those that are supported by the underlying DCMTK classes. so she's giving what she can give, not everything πŸ’…

in particular, textual and graphical annotations will not be visible in the output image. the reason is that these aspects of a GSPS object are typically rendered by DICOMscope, the graphical user interface that is put on top of the related DCMTK classes and written in Java. different tool, different job, no beef 🫢

also: concepts that were introduced after the initial definition of the GSPS IOD (see Supplement 33) are ignored. this includes Supplement 120 with its extended features like e.g. Compound Graphics. not her era, not her problem πŸ™ˆ


πŸ”₯ LOGGING πŸ”₯

okay so 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 --verbose also gets you informational messages like processing details. option --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 --log-level.

in --quiet mode only fatal errors are reported β€” and in such very severe error events, the application will usually terminate. so like, she's quiet but she's also leaving πŸ’€

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 --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 <etcdir>/logger.cfg. slay πŸŽ€


πŸ‘‘ 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), and a combination of both means 0 to n values. iconic syntax behavior, honestly.

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 behavior conforms to the standard evaluation rules of common Unix shells. rightmost wins, periodt πŸ’…

in addition, one or more command files can be specified using an @ sign as a prefix to the filename (e.g. @command.txt). 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. no inception, bestie.

this simple but effective approach allows one to summarize common combinations of options/parameters and avoids longish and confusing command lines (an example is provided in file <datadir>/dumppat.txt). she's efficient AND cute 🌟


🌈 ENVIRONMENT 🌈

the dcmp2pgm utility will attempt to load DICOM data dictionaries specified in the DCMDICTPATH environment variable. by default, i.e. if the DCMDICTPATH environment variable is not set, the file <datadir>/dicom.dic will be loaded β€” unless the dictionary is built into the application (default for Windows).

the default behavior should be preferred, and the DCMDICTPATH environment variable only used when alternative data dictionaries are required 🫢 the DCMDICTPATH environment variable has the same format as the Unix shell 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 DCMDICTPATH environment variable. and it is an error if no data dictionary can be loaded. no dictionary, no service 😭


πŸŽ€ FILES πŸŽ€

  • <etcdir>/dcmpstat.cfg β€” sample configuration file. peek at it, she left you a template πŸ’–

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


okay that's the whole page, you ate that πŸ’… this was Version 3.7.1, dated Sat Oct 17 2026 09:34:01 β€” go forth and render, bestie, and remember: annotations still won't show up, and that's not her fault πŸ¦‹πŸ’–

πŸ“¦ where this page comes from