Mercurial > hg > orthanc
annotate Core/Enumerations.cpp @ 1576:de54c19fc44d
refactoring OrthancException
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 25 Aug 2015 14:48:06 +0200 |
parents | f8aae45011c9 |
children | 7aac0cddd42e |
rev | line source |
---|---|
477 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1206
diff
changeset
|
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics |
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1206
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
477 | 5 * |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation, either version 3 of the | |
9 * License, or (at your option) any later version. | |
10 * | |
11 * In addition, as a special exception, the copyright holders of this | |
12 * program give permission to link the code of its release with the | |
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
14 * that use the same license as the "OpenSSL" library), and distribute | |
15 * the linked executables. You must obey the GNU General Public License | |
16 * in all respects for all of the code used other than "OpenSSL". If you | |
17 * modify file(s) with this exception, you may extend this exception to | |
18 * your version of the file(s), but you are not obligated to do so. If | |
19 * you do not wish to do so, delete this exception statement from your | |
20 * version. If you delete this exception statement from all source files | |
21 * in the program, then also delete it here. | |
22 * | |
23 * This program is distributed in the hope that it will be useful, but | |
24 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 * General Public License for more details. | |
27 * | |
28 * You should have received a copy of the GNU General Public License | |
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
30 **/ | |
31 | |
32 | |
824
a811bdf8b8eb
precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
800
diff
changeset
|
33 #include "PrecompiledHeaders.h" |
477 | 34 #include "Enumerations.h" |
35 | |
36 #include "OrthancException.h" | |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
37 #include "Toolbox.h" |
477 | 38 |
1495
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
39 #include <string.h> |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
40 |
477 | 41 namespace Orthanc |
42 { | |
1575
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
43 const char* EnumerationToString(ErrorCode error) |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
44 { |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
45 switch (error) |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
46 { |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
47 case ErrorCode_Success: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
48 return "Success"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
49 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
50 case ErrorCode_Custom: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
51 return "Custom error, see the attached error message"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
52 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
53 case ErrorCode_InternalError: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
54 return "Internal error"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
55 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
56 case ErrorCode_NotImplemented: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
57 return "Not implemented yet"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
58 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
59 case ErrorCode_ParameterOutOfRange: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
60 return "Parameter out of range"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
61 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
62 case ErrorCode_NotEnoughMemory: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
63 return "Not enough memory"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
64 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
65 case ErrorCode_BadParameterType: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
66 return "Bad type for a parameter"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
67 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
68 case ErrorCode_BadSequenceOfCalls: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
69 return "Bad sequence of calls"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
70 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
71 case ErrorCode_UriSyntax: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
72 return "Badly formatted URI"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
73 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
74 case ErrorCode_InexistentFile: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
75 return "Inexistent file"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
76 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
77 case ErrorCode_BadFileFormat: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
78 return "Bad file format"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
79 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
80 case ErrorCode_CannotWriteFile: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
81 return "Cannot write to file"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
82 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
83 case ErrorCode_Timeout: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
84 return "Timeout"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
85 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
86 case ErrorCode_UnknownResource: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
87 return "Unknown resource"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
88 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
89 case ErrorCode_IncompatibleDatabaseVersion: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
90 return "Incompatible version of the database"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
91 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
92 case ErrorCode_FullStorage: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
93 return "The file storage is full"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
94 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
95 case ErrorCode_InexistentItem: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
96 return "Accessing an inexistent item"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
97 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
98 case ErrorCode_BadRequest: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
99 return "Bad request"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
100 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
101 case ErrorCode_NetworkProtocol: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
102 return "Error in the network protocol"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
103 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
104 case ErrorCode_CorruptedFile: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
105 return "Corrupted file (inconsistent MD5 hash)"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
106 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
107 case ErrorCode_InexistentTag: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
108 return "Inexistent tag"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
109 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
110 case ErrorCode_ReadOnly: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
111 return "Cannot modify a read-only data structure"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
112 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
113 case ErrorCode_IncompatibleImageSize: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
114 return "Incompatible size of the images"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
115 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
116 case ErrorCode_IncompatibleImageFormat: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
117 return "Incompatible format of the images"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
118 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
119 case ErrorCode_SharedLibrary: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
120 return "Error while using a shared library (plugin)"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
121 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
122 case ErrorCode_SystemCommand: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
123 return "Error while calling a system command"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
124 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
125 case ErrorCode_Plugin: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
126 return "Error encountered inside a plugin"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
127 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
128 case ErrorCode_Database: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
129 return "Error with the database engine"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
130 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
131 default: |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
132 return "Unknown error code"; |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
133 } |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
134 } |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
135 |
f8aae45011c9
exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
136 |
477 | 137 const char* EnumerationToString(HttpMethod method) |
138 { | |
139 switch (method) | |
140 { | |
141 case HttpMethod_Get: | |
142 return "GET"; | |
143 | |
144 case HttpMethod_Post: | |
145 return "POST"; | |
146 | |
147 case HttpMethod_Delete: | |
148 return "DELETE"; | |
149 | |
150 case HttpMethod_Put: | |
151 return "PUT"; | |
152 | |
153 default: | |
154 return "?"; | |
155 } | |
156 } | |
157 | |
158 | |
159 const char* EnumerationToString(HttpStatus status) | |
160 { | |
161 switch (status) | |
162 { | |
163 case HttpStatus_100_Continue: | |
164 return "Continue"; | |
165 | |
166 case HttpStatus_101_SwitchingProtocols: | |
167 return "Switching Protocols"; | |
168 | |
169 case HttpStatus_102_Processing: | |
170 return "Processing"; | |
171 | |
172 case HttpStatus_200_Ok: | |
173 return "OK"; | |
174 | |
175 case HttpStatus_201_Created: | |
176 return "Created"; | |
177 | |
178 case HttpStatus_202_Accepted: | |
179 return "Accepted"; | |
180 | |
181 case HttpStatus_203_NonAuthoritativeInformation: | |
182 return "Non-Authoritative Information"; | |
183 | |
184 case HttpStatus_204_NoContent: | |
185 return "No Content"; | |
186 | |
187 case HttpStatus_205_ResetContent: | |
188 return "Reset Content"; | |
189 | |
190 case HttpStatus_206_PartialContent: | |
191 return "Partial Content"; | |
192 | |
193 case HttpStatus_207_MultiStatus: | |
194 return "Multi-Status"; | |
195 | |
196 case HttpStatus_208_AlreadyReported: | |
197 return "Already Reported"; | |
198 | |
199 case HttpStatus_226_IMUsed: | |
200 return "IM Used"; | |
201 | |
202 case HttpStatus_300_MultipleChoices: | |
203 return "Multiple Choices"; | |
204 | |
205 case HttpStatus_301_MovedPermanently: | |
206 return "Moved Permanently"; | |
207 | |
208 case HttpStatus_302_Found: | |
209 return "Found"; | |
210 | |
211 case HttpStatus_303_SeeOther: | |
212 return "See Other"; | |
213 | |
214 case HttpStatus_304_NotModified: | |
215 return "Not Modified"; | |
216 | |
217 case HttpStatus_305_UseProxy: | |
218 return "Use Proxy"; | |
219 | |
220 case HttpStatus_307_TemporaryRedirect: | |
221 return "Temporary Redirect"; | |
222 | |
223 case HttpStatus_400_BadRequest: | |
224 return "Bad Request"; | |
225 | |
226 case HttpStatus_401_Unauthorized: | |
227 return "Unauthorized"; | |
228 | |
229 case HttpStatus_402_PaymentRequired: | |
230 return "Payment Required"; | |
231 | |
232 case HttpStatus_403_Forbidden: | |
233 return "Forbidden"; | |
234 | |
235 case HttpStatus_404_NotFound: | |
236 return "Not Found"; | |
237 | |
238 case HttpStatus_405_MethodNotAllowed: | |
239 return "Method Not Allowed"; | |
240 | |
241 case HttpStatus_406_NotAcceptable: | |
242 return "Not Acceptable"; | |
243 | |
244 case HttpStatus_407_ProxyAuthenticationRequired: | |
245 return "Proxy Authentication Required"; | |
246 | |
247 case HttpStatus_408_RequestTimeout: | |
248 return "Request Timeout"; | |
249 | |
250 case HttpStatus_409_Conflict: | |
251 return "Conflict"; | |
252 | |
253 case HttpStatus_410_Gone: | |
254 return "Gone"; | |
255 | |
256 case HttpStatus_411_LengthRequired: | |
257 return "Length Required"; | |
258 | |
259 case HttpStatus_412_PreconditionFailed: | |
260 return "Precondition Failed"; | |
261 | |
262 case HttpStatus_413_RequestEntityTooLarge: | |
263 return "Request Entity Too Large"; | |
264 | |
265 case HttpStatus_414_RequestUriTooLong: | |
266 return "Request-URI Too Long"; | |
267 | |
268 case HttpStatus_415_UnsupportedMediaType: | |
269 return "Unsupported Media Type"; | |
270 | |
271 case HttpStatus_416_RequestedRangeNotSatisfiable: | |
272 return "Requested Range Not Satisfiable"; | |
273 | |
274 case HttpStatus_417_ExpectationFailed: | |
275 return "Expectation Failed"; | |
276 | |
277 case HttpStatus_422_UnprocessableEntity: | |
278 return "Unprocessable Entity"; | |
279 | |
280 case HttpStatus_423_Locked: | |
281 return "Locked"; | |
282 | |
283 case HttpStatus_424_FailedDependency: | |
284 return "Failed Dependency"; | |
285 | |
286 case HttpStatus_426_UpgradeRequired: | |
287 return "Upgrade Required"; | |
288 | |
289 case HttpStatus_500_InternalServerError: | |
290 return "Internal Server Error"; | |
291 | |
292 case HttpStatus_501_NotImplemented: | |
293 return "Not Implemented"; | |
294 | |
295 case HttpStatus_502_BadGateway: | |
296 return "Bad Gateway"; | |
297 | |
298 case HttpStatus_503_ServiceUnavailable: | |
299 return "Service Unavailable"; | |
300 | |
301 case HttpStatus_504_GatewayTimeout: | |
302 return "Gateway Timeout"; | |
303 | |
304 case HttpStatus_505_HttpVersionNotSupported: | |
305 return "HTTP Version Not Supported"; | |
306 | |
307 case HttpStatus_506_VariantAlsoNegotiates: | |
308 return "Variant Also Negotiates"; | |
309 | |
310 case HttpStatus_507_InsufficientStorage: | |
311 return "Insufficient Storage"; | |
312 | |
313 case HttpStatus_509_BandwidthLimitExceeded: | |
314 return "Bandwidth Limit Exceeded"; | |
315 | |
316 case HttpStatus_510_NotExtended: | |
317 return "Not Extended"; | |
318 | |
319 default: | |
320 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
321 } | |
322 } | |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
323 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
324 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
325 const char* EnumerationToString(ResourceType type) |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
326 { |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
327 switch (type) |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
328 { |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
329 case ResourceType_Patient: |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
330 return "Patient"; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
331 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
332 case ResourceType_Study: |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
333 return "Study"; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
334 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
335 case ResourceType_Series: |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
336 return "Series"; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
337 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
338 case ResourceType_Instance: |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
339 return "Instance"; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
340 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
341 default: |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
342 throw OrthancException(ErrorCode_ParameterOutOfRange); |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
343 } |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
344 } |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
345 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
346 |
800
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
347 const char* EnumerationToString(ImageFormat format) |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
348 { |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
349 switch (format) |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
350 { |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
351 case ImageFormat_Png: |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
352 return "Png"; |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
353 |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
354 default: |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
355 throw OrthancException(ErrorCode_ParameterOutOfRange); |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
356 } |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
357 } |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
358 |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
359 |
1086
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
360 const char* EnumerationToString(Encoding encoding) |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
361 { |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
362 switch (encoding) |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
363 { |
1087 | 364 case Encoding_Ascii: |
365 return "Ascii"; | |
366 | |
1086
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
367 case Encoding_Utf8: |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
368 return "Utf8"; |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
369 |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
370 case Encoding_Latin1: |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
371 return "Latin1"; |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
372 |
1087 | 373 case Encoding_Latin2: |
374 return "Latin2"; | |
375 | |
376 case Encoding_Latin3: | |
377 return "Latin3"; | |
378 | |
379 case Encoding_Latin4: | |
380 return "Latin4"; | |
381 | |
382 case Encoding_Latin5: | |
383 return "Latin5"; | |
384 | |
385 case Encoding_Cyrillic: | |
386 return "Cyrillic"; | |
387 | |
1347 | 388 case Encoding_Windows1251: |
389 return "Windows1251"; | |
390 | |
1087 | 391 case Encoding_Arabic: |
392 return "Arabic"; | |
393 | |
394 case Encoding_Greek: | |
395 return "Greek"; | |
396 | |
397 case Encoding_Hebrew: | |
398 return "Hebrew"; | |
1086
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
399 |
1090
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
400 case Encoding_Thai: |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
401 return "Thai"; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
402 |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
403 case Encoding_Japanese: |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
404 return "Japanese"; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
405 |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
406 case Encoding_Chinese: |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
407 return "Chinese"; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
408 |
1086
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
409 default: |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
410 throw OrthancException(ErrorCode_ParameterOutOfRange); |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
411 } |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
412 } |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
413 |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
414 |
1206
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
415 const char* EnumerationToString(PhotometricInterpretation photometric) |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
416 { |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
417 switch (photometric) |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
418 { |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
419 case PhotometricInterpretation_RGB: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
420 return "RGB"; |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
421 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
422 case PhotometricInterpretation_Monochrome1: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
423 return "Monochrome1"; |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
424 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
425 case PhotometricInterpretation_Monochrome2: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
426 return "Monochrome2"; |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
427 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
428 case PhotometricInterpretation_ARGB: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
429 return "ARGB"; |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
430 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
431 case PhotometricInterpretation_CMYK: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
432 return "CMYK"; |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
433 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
434 case PhotometricInterpretation_HSV: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
435 return "HSV"; |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
436 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
437 case PhotometricInterpretation_Palette: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
438 return "Palette color"; |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
439 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
440 case PhotometricInterpretation_YBRFull: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
441 return "YBR full"; |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
442 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
443 case PhotometricInterpretation_YBRFull422: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
444 return "YBR full 422"; |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
445 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
446 case PhotometricInterpretation_YBRPartial420: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
447 return "YBR partial 420"; |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
448 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
449 case PhotometricInterpretation_YBRPartial422: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
450 return "YBR partial 422"; |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
451 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
452 case PhotometricInterpretation_YBR_ICT: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
453 return "YBR ICT"; |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
454 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
455 case PhotometricInterpretation_YBR_RCT: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
456 return "YBR RCT"; |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
457 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
458 case PhotometricInterpretation_Unknown: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
459 return "Unknown"; |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
460 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
461 default: |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
462 throw OrthancException(ErrorCode_ParameterOutOfRange); |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
463 } |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
464 } |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
465 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
466 |
1571
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
467 const char* EnumerationToString(RequestOrigin origin) |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
468 { |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
469 switch (origin) |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
470 { |
1572
904096e7367e
More information about the origin request in OnStoredInstance() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
471 case RequestOrigin_Unknown: |
904096e7367e
More information about the origin request in OnStoredInstance() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
472 return "Unknown"; |
904096e7367e
More information about the origin request in OnStoredInstance() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
473 |
1571
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
474 case RequestOrigin_DicomProtocol: |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
475 return "DicomProtocol"; |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
476 |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
477 case RequestOrigin_Http: |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
478 return "Http"; |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
479 |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
480 case RequestOrigin_Plugins: |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
481 return "Plugins"; |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
482 |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
483 case RequestOrigin_Lua: |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
484 return "Lua"; |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
485 |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
486 default: |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
487 throw OrthancException(ErrorCode_ParameterOutOfRange); |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
488 } |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
489 } |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
490 |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1565
diff
changeset
|
491 |
1495
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
492 const char* EnumerationToString(LogLevel level) |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
493 { |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
494 switch (level) |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
495 { |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
496 case LogLevel_Error: |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
497 return "ERROR"; |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
498 |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
499 case LogLevel_Warning: |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
500 return "WARNING"; |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
501 |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
502 case LogLevel_Info: |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
503 return "INFO"; |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
504 |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
505 case LogLevel_Trace: |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
506 return "TRACE"; |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
507 |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
508 default: |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
509 throw OrthancException(ErrorCode_ParameterOutOfRange); |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
510 } |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
511 } |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
512 |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
513 |
1086
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
514 Encoding StringToEncoding(const char* encoding) |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
515 { |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
516 std::string s(encoding); |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
517 Toolbox::ToUpperCase(s); |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
518 |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
519 if (s == "UTF8") |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
520 { |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
521 return Encoding_Utf8; |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
522 } |
1087 | 523 |
524 if (s == "ASCII") | |
525 { | |
526 return Encoding_Ascii; | |
527 } | |
528 | |
529 if (s == "LATIN1") | |
1086
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
530 { |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
531 return Encoding_Latin1; |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
532 } |
1087 | 533 |
534 if (s == "LATIN2") | |
535 { | |
536 return Encoding_Latin2; | |
537 } | |
538 | |
539 if (s == "LATIN3") | |
540 { | |
541 return Encoding_Latin3; | |
542 } | |
543 | |
544 if (s == "LATIN4") | |
545 { | |
546 return Encoding_Latin4; | |
547 } | |
548 | |
549 if (s == "LATIN5") | |
1086
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
550 { |
1087 | 551 return Encoding_Latin5; |
552 } | |
553 | |
554 if (s == "CYRILLIC") | |
555 { | |
556 return Encoding_Cyrillic; | |
557 } | |
558 | |
1347 | 559 if (s == "WINDOWS1251") |
560 { | |
561 return Encoding_Windows1251; | |
562 } | |
563 | |
1087 | 564 if (s == "ARABIC") |
565 { | |
566 return Encoding_Arabic; | |
567 } | |
568 | |
569 if (s == "GREEK") | |
570 { | |
571 return Encoding_Greek; | |
572 } | |
573 | |
574 if (s == "HEBREW") | |
575 { | |
576 return Encoding_Hebrew; | |
1086
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
577 } |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
578 |
1090
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
579 if (s == "THAI") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
580 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
581 return Encoding_Thai; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
582 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
583 |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
584 if (s == "JAPANESE") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
585 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
586 return Encoding_Japanese; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
587 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
588 |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
589 if (s == "CHINESE") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
590 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
591 return Encoding_Chinese; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
592 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
593 |
1086
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
594 throw OrthancException(ErrorCode_ParameterOutOfRange); |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
595 } |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
596 |
e56c3ed8d738
Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
597 |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
598 ResourceType StringToResourceType(const char* type) |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
599 { |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
600 std::string s(type); |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
601 Toolbox::ToUpperCase(s); |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
602 |
697
dd1ce9a2844c
access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
603 if (s == "PATIENT" || s == "PATIENTS") |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
604 { |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
605 return ResourceType_Patient; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
606 } |
697
dd1ce9a2844c
access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
607 else if (s == "STUDY" || s == "STUDIES") |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
608 { |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
609 return ResourceType_Study; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
610 } |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
611 else if (s == "SERIES") |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
612 { |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
613 return ResourceType_Series; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
614 } |
697
dd1ce9a2844c
access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
615 else if (s == "INSTANCE" || s == "IMAGE" || |
dd1ce9a2844c
access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
616 s == "INSTANCES" || s == "IMAGES") |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
617 { |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
618 return ResourceType_Instance; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
619 } |
800
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
620 |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
621 throw OrthancException(ErrorCode_ParameterOutOfRange); |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
622 } |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
623 |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
624 |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
625 ImageFormat StringToImageFormat(const char* format) |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
626 { |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
627 std::string s(format); |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
628 Toolbox::ToUpperCase(s); |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
629 |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
630 if (s == "PNG") |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
631 { |
800
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
632 return ImageFormat_Png; |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
633 } |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
634 |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
635 throw OrthancException(ErrorCode_ParameterOutOfRange); |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
636 } |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
637 |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
638 |
1495
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
639 LogLevel StringToLogLevel(const char *level) |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
640 { |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
641 if (strcmp(level, "ERROR") == 0) |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
642 { |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
643 return LogLevel_Error; |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
644 } |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
645 else if (strcmp(level, "WARNING") == 0) |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
646 { |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
647 return LogLevel_Warning; |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
648 } |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
649 else if (strcmp(level, "INFO") == 0) |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
650 { |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
651 return LogLevel_Info; |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
652 } |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
653 else if (strcmp(level, "TRACE") == 0) |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
654 { |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
655 return LogLevel_Trace; |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
656 } |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
657 else |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
658 { |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
659 throw OrthancException(ErrorCode_InternalError); |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
660 } |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
661 } |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
662 |
fbe40117eb21
improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1347
diff
changeset
|
663 |
800
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
664 unsigned int GetBytesPerPixel(PixelFormat format) |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
665 { |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
666 switch (format) |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
667 { |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
668 case PixelFormat_Grayscale8: |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
669 return 1; |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
670 |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
671 case PixelFormat_Grayscale16: |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
672 case PixelFormat_SignedGrayscale16: |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
673 return 2; |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
674 |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
675 case PixelFormat_RGB24: |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
676 return 3; |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
677 |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
678 case PixelFormat_RGBA32: |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
679 return 4; |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
680 |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
681 default: |
ecedd89055db
generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
682 throw OrthancException(ErrorCode_ParameterOutOfRange); |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
683 } |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
477
diff
changeset
|
684 } |
1090
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
685 |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
686 |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
687 bool GetDicomEncoding(Encoding& encoding, |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
688 const char* specificCharacterSet) |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
689 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
690 std::string s = specificCharacterSet; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
691 Toolbox::ToUpperCase(s); |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
692 |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
693 // http://www.dabsoft.ch/dicom/3/C.12.1.1.2/ |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
694 // https://github.com/dcm4che/dcm4che/blob/master/dcm4che-core/src/main/java/org/dcm4che3/data/SpecificCharacterSet.java |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
695 if (s == "ISO_IR 6" || |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
696 s == "ISO_IR 192" || |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
697 s == "ISO 2022 IR 6") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
698 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
699 encoding = Encoding_Utf8; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
700 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
701 else if (s == "ISO_IR 100" || |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
702 s == "ISO 2022 IR 100") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
703 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
704 encoding = Encoding_Latin1; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
705 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
706 else if (s == "ISO_IR 101" || |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
707 s == "ISO 2022 IR 101") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
708 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
709 encoding = Encoding_Latin2; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
710 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
711 else if (s == "ISO_IR 109" || |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
712 s == "ISO 2022 IR 109") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
713 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
714 encoding = Encoding_Latin3; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
715 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
716 else if (s == "ISO_IR 110" || |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
717 s == "ISO 2022 IR 110") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
718 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
719 encoding = Encoding_Latin4; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
720 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
721 else if (s == "ISO_IR 148" || |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
722 s == "ISO 2022 IR 148") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
723 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
724 encoding = Encoding_Latin5; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
725 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
726 else if (s == "ISO_IR 144" || |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
727 s == "ISO 2022 IR 144") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
728 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
729 encoding = Encoding_Cyrillic; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
730 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
731 else if (s == "ISO_IR 127" || |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
732 s == "ISO 2022 IR 127") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
733 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
734 encoding = Encoding_Arabic; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
735 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
736 else if (s == "ISO_IR 126" || |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
737 s == "ISO 2022 IR 126") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
738 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
739 encoding = Encoding_Greek; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
740 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
741 else if (s == "ISO_IR 138" || |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
742 s == "ISO 2022 IR 138") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
743 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
744 encoding = Encoding_Hebrew; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
745 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
746 else if (s == "ISO_IR 166" || s == "ISO 2022 IR 166") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
747 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
748 encoding = Encoding_Thai; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
749 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
750 else if (s == "ISO_IR 13" || s == "ISO 2022 IR 13") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
751 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
752 encoding = Encoding_Japanese; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
753 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
754 else if (s == "GB18030") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
755 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
756 encoding = Encoding_Chinese; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
757 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
758 /* |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
759 else if (s == "ISO 2022 IR 149") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
760 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
761 TODO |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
762 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
763 else if (s == "ISO 2022 IR 159") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
764 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
765 TODO |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
766 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
767 else if (s == "ISO 2022 IR 87") |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
768 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
769 TODO |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
770 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
771 */ |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
772 else |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
773 { |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
774 return false; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
775 } |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
776 |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
777 // The encoding was properly detected |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
778 return true; |
e494ceb8d763
support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1087
diff
changeset
|
779 } |
1146
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
780 |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
781 |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
782 const char* GetMimeType(FileContentType type) |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
783 { |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
784 switch (type) |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
785 { |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
786 case FileContentType_Dicom: |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
787 return "application/dicom"; |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
788 |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
789 case FileContentType_DicomAsJson: |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
790 return "application/json"; |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
791 |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
792 default: |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
793 return "application/octet-stream"; |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
794 } |
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1090
diff
changeset
|
795 } |
1548
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
796 |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
797 |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
798 const char* GetFileExtension(FileContentType type) |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
799 { |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
800 switch (type) |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
801 { |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
802 case FileContentType_Dicom: |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
803 return ".dcm"; |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
804 |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
805 case FileContentType_DicomAsJson: |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
806 return ".json"; |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
807 |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
808 default: |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
809 // Unknown file type |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
810 return ""; |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
811 } |
e9325f3ac496
Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1495
diff
changeset
|
812 } |
1555
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
813 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
814 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
815 ResourceType GetChildResourceType(ResourceType type) |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
816 { |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
817 switch (type) |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
818 { |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
819 case ResourceType_Patient: |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
820 return ResourceType_Study; |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
821 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
822 case ResourceType_Study: |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
823 return ResourceType_Series; |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
824 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
825 case ResourceType_Series: |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
826 return ResourceType_Instance; |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
827 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
828 default: |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
829 throw OrthancException(ErrorCode_ParameterOutOfRange); |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
830 } |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
831 } |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
832 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
833 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
834 ResourceType GetParentResourceType(ResourceType type) |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
835 { |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
836 switch (type) |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
837 { |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
838 case ResourceType_Study: |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
839 return ResourceType_Patient; |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
840 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
841 case ResourceType_Series: |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
842 return ResourceType_Study; |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
843 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
844 case ResourceType_Instance: |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
845 return ResourceType_Series; |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
846 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
847 default: |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
848 throw OrthancException(ErrorCode_ParameterOutOfRange); |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
849 } |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
850 } |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
851 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
852 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
853 DicomModule GetModule(ResourceType type) |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
854 { |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
855 switch (type) |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
856 { |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
857 case ResourceType_Patient: |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
858 return DicomModule_Patient; |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
859 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
860 case ResourceType_Study: |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
861 return DicomModule_Study; |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
862 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
863 case ResourceType_Series: |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
864 return DicomModule_Series; |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
865 |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
866 default: |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
867 throw OrthancException(ErrorCode_ParameterOutOfRange); |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
868 } |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1548
diff
changeset
|
869 } |
1565
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
870 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
871 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
872 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
873 const char* GetDicomSpecificCharacterSet(Encoding encoding) |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
874 { |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
875 // http://www.dabsoft.ch/dicom/3/C.12.1.1.2/ |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
876 switch (encoding) |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
877 { |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
878 case Encoding_Utf8: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
879 case Encoding_Ascii: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
880 return "ISO_IR 192"; |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
881 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
882 case Encoding_Latin1: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
883 return "ISO_IR 100"; |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
884 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
885 case Encoding_Latin2: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
886 return "ISO_IR 101"; |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
887 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
888 case Encoding_Latin3: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
889 return "ISO_IR 109"; |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
890 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
891 case Encoding_Latin4: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
892 return "ISO_IR 110"; |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
893 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
894 case Encoding_Latin5: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
895 return "ISO_IR 148"; |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
896 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
897 case Encoding_Cyrillic: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
898 return "ISO_IR 144"; |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
899 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
900 case Encoding_Arabic: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
901 return "ISO_IR 127"; |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
902 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
903 case Encoding_Greek: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
904 return "ISO_IR 126"; |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
905 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
906 case Encoding_Hebrew: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
907 return "ISO_IR 138"; |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
908 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
909 case Encoding_Japanese: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
910 return "ISO_IR 13"; |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
911 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
912 case Encoding_Chinese: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
913 return "GB18030"; |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
914 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
915 case Encoding_Thai: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
916 return "ISO_IR 166"; |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
917 |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
918 default: |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
919 throw OrthancException(ErrorCode_ParameterOutOfRange); |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
920 } |
4b23310eb7e8
add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
921 } |
1576
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
922 |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
923 |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
924 HttpStatus ConvertErrorCodeToHttpStatus(ErrorCode error) |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
925 { |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
926 switch (error) |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
927 { |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
928 case ErrorCode_Success: |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
929 { |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
930 return HttpStatus_200_Ok; |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
931 } |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
932 |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
933 case ErrorCode_InexistentFile: |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
934 case ErrorCode_InexistentItem: |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
935 case ErrorCode_InexistentTag: |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
936 case ErrorCode_UnknownResource: |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
937 { |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
938 return HttpStatus_404_NotFound; |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
939 } |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
940 |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
941 case ErrorCode_BadFileFormat: |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
942 case ErrorCode_BadParameterType: |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
943 case ErrorCode_BadRequest: |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
944 case ErrorCode_ParameterOutOfRange: |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
945 case ErrorCode_UriSyntax: |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
946 { |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
947 return HttpStatus_400_BadRequest; |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
948 break; |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
949 } |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
950 |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
951 default: |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
952 { |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
953 return HttpStatus_500_InternalServerError; |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
954 } |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
955 } |
de54c19fc44d
refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
956 } |
477 | 957 } |