Mercurial > hg > orthanc
diff Plugins/Samples/GdcmDecoding/Plugin.cpp @ 1040:d06186cdc502
check plugin version in samples
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 17 Jul 2014 13:04:02 +0200 |
parents | 501880d76474 |
children | 6e7e5ed91c2d |
line wrap: on
line diff
--- a/Plugins/Samples/GdcmDecoding/Plugin.cpp Thu Jul 17 12:46:00 2014 +0200 +++ b/Plugins/Samples/GdcmDecoding/Plugin.cpp Thu Jul 17 13:04:02 2014 +0200 @@ -29,6 +29,7 @@ #include <string> #include <stdexcept> #include <sstream> +#include <boost/lexical_cast.hpp> #include "OrthancContext.h" #include "../../../Core/ImageFormats/ImageProcessing.h" @@ -235,6 +236,19 @@ { OrthancContext::GetInstance().Initialize(context); OrthancContext::GetInstance().LogWarning("Initializing GDCM decoding"); + + // Check the version of the Orthanc core + if (OrthancPluginCheckVersion(context) == 0) + { + OrthancContext::GetInstance().LogError( + "Your version of Orthanc (" + std::string(context->orthancVersion) + + ") must be above " + boost::lexical_cast<std::string>(ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER) + + "." + boost::lexical_cast<std::string>(ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER) + + "." + boost::lexical_cast<std::string>(ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER) + + " to run this plugin"); + return -1; + } + OrthancContext::GetInstance().Register("/instances/([^/]+)/(preview|image-uint8|image-uint16|image-int16)", DecodeImage); return 0; }