Mercurial > hg > orthanc
annotate OrthancServer/Sources/OrthancConfiguration.cpp @ 4724:149f5e53a084 Orthanc-1.9.1
closing branch Orthanc-1.9.1
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 24 Jun 2021 12:51:45 +0200 |
parents | 8f9090b137f1 |
children | 2c702cfae274 |
rev | line source |
---|---|
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4394
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU General Public License as |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * published by the Free Software Foundation, either version 3 of the |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * License, or (at your option) any later version. |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * In addition, as a special exception, the copyright holders of this |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * program give permission to link the code of its release with the |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * that use the same license as the "OpenSSL" library), and distribute |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * the linked executables. You must obey the GNU General Public License |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * in all respects for all of the code used other than "OpenSSL". If you |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * modify file(s) with this exception, you may extend this exception to |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * your version of the file(s), but you are not obligated to do so. If |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * you do not wish to do so, delete this exception statement from your |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 * version. If you delete this exception statement from all source files |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 * in the program, then also delete it here. |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 * |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 * This program is distributed in the hope that it will be useful, but |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 * WITHOUT ANY WARRANTY; without even the implied warranty of |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 * General Public License for more details. |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 * |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 * You should have received a copy of the GNU General Public License |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 **/ |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 #include "PrecompiledHeadersServer.h" |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 #include "OrthancConfiguration.h" |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
37 #include "../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h" |
4140
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
38 #include "../../OrthancFramework/Sources/DicomParsing/ParsedDicomFile.h" |
4045 | 39 #include "../../OrthancFramework/Sources/HttpServer/HttpServer.h" |
40 #include "../../OrthancFramework/Sources/Logging.h" | |
41 #include "../../OrthancFramework/Sources/OrthancException.h" | |
42 #include "../../OrthancFramework/Sources/SystemToolbox.h" | |
43 #include "../../OrthancFramework/Sources/TemporaryFile.h" | |
44 #include "../../OrthancFramework/Sources/Toolbox.h" | |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 |
2941
e292798f9980
OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
46 #include "ServerIndex.h" |
e292798f9980
OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
47 |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
48 #include <boost/regex.hpp> |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
49 |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
50 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
51 static const char* const DICOM_MODALITIES = "DicomModalities"; |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
52 static const char* const DICOM_MODALITIES_IN_DB = "DicomModalitiesInDatabase"; |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
53 static const char* const ORTHANC_PEERS = "OrthancPeers"; |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
54 static const char* const ORTHANC_PEERS_IN_DB = "OrthancPeersInDatabase"; |
3181
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3138
diff
changeset
|
55 static const char* const TEMPORARY_DIRECTORY = "TemporaryDirectory"; |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
56 |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 namespace Orthanc |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 static void AddFileToConfiguration(Json::Value& target, |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 const boost::filesystem::path& path) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 std::map<std::string, std::string> env; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 SystemToolbox::GetEnvironmentVariables(env); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 LOG(WARNING) << "Reading the configuration from: " << path; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 Json::Value config; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 std::string content; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 SystemToolbox::ReadFile(content, path.string()); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 content = Toolbox::SubstituteVariables(content, env); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 Json::Value tmp; |
4392
3af1d763763a
confining Json::Reader and Json::*Writer into Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4267
diff
changeset
|
76 if (!Toolbox::ReadJson(tmp, content) || |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 tmp.type() != Json::objectValue) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 { |
2955 | 79 throw OrthancException(ErrorCode_BadJson, |
80 "The configuration file does not follow the JSON syntax: " + path.string()); | |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 Toolbox::CopyJsonWithoutComments(config, tmp); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 if (target.size() == 0) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 target = config; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 // Merge the newly-added file with the previous content of "target" |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 Json::Value::Members members = config.getMemberNames(); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 for (Json::Value::ArrayIndex i = 0; i < members.size(); i++) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 if (target.isMember(members[i])) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 { |
2955 | 98 throw OrthancException(ErrorCode_BadFileFormat, |
99 "The configuration section \"" + members[i] + | |
100 "\" is defined in 2 different configuration files"); | |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 target[members[i]] = config[members[i]]; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 static void ScanFolderForConfiguration(Json::Value& target, |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 const char* folder) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 using namespace boost::filesystem; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 LOG(WARNING) << "Scanning folder \"" << folder << "\" for configuration files"; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 directory_iterator end_it; // default construction yields past-the-end |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 for (directory_iterator it(folder); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 it != end_it; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 ++it) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 if (!is_directory(it->status())) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 std::string extension = boost::filesystem::extension(it->path()); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 Toolbox::ToLowerCase(extension); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 if (extension == ".json") |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 AddFileToConfiguration(target, it->path().string()); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 static void ReadConfiguration(Json::Value& target, |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 const char* configurationFile) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 target = Json::objectValue; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 |
2956 | 142 if (configurationFile != NULL) |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 if (!boost::filesystem::exists(configurationFile)) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 { |
2956 | 146 throw OrthancException(ErrorCode_InexistentFile, |
147 "Inexistent path to configuration: " + | |
148 std::string(configurationFile)); | |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 if (boost::filesystem::is_directory(configurationFile)) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 ScanFolderForConfiguration(target, configurationFile); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 AddFileToConfiguration(target, configurationFile); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 #if ORTHANC_STANDALONE == 1 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 // No default path for the standalone configuration |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 LOG(WARNING) << "Using the default Orthanc configuration"; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 return; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 #else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 // In a non-standalone build, we use the |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 // "Resources/Configuration.json" from the Orthanc source code |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 boost::filesystem::path p = ORTHANC_PATH; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 p /= "Resources"; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 p /= "Configuration.json"; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 AddFileToConfiguration(target, p); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 #endif |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
180 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
181 static void CheckAlphanumeric(const std::string& s) |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 { |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
183 for (size_t j = 0; j < s.size(); j++) |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
184 { |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
185 if (!isalnum(s[j]) && |
4164
b3c5418109a9
underscores are now allowed in peers/modalities symbolic names
Alain Mazy <alain@mazy.be>
parents:
4140
diff
changeset
|
186 s[j] != '-' && s[j] != '_') |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
187 { |
2956 | 188 throw OrthancException(ErrorCode_BadFileFormat, |
4164
b3c5418109a9
underscores are now allowed in peers/modalities symbolic names
Alain Mazy <alain@mazy.be>
parents:
4140
diff
changeset
|
189 "Only alphanumeric, dash characters and underscores are allowed " |
2956 | 190 "in the names of modalities/peers, but found: " + s); |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
191 } |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
192 } |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
193 } |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
194 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
195 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
196 void OrthancConfiguration::LoadModalitiesFromJson(const Json::Value& source) |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
197 { |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
198 modalities_.clear(); |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
199 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
200 if (source.type() != Json::objectValue) |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
201 { |
2956 | 202 throw OrthancException(ErrorCode_BadFileFormat, |
203 "Bad format of the \"" + std::string(DICOM_MODALITIES) + | |
204 "\" configuration section"); | |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
205 } |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
206 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
207 Json::Value::Members members = source.getMemberNames(); |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
208 |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
209 for (size_t i = 0; i < members.size(); i++) |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
210 { |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
211 const std::string& name = members[i]; |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
212 CheckAlphanumeric(name); |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
213 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
214 RemoteModalityParameters modality; |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
215 modality.Unserialize(source[name]); |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
216 modalities_[name] = modality; |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
217 } |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
218 } |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
219 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
220 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
221 void OrthancConfiguration::LoadPeersFromJson(const Json::Value& source) |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
222 { |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
223 peers_.clear(); |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
224 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
225 if (source.type() != Json::objectValue) |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
226 { |
2956 | 227 throw OrthancException(ErrorCode_BadFileFormat, |
228 "Bad format of the \"" + std::string(ORTHANC_PEERS) + | |
229 "\" configuration section"); | |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
230 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
231 |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
232 Json::Value::Members members = source.getMemberNames(); |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
233 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
234 for (size_t i = 0; i < members.size(); i++) |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
235 { |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
236 const std::string& name = members[i]; |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
237 CheckAlphanumeric(name); |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
238 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
239 WebServiceParameters peer; |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
240 peer.Unserialize(source[name]); |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
241 peers_[name] = peer; |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
242 } |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
243 } |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
244 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
245 |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
246 void OrthancConfiguration::LoadModalities() |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
247 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
248 if (GetBooleanParameter(DICOM_MODALITIES_IN_DB, false)) |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
249 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
250 // Modalities are stored in the database |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
251 if (serverIndex_ == NULL) |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
252 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
253 throw Orthanc::OrthancException(ErrorCode_BadSequenceOfCalls); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
254 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
255 else |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
256 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
257 std::string property = serverIndex_->GetGlobalProperty(GlobalProperty_Modalities, "{}"); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
258 |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
259 Json::Value modalities; |
4392
3af1d763763a
confining Json::Reader and Json::*Writer into Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4267
diff
changeset
|
260 if (Toolbox::ReadJson(modalities, property)) |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
261 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
262 LoadModalitiesFromJson(modalities); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
263 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
264 else |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
265 { |
2956 | 266 throw OrthancException(ErrorCode_InternalError, |
267 "Cannot unserialize the list of modalities from the Orthanc database"); | |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
268 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
269 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
270 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
271 else |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
272 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
273 // Modalities are stored in the configuration files |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
274 if (json_.isMember(DICOM_MODALITIES)) |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
275 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
276 LoadModalitiesFromJson(json_[DICOM_MODALITIES]); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
277 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
278 else |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
279 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
280 modalities_.clear(); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
281 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
282 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
283 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
284 |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
285 void OrthancConfiguration::LoadPeers() |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
286 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
287 if (GetBooleanParameter(ORTHANC_PEERS_IN_DB, false)) |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
288 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
289 // Peers are stored in the database |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
290 if (serverIndex_ == NULL) |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
291 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
292 throw Orthanc::OrthancException(ErrorCode_BadSequenceOfCalls); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
293 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
294 else |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
295 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
296 std::string property = serverIndex_->GetGlobalProperty(GlobalProperty_Peers, "{}"); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
297 |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
298 Json::Value peers; |
4392
3af1d763763a
confining Json::Reader and Json::*Writer into Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4267
diff
changeset
|
299 if (Toolbox::ReadJson(peers, property)) |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
300 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
301 LoadPeersFromJson(peers); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
302 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
303 else |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
304 { |
2956 | 305 throw OrthancException(ErrorCode_InternalError, |
306 "Cannot unserialize the list of peers from the Orthanc database"); | |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
307 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
308 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
309 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
310 else |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
311 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
312 // Peers are stored in the configuration files |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
313 if (json_.isMember(ORTHANC_PEERS)) |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
314 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
315 LoadPeersFromJson(json_[ORTHANC_PEERS]); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
316 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
317 else |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
318 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
319 peers_.clear(); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
320 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
321 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
322 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
323 |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
324 |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
325 void OrthancConfiguration::SaveModalitiesToJson(Json::Value& target) |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
326 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
327 target = Json::objectValue; |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
328 |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
329 for (Modalities::const_iterator it = modalities_.begin(); it != modalities_.end(); ++it) |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
330 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
331 Json::Value modality; |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
332 it->second.Serialize(modality, true /* force advanced format */); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
333 |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
334 target[it->first] = modality; |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
335 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
336 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
337 |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
338 |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
339 void OrthancConfiguration::SavePeersToJson(Json::Value& target) |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
340 { |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
341 target = Json::objectValue; |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
342 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
343 for (Peers::const_iterator it = peers_.begin(); it != peers_.end(); ++it) |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
344 { |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
345 Json::Value peer; |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
346 it->second.Serialize(peer, |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
347 false /* use simple format if possible */, |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
348 true /* include passwords */); |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
349 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
350 target[it->first] = peer; |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
351 } |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
352 } |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
353 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
354 |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
355 void OrthancConfiguration::SaveModalities() |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
356 { |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
357 if (GetBooleanParameter(DICOM_MODALITIES_IN_DB, false)) |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
358 { |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
359 // Modalities are stored in the database |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
360 if (serverIndex_ == NULL) |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
361 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
362 throw Orthanc::OrthancException(ErrorCode_BadSequenceOfCalls); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
363 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
364 else |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
365 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
366 Json::Value modalities; |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
367 SaveModalitiesToJson(modalities); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
368 |
4392
3af1d763763a
confining Json::Reader and Json::*Writer into Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4267
diff
changeset
|
369 std::string s; |
4394
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4392
diff
changeset
|
370 Toolbox::WriteFastJson(s, modalities); |
4392
3af1d763763a
confining Json::Reader and Json::*Writer into Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4267
diff
changeset
|
371 |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
372 serverIndex_->SetGlobalProperty(GlobalProperty_Modalities, s); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
373 } |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
374 } |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
375 else |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
376 { |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
377 // Modalities are stored in the configuration files |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
378 if (!modalities_.empty() || |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
379 json_.isMember(DICOM_MODALITIES)) |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
380 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
381 SaveModalitiesToJson(json_[DICOM_MODALITIES]); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
382 } |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
383 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
384 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
386 |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
387 void OrthancConfiguration::SavePeers() |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
388 { |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
389 if (GetBooleanParameter(ORTHANC_PEERS_IN_DB, false)) |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
390 { |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
391 // Peers are stored in the database |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
392 if (serverIndex_ == NULL) |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
393 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
394 throw Orthanc::OrthancException(ErrorCode_BadSequenceOfCalls); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
395 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
396 else |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
397 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
398 Json::Value peers; |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
399 SavePeersToJson(peers); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
400 |
4392
3af1d763763a
confining Json::Reader and Json::*Writer into Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4267
diff
changeset
|
401 std::string s; |
4394
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4392
diff
changeset
|
402 Toolbox::WriteFastJson(s, peers); |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
403 |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
404 serverIndex_->SetGlobalProperty(GlobalProperty_Peers, s); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
405 } |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
406 } |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
407 else |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
408 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
409 // Peers are stored in the configuration files |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
410 if (!peers_.empty() || |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
411 json_.isMember(ORTHANC_PEERS)) |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
412 { |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
413 SavePeersToJson(json_[ORTHANC_PEERS]); |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
414 } |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
415 } |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
416 } |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
417 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
418 |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
419 OrthancConfiguration& OrthancConfiguration::GetInstance() |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
420 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
421 static OrthancConfiguration configuration; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
422 return configuration; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
423 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
424 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
425 |
3939
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
426 bool OrthancConfiguration::LookupStringParameter(std::string& target, |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
427 const std::string& parameter) const |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
428 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
429 if (json_.isMember(parameter)) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
430 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
431 if (json_[parameter].type() != Json::stringValue) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
432 { |
2956 | 433 throw OrthancException(ErrorCode_BadParameterType, |
434 "The configuration option \"" + parameter + "\" must be a string"); | |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
435 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
436 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
437 { |
3939
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
438 target = json_[parameter].asString(); |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
439 return true; |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
440 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
441 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
442 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
443 { |
3939
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
444 return false; |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
445 } |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
446 } |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
447 |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
448 |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
449 std::string OrthancConfiguration::GetStringParameter(const std::string& parameter, |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
450 const std::string& defaultValue) const |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
451 { |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
452 std::string value; |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
453 if (LookupStringParameter(value, parameter)) |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
454 { |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
455 return value; |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
456 } |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
457 else |
c205f670098e
new configuration options: BuiltinDecoderTranscoderOrder and IngestTranscoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
458 { |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
459 return defaultValue; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
460 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
461 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
462 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
463 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
464 int OrthancConfiguration::GetIntegerParameter(const std::string& parameter, |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
465 int defaultValue) const |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
466 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
467 if (json_.isMember(parameter)) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
468 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
469 if (json_[parameter].type() != Json::intValue) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
470 { |
2956 | 471 throw OrthancException(ErrorCode_BadParameterType, |
472 "The configuration option \"" + parameter + "\" must be an integer"); | |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
473 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
474 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
475 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
476 return json_[parameter].asInt(); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
477 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
478 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
479 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
480 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
481 return defaultValue; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
482 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
483 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
484 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
485 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
486 unsigned int OrthancConfiguration::GetUnsignedIntegerParameter( |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
487 const std::string& parameter, |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
488 unsigned int defaultValue) const |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
489 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
490 int v = GetIntegerParameter(parameter, defaultValue); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
491 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
492 if (v < 0) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
493 { |
2956 | 494 throw OrthancException(ErrorCode_ParameterOutOfRange, |
495 "The configuration option \"" + parameter + "\" must be a positive integer"); | |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
496 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
497 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
498 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
499 return static_cast<unsigned int>(v); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
500 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
501 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
502 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
503 |
3506
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
504 bool OrthancConfiguration::LookupBooleanParameter(bool& target, |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
505 const std::string& parameter) const |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
506 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
507 if (json_.isMember(parameter)) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
508 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
509 if (json_[parameter].type() != Json::booleanValue) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
510 { |
2956 | 511 throw OrthancException(ErrorCode_BadParameterType, |
512 "The configuration option \"" + parameter + | |
513 "\" must be a Boolean (true or false)"); | |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
514 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
515 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
516 { |
3506
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
517 target = json_[parameter].asBool(); |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
518 return true; |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
519 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
520 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
521 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
522 { |
3506
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
523 return false; |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
524 } |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
525 } |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
526 |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
527 |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
528 bool OrthancConfiguration::GetBooleanParameter(const std::string& parameter, |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
529 bool defaultValue) const |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
530 { |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
531 bool value; |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
532 if (LookupBooleanParameter(value, parameter)) |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
533 { |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
534 return value; |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
535 } |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
536 else |
d2b9981017c4
better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3500
diff
changeset
|
537 { |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
538 return defaultValue; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
539 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
540 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
541 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
542 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
543 void OrthancConfiguration::Read(const char* configurationFile) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
544 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
545 // Read the content of the configuration |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
546 configurationFileArg_ = configurationFile; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
547 ReadConfiguration(json_, configurationFile); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
548 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
549 // Adapt the paths to the configurations |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
550 defaultDirectory_ = boost::filesystem::current_path(); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
551 configurationAbsolutePath_ = ""; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
552 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
553 if (configurationFile) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
554 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
555 if (boost::filesystem::is_directory(configurationFile)) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
556 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
557 defaultDirectory_ = boost::filesystem::path(configurationFile); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
558 configurationAbsolutePath_ = boost::filesystem::absolute(configurationFile).parent_path().string(); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
559 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
560 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
561 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
562 defaultDirectory_ = boost::filesystem::path(configurationFile).parent_path(); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
563 configurationAbsolutePath_ = boost::filesystem::absolute(configurationFile).string(); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
564 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
565 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
566 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
567 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
568 #if ORTHANC_STANDALONE != 1 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
569 // In a non-standalone build, we use the |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
570 // "Resources/Configuration.json" from the Orthanc source code |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
571 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
572 boost::filesystem::path p = ORTHANC_PATH; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
573 p /= "Resources"; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
574 p /= "Configuration.json"; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
575 configurationAbsolutePath_ = boost::filesystem::absolute(p).string(); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
576 #endif |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
577 } |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
578 } |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
579 |
2946
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
580 |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
581 void OrthancConfiguration::LoadModalitiesAndPeers() |
2e751f615e03
new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2944
diff
changeset
|
582 { |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
583 if (serverIndex_ == NULL) |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
584 { |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
585 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
586 } |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
587 else |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
588 { |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
589 LoadModalities(); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
590 LoadPeers(); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
591 } |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
592 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
593 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
594 |
4031
e3b3af80732d
ServerResources, and moving EmbeddedResourceHttpHandler from Core to OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3939
diff
changeset
|
595 void OrthancConfiguration::RegisterFont(ServerResources::FileResourceId resource) |
e3b3af80732d
ServerResources, and moving EmbeddedResourceHttpHandler from Core to OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3939
diff
changeset
|
596 { |
e3b3af80732d
ServerResources, and moving EmbeddedResourceHttpHandler from Core to OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3939
diff
changeset
|
597 std::string content; |
e3b3af80732d
ServerResources, and moving EmbeddedResourceHttpHandler from Core to OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3939
diff
changeset
|
598 ServerResources::GetFileResource(content, resource); |
e3b3af80732d
ServerResources, and moving EmbeddedResourceHttpHandler from Core to OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3939
diff
changeset
|
599 fontRegistry_.AddFromMemory(content); |
e3b3af80732d
ServerResources, and moving EmbeddedResourceHttpHandler from Core to OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3939
diff
changeset
|
600 } |
e3b3af80732d
ServerResources, and moving EmbeddedResourceHttpHandler from Core to OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3939
diff
changeset
|
601 |
e3b3af80732d
ServerResources, and moving EmbeddedResourceHttpHandler from Core to OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3939
diff
changeset
|
602 |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
603 void OrthancConfiguration::GetDicomModalityUsingSymbolicName( |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
604 RemoteModalityParameters& modality, |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
605 const std::string& name) const |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
606 { |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
607 Modalities::const_iterator found = modalities_.find(name); |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
608 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
609 if (found == modalities_.end()) |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
610 { |
2956 | 611 throw OrthancException(ErrorCode_InexistentItem, |
612 "No modality with symbolic name: " + name); | |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
613 } |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
614 else |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
615 { |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
616 modality = found->second; |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
617 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
618 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
619 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
620 |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
621 bool OrthancConfiguration::LookupOrthancPeer(WebServiceParameters& peer, |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
622 const std::string& name) const |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
623 { |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
624 Peers::const_iterator found = peers_.find(name); |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
625 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
626 if (found == peers_.end()) |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
627 { |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
628 LOG(ERROR) << "No peer with symbolic name: " << name; |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
629 return false; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
630 } |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
631 else |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
632 { |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
633 peer = found->second; |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
634 return true; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
635 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
636 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
637 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
638 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
639 void OrthancConfiguration::GetListOfDicomModalities(std::set<std::string>& target) const |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
640 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
641 target.clear(); |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
642 |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
643 for (Modalities::const_iterator |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
644 it = modalities_.begin(); it != modalities_.end(); ++it) |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
645 { |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
646 target.insert(it->first); |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
647 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
648 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
649 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
650 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
651 void OrthancConfiguration::GetListOfOrthancPeers(std::set<std::string>& target) const |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
652 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
653 target.clear(); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
654 |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
655 for (Peers::const_iterator it = peers_.begin(); it != peers_.end(); ++it) |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
656 { |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
657 target.insert(it->first); |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
658 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
659 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
660 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
661 |
3500
0d248cc63ded
Security: If remote HTTP access is enabled, HTTP authentication automatically gets enabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3341
diff
changeset
|
662 bool OrthancConfiguration::SetupRegisteredUsers(HttpServer& httpServer) const |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
663 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
664 httpServer.ClearUsers(); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
665 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
666 if (!json_.isMember("RegisteredUsers")) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
667 { |
3500
0d248cc63ded
Security: If remote HTTP access is enabled, HTTP authentication automatically gets enabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3341
diff
changeset
|
668 return false; |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
669 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
670 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
671 const Json::Value& users = json_["RegisteredUsers"]; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
672 if (users.type() != Json::objectValue) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
673 { |
2956 | 674 throw OrthancException(ErrorCode_BadFileFormat, "Badly formatted list of users"); |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
675 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
676 |
3500
0d248cc63ded
Security: If remote HTTP access is enabled, HTTP authentication automatically gets enabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3341
diff
changeset
|
677 bool hasUser = false; |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
678 Json::Value::Members usernames = users.getMemberNames(); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
679 for (size_t i = 0; i < usernames.size(); i++) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
680 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
681 const std::string& username = usernames[i]; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
682 std::string password = users[username].asString(); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
683 httpServer.RegisterUser(username.c_str(), password.c_str()); |
3500
0d248cc63ded
Security: If remote HTTP access is enabled, HTTP authentication automatically gets enabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3341
diff
changeset
|
684 hasUser = true; |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
685 } |
3500
0d248cc63ded
Security: If remote HTTP access is enabled, HTTP authentication automatically gets enabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3341
diff
changeset
|
686 |
0d248cc63ded
Security: If remote HTTP access is enabled, HTTP authentication automatically gets enabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3341
diff
changeset
|
687 return hasUser; |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
688 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
689 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
690 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
691 std::string OrthancConfiguration::InterpretStringParameterAsPath( |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
692 const std::string& parameter) const |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
693 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
694 return SystemToolbox::InterpretRelativePath(defaultDirectory_.string(), parameter); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
695 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
696 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
697 |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2933
diff
changeset
|
698 void OrthancConfiguration::GetListOfStringsParameter(std::list<std::string>& target, |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2933
diff
changeset
|
699 const std::string& key) const |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
700 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
701 target.clear(); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
702 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
703 if (!json_.isMember(key)) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
704 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
705 return; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
706 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
707 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
708 const Json::Value& lst = json_[key]; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
709 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
710 if (lst.type() != Json::arrayValue) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
711 { |
2956 | 712 throw OrthancException(ErrorCode_BadFileFormat, "Badly formatted list of strings"); |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
713 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
714 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
715 for (Json::Value::ArrayIndex i = 0; i < lst.size(); i++) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
716 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
717 target.push_back(lst[i].asString()); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
718 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
719 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
720 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
721 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
722 bool OrthancConfiguration::IsSameAETitle(const std::string& aet1, |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
723 const std::string& aet2) const |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
724 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
725 if (GetBooleanParameter("StrictAetComparison", false)) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
726 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
727 // Case-sensitive matching |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
728 return aet1 == aet2; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
729 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
730 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
731 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
732 // Case-insensitive matching (default) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
733 std::string tmp1, tmp2; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
734 Toolbox::ToLowerCase(tmp1, aet1); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
735 Toolbox::ToLowerCase(tmp2, aet2); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
736 return tmp1 == tmp2; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
737 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
738 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
739 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
740 |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
741 bool OrthancConfiguration::LookupDicomModalityUsingAETitle(RemoteModalityParameters& modality, |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
742 const std::string& aet) const |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
743 { |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
744 for (Modalities::const_iterator it = modalities_.begin(); it != modalities_.end(); ++it) |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
745 { |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
746 if (IsSameAETitle(aet, it->second.GetApplicationEntityTitle())) |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
747 { |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
748 modality = it->second; |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
749 return true; |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
750 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
751 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
752 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
753 return false; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
754 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
755 |
4182
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
756 bool OrthancConfiguration::LookupDicomModalitiesUsingAETitle(std::list<RemoteModalityParameters>& modalities, |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
757 const std::string& aet) const |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
758 { |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
759 modalities.clear(); |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
760 |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
761 for (Modalities::const_iterator it = modalities_.begin(); it != modalities_.end(); ++it) |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
762 { |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
763 if (IsSameAETitle(aet, it->second.GetApplicationEntityTitle())) |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
764 { |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
765 modalities.push_back(it->second); |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
766 } |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
767 } |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
768 |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
769 return modalities.size() > 0; |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
770 } |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
771 |
1c9c2c41c015
When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
Alain Mazy <alain@mazy.be>
parents:
4164
diff
changeset
|
772 |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
773 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
774 bool OrthancConfiguration::IsKnownAETitle(const std::string& aet, |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
775 const std::string& ip) const |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
776 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
777 RemoteModalityParameters modality; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
778 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
779 if (!LookupDicomModalityUsingAETitle(modality, aet)) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
780 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
781 LOG(WARNING) << "Modality \"" << aet |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
782 << "\" is not listed in the \"DicomModalities\" configuration option"; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
783 return false; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
784 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
785 else if (!GetBooleanParameter("DicomCheckModalityHost", false) || |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
786 ip == modality.GetHost()) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
787 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
788 return true; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
789 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
790 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
791 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
792 LOG(WARNING) << "Forbidding access from AET \"" << aet |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
793 << "\" given its hostname (" << ip << ") does not match " |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
794 << "the \"DicomModalities\" configuration option (" |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
795 << modality.GetHost() << " was expected)"; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
796 return false; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
797 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
798 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
799 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
800 |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
801 RemoteModalityParameters |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
802 OrthancConfiguration::GetModalityUsingSymbolicName(const std::string& name) const |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
803 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
804 RemoteModalityParameters modality; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
805 GetDicomModalityUsingSymbolicName(modality, name); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
806 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
807 return modality; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
808 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
809 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
810 |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
811 RemoteModalityParameters |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
812 OrthancConfiguration::GetModalityUsingAet(const std::string& aet) const |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
813 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
814 RemoteModalityParameters modality; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
815 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
816 if (LookupDicomModalityUsingAETitle(modality, aet)) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
817 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
818 return modality; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
819 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
820 else |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
821 { |
2956 | 822 throw OrthancException(ErrorCode_InexistentItem, |
823 "Unknown modality for AET: " + aet); | |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
824 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
825 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
826 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
827 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
828 void OrthancConfiguration::UpdateModality(const std::string& symbolicName, |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
829 const RemoteModalityParameters& modality) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
830 { |
3341
8f44dadcdbc1
Fix issue #138 (POST to modalities/{name} accepts invalid characters)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3184
diff
changeset
|
831 CheckAlphanumeric(symbolicName); |
8f44dadcdbc1
Fix issue #138 (POST to modalities/{name} accepts invalid characters)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3184
diff
changeset
|
832 |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
833 modalities_[symbolicName] = modality; |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
834 SaveModalities(); |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
835 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
836 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
837 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
838 void OrthancConfiguration::RemoveModality(const std::string& symbolicName) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
839 { |
4267
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
840 if (modalities_.find(symbolicName) == modalities_.end()) |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
841 { |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
842 throw OrthancException(ErrorCode_InexistentItem, |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
843 "Unknown DICOM modality with symbolic name: " + symbolicName); |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
844 } |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
845 else |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
846 { |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
847 modalities_.erase(symbolicName); |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
848 SaveModalities(); |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
849 } |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
850 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
851 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
852 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
853 void OrthancConfiguration::UpdatePeer(const std::string& symbolicName, |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
854 const WebServiceParameters& peer) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
855 { |
3341
8f44dadcdbc1
Fix issue #138 (POST to modalities/{name} accepts invalid characters)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3184
diff
changeset
|
856 CheckAlphanumeric(symbolicName); |
8f44dadcdbc1
Fix issue #138 (POST to modalities/{name} accepts invalid characters)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3184
diff
changeset
|
857 |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
858 peer.CheckClientCertificate(); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
859 |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
860 peers_[symbolicName] = peer; |
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2941
diff
changeset
|
861 SavePeers(); |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
862 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
863 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
864 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
865 void OrthancConfiguration::RemovePeer(const std::string& symbolicName) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
866 { |
4267
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
867 if (peers_.find(symbolicName) == peers_.end()) |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
868 { |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
869 throw OrthancException(ErrorCode_InexistentItem, |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
870 "Unknown Orthanc peer: " + symbolicName); |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
871 } |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
872 else |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
873 { |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
874 peers_.erase(symbolicName); |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
875 SavePeers(); |
a20928107a90
REST API returns 404 error if deleting an inexistent peer or modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4204
diff
changeset
|
876 } |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
877 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
878 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
879 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
880 void OrthancConfiguration::Format(std::string& result) const |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
881 { |
4394
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4392
diff
changeset
|
882 Toolbox::WriteStyledJson(result, json_); |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
883 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
884 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
885 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
886 void OrthancConfiguration::SetDefaultEncoding(Encoding encoding) |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
887 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
888 SetDefaultDicomEncoding(encoding); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
889 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
890 // Propagate the encoding to the configuration file that is |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
891 // stored in memory |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
892 json_["DefaultEncoding"] = EnumerationToString(encoding); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
893 } |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
894 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
895 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
896 bool OrthancConfiguration::HasConfigurationChanged() const |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
897 { |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
898 Json::Value current; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
899 ReadConfiguration(current, configurationFileArg_); |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
900 |
4392
3af1d763763a
confining Json::Reader and Json::*Writer into Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4267
diff
changeset
|
901 std::string a, b; |
4394
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4392
diff
changeset
|
902 Toolbox::WriteFastJson(a, json_); |
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4392
diff
changeset
|
903 Toolbox::WriteFastJson(b, current); |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
904 |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
905 return a != b; |
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
906 } |
2941
e292798f9980
OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
907 |
e292798f9980
OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
908 |
e292798f9980
OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
909 void OrthancConfiguration::SetServerIndex(ServerIndex& index) |
e292798f9980
OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
910 { |
e292798f9980
OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
911 serverIndex_ = &index; |
e292798f9980
OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
912 } |
e292798f9980
OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
913 |
e292798f9980
OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
914 |
e292798f9980
OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
915 void OrthancConfiguration::ResetServerIndex() |
e292798f9980
OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
916 { |
e292798f9980
OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
917 serverIndex_ = NULL; |
e292798f9980
OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
918 } |
3181
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3138
diff
changeset
|
919 |
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3138
diff
changeset
|
920 |
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3138
diff
changeset
|
921 TemporaryFile* OrthancConfiguration::CreateTemporaryFile() const |
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3138
diff
changeset
|
922 { |
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3138
diff
changeset
|
923 if (json_.isMember(TEMPORARY_DIRECTORY)) |
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3138
diff
changeset
|
924 { |
3184 | 925 return new TemporaryFile(InterpretStringParameterAsPath(GetStringParameter(TEMPORARY_DIRECTORY, ".")), ""); |
3181
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3138
diff
changeset
|
926 } |
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3138
diff
changeset
|
927 else |
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3138
diff
changeset
|
928 { |
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3138
diff
changeset
|
929 return new TemporaryFile; |
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3138
diff
changeset
|
930 } |
6fd38327e777
Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3138
diff
changeset
|
931 } |
3709
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
932 |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
933 |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
934 std::string OrthancConfiguration::GetDefaultPrivateCreator() const |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
935 { |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
936 // New configuration option in Orthanc 1.6.0 |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
937 return GetStringParameter("DefaultPrivateCreator", ""); |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
938 } |
4140
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
939 |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
940 |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
941 static void GetAcceptOption(std::set<DicomTransferSyntax>& target, |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
942 const OrthancConfiguration& configuration, |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
943 const std::string& optionName, |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
944 TransferSyntaxGroup optionGroup) |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
945 { |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
946 bool accept; |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
947 if (configuration.LookupBooleanParameter(accept, optionName)) |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
948 { |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
949 std::set<DicomTransferSyntax> group; |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
950 GetTransferSyntaxGroup(group, optionGroup); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
951 |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
952 for (std::set<DicomTransferSyntax>::const_iterator |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
953 syntax = group.begin(); syntax != group.end(); ++syntax) |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
954 { |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
955 if (accept) |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
956 { |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
957 target.insert(*syntax); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
958 } |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
959 else |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
960 { |
4474
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
961 target.erase(*syntax); |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
962 } |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
963 } |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
964 } |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
965 } |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
966 |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
967 |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
968 void OrthancConfiguration::GetAcceptedTransferSyntaxes(std::set<DicomTransferSyntax>& target) const |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
969 { |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
970 target.clear(); |
4474
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
971 |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
972 #if 1 |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
973 /** |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
974 * This is the behavior in Orthanc >= 1.9.0. All the transfer |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
975 * syntaxes are accepted by default, and the |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
976 * "TransferSyntaxAccepted" options can be used to disable groups |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
977 * of transfer syntaxes. |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
978 **/ |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
979 |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
980 static const char* const ACCEPTED_TRANSFER_SYNTAXES = "AcceptedTransferSyntaxes"; |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
981 |
4487 | 982 if (json_.isMember(ACCEPTED_TRANSFER_SYNTAXES)) |
4474
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
983 { |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
984 ParseAcceptedTransferSyntaxes(target, json_[ACCEPTED_TRANSFER_SYNTAXES]); |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
985 } |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
986 else |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
987 { |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
988 GetAllDicomTransferSyntaxes(target); |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
989 } |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
990 #else |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
991 /** |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
992 * This was the behavior of Orthanc <= 1.8.2. The uncompressed |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
993 * transfer syntaxes were always accepted, and additional transfer |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
994 * syntaxes were added using the configuration options |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
995 * "XXXTransferSyntaxAccepted". |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
996 **/ |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
997 |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
998 // The 3 transfer syntaxes below were the only ones to be supported in Orthanc <= 0.7.1 |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
999 target.insert(DicomTransferSyntax_LittleEndianExplicit); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1000 target.insert(DicomTransferSyntax_BigEndianExplicit); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1001 target.insert(DicomTransferSyntax_LittleEndianImplicit); |
4474
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1002 #endif |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1003 |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1004 // Groups of transfer syntaxes, supported since Orthanc 0.7.2 |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1005 GetAcceptOption(target, *this, "DeflatedTransferSyntaxAccepted", TransferSyntaxGroup_Deflated); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1006 GetAcceptOption(target, *this, "JpegTransferSyntaxAccepted", TransferSyntaxGroup_Jpeg); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1007 GetAcceptOption(target, *this, "Jpeg2000TransferSyntaxAccepted", TransferSyntaxGroup_Jpeg2000); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1008 GetAcceptOption(target, *this, "JpegLosslessTransferSyntaxAccepted", TransferSyntaxGroup_JpegLossless); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1009 GetAcceptOption(target, *this, "JpipTransferSyntaxAccepted", TransferSyntaxGroup_Jpip); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1010 GetAcceptOption(target, *this, "Mpeg2TransferSyntaxAccepted", TransferSyntaxGroup_Mpeg2); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1011 GetAcceptOption(target, *this, "Mpeg4TransferSyntaxAccepted", TransferSyntaxGroup_Mpeg4); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1012 GetAcceptOption(target, *this, "RleTransferSyntaxAccepted", TransferSyntaxGroup_Rle); |
4474
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1013 GetAcceptOption(target, *this, "H265TransferSyntaxAccepted", TransferSyntaxGroup_H265); |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1014 } |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1015 |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1016 |
4140
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1017 void OrthancConfiguration::DefaultExtractDicomSummary(DicomMap& target, |
4204 | 1018 const ParsedDicomFile& dicom) |
4140
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1019 { |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1020 std::set<DicomTag> ignoreTagLength; |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1021 dicom.ExtractDicomSummary(target, ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength); |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1022 } |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1023 |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1024 |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1025 void OrthancConfiguration::DefaultExtractDicomSummary(DicomMap& target, |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1026 DcmDataset& dicom) |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1027 { |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1028 std::set<DicomTag> ignoreTagLength; |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1029 FromDcmtkBridge::ExtractDicomSummary(target, dicom, ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength); |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1030 } |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1031 |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1032 |
4140
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1033 void OrthancConfiguration::DefaultDicomDatasetToJson(Json::Value& target, |
4204 | 1034 const ParsedDicomFile& dicom) |
4140
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1035 { |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1036 std::set<DicomTag> ignoreTagLength; |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1037 DefaultDicomDatasetToJson(target, dicom, ignoreTagLength); |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1038 } |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1039 |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1040 |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1041 void OrthancConfiguration::DefaultDicomDatasetToJson(Json::Value& target, |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1042 DcmDataset& dicom) |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1043 { |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1044 std::set<DicomTag> ignoreTagLength; |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1045 FromDcmtkBridge::ExtractDicomAsJson(target, dicom, DicomToJsonFormat_Full, DicomToJsonFlags_Default, |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1046 ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength); |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4487
diff
changeset
|
1047 } |
4140
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1048 |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1049 |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1050 void OrthancConfiguration::DefaultDicomDatasetToJson(Json::Value& target, |
4204 | 1051 const ParsedDicomFile& dicom, |
4140
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1052 const std::set<DicomTag>& ignoreTagLength) |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1053 { |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1054 dicom.DatasetToJson(target, DicomToJsonFormat_Full, DicomToJsonFlags_Default, |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1055 ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength); |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1056 } |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1057 |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1058 |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1059 void OrthancConfiguration::DefaultDicomHeaderToJson(Json::Value& target, |
4204 | 1060 const ParsedDicomFile& dicom) |
4140
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1061 { |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1062 dicom.HeaderToJson(target, DicomToJsonFormat_Full); |
0ddc5297a8ab
centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1063 } |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1064 |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1065 |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1066 static void AddTransferSyntaxes(std::set<DicomTransferSyntax>& target, |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1067 const std::string& source) |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1068 { |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1069 boost::regex pattern(Toolbox::WildcardToRegularExpression(source)); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1070 |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1071 std::set<DicomTransferSyntax> allSyntaxes; |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1072 GetAllDicomTransferSyntaxes(allSyntaxes); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1073 |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1074 for (std::set<DicomTransferSyntax>::const_iterator |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1075 syntax = allSyntaxes.begin(); syntax != allSyntaxes.end(); ++syntax) |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1076 { |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1077 if (regex_match(GetTransferSyntaxUid(*syntax), pattern)) |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1078 { |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1079 target.insert(*syntax); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1080 } |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1081 } |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1082 } |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1083 |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1084 |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1085 void OrthancConfiguration::ParseAcceptedTransferSyntaxes(std::set<DicomTransferSyntax>& target, |
4474
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1086 const Json::Value& source) |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1087 { |
4474
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1088 if (source.type() == Json::stringValue) |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1089 { |
4474
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1090 AddTransferSyntaxes(target, source.asString()); |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1091 } |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1092 else if (source.type() == Json::arrayValue) |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1093 { |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1094 for (Json::Value::ArrayIndex i = 0; i < source.size(); i++) |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1095 { |
4474
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1096 if (source[i].type() == Json::stringValue) |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1097 { |
4474
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1098 AddTransferSyntaxes(target, source[i].asString()); |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1099 } |
4474
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1100 else |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1101 { |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1102 throw OrthancException(ErrorCode_BadFileFormat); |
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1103 } |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1104 } |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1105 } |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1106 else |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1107 { |
4474
f8c1d94363b6
new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4473
diff
changeset
|
1108 throw OrthancException(ErrorCode_BadFileFormat); |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1109 } |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1110 } |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1111 } |