annotate OrthancStone/Sources/Loaders/DicomSource.cpp @ 1953:0661115af939 deep-learning

first successful application of deep learning
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 16 Aug 2022 15:05:51 +0200
parents 7053b8a0aaec
children 07964689cb0b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1871
7053b8a0aaec upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1870
diff changeset
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
7053b8a0aaec upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1870
diff changeset
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
9 * modify it under the terms of the GNU Lesser General Public License
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * as published by the Free Software Foundation, either version 3 of
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * the License, or (at your option) any later version.
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
16 * Lesser General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
17 *
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
19 * License along with this program. If not, see
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
20 * <http://www.gnu.org/licenses/>.
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "DicomSource.h"
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "../Oracle/HttpCommand.h"
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include "../Oracle/OrthancRestApiCommand.h"
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
1455
30deba7bc8e2 simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1299
diff changeset
29 #include <OrthancException.h>
1737
ef2f56c0311c remove calls to deprecated classes of JsonCpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1725
diff changeset
30 #include <Toolbox.h>
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 #include <boost/algorithm/string/predicate.hpp>
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 namespace OrthancStone
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 {
1845
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
36 static std::string EncodeGetArguments(const std::map<std::string, std::string>& arguments)
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 {
1845
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
38 std::string s;
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 bool first = true;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 for (std::map<std::string, std::string>::const_iterator
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 it = arguments.begin(); it != arguments.end(); ++it)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 if (first)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 s += "?";
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 first = false;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 else
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 s += "&";
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 s += it->first + "=" + it->second;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 // TODO: Call Orthanc::Toolbox::UriEncode() ?
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 return s;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
1845
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
63 static std::string AddUriSuffix(const std::string& base,
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
64 const std::string& suffix)
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
65 {
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
66 if (base.empty())
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
67 {
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
68 return suffix;
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
69 }
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
70 else if (suffix.empty())
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
71 {
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
72 return base;
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
73 }
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
74 else
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
75 {
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
76 char lastBase = base[base.size() - 1];
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
77
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
78 if (lastBase == '/' &&
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
79 suffix[0] == '/')
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
80 {
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
81 return base + suffix.substr(1);
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
82 }
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
83 else if (lastBase == '/' ||
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
84 suffix[0] == '/')
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
85 {
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
86 return base + suffix;
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
87 }
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
88 else
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
89 {
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
90 return base + "/" + suffix;
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
91 }
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
92 }
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
93 }
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
94
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
95
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 void DicomSource::SetOrthancSource(const Orthanc::WebServiceParameters& parameters)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 type_ = DicomSourceType_Orthanc;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 webService_ = parameters;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 hasOrthancWebViewer1_ = false;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 hasOrthancAdvancedPreview_ = false;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
1725
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
105 bool DicomSource::IsSameSource(const DicomSource& other) const
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
106 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
107 if (type_ != other.type_)
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
108 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
109 return false;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
110 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
111 else
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
112 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
113 switch (type_)
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
114 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
115 case DicomSourceType_Orthanc:
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
116 return (webService_.GetUrl() == other.webService_.GetUrl() &&
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
117 webService_.GetUsername() == other.webService_.GetUsername() &&
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
118 webService_.GetHttpHeaders() == other.webService_.GetHttpHeaders() &&
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
119 hasOrthancWebViewer1_ == other.hasOrthancWebViewer1_ &&
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
120 hasOrthancAdvancedPreview_ == other.hasOrthancAdvancedPreview_);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
121
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
122 case DicomSourceType_DicomWeb:
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
123 return (webService_.GetUrl() == other.webService_.GetUrl() &&
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
124 webService_.GetUsername() == other.webService_.GetUsername() &&
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
125 webService_.GetHttpHeaders() == other.webService_.GetHttpHeaders() &&
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
126 hasDicomWebRendered_ == other.hasDicomWebRendered_);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
127
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
128 case DicomSourceType_DicomWebThroughOrthanc:
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
129 return (webService_.GetUrl() == other.webService_.GetUrl() &&
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
130 webService_.GetUsername() == other.webService_.GetUsername() &&
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
131 webService_.GetHttpHeaders() == other.webService_.GetHttpHeaders() &&
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
132 orthancDicomWebRoot_ == other.orthancDicomWebRoot_ &&
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
133 serverName_ == other.serverName_ &&
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
134 hasDicomWebRendered_ == other.hasDicomWebRendered_);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
135
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
136 case DicomSourceType_DicomDir:
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
137 return true;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
138
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
139 default:
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
140 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
141 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
142 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
143 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
144
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
145
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 void DicomSource::SetOrthancSource()
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 Orthanc::WebServiceParameters parameters;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 parameters.SetUrl("http://localhost:8042/");
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 SetOrthancSource(parameters);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 const Orthanc::WebServiceParameters& DicomSource::GetOrthancParameters() const
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 if (type_ == DicomSourceType_Orthanc ||
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 type_ == DicomSourceType_DicomWebThroughOrthanc)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 return webService_;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 else
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 void DicomSource::SetDicomDirSource()
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 type_ = DicomSourceType_DicomDir;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 void DicomSource::SetDicomWebSource(const std::string& baseUrl)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 type_ = DicomSourceType_DicomWeb;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 webService_.SetUrl(baseUrl);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 webService_.ClearCredentials();
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 void DicomSource::SetDicomWebSource(const std::string& baseUrl,
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 const std::string& username,
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 const std::string& password)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 type_ = DicomSourceType_DicomWeb;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 webService_.SetUrl(baseUrl);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 webService_.SetCredentials(username, password);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 void DicomSource::SetDicomWebThroughOrthancSource(const Orthanc::WebServiceParameters& orthancParameters,
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 const std::string& dicomWebRoot,
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 const std::string& serverName)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 type_ = DicomSourceType_DicomWebThroughOrthanc;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 webService_ = orthancParameters;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 orthancDicomWebRoot_ = dicomWebRoot;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 serverName_ = serverName;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 void DicomSource::SetDicomWebThroughOrthancSource(const std::string& serverName)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 Orthanc::WebServiceParameters orthanc;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 orthanc.SetUrl("http://localhost:8042/");
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 SetDicomWebThroughOrthancSource(orthanc, "/dicom-web/", serverName);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 bool DicomSource::IsDicomWeb() const
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 return (type_ == DicomSourceType_DicomWeb ||
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 type_ == DicomSourceType_DicomWebThroughOrthanc);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 IOracleCommand* DicomSource::CreateDicomWebCommand(const std::string& uri,
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 const std::map<std::string, std::string>& arguments,
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 const std::map<std::string, std::string>& headers,
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 Orthanc::IDynamicObject* payload) const
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 {
1299
c38c89684d83 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1271
diff changeset
223 std::unique_ptr<Orthanc::IDynamicObject> protection(payload);
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 switch (type_)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 case DicomSourceType_DicomWeb:
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 {
1299
c38c89684d83 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1271
diff changeset
229 std::unique_ptr<HttpCommand> command(new HttpCommand);
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 command->SetMethod(Orthanc::HttpMethod_Get);
1845
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
232 command->SetUrl(AddUriSuffix(webService_.GetUrl(), uri + EncodeGetArguments(arguments)));
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 command->SetHttpHeaders(webService_.GetHttpHeaders());
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 for (std::map<std::string, std::string>::const_iterator
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 it = headers.begin(); it != headers.end(); ++it)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 command->SetHttpHeader(it->first, it->second);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 if (!webService_.GetUsername().empty())
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 command->SetCredentials(webService_.GetUsername(), webService_.GetPassword());
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 if (protection.get())
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 command->AcquirePayload(protection.release());
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 return command.release();
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 case DicomSourceType_DicomWebThroughOrthanc:
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 Json::Value args = Json::objectValue;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 for (std::map<std::string, std::string>::const_iterator
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 it = arguments.begin(); it != arguments.end(); ++it)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 args[it->first] = it->second;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 Json::Value h = Json::objectValue;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 for (std::map<std::string, std::string>::const_iterator
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 it = headers.begin(); it != headers.end(); ++it)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 h[it->first] = it->second;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 }
1484
121d01aa328e SeriesThumbnailsLoader working on raw dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1472
diff changeset
269
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 Json::Value body = Json::objectValue;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 body["Uri"] = uri;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 body["Arguments"] = args;
1484
121d01aa328e SeriesThumbnailsLoader working on raw dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1472
diff changeset
273 body["HttpHeaders"] = h;
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274
1299
c38c89684d83 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1271
diff changeset
275 std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand);
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 command->SetMethod(Orthanc::HttpMethod_Post);
1845
ca85b6d60bca removed duplicate slash in DICOMweb sources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
277 command->SetUri(AddUriSuffix(orthancDicomWebRoot_, "/servers/" + serverName_ + "/get"));
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 command->SetBody(body);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 if (protection.get())
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 command->AcquirePayload(protection.release());
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 return command.release();
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 default:
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 void DicomSource::AutodetectOrthancFeatures(const std::string& system,
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 const std::string& plugins)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 static const char* const REST_API_VERSION = "ApiVersion";
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 if (IsDicomWeb())
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 Json::Value a, b;
1737
ef2f56c0311c remove calls to deprecated classes of JsonCpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1725
diff changeset
305 if (Orthanc::Toolbox::ReadJson(a, system) &&
ef2f56c0311c remove calls to deprecated classes of JsonCpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1725
diff changeset
306 Orthanc::Toolbox::ReadJson(b, plugins) &&
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 a.type() == Json::objectValue &&
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 b.type() == Json::arrayValue &&
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 a.isMember(REST_API_VERSION) &&
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310 a[REST_API_VERSION].type() == Json::intValue)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 SetOrthancAdvancedPreview(a[REST_API_VERSION].asInt() >= 5);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 hasOrthancWebViewer1_ = false;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 for (Json::Value::ArrayIndex i = 0; i < b.size(); i++)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 if (b[i].type() != Json::stringValue)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 if (boost::iequals(b[i].asString(), "web-viewer"))
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 hasOrthancWebViewer1_ = true;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 else
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331 printf("[%s] [%s]\n", system.c_str(), plugins.c_str());
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 void DicomSource::SetOrthancWebViewer1(bool hasPlugin)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 if (IsOrthanc())
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342 hasOrthancWebViewer1_ = hasPlugin;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 else
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 bool DicomSource::HasOrthancWebViewer1() const
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352 if (IsOrthanc())
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 return hasOrthancWebViewer1_;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 else
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362 void DicomSource::SetOrthancAdvancedPreview(bool hasFeature)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 if (IsOrthanc())
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 hasOrthancAdvancedPreview_ = hasFeature;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 else
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 bool DicomSource::HasOrthancAdvancedPreview() const
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 if (IsOrthanc())
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 return hasOrthancAdvancedPreview_;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 else
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 void DicomSource::SetDicomWebRendered(bool hasFeature)
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 if (IsDicomWeb())
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 hasDicomWebRendered_ = hasFeature;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 else
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 bool DicomSource::HasDicomWebRendered() const
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 if (IsDicomWeb())
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 return hasDicomWebRendered_;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404 else
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411 unsigned int DicomSource::GetQualityCount() const
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413 if (IsDicomWeb())
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 return (HasDicomWebRendered() ? 2 : 1);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417 else if (IsOrthanc())
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 return (HasOrthancWebViewer1() ||
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420 HasOrthancAdvancedPreview() ? 2 : 1);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 else if (IsDicomDir())
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424 return 1;
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426 else
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 {
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 }
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430 }
1761
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
431
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
432
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
433 void DicomSource::AddHttpHeader(const std::string& header,
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
434 const std::string& value)
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
435 {
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
436 if (type_ == DicomSourceType_Orthanc ||
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
437 type_ == DicomSourceType_DicomWeb ||
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
438 type_ == DicomSourceType_DicomWebThroughOrthanc)
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
439 {
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
440 webService_.AddHttpHeader(header, value);
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
441 }
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
442 else
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
443 {
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
444 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadParameterType);
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
445 }
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
446 }
1228
c471a0aa137b adding the next generation of loaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 }