Mercurial > hg > orthanc-webviewer
comparison Orthanc/Core/Enumerations.h @ 25:15acbf5e7545
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 02 Jun 2015 11:16:30 +0200 |
parents | |
children | fe8dab5c051f |
comparison
equal
deleted
inserted
replaced
24:ed9acb0f938e | 25:15acbf5e7545 |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
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 | |
33 #pragma once | |
34 | |
35 namespace Orthanc | |
36 { | |
37 enum Endianness | |
38 { | |
39 Endianness_Unknown, | |
40 Endianness_Big, | |
41 Endianness_Little | |
42 }; | |
43 | |
44 enum ErrorCode | |
45 { | |
46 // Generic error codes | |
47 ErrorCode_Success, | |
48 ErrorCode_Custom, | |
49 ErrorCode_InternalError, | |
50 ErrorCode_NotImplemented, | |
51 ErrorCode_ParameterOutOfRange, | |
52 ErrorCode_NotEnoughMemory, | |
53 ErrorCode_BadParameterType, | |
54 ErrorCode_BadSequenceOfCalls, | |
55 ErrorCode_InexistentItem, | |
56 ErrorCode_BadRequest, | |
57 ErrorCode_NetworkProtocol, | |
58 ErrorCode_SystemCommand, | |
59 ErrorCode_Database, | |
60 | |
61 // Specific error codes | |
62 ErrorCode_UriSyntax, | |
63 ErrorCode_InexistentFile, | |
64 ErrorCode_CannotWriteFile, | |
65 ErrorCode_BadFileFormat, | |
66 ErrorCode_Timeout, | |
67 ErrorCode_UnknownResource, | |
68 ErrorCode_IncompatibleDatabaseVersion, | |
69 ErrorCode_FullStorage, | |
70 ErrorCode_CorruptedFile, | |
71 ErrorCode_InexistentTag, | |
72 ErrorCode_ReadOnly, | |
73 ErrorCode_IncompatibleImageFormat, | |
74 ErrorCode_IncompatibleImageSize, | |
75 ErrorCode_SharedLibrary, | |
76 ErrorCode_Plugin | |
77 }; | |
78 | |
79 | |
80 /** | |
81 * {summary}{The memory layout of the pixels (resp. voxels) of a 2D (resp. 3D) image.} | |
82 **/ | |
83 enum PixelFormat | |
84 { | |
85 /** | |
86 * {summary}{Color image in RGB24 format.} | |
87 * {description}{This format describes a color image. The pixels are stored in 3 | |
88 * consecutive bytes. The memory layout is RGB.} | |
89 **/ | |
90 PixelFormat_RGB24 = 1, | |
91 | |
92 /** | |
93 * {summary}{Color image in RGBA32 format.} | |
94 * {description}{This format describes a color image. The pixels are stored in 4 | |
95 * consecutive bytes. The memory layout is RGBA.} | |
96 **/ | |
97 PixelFormat_RGBA32 = 2, | |
98 | |
99 /** | |
100 * {summary}{Graylevel 8bpp image.} | |
101 * {description}{The image is graylevel. Each pixel is unsigned and stored in one byte.} | |
102 **/ | |
103 PixelFormat_Grayscale8 = 3, | |
104 | |
105 /** | |
106 * {summary}{Graylevel, unsigned 16bpp image.} | |
107 * {description}{The image is graylevel. Each pixel is unsigned and stored in two bytes.} | |
108 **/ | |
109 PixelFormat_Grayscale16 = 4, | |
110 | |
111 /** | |
112 * {summary}{Graylevel, signed 16bpp image.} | |
113 * {description}{The image is graylevel. Each pixel is signed and stored in two bytes.} | |
114 **/ | |
115 PixelFormat_SignedGrayscale16 = 5 | |
116 }; | |
117 | |
118 | |
119 /** | |
120 * {summary}{The extraction mode specifies the way the values of the pixels are scaled when downloading a 2D image.} | |
121 **/ | |
122 enum ImageExtractionMode | |
123 { | |
124 /** | |
125 * {summary}{Rescaled to 8bpp.} | |
126 * {description}{The minimum value of the image is set to 0, and its maximum value is set to 255.} | |
127 **/ | |
128 ImageExtractionMode_Preview = 1, | |
129 | |
130 /** | |
131 * {summary}{Truncation to the [0, 255] range.} | |
132 **/ | |
133 ImageExtractionMode_UInt8 = 2, | |
134 | |
135 /** | |
136 * {summary}{Truncation to the [0, 65535] range.} | |
137 **/ | |
138 ImageExtractionMode_UInt16 = 3, | |
139 | |
140 /** | |
141 * {summary}{Truncation to the [-32768, 32767] range.} | |
142 **/ | |
143 ImageExtractionMode_Int16 = 4 | |
144 }; | |
145 | |
146 | |
147 /** | |
148 * Most common, non-joke and non-experimental HTTP status codes | |
149 * http://en.wikipedia.org/wiki/List_of_HTTP_status_codes | |
150 **/ | |
151 enum HttpStatus | |
152 { | |
153 HttpStatus_None = -1, | |
154 | |
155 // 1xx Informational | |
156 HttpStatus_100_Continue = 100, | |
157 HttpStatus_101_SwitchingProtocols = 101, | |
158 HttpStatus_102_Processing = 102, | |
159 | |
160 // 2xx Success | |
161 HttpStatus_200_Ok = 200, | |
162 HttpStatus_201_Created = 201, | |
163 HttpStatus_202_Accepted = 202, | |
164 HttpStatus_203_NonAuthoritativeInformation = 203, | |
165 HttpStatus_204_NoContent = 204, | |
166 HttpStatus_205_ResetContent = 205, | |
167 HttpStatus_206_PartialContent = 206, | |
168 HttpStatus_207_MultiStatus = 207, | |
169 HttpStatus_208_AlreadyReported = 208, | |
170 HttpStatus_226_IMUsed = 226, | |
171 | |
172 // 3xx Redirection | |
173 HttpStatus_300_MultipleChoices = 300, | |
174 HttpStatus_301_MovedPermanently = 301, | |
175 HttpStatus_302_Found = 302, | |
176 HttpStatus_303_SeeOther = 303, | |
177 HttpStatus_304_NotModified = 304, | |
178 HttpStatus_305_UseProxy = 305, | |
179 HttpStatus_307_TemporaryRedirect = 307, | |
180 | |
181 // 4xx Client Error | |
182 HttpStatus_400_BadRequest = 400, | |
183 HttpStatus_401_Unauthorized = 401, | |
184 HttpStatus_402_PaymentRequired = 402, | |
185 HttpStatus_403_Forbidden = 403, | |
186 HttpStatus_404_NotFound = 404, | |
187 HttpStatus_405_MethodNotAllowed = 405, | |
188 HttpStatus_406_NotAcceptable = 406, | |
189 HttpStatus_407_ProxyAuthenticationRequired = 407, | |
190 HttpStatus_408_RequestTimeout = 408, | |
191 HttpStatus_409_Conflict = 409, | |
192 HttpStatus_410_Gone = 410, | |
193 HttpStatus_411_LengthRequired = 411, | |
194 HttpStatus_412_PreconditionFailed = 412, | |
195 HttpStatus_413_RequestEntityTooLarge = 413, | |
196 HttpStatus_414_RequestUriTooLong = 414, | |
197 HttpStatus_415_UnsupportedMediaType = 415, | |
198 HttpStatus_416_RequestedRangeNotSatisfiable = 416, | |
199 HttpStatus_417_ExpectationFailed = 417, | |
200 HttpStatus_422_UnprocessableEntity = 422, | |
201 HttpStatus_423_Locked = 423, | |
202 HttpStatus_424_FailedDependency = 424, | |
203 HttpStatus_426_UpgradeRequired = 426, | |
204 | |
205 // 5xx Server Error | |
206 HttpStatus_500_InternalServerError = 500, | |
207 HttpStatus_501_NotImplemented = 501, | |
208 HttpStatus_502_BadGateway = 502, | |
209 HttpStatus_503_ServiceUnavailable = 503, | |
210 HttpStatus_504_GatewayTimeout = 504, | |
211 HttpStatus_505_HttpVersionNotSupported = 505, | |
212 HttpStatus_506_VariantAlsoNegotiates = 506, | |
213 HttpStatus_507_InsufficientStorage = 507, | |
214 HttpStatus_509_BandwidthLimitExceeded = 509, | |
215 HttpStatus_510_NotExtended = 510 | |
216 }; | |
217 | |
218 | |
219 enum HttpMethod | |
220 { | |
221 HttpMethod_Get = 0, | |
222 HttpMethod_Post = 1, | |
223 HttpMethod_Delete = 2, | |
224 HttpMethod_Put = 3 | |
225 }; | |
226 | |
227 | |
228 enum ImageFormat | |
229 { | |
230 ImageFormat_Png = 1 | |
231 }; | |
232 | |
233 | |
234 // http://www.dabsoft.ch/dicom/3/C.12.1.1.2/ | |
235 enum Encoding | |
236 { | |
237 Encoding_Ascii, | |
238 Encoding_Utf8, | |
239 Encoding_Latin1, | |
240 Encoding_Latin2, | |
241 Encoding_Latin3, | |
242 Encoding_Latin4, | |
243 Encoding_Latin5, // Turkish | |
244 Encoding_Cyrillic, | |
245 Encoding_Windows1251, // Windows-1251 (commonly used for Cyrillic) | |
246 Encoding_Arabic, | |
247 Encoding_Greek, | |
248 Encoding_Hebrew, | |
249 Encoding_Thai, // TIS 620-2533 | |
250 Encoding_Japanese, // JIS X 0201 (Shift JIS): Katakana | |
251 Encoding_Chinese // GB18030 - Chinese simplified | |
252 //Encoding_JapaneseKanji, // Multibyte - JIS X 0208: Kanji | |
253 //Encoding_JapaneseSupplementaryKanji, // Multibyte - JIS X 0212: Supplementary Kanji set | |
254 //Encoding_Korean, // Multibyte - KS X 1001: Hangul and Hanja | |
255 }; | |
256 | |
257 | |
258 // https://www.dabsoft.ch/dicom/3/C.7.6.3.1.2/ | |
259 enum PhotometricInterpretation | |
260 { | |
261 PhotometricInterpretation_ARGB, // Retired | |
262 PhotometricInterpretation_CMYK, // Retired | |
263 PhotometricInterpretation_HSV, // Retired | |
264 PhotometricInterpretation_Monochrome1, | |
265 PhotometricInterpretation_Monochrome2, | |
266 PhotometricInterpretation_Palette, | |
267 PhotometricInterpretation_RGB, | |
268 PhotometricInterpretation_YBRFull, | |
269 PhotometricInterpretation_YBRFull422, | |
270 PhotometricInterpretation_YBRPartial420, | |
271 PhotometricInterpretation_YBRPartial422, | |
272 PhotometricInterpretation_YBR_ICT, | |
273 PhotometricInterpretation_YBR_RCT, | |
274 PhotometricInterpretation_Unknown | |
275 }; | |
276 | |
277 enum DicomModule | |
278 { | |
279 DicomModule_Patient, | |
280 DicomModule_Study, | |
281 DicomModule_Series, | |
282 DicomModule_Instance, | |
283 DicomModule_Image | |
284 }; | |
285 | |
286 | |
287 /** | |
288 * WARNING: Do not change the explicit values in the enumerations | |
289 * below this point. This would result in incompatible databases | |
290 * between versions of Orthanc! | |
291 **/ | |
292 | |
293 enum CompressionType | |
294 { | |
295 CompressionType_None = 1, | |
296 CompressionType_Zlib = 2 | |
297 }; | |
298 | |
299 enum FileContentType | |
300 { | |
301 // If you add a value below, insert it in "PluginStorageArea" in | |
302 // the file "Plugins/Engine/OrthancPlugins.cpp" | |
303 FileContentType_Unknown = 0, | |
304 FileContentType_Dicom = 1, | |
305 FileContentType_DicomAsJson = 2, | |
306 | |
307 // Make sure that the value "65535" can be stored into this enumeration | |
308 FileContentType_StartUser = 1024, | |
309 FileContentType_EndUser = 65535 | |
310 }; | |
311 | |
312 enum ResourceType | |
313 { | |
314 ResourceType_Patient = 1, | |
315 ResourceType_Study = 2, | |
316 ResourceType_Series = 3, | |
317 ResourceType_Instance = 4 | |
318 }; | |
319 | |
320 | |
321 const char* EnumerationToString(HttpMethod method); | |
322 | |
323 const char* EnumerationToString(HttpStatus status); | |
324 | |
325 const char* EnumerationToString(ResourceType type); | |
326 | |
327 const char* EnumerationToString(ImageFormat format); | |
328 | |
329 const char* EnumerationToString(Encoding encoding); | |
330 | |
331 const char* EnumerationToString(PhotometricInterpretation photometric); | |
332 | |
333 Encoding StringToEncoding(const char* encoding); | |
334 | |
335 ResourceType StringToResourceType(const char* type); | |
336 | |
337 ImageFormat StringToImageFormat(const char* format); | |
338 | |
339 unsigned int GetBytesPerPixel(PixelFormat format); | |
340 | |
341 bool GetDicomEncoding(Encoding& encoding, | |
342 const char* specificCharacterSet); | |
343 | |
344 const char* GetMimeType(FileContentType type); | |
345 } |