Mercurial > hg > orthanc-dicomweb
changeset 279:003315d900ad
cont
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 06 Jun 2019 16:48:12 +0200 |
parents | 3766775411b5 |
children | bff26b6f69f5 |
files | Plugin/Plugin.cpp Resources/Orthanc/DownloadOrthancFramework.cmake |
diffstat | 2 files changed, 20 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugin/Plugin.cpp Wed Jun 05 18:14:10 2019 +0200 +++ b/Plugin/Plugin.cpp Thu Jun 06 16:48:12 2019 +0200 @@ -174,7 +174,7 @@ #include <boost/filesystem.hpp> #include <Core/SystemToolbox.h> -class StowSender : public OrthancPlugins::HttpClient::IChunkedBody +class StowClientBody : public OrthancPlugins::HttpClient::IRequestBody { private: std::vector<std::string> files_; @@ -182,11 +182,12 @@ std::string boundary_; public: - StowSender(unsigned int size) : + StowClientBody() : position_(0), boundary_(Orthanc::Toolbox::GenerateUuid()) { - boost::filesystem::path p("/home/jodogne/DICOM/Demo/KNIX/Knee (R)/AX. FSE PD - 5"); + //boost::filesystem::path p("/home/jodogne/DICOM/Demo/KNIX/Knee (R)/AX. FSE PD - 5"); + boost::filesystem::path p("/tmp/dicom"); boost::filesystem::directory_iterator end; @@ -242,22 +243,31 @@ { try { - StowSender stow(1024*128); + StowClientBody stow; OrthancPlugins::HttpClient client; client.SetUrl("http://localhost:8080/dicom-web/studies"); client.SetMethod(OrthancPluginHttpMethod_Post); client.AddHeader("Accept", "application/dicom+json"); - client.AddHeader("Transfer-Encoding", "chunked"); client.AddHeader("Expect", ""); client.AddHeader("Content-Type", "multipart/related; type=application/dicom; boundary=" + stow.GetBoundary()); client.SetTimeout(120); client.SetBody(stow); - client.Execute(); + + OrthancPlugins::HttpClient::HttpHeaders headers; + std::string answer; + client.Execute(headers, answer); Json::Value v; - client.GetAnswerBody().ToJson(v); - std::cout << v.toStyledString() << std::endl; + Json::Reader reader; + if (reader.parse(answer, v)) + { + std::cout << v["00081190"].toStyledString() << std::endl; + } + else + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); + } } catch (Orthanc::OrthancException& e) {
--- a/Resources/Orthanc/DownloadOrthancFramework.cmake Wed Jun 05 18:14:10 2019 +0200 +++ b/Resources/Orthanc/DownloadOrthancFramework.cmake Thu Jun 06 16:48:12 2019 +0200 @@ -103,6 +103,8 @@ set(ORTHANC_FRAMEWORK_MD5 "404baef5d4c43e7c5d9410edda8ef5a5") elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.5") set(ORTHANC_FRAMEWORK_MD5 "cfc437e0687ae4bd725fd93dc1f08bc4") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.6") + set(ORTHANC_FRAMEWORK_MD5 "3c29de1e289b5472342947168f0105c0") endif() endif() endif()