Project

General

Profile

Howto: Compare the content of two DICOM files and show the differences

The following Unix shell script compares the content (textual dump) of two DICOM files and shows the differences. This script is based on dcdiff.script from David Clunie's dicom3tools:

#!/bin/sh

if [ $# != 2 ]
then
  echo "usage: `basename $0` file1 file2" 
  exit 1
fi

TMPFILE1=/tmp/`basename $0`.$$.tmp1
TMPFILE2=/tmp/`basename $0`.$$.tmp2

dcmdump -q -dc "$1" >"$TMPFILE1" 2>&1
dcmdump -q -dc "$2" >"$TMPFILE2" 2>&1
diff -a "$TMPFILE1" "$TMPFILE2" | colordiff

rm "$TMPFILE1" "$TMPFILE2" 

exit 0

Note

If colordiff is not available on your system, you can simply remove the "| colordiff" from the script.