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
PSNRhere, 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 comparisondcmfile-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 toLINEAR+Wfs,--sigmoid-functionβ set VOI LUT function toSIGMOID
π presentation LUT transformation π
+Pid,--identity-shapeβ set presentation LUT shape toIDENTITY+Piv,--inverse-shapeβ set presentation LUT shape toINVERSE+Pod,--lin-od-shapeβ set presentation LUT shape toLIN OD
π image comparison metrics options π
+ce,--check-error[l]imit: integerβ check if max absolute error<=limit. Returns exit codeEXITCODE_LIMIT_EXCEEDED_MAX_ERRORif 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 codeEXITCODE_LIMIT_EXCEEDED_MAEif 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 codeEXITCODE_LIMIT_EXCEEDED_RMSEif the computed root mean square error is larger than the given limit.+cp,--check-psnr[l]imit: floatβ check if PSNR>=limit. Returns exit codeEXITCODE_LIMIT_EXCEEDED_PSNRif 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 codeEXITCODE_LIMIT_EXCEEDED_PSNRβ yep,PSNRagain, notSNR, 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.2LittleEndianExplicitTransferSyntaxβ1.2.840.10008.1.2.1DeflatedExplicitVRLittleEndianTransferSyntaxβ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
0to1of them. - Three trailing dots mean multiple values are allowed β thatβs
1ton. - Combine both and you get
0tonvalues. 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 π
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
- arch rolling: dcmtk 3.7.1-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms