Mercurial > hg > orthanc
annotate Core/DicomNetworking/RemoteModalityParameters.cpp @ 3785:763533d6dd67 SylvainRouquette/fix-issue169-95b752c
add PreferredTransferSyntax to RemoteModalityParameters
DicomUserConnection can now use RemoteModalityParameters.PreferredTransferSyntax instead of using the default transfer syntax (LE-implicit).
This way we can transcode by default in LE-explicit.
fix issue #169
author | sylvain.rouquette@incepto-medical.com |
---|---|
date | Wed, 18 Mar 2020 08:59:06 +0100 |
parents | 4e43e67f8ecf |
children | 3801435e34a1 |
rev | line source |
---|---|
806 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
942
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3060
4e43e67f8ecf
preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2954
diff
changeset
|
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
806 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
34 #include "../PrecompiledHeaders.h" |
806 | 35 #include "RemoteModalityParameters.h" |
36 | |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
37 #include "../Logging.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
38 #include "../OrthancException.h" |
2659 | 39 #include "../SerializationToolbox.h" |
806 | 40 |
3785
763533d6dd67
add PreferredTransferSyntax to RemoteModalityParameters
sylvain.rouquette@incepto-medical.com
parents:
3060
diff
changeset
|
41 #include <dcmtk/dcmdata/dcuid.h> |
763533d6dd67
add PreferredTransferSyntax to RemoteModalityParameters
sylvain.rouquette@incepto-medical.com
parents:
3060
diff
changeset
|
42 |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
43 #include <boost/lexical_cast.hpp> |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
44 #include <stdexcept> |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
45 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
46 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
47 static const char* KEY_AET = "AET"; |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
48 static const char* KEY_ALLOW_ECHO = "AllowEcho"; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
49 static const char* KEY_ALLOW_FIND = "AllowFind"; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
50 static const char* KEY_ALLOW_GET = "AllowGet"; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
51 static const char* KEY_ALLOW_MOVE = "AllowMove"; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
52 static const char* KEY_ALLOW_STORE = "AllowStore"; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
53 static const char* KEY_HOST = "Host"; |
3785
763533d6dd67
add PreferredTransferSyntax to RemoteModalityParameters
sylvain.rouquette@incepto-medical.com
parents:
3060
diff
changeset
|
54 static const char* KEY_PREFERRED_TRANSFER_SYNTAX = "PreferredTransferSyntax"; |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
55 static const char* KEY_MANUFACTURER = "Manufacturer"; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
56 static const char* KEY_PORT = "Port"; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
57 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
58 |
806 | 59 namespace Orthanc |
60 { | |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
61 void RemoteModalityParameters::Clear() |
806 | 62 { |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
63 aet_ = "ORTHANC"; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
64 host_ = "127.0.0.1"; |
3785
763533d6dd67
add PreferredTransferSyntax to RemoteModalityParameters
sylvain.rouquette@incepto-medical.com
parents:
3060
diff
changeset
|
65 preferredTransferSyntax_ = UID_LittleEndianImplicitTransferSyntax; |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
66 port_ = 104; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
67 manufacturer_ = ModalityManufacturer_Generic; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
68 allowEcho_ = true; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
69 allowStore_ = true; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
70 allowFind_ = true; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
71 allowMove_ = true; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
72 allowGet_ = true; |
806 | 73 } |
74 | |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
75 |
1427
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
76 RemoteModalityParameters::RemoteModalityParameters(const std::string& aet, |
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
77 const std::string& host, |
1654
3727a09e7b53
fix some icc warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
78 uint16_t port, |
1427
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
79 ModalityManufacturer manufacturer) |
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
80 { |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
81 Clear(); |
1427
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
82 SetApplicationEntityTitle(aet); |
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
83 SetHost(host); |
2715
73bc0c32547c
fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
84 SetPortNumber(port); |
1427
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
85 SetManufacturer(manufacturer); |
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
86 } |
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
87 |
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
88 |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
89 static void CheckPortNumber(int value) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
90 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
91 if (value <= 0 || |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
92 value >= 65535) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
93 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
94 throw OrthancException(ErrorCode_ParameterOutOfRange, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
95 "A TCP port number must be in range [1..65534], but found: " + |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
96 boost::lexical_cast<std::string>(value)); |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
97 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
98 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
99 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
100 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
101 static uint16_t ReadPortNumber(const Json::Value& value) |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
102 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
103 int tmp; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
104 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
105 switch (value.type()) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
106 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
107 case Json::intValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
108 case Json::uintValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
109 tmp = value.asInt(); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
110 break; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
111 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
112 case Json::stringValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
113 try |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
114 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
115 tmp = boost::lexical_cast<int>(value.asString()); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
116 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
117 catch (boost::bad_lexical_cast&) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
118 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
119 throw OrthancException(ErrorCode_BadFileFormat); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
120 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
121 break; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
122 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
123 default: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
124 throw OrthancException(ErrorCode_BadFileFormat); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
125 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
126 |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
127 CheckPortNumber(tmp); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
128 return static_cast<uint16_t>(tmp); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
129 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
130 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
131 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
132 void RemoteModalityParameters::SetPortNumber(uint16_t port) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
133 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
134 CheckPortNumber(port); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
135 port_ = port; |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
136 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
137 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
138 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
139 void RemoteModalityParameters::UnserializeArray(const Json::Value& serialized) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
140 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
141 assert(serialized.type() == Json::arrayValue); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
142 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
143 if ((serialized.size() != 3 && |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
144 serialized.size() != 4) || |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
145 serialized[0].type() != Json::stringValue || |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
146 serialized[1].type() != Json::stringValue || |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
147 (serialized.size() == 4 && |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
148 serialized[3].type() != Json::stringValue)) |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
149 { |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
150 throw OrthancException(ErrorCode_BadFileFormat); |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
151 } |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
152 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
153 aet_ = serialized[0].asString(); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
154 host_ = serialized[1].asString(); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
155 port_ = ReadPortNumber(serialized[2]); |
1654
3727a09e7b53
fix some icc warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
156 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
157 if (serialized.size() == 4) |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
158 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
159 manufacturer_ = StringToModalityManufacturer(serialized[3].asString()); |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
160 } |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
161 else |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
162 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
163 manufacturer_ = ModalityManufacturer_Generic; |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
164 } |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
165 } |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
166 |
2715
73bc0c32547c
fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
167 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
168 void RemoteModalityParameters::UnserializeObject(const Json::Value& serialized) |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
169 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
170 assert(serialized.type() == Json::objectValue); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
171 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
172 aet_ = SerializationToolbox::ReadString(serialized, KEY_AET); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
173 host_ = SerializationToolbox::ReadString(serialized, KEY_HOST); |
3785
763533d6dd67
add PreferredTransferSyntax to RemoteModalityParameters
sylvain.rouquette@incepto-medical.com
parents:
3060
diff
changeset
|
174 preferredTransferSyntax_ = SerializationToolbox::ReadString(serialized, KEY_PREFERRED_TRANSFER_SYNTAX); |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
175 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
176 if (serialized.isMember(KEY_PORT)) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
177 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
178 port_ = ReadPortNumber(serialized[KEY_PORT]); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
179 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
180 else |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
181 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
182 throw OrthancException(ErrorCode_BadFileFormat); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
183 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
184 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
185 if (serialized.isMember(KEY_MANUFACTURER)) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
186 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
187 manufacturer_ = StringToModalityManufacturer |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
188 (SerializationToolbox::ReadString(serialized, KEY_MANUFACTURER)); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
189 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
190 else |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
191 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
192 manufacturer_ = ModalityManufacturer_Generic; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
193 } |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
194 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
195 if (serialized.isMember(KEY_ALLOW_ECHO)) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
196 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
197 allowEcho_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_ECHO); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
198 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
199 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
200 if (serialized.isMember(KEY_ALLOW_FIND)) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
201 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
202 allowFind_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_FIND); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
203 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
204 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
205 if (serialized.isMember(KEY_ALLOW_STORE)) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
206 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
207 allowStore_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_STORE); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
208 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
209 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
210 if (serialized.isMember(KEY_ALLOW_GET)) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
211 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
212 allowGet_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_GET); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
213 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
214 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
215 if (serialized.isMember(KEY_ALLOW_MOVE)) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
216 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
217 allowMove_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_MOVE); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
218 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
219 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
220 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
221 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
222 bool RemoteModalityParameters::IsRequestAllowed(DicomRequestType type) const |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
223 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
224 switch (type) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
225 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
226 case DicomRequestType_Echo: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
227 return allowEcho_; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
228 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
229 case DicomRequestType_Find: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
230 return allowFind_; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
231 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
232 case DicomRequestType_Get: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
233 return allowGet_; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
234 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
235 case DicomRequestType_Move: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
236 return allowMove_; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
237 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
238 case DicomRequestType_Store: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
239 return allowStore_; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
240 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
241 default: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
242 throw OrthancException(ErrorCode_ParameterOutOfRange); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
243 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
244 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
245 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
246 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
247 void RemoteModalityParameters::SetRequestAllowed(DicomRequestType type, |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
248 bool allowed) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
249 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
250 switch (type) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
251 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
252 case DicomRequestType_Echo: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
253 allowEcho_ = allowed; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
254 break; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
255 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
256 case DicomRequestType_Find: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
257 allowFind_ = allowed; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
258 break; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
259 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
260 case DicomRequestType_Get: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
261 allowGet_ = allowed; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
262 break; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
263 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
264 case DicomRequestType_Move: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
265 allowMove_ = allowed; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
266 break; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
267 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
268 case DicomRequestType_Store: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
269 allowStore_ = allowed; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
270 break; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
271 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
272 default: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
273 throw OrthancException(ErrorCode_ParameterOutOfRange); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
274 } |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
275 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
276 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
277 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
278 bool RemoteModalityParameters::IsAdvancedFormatNeeded() const |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
279 { |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
280 return (!allowEcho_ || |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
281 !allowStore_ || |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
282 !allowFind_ || |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
283 !allowGet_ || |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
284 !allowMove_); |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
285 } |
2655 | 286 |
287 | |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
288 void RemoteModalityParameters::Serialize(Json::Value& target, |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
289 bool forceAdvancedFormat) const |
2655 | 290 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
291 if (forceAdvancedFormat || |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
292 IsAdvancedFormatNeeded()) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
293 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
294 target = Json::objectValue; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
295 target[KEY_AET] = aet_; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
296 target[KEY_HOST] = host_; |
3785
763533d6dd67
add PreferredTransferSyntax to RemoteModalityParameters
sylvain.rouquette@incepto-medical.com
parents:
3060
diff
changeset
|
297 target[KEY_PREFERRED_TRANSFER_SYNTAX] = preferredTransferSyntax_; |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
298 target[KEY_PORT] = port_; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
299 target[KEY_MANUFACTURER] = EnumerationToString(manufacturer_); |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
300 target[KEY_ALLOW_ECHO] = allowEcho_; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
301 target[KEY_ALLOW_STORE] = allowStore_; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
302 target[KEY_ALLOW_FIND] = allowFind_; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
303 target[KEY_ALLOW_GET] = allowGet_; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
304 target[KEY_ALLOW_MOVE] = allowMove_; |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
305 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
306 else |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
307 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
308 target = Json::arrayValue; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
309 target.append(GetApplicationEntityTitle()); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
310 target.append(GetHost()); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
311 target.append(GetPortNumber()); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
312 target.append(EnumerationToString(GetManufacturer())); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
313 } |
2655 | 314 } |
315 | |
316 | |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
317 void RemoteModalityParameters::Unserialize(const Json::Value& serialized) |
2655 | 318 { |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
319 Clear(); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
320 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
321 switch (serialized.type()) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
322 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
323 case Json::objectValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
324 UnserializeObject(serialized); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
325 break; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
326 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
327 case Json::arrayValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
328 UnserializeArray(serialized); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
329 break; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
330 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
331 default: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
332 throw OrthancException(ErrorCode_BadFileFormat); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
333 } |
2655 | 334 } |
806 | 335 } |