# HG changeset patch # User Sebastien Jodogne # Date 1610540223 -3600 # Node ID 4eefa34657f0fcff40b0801f69ed2f9e3a0af2eb # Parent 96d1774148e73fe21f6dcfa795b5353006b529c8 fix build diff -r 96d1774148e7 -r 4eefa34657f0 Applications/CMakeLists.txt --- a/Applications/CMakeLists.txt Wed Jan 13 10:33:37 2021 +0100 +++ b/Applications/CMakeLists.txt Wed Jan 13 13:17:03 2021 +0100 @@ -104,11 +104,6 @@ ${ORTHANC_WSI_DIR}/Framework/Outputs/TruncatedPyramidWriter.cpp ${ORTHANC_WSI_DIR}/Framework/Targets/FolderTarget.cpp ${ORTHANC_WSI_DIR}/Framework/Targets/OrthancTarget.cpp - - # To access compatibility functions - # "OrthancPlugins::WriteFastJson()" and "OrthancPlugins::ReadJson()" - # if Orthanc framework <= 1.8.2 - ${ORTHANC_WSI_DIR}/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp ) EmbedResources( diff -r 96d1774148e7 -r 4eefa34657f0 Applications/Dicomizer.cpp --- a/Applications/Dicomizer.cpp Wed Jan 13 10:33:37 2021 +0100 +++ b/Applications/Dicomizer.cpp Wed Jan 13 13:17:03 2021 +0100 @@ -33,7 +33,6 @@ #include "../Framework/MultiThreading/BagOfTasksProcessor.h" #include "../Framework/Outputs/DicomPyramidWriter.h" #include "../Framework/Outputs/TruncatedPyramidWriter.h" -#include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h" #include // For std::unique_ptr #include @@ -84,6 +83,28 @@ static const char* OPTION_VERSION = "version"; +#if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 9, 0) + +bool ReadJsonWithoutComments(Json::Value& target, + const std::string& source) +{ + return Orthanc::Toolbox::ReadJsonWithoutComments(target, source); +} + +#else + +// Backward compatibility with Orthanc framework <= 1.8.2 +#include + +bool ReadJsonWithoutComments(Json::Value& target, + const std::string& source) +{ + Json::Reader reader; + return reader.parse(source, target, false); +} +#endif + + static void TranscodePyramid(OrthancWSI::PyramidWriterBase& target, OrthancWSI::ITiledPyramid& source, const OrthancWSI::DicomizerParameters& parameters) @@ -298,7 +319,7 @@ std::string content; Orthanc::SystemToolbox::ReadFile(content, path); - if (!OrthancPlugins::ReadJsonWithoutComments(json, content)) + if (!ReadJsonWithoutComments(json, content)) { LOG(ERROR) << "Cannot parse the JSON file in: " << path; throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); @@ -472,7 +493,7 @@ Orthanc::EmbeddedResources::GetFileResource(brightfield, Orthanc::EmbeddedResources::BRIGHTFIELD_OPTICAL_PATH); Json::Value json; - if (!OrthancPlugins::ReadJsonWithoutComments(json, brightfield)) + if (!ReadJsonWithoutComments(json, brightfield)) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } diff -r 96d1774148e7 -r 4eefa34657f0 Framework/Inputs/DicomPyramidInstance.cpp --- a/Framework/Inputs/DicomPyramidInstance.cpp Wed Jan 13 10:33:37 2021 +0100 +++ b/Framework/Inputs/DicomPyramidInstance.cpp Wed Jan 13 13:17:03 2021 +0100 @@ -23,7 +23,6 @@ #include "DicomPyramidInstance.h" #include "../DicomToolbox.h" -#include "../../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h" #include "../../Resources/Orthanc/Stone/DicomDatasetReader.h" #include "../../Resources/Orthanc/Stone/FullOrthancDataset.h" @@ -34,6 +33,10 @@ #include +#if !ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 9, 0) +# include +#endif + #define SERIALIZED_METADATA "4201" // Was "4200" if versions <= 0.7 of this plugin @@ -350,14 +353,19 @@ content[PHOTOMETRIC_INTERPRETATION] = Orthanc::EnumerationToString(photometric_); content[IMAGE_TYPE] = imageType_; - OrthancPlugins::WriteFastJson(result, content); +#if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 9, 0) + Orthanc::Toolbox::WriteFastJson(result, content); +#else + Json::FastWriter writer; + result = writer.write(content); +#endif } void DicomPyramidInstance::Deserialize(const std::string& s) { Json::Value content; - OrthancPlugins::ReadJson(content, s); + OrthancStone::IOrthancConnection::ParseJson(content, s); if (content.type() != Json::objectValue || !content.isMember(FRAMES) || diff -r 96d1774148e7 -r 4eefa34657f0 Framework/Jpeg2000Reader.cpp --- a/Framework/Jpeg2000Reader.cpp Wed Jan 13 10:33:37 2021 +0100 +++ b/Framework/Jpeg2000Reader.cpp Wed Jan 13 13:17:03 2021 +0100 @@ -329,9 +329,8 @@ const unsigned int width = target.GetWidth(); const unsigned int height = target.GetHeight(); - if (0 && // TODO - width == image_->comps[channel].w && - height == image_->comps[channel].h) + if (static_cast(width) == image_->comps[channel].w && + static_cast(height) == image_->comps[channel].h) { const int32_t* q = image_->comps[channel].data; assert(q != NULL); diff -r 96d1774148e7 -r 4eefa34657f0 Resources/CMake/Version.cmake --- a/Resources/CMake/Version.cmake Wed Jan 13 10:33:37 2021 +0100 +++ b/Resources/CMake/Version.cmake Wed Jan 13 13:17:03 2021 +0100 @@ -9,7 +9,6 @@ endif() add_definitions( - -DHAS_ORTHANC_EXCEPTION=1 -DORTHANC_WSI_VERSION="${ORTHANC_WSI_VERSION}" ) diff -r 96d1774148e7 -r 4eefa34657f0 ViewerPlugin/CMakeLists.txt --- a/ViewerPlugin/CMakeLists.txt Wed Jan 13 10:33:37 2021 +0100 +++ b/ViewerPlugin/CMakeLists.txt Wed Jan 13 13:17:03 2021 +0100 @@ -77,6 +77,7 @@ ##################################################################### add_definitions( + -DHAS_ORTHANC_EXCEPTION=1 -DORTHANC_ENABLE_LOGGING_PLUGIN=1 -DORTHANC_FRAMEWORK_BUILDING_PLUGIN=1 )