Mercurial > hg > orthanc-wsi
comparison Applications/Dicomizer.cpp @ 226:4eefa34657f0
fix build
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 13 Jan 2021 13:17:03 +0100 |
parents | 443f219a68fd |
children | b0ee417b667a |
comparison
equal
deleted
inserted
replaced
225:96d1774148e7 | 226:4eefa34657f0 |
---|---|
31 #include "../Framework/Inputs/TiledPngImage.h" | 31 #include "../Framework/Inputs/TiledPngImage.h" |
32 #include "../Framework/Inputs/TiledPyramidStatistics.h" | 32 #include "../Framework/Inputs/TiledPyramidStatistics.h" |
33 #include "../Framework/MultiThreading/BagOfTasksProcessor.h" | 33 #include "../Framework/MultiThreading/BagOfTasksProcessor.h" |
34 #include "../Framework/Outputs/DicomPyramidWriter.h" | 34 #include "../Framework/Outputs/DicomPyramidWriter.h" |
35 #include "../Framework/Outputs/TruncatedPyramidWriter.h" | 35 #include "../Framework/Outputs/TruncatedPyramidWriter.h" |
36 #include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h" | |
37 | 36 |
38 #include <Compatibility.h> // For std::unique_ptr | 37 #include <Compatibility.h> // For std::unique_ptr |
39 #include <DicomParsing/FromDcmtkBridge.h> | 38 #include <DicomParsing/FromDcmtkBridge.h> |
40 #include <Logging.h> | 39 #include <Logging.h> |
41 #include <OrthancException.h> | 40 #include <OrthancException.h> |
82 static const char* OPTION_TILE_WIDTH = "tile-width"; | 81 static const char* OPTION_TILE_WIDTH = "tile-width"; |
83 static const char* OPTION_VERBOSE = "verbose"; | 82 static const char* OPTION_VERBOSE = "verbose"; |
84 static const char* OPTION_VERSION = "version"; | 83 static const char* OPTION_VERSION = "version"; |
85 | 84 |
86 | 85 |
86 #if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 9, 0) | |
87 | |
88 bool ReadJsonWithoutComments(Json::Value& target, | |
89 const std::string& source) | |
90 { | |
91 return Orthanc::Toolbox::ReadJsonWithoutComments(target, source); | |
92 } | |
93 | |
94 #else | |
95 | |
96 // Backward compatibility with Orthanc framework <= 1.8.2 | |
97 #include <json/reader.h> | |
98 | |
99 bool ReadJsonWithoutComments(Json::Value& target, | |
100 const std::string& source) | |
101 { | |
102 Json::Reader reader; | |
103 return reader.parse(source, target, false); | |
104 } | |
105 #endif | |
106 | |
107 | |
87 static void TranscodePyramid(OrthancWSI::PyramidWriterBase& target, | 108 static void TranscodePyramid(OrthancWSI::PyramidWriterBase& target, |
88 OrthancWSI::ITiledPyramid& source, | 109 OrthancWSI::ITiledPyramid& source, |
89 const OrthancWSI::DicomizerParameters& parameters) | 110 const OrthancWSI::DicomizerParameters& parameters) |
90 { | 111 { |
91 LOG(WARNING) << "Transcoding the source pyramid (not re-encoding)"; | 112 LOG(WARNING) << "Transcoding the source pyramid (not re-encoding)"; |
296 else | 317 else |
297 { | 318 { |
298 std::string content; | 319 std::string content; |
299 Orthanc::SystemToolbox::ReadFile(content, path); | 320 Orthanc::SystemToolbox::ReadFile(content, path); |
300 | 321 |
301 if (!OrthancPlugins::ReadJsonWithoutComments(json, content)) | 322 if (!ReadJsonWithoutComments(json, content)) |
302 { | 323 { |
303 LOG(ERROR) << "Cannot parse the JSON file in: " << path; | 324 LOG(ERROR) << "Cannot parse the JSON file in: " << path; |
304 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); | 325 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); |
305 } | 326 } |
306 } | 327 } |
470 | 491 |
471 std::string brightfield; | 492 std::string brightfield; |
472 Orthanc::EmbeddedResources::GetFileResource(brightfield, Orthanc::EmbeddedResources::BRIGHTFIELD_OPTICAL_PATH); | 493 Orthanc::EmbeddedResources::GetFileResource(brightfield, Orthanc::EmbeddedResources::BRIGHTFIELD_OPTICAL_PATH); |
473 | 494 |
474 Json::Value json; | 495 Json::Value json; |
475 if (!OrthancPlugins::ReadJsonWithoutComments(json, brightfield)) | 496 if (!ReadJsonWithoutComments(json, brightfield)) |
476 { | 497 { |
477 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); | 498 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
478 } | 499 } |
479 | 500 |
480 std::unique_ptr<DcmElement> element(Orthanc::FromDcmtkBridge::FromJson( | 501 std::unique_ptr<DcmElement> element(Orthanc::FromDcmtkBridge::FromJson( |