Mercurial > hg > orthanc-webviewer
comparison Plugin/Plugin.cpp @ 127:5754d39b011d
Option "EnableGdcm" to replace the built-in decoder of Orthanc with GDCM
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Mar 2016 17:38:34 +0100 |
parents | 3809121c3290 |
children | 3251ec958a29 |
comparison
equal
deleted
inserted
replaced
126:f99adade8b77 | 127:5754d39b011d |
---|---|
388 } | 388 } |
389 | 389 |
390 OrthancPluginSetDescription(context_, "Provides a Web viewer of DICOM series within Orthanc."); | 390 OrthancPluginSetDescription(context_, "Provides a Web viewer of DICOM series within Orthanc."); |
391 | 391 |
392 | 392 |
393 // Replace the default decoder of DICOM images that is built in Orthanc | |
394 OrthancPluginRegisterDecodeImageCallback(context_, DecodeImageCallback); | |
395 | |
396 | |
397 /* By default, use half of the available processing cores for the decoding of DICOM images */ | 393 /* By default, use half of the available processing cores for the decoding of DICOM images */ |
398 int decodingThreads = boost::thread::hardware_concurrency() / 2; | 394 int decodingThreads = boost::thread::hardware_concurrency() / 2; |
399 if (decodingThreads == 0) | 395 if (decodingThreads == 0) |
400 { | 396 { |
401 decodingThreads = 1; | 397 decodingThreads = 1; |
402 } | 398 } |
399 | |
400 /* By default, use GDCM */ | |
401 bool enableGdcm = true; | |
403 | 402 |
404 | 403 |
405 try | 404 try |
406 { | 405 { |
407 /* Read the configuration of the Web viewer */ | 406 /* Read the configuration of the Web viewer */ |
428 } | 427 } |
429 | 428 |
430 cachePath = GetStringValue(configuration["WebViewer"], key, cachePath.string()); | 429 cachePath = GetStringValue(configuration["WebViewer"], key, cachePath.string()); |
431 cacheSize = GetIntegerValue(configuration["WebViewer"], "CacheSize", cacheSize); | 430 cacheSize = GetIntegerValue(configuration["WebViewer"], "CacheSize", cacheSize); |
432 decodingThreads = GetIntegerValue(configuration["WebViewer"], "Threads", decodingThreads); | 431 decodingThreads = GetIntegerValue(configuration["WebViewer"], "Threads", decodingThreads); |
432 | |
433 if (configuration["WebViewer"].isMember("EnableGdcm") && | |
434 configuration["WebViewer"]["EnableGdcm"].type() == Json::booleanValue) | |
435 { | |
436 enableGdcm = configuration["WebViewer"]["EnableGdcm"].asBool(); | |
437 } | |
433 } | 438 } |
434 | 439 |
435 std::string message = ("Web viewer using " + boost::lexical_cast<std::string>(decodingThreads) + | 440 std::string message = ("Web viewer using " + boost::lexical_cast<std::string>(decodingThreads) + |
436 " threads for the decoding of the DICOM images"); | 441 " threads for the decoding of the DICOM images"); |
437 OrthancPluginLogWarning(context_, message.c_str()); | 442 OrthancPluginLogWarning(context_, message.c_str()); |
513 OrthancPluginLogError(context_, e.What()); | 518 OrthancPluginLogError(context_, e.What()); |
514 return -1; | 519 return -1; |
515 } | 520 } |
516 | 521 |
517 | 522 |
523 /* Configure the DICOM decoder */ | |
524 if (enableGdcm) | |
525 { | |
526 // Replace the default decoder of DICOM images that is built in Orthanc | |
527 OrthancPluginLogWarning(context_, "Using GDCM instead of the DICOM decoder that is built in Orthanc"); | |
528 OrthancPluginRegisterDecodeImageCallback(context_, DecodeImageCallback); | |
529 } | |
530 else | |
531 { | |
532 OrthancPluginLogWarning(context_, "Using the DICOM decoder that is built in Orthanc (not using GDCM)"); | |
533 } | |
534 | |
535 | |
518 /* Install the callbacks */ | 536 /* Install the callbacks */ |
519 OrthancPluginRegisterRestCallback(context_, "/web-viewer/series/(.*)", ServeCache<CacheBundle_SeriesInformation>); | 537 OrthancPluginRegisterRestCallback(context_, "/web-viewer/series/(.*)", ServeCache<CacheBundle_SeriesInformation>); |
520 OrthancPluginRegisterRestCallback(context_, "/web-viewer/is-stable-series/(.*)", IsStableSeries); | 538 OrthancPluginRegisterRestCallback(context_, "/web-viewer/is-stable-series/(.*)", IsStableSeries); |
521 OrthancPluginRegisterRestCallback(context_, "/web-viewer/instances/(.*)", ServeCache<CacheBundle_DecodedImage>); | 539 OrthancPluginRegisterRestCallback(context_, "/web-viewer/instances/(.*)", ServeCache<CacheBundle_DecodedImage>); |
522 OrthancPluginRegisterRestCallback(context, "/web-viewer/libs/(.*)", ServeEmbeddedFolder<Orthanc::EmbeddedResources::JAVASCRIPT_LIBS>); | 540 OrthancPluginRegisterRestCallback(context, "/web-viewer/libs/(.*)", ServeEmbeddedFolder<Orthanc::EmbeddedResources::JAVASCRIPT_LIBS>); |