GDCM plugin for Orthanc

This official plugin extends Orthanc with a decoder/transcoder of DICOM images that takes advantage of the Grassroots GDCM library.

This plugin notably replaces the built-in decoder/transcoder of Orthanc that internally uses DCMTK. This is notably necessary to deal with DICOM images encoded using JPEG2000, as this format is not readily supported by the core version of DCMTK.

History

Originally, this plugin was a sample snippet that was shipped with the source code of Orthanc versions below 1.7.0, in the folder Plugins/Samples/GdcmDecoder/. This sample code was itself bundled in the Orthanc Web viewer (up to release 2.5) and in the Osimis Web viewer plugins (up to releases 1.3.x).

In May 2020, starting with Orthanc 1.7.0, as a part of the large refactoring necessary to implement transcoding, the GDCM plugin was migrated as separate plugin. The reasons are twofold:

  • To avoid redundancies between the two viewers, and to improve performance by avoiding multiple calls to GDCM on unsupported DICOM instances.
  • To uncouple the viewers and the DICOMweb plugins from the dependency on GDCM. This notably allows to more easily follow new releases of the GDCM library.

Compilation

The procedure to compile this plugin is similar of that for the core of Orthanc. The following commands should work for every UNIX-like distribution (including GNU/Linux):

$ mkdir Build
$ cd Build
$ cmake .. -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release
$ make

The compilation will produce a shared library OrthancGdcm that contains the GDCM decoder/transcoder plugin. Pre-compiled binaries for Microsoft Windows are also available.

Remark: Some older build instructions are also available in the source distribution.

Usage

You of course first have to install Orthanc. Once Orthanc is installed, you must change the configuration file to tell Orthanc where it can find the plugin: This is done by properly modifying the Plugins option. You could for instance use the following configuration file:

{
  "Name" : "MyOrthanc",
  [...]
  "Plugins" : [
    "/home/user/OrthancGdcm/Build/libOrthancGdcm.so"
  ]
}

Orthanc must of course be restarted after the modification of its configuration file. Carefully inspect the logs to make sure that the GDCM plugin is properly loaded.

Advanced options

The configuration of the GDCM plugin can be fine-tuned by adding some options:

{
  "Name" : "MyOrthanc",
  [...]
  "Plugins" : [
    "/home/user/OrthancGdcm/Build/libOrthancGdcm.so"
  ],
  "Gdcm" : {
    "Enable" : false,
    "Throttling" : 4
  },
  "BuiltinDecoderTranscoderOrder" : "After"
}
  • Enable specifies whether the GDCM decoder/transcoder is enabled. By default, this option is set to true.
  • Throttling specifies the maximum number of threads that can simultaneously call the GDCM decoder/transcoder. This is useful to avoid uncontrolled CPU or RAM usage if many people are connected to the same Orthanc server. By default, no throttling is applied, and an unrestricted number of threads can call GDCM simultaneously.
  • Starting with Orthanc 1.7.0, BuiltinDecoderTranscoderOrder is a configuration option of the Orthanc core (i.e. outside of the Gdcm section) that can be used to control whether the built-in DCMTK decoder/transcoder is applied before or after GDCM.

As a complement to the Enable option, you also have the possibility to restrict the GDCM decoder/transcoder to some specific transfer syntaxes using the RestrictTransferSyntaxes option. For instance, the following configuration would use GDCM to decode JPEG 2000 images, while using DCMTK to decode the other transfer syntaxes:

{
  [...]
  "Gdcm" : {
    "Enable" : true,
    "RestrictTransferSyntaxes" : [
      "1.2.840.10008.1.2.4.90",   // JPEG 2000 Image Compression (Lossless Only)
      "1.2.840.10008.1.2.4.91",   // JPEG 2000 Image Compression
      "1.2.840.10008.1.2.4.92",   // JPEG 2000 Part 2 Multicomponent Image Compression (Lossless Only)
      "1.2.840.10008.1.2.4.93"    // JPEG 2000 Part 2 Multicomponent Image Compression
    ]
  }
}