# HG changeset patch # User Sebastien Jodogne # Date 1458923914 -3600 # Node ID 5754d39b011d4feaff7fbb745efa439bfc3f50bb # Parent f99adade8b776bb1d8da8c97d750209da730641d Option "EnableGdcm" to replace the built-in decoder of Orthanc with GDCM diff -r f99adade8b77 -r 5754d39b011d NEWS --- a/NEWS Fri Mar 25 11:55:35 2016 +0100 +++ b/NEWS Fri Mar 25 17:38:34 2016 +0100 @@ -1,6 +1,7 @@ Pending changes in the mainline =============================== +* Option "EnableGdcm" to replace the built-in decoder of Orthanc with GDCM * Fixed rendering of 16bpp images if values are < 0 or >= 32768 diff -r f99adade8b77 -r 5754d39b011d Plugin/Plugin.cpp --- a/Plugin/Plugin.cpp Fri Mar 25 11:55:35 2016 +0100 +++ b/Plugin/Plugin.cpp Fri Mar 25 17:38:34 2016 +0100 @@ -390,10 +390,6 @@ OrthancPluginSetDescription(context_, "Provides a Web viewer of DICOM series within Orthanc."); - // Replace the default decoder of DICOM images that is built in Orthanc - OrthancPluginRegisterDecodeImageCallback(context_, DecodeImageCallback); - - /* By default, use half of the available processing cores for the decoding of DICOM images */ int decodingThreads = boost::thread::hardware_concurrency() / 2; if (decodingThreads == 0) @@ -401,6 +397,9 @@ decodingThreads = 1; } + /* By default, use GDCM */ + bool enableGdcm = true; + try { @@ -430,6 +429,12 @@ cachePath = GetStringValue(configuration["WebViewer"], key, cachePath.string()); cacheSize = GetIntegerValue(configuration["WebViewer"], "CacheSize", cacheSize); decodingThreads = GetIntegerValue(configuration["WebViewer"], "Threads", decodingThreads); + + if (configuration["WebViewer"].isMember("EnableGdcm") && + configuration["WebViewer"]["EnableGdcm"].type() == Json::booleanValue) + { + enableGdcm = configuration["WebViewer"]["EnableGdcm"].asBool(); + } } std::string message = ("Web viewer using " + boost::lexical_cast(decodingThreads) + @@ -515,6 +520,19 @@ } + /* Configure the DICOM decoder */ + if (enableGdcm) + { + // Replace the default decoder of DICOM images that is built in Orthanc + OrthancPluginLogWarning(context_, "Using GDCM instead of the DICOM decoder that is built in Orthanc"); + OrthancPluginRegisterDecodeImageCallback(context_, DecodeImageCallback); + } + else + { + OrthancPluginLogWarning(context_, "Using the DICOM decoder that is built in Orthanc (not using GDCM)"); + } + + /* Install the callbacks */ OrthancPluginRegisterRestCallback(context_, "/web-viewer/series/(.*)", ServeCache); OrthancPluginRegisterRestCallback(context_, "/web-viewer/is-stable-series/(.*)", IsStableSeries);