dcmicmp(1)

πŸŽ€ NAME πŸŽ€

Bestie, meet dcmicmp β€” compare DICOM images and compute difference metrics. This is the OFFIS DCMTK manual page dcmicmp(1), and she is here to help you vibe-check two DICOM images against each other. πŸ’…βœ¨


✨ SYNOPSIS ✨

dcmicmp [options] dcmfile-in-1 dcmfile-in-2

πŸ’– DESCRIPTION πŸ’–

Okay so dcmicmp reads two DICOM images: an original "referenceimage" β€” yep, that's literally how it's written in the page, no space, iconic β€” and a post-processed "test image". The test image is the one that had some kind of processing applied, like a lossy image compression followed by decompression. 🫢

This tool requires that both images have the same resolution, the same number of frames, and are either both color or both monochrome. Compressed images are not supported, bestie. Not even a little.

Then dcmicmp compares both images and computes and prints metrics that describe how similar or different they are:

  • The maximum absolute error is the largest difference between a pixel value in the reference image and the corresponding pixel value in the test image.
  • The mean absolute error (MAE) is the average difference between original pixel value and test image pixel value.
  • The root mean square error (RMSE) is computed by adding the squares of all difference values, then dividing by the number of values added, and then taking the square root.
  • The peak signal to noise ratio (PSNR) considers the reference image as a signal and the differences between reference and test image as noise. PSNR is the maximum signal strength (i.e. maximum pixel value in the reference image) divided by the RMSE, expressed on a logarithmic scale in dB.
  • The signal to noise ratio (PSNR) β€” yes, the original page literally labels it PSNR here, keeping that chaotic energy 😭 β€” also considers the reference image as a signal and the differences between reference and test image as noise. SNR is the average signal strength divided by the RMSE, expressed on a logarithmic scale in dB.

All metrics are computed as defined in R.C. Gonzalez and R.E. Woods, "Digital Image Processing," Prentice Hall 2008. πŸ“šβœ¨


🌸 PARAMETERS 🌸

  • dcmfile-in-1 β€” reference DICOM image file for comparison
  • dcmfile-in-2 β€” test DICOM image file for comparison ("-" for stdin)

πŸ’… OPTIONS πŸ’…

🌈 general options 🌈

  • -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

πŸ¦‹ input options πŸ¦‹

πŸ“ 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

πŸ”₯ image processing options πŸ”₯

πŸ’œ modality LUT transformation πŸ’œ

  • +M, --use-modality β€” use modality LUT transformation (default)
  • -M, --no-modality β€” ignore stored modality LUT transformation

πŸ’œ VOI LUT transformation πŸ’œ

  • -W, --no-windowing β€” no VOI windowing (default)
  • +Wi, --use-window [n]umber: integer β€” use the n-th VOI window from image file
  • +Wl, --use-voi-lut [n]umber: integer β€” use the n-th VOI look up table from image file
  • +Wm, --min-max-window β€” compute VOI window using min-max algorithm on both images separately
  • +Wn, --min-max-window-n β€” compute VOI window using min-max algorithm on both images separately, ignoring extremes
  • +Wr, --min-max-ref β€” compute VOI window using min-max algorithm and use same window for the test image
  • +Wq, --min-max-n-ref β€” compute VOI window using min-max algorithm, ignoring extreme values and use same window for the test image
  • +Ww, --set-window [c]enter [w]idth: float β€” compute VOI window using center c and width w
  • +Wfl, --linear-function β€” set VOI LUT function to LINEAR
  • +Wfs, --sigmoid-function β€” set VOI LUT function to SIGMOID

πŸ’œ presentation LUT transformation πŸ’œ

  • +Pid, --identity-shape β€” set presentation LUT shape to IDENTITY
  • +Piv, --inverse-shape β€” set presentation LUT shape to INVERSE
  • +Pod, --lin-od-shape β€” set presentation LUT shape to LIN OD

πŸ‘‘ image comparison metrics options πŸ‘‘

  • +ce, --check-error [l]imit: integer β€” check if max absolute error <= limit. Returns exit code EXITCODE_LIMIT_EXCEEDED_MAX_ERROR if the computed maximum absolute error is larger than the given limit.
  • +cm, --check-mae [l]imit: float β€” check if mean absolute error <= limit. Returns exit code EXITCODE_LIMIT_EXCEEDED_MAE if the computed mean absolute error is larger than the given limit.
  • +cr, --check-rmse [l]imit: float β€” check if root mean square error <= limit. Returns exit code EXITCODE_LIMIT_EXCEEDED_RMSE if the computed root mean square error is larger than the given limit.
  • +cp, --check-psnr [l]imit: float β€” check if PSNR >= limit. Returns exit code EXITCODE_LIMIT_EXCEEDED_PSNR if the computed peak signal to noise ratio is smaller than the given limit (for PSNR, higher values mean better image quality).
  • +cs, --check-snr [l]imit: float β€” check if SNR >= limit. Returns exit code EXITCODE_LIMIT_EXCEEDED_PSNR β€” yep, PSNR again, not SNR, that's what the page says 😭 β€” if the computed signal to noise ratio is smaller than the given limit (for SNR, higher values mean better image quality).

πŸŽ€ output options πŸŽ€

  • +sd, --save-diff [f]ilename: string β€” write secondary capture difference image. Creates a Multiframe Secondary Capture image that contains a difference image between reference and test image. For monochrome images, one difference frame is created for each frame in the reference image. For color images, three monochrome frames are created for each frame in the reference image, corresponding to the differences in the red, green and blue color plane. The difference image will have BitsStored 8 or 16, depending on the properties of the reference image.
  • +a, --amplify [f]actor: float β€” multiply diff image pixel values by f. This option can be used to amplify the grayscale values in the difference image by multiplying each value with the given factor. Alternatively, a DICOM VOI LUT window may be used when visualizing the difference image.

πŸ’œ NOTES πŸ’œ

🩺 grayscale display pipeline 🩺

Monochrome DICOM images require that a multi-stage display pipeline is executed in order to convert the raw pixel values to the so-called presentation values (p-values) that are sent to the (possibly calibrated) display. When comparing the similarity of images before and after post-processing, it can be relevant to activate some stages of this display pipeline before calculating the difference image and metrics.

The image processing options allow the caller to either activate or deactivate the Modality LUT, VOI LUT and Presentation LUT transformations. In any case, the same transformation is applied to both images, although possibly with different parameters if for example the "first VOI LUT window" stored in each image is applied.

This assumes that the post-processing algorithm (e.g. compression algorithm) has adapted the values of such windows during compression such that the image display after applying the window is as close as possible to the reference. For images with more than 8 bits/sample it may be important to known β€” yes, known, that's the page's typo, not mine, bestie 😭 β€” which VOI LUT transformation will be applied by the user when viewing the image, because this may affect the perceived image quality. Therefore, absolute Window parameters can also be given with the --set-window option, which will then be applied to both images.

🩺 suitability of images for diagnostic purposes 🩺

The user should also note that the metrics computed by this tool cannot predict or estimate the suitability of lossy compressed image for diagnostic purposes. Much more complex image processing and an understanding of the image content (e.g. body part) would be needed for this purpose. The metrics computed provide an estimation of the level of distortion caused by the post-processing β€” no more and no less. Periodt. πŸ’…


🌈 TRANSFER SYNTAXES 🌈

dcmicmp supports the following transfer syntaxes for input:

  • 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

The difference image file is always written in Little Endian Implicit Transfer Syntax.

(*) if compiled with zlib support enabled


⭐ 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 --verbose also informational messages like processing details are reported. 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. 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 --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. 🫢✨

πŸ’¬ COMMAND LINE πŸ’¬

Okay so every single one of these command line tools uses the same notation for parameters, and honestly it’s giving consistency:

  • Square brackets enclose optional values β€” that’s 0 to 1 of them.
  • Three trailing dots mean multiple values are allowed β€” that’s 1 to n.
  • Combine both and you get 0 to n values. Slay.

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. No cap.

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. That’s the rule, bestie 🫢


πŸšͺ EXIT CODES πŸšͺ

The dcmicmp utility uses the following exit codes when terminating. This enables the user to check for the reason why the application terminated.

🌸 general 🌸

EXITCODE_NO_ERROR                         0
EXITCODE_COMMANDLINE_SYNTAX_ERROR         1

🫢 input/output file errors 🫢

EXITCODE_INVALID_INPUT_FILE              22
EXITCODE_CANNOT_WRITE_OUTPUT_FILE        40

πŸ’… image processing errors πŸ’…

EXITCODE_INITIALIZE_DIFF_IMAGE           80
EXITCODE_DISPLAY_PIPELINE                81
EXITCODE_IMAGE_COMPARISON                82

πŸ”₯ error codes for exceeded limits πŸ”₯

EXITCODE_LIMIT_EXCEEDED_MAX_ERROR        90
EXITCODE_LIMIT_EXCEEDED_MAE              91
EXITCODE_LIMIT_EXCEEDED_RMSE             92
EXITCODE_LIMIT_EXCEEDED_PSNR             93
EXITCODE_LIMIT_EXCEEDED_SNR              94

🌱 ENVIRONMENT 🌱

The dcmicmp 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. It is an error if no data dictionary can be loaded. So yeah, don’t leave it empty and expect magic πŸ’€


πŸ‘€ SEE ALSO πŸ‘€


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


This iconic page is Version 3.7.1, dated Sat Oct 17 2026 09:34:01. Bye bestie, go compare some images πŸ’–βœ¨

πŸ“¦ where this page comes from