Building dcm4che2


In order to build all components of the dcm4che2 toolkit you will need to download and install:

In addition, you will have to download the dcm4che2 source code from the dcm4che project at SourceForge, or get it directly from SVN:

svn co dcm4che2

There are two pieces to building dcm4che2: building the DICOM dictionary, and building the software itself. Building the dictionary is purely optional, as the standard dictionary is included in the application already. However, if you want to customize the dictionary, or add items to it that have not yet been included in the standard yet, then knowing how to build the dictionary is a good thing.

Building and Packaging

Building dcm4che2 is relatively easy, as Maven manages the dependencies for you. Assuming that you have the Maven executable scripts on your path... Simply navigate to the root of the dcm4che2 source directory structure, and type:

mvn install assembly:assembly

or (to avoid test failure in DicomImageWriterTest in versions prior to 2.0.20)

mvn install assembly:assembly -P nojiio

This will build distributions of the dcm4che2 toolkit. That's it! You may then find the zip distribution file in the target directory and copy/extract it to wherever you wish.

The DICOM Data Dictionary

/dcm4che2/dcm4che2-core is the project that contains the base dictionary files and the build script that generates the serialized file which gets included in the distribution. The DICOM standard is contained in an OpenOffice format. These documents are parsed using the appropriate DTD, and transformed (with XSL) into XML documents. These XML documents are then used as input to another XSL process which will generate,, dictionary.xml, and uids.xml. The two Java files are compiled later as part of the dcm4che-core build process. The two XML files are used to generate serialized data dictionaries which are accessed at run time. These data dictionaries are ElementDictionary.ser, UIDDictionary.ser, and VRMap.ser.

Currently the movement of the generated Java and XML files over to the /dcm4che2/dcm4che-core directory structure is manual, as well as the generation of the serialized data dictionaries.

Within this directory, you'll see the following structure:


The main directory contains the content subdirectories and the Ant build script. The content subdirectories can be described as follows:

  • dtd
    • This directory contains all of the DTD for OpenOffice documents. The file names within this directory have .mod, or .dtd extensions.
  • sxw
    • This directory contains the DICOM standard documents in format. These documents include Part 6 (Data Dictionary), Part 7 (Message Exchange), Correction Items, and appropriate Supplements which contain DICOM UIDs, VR definitions, and Tag mappings. All of these documents can be found in Microsoft Word format at the DICOM FTP site. The documents are opened with Writer, and then saved in that format (.sxw) to create the files within this directory.
  • xml
    • This directory contains XML definitions of what will get included when the stylesheets are applied to create the Tag and UID Java classes. After the OpenOffice DICOM standard documents have been rendered into XML, they will reside in the build target directory. The elements.xml and uids.xml files reference these generated XML files. There also exists a private-uids.xml file which contains UIDs which are mainly used by dcm4chee and other applications to initiate custom DICOM behavior.
  • xsl
    • This directory contains the XSL files which are used to perform all of the transformations on files. This includes transformation of the documents into XML (dictionary.xml, uids.xml), and XML documents into Java classes (,