comparison Resources/Orthanc/Core/Enumerations.h @ 200:03afbee0cc7b

integration of Orthanc core into Stone
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 23 Mar 2018 11:04:03 +0100
parents
children e7f90aba3c97
comparison
equal deleted inserted replaced
199:dabe9982fca3 200:03afbee0cc7b
1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
6 *
7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
11 *
12 * In addition, as a special exception, the copyright holders of this
13 * program give permission to link the code of its release with the
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
15 * that use the same license as the "OpenSSL" library), and distribute
16 * the linked executables. You must obey the GNU General Public License
17 * in all respects for all of the code used other than "OpenSSL". If you
18 * modify file(s) with this exception, you may extend this exception to
19 * your version of the file(s), but you are not obligated to do so. If
20 * you do not wish to do so, delete this exception statement from your
21 * version. If you delete this exception statement from all source files
22 * in the program, then also delete it here.
23 *
24 * This program is distributed in the hope that it will be useful, but
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * General Public License for more details.
28 *
29 * You should have received a copy of the GNU General Public License
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 **/
32
33
34 #pragma once
35
36 #include <string>
37
38
39 #if defined(_MSC_VER)
40 # define ORTHANC_FORCE_INLINE __forceinline
41 #elif defined(__GNUC__) || defined(__clang__) || defined(__EMSCRIPTEN__)
42 # define ORTHANC_FORCE_INLINE inline __attribute((always_inline))
43 #else
44 # error Please support your compiler here
45 #endif
46
47
48 namespace Orthanc
49 {
50 enum Endianness
51 {
52 Endianness_Unknown,
53 Endianness_Big,
54 Endianness_Little
55 };
56
57 // This enumeration is autogenerated by the script
58 // "Resources/GenerateErrorCodes.py"
59 enum ErrorCode
60 {
61 ErrorCode_InternalError = -1 /*!< Internal error */,
62 ErrorCode_Success = 0 /*!< Success */,
63 ErrorCode_Plugin = 1 /*!< Error encountered within the plugin engine */,
64 ErrorCode_NotImplemented = 2 /*!< Not implemented yet */,
65 ErrorCode_ParameterOutOfRange = 3 /*!< Parameter out of range */,
66 ErrorCode_NotEnoughMemory = 4 /*!< The server hosting Orthanc is running out of memory */,
67 ErrorCode_BadParameterType = 5 /*!< Bad type for a parameter */,
68 ErrorCode_BadSequenceOfCalls = 6 /*!< Bad sequence of calls */,
69 ErrorCode_InexistentItem = 7 /*!< Accessing an inexistent item */,
70 ErrorCode_BadRequest = 8 /*!< Bad request */,
71 ErrorCode_NetworkProtocol = 9 /*!< Error in the network protocol */,
72 ErrorCode_SystemCommand = 10 /*!< Error while calling a system command */,
73 ErrorCode_Database = 11 /*!< Error with the database engine */,
74 ErrorCode_UriSyntax = 12 /*!< Badly formatted URI */,
75 ErrorCode_InexistentFile = 13 /*!< Inexistent file */,
76 ErrorCode_CannotWriteFile = 14 /*!< Cannot write to file */,
77 ErrorCode_BadFileFormat = 15 /*!< Bad file format */,
78 ErrorCode_Timeout = 16 /*!< Timeout */,
79 ErrorCode_UnknownResource = 17 /*!< Unknown resource */,
80 ErrorCode_IncompatibleDatabaseVersion = 18 /*!< Incompatible version of the database */,
81 ErrorCode_FullStorage = 19 /*!< The file storage is full */,
82 ErrorCode_CorruptedFile = 20 /*!< Corrupted file (e.g. inconsistent MD5 hash) */,
83 ErrorCode_InexistentTag = 21 /*!< Inexistent tag */,
84 ErrorCode_ReadOnly = 22 /*!< Cannot modify a read-only data structure */,
85 ErrorCode_IncompatibleImageFormat = 23 /*!< Incompatible format of the images */,
86 ErrorCode_IncompatibleImageSize = 24 /*!< Incompatible size of the images */,
87 ErrorCode_SharedLibrary = 25 /*!< Error while using a shared library (plugin) */,
88 ErrorCode_UnknownPluginService = 26 /*!< Plugin invoking an unknown service */,
89 ErrorCode_UnknownDicomTag = 27 /*!< Unknown DICOM tag */,
90 ErrorCode_BadJson = 28 /*!< Cannot parse a JSON document */,
91 ErrorCode_Unauthorized = 29 /*!< Bad credentials were provided to an HTTP request */,
92 ErrorCode_BadFont = 30 /*!< Badly formatted font file */,
93 ErrorCode_DatabasePlugin = 31 /*!< The plugin implementing a custom database back-end does not fulfill the proper interface */,
94 ErrorCode_StorageAreaPlugin = 32 /*!< Error in the plugin implementing a custom storage area */,
95 ErrorCode_EmptyRequest = 33 /*!< The request is empty */,
96 ErrorCode_NotAcceptable = 34 /*!< Cannot send a response which is acceptable according to the Accept HTTP header */,
97 ErrorCode_NullPointer = 35 /*!< Cannot handle a NULL pointer */,
98 ErrorCode_DatabaseUnavailable = 36 /*!< The database is currently not available (probably a transient situation) */,
99 ErrorCode_SQLiteNotOpened = 1000 /*!< SQLite: The database is not opened */,
100 ErrorCode_SQLiteAlreadyOpened = 1001 /*!< SQLite: Connection is already open */,
101 ErrorCode_SQLiteCannotOpen = 1002 /*!< SQLite: Unable to open the database */,
102 ErrorCode_SQLiteStatementAlreadyUsed = 1003 /*!< SQLite: This cached statement is already being referred to */,
103 ErrorCode_SQLiteExecute = 1004 /*!< SQLite: Cannot execute a command */,
104 ErrorCode_SQLiteRollbackWithoutTransaction = 1005 /*!< SQLite: Rolling back a nonexistent transaction (have you called Begin()?) */,
105 ErrorCode_SQLiteCommitWithoutTransaction = 1006 /*!< SQLite: Committing a nonexistent transaction */,
106 ErrorCode_SQLiteRegisterFunction = 1007 /*!< SQLite: Unable to register a function */,
107 ErrorCode_SQLiteFlush = 1008 /*!< SQLite: Unable to flush the database */,
108 ErrorCode_SQLiteCannotRun = 1009 /*!< SQLite: Cannot run a cached statement */,
109 ErrorCode_SQLiteCannotStep = 1010 /*!< SQLite: Cannot step over a cached statement */,
110 ErrorCode_SQLiteBindOutOfRange = 1011 /*!< SQLite: Bing a value while out of range (serious error) */,
111 ErrorCode_SQLitePrepareStatement = 1012 /*!< SQLite: Cannot prepare a cached statement */,
112 ErrorCode_SQLiteTransactionAlreadyStarted = 1013 /*!< SQLite: Beginning the same transaction twice */,
113 ErrorCode_SQLiteTransactionCommit = 1014 /*!< SQLite: Failure when committing the transaction */,
114 ErrorCode_SQLiteTransactionBegin = 1015 /*!< SQLite: Cannot start a transaction */,
115 ErrorCode_DirectoryOverFile = 2000 /*!< The directory to be created is already occupied by a regular file */,
116 ErrorCode_FileStorageCannotWrite = 2001 /*!< Unable to create a subdirectory or a file in the file storage */,
117 ErrorCode_DirectoryExpected = 2002 /*!< The specified path does not point to a directory */,
118 ErrorCode_HttpPortInUse = 2003 /*!< The TCP port of the HTTP server is privileged or already in use */,
119 ErrorCode_DicomPortInUse = 2004 /*!< The TCP port of the DICOM server is privileged or already in use */,
120 ErrorCode_BadHttpStatusInRest = 2005 /*!< This HTTP status is not allowed in a REST API */,
121 ErrorCode_RegularFileExpected = 2006 /*!< The specified path does not point to a regular file */,
122 ErrorCode_PathToExecutable = 2007 /*!< Unable to get the path to the executable */,
123 ErrorCode_MakeDirectory = 2008 /*!< Cannot create a directory */,
124 ErrorCode_BadApplicationEntityTitle = 2009 /*!< An application entity title (AET) cannot be empty or be longer than 16 characters */,
125 ErrorCode_NoCFindHandler = 2010 /*!< No request handler factory for DICOM C-FIND SCP */,
126 ErrorCode_NoCMoveHandler = 2011 /*!< No request handler factory for DICOM C-MOVE SCP */,
127 ErrorCode_NoCStoreHandler = 2012 /*!< No request handler factory for DICOM C-STORE SCP */,
128 ErrorCode_NoApplicationEntityFilter = 2013 /*!< No application entity filter */,
129 ErrorCode_NoSopClassOrInstance = 2014 /*!< DicomUserConnection: Unable to find the SOP class and instance */,
130 ErrorCode_NoPresentationContext = 2015 /*!< DicomUserConnection: No acceptable presentation context for modality */,
131 ErrorCode_DicomFindUnavailable = 2016 /*!< DicomUserConnection: The C-FIND command is not supported by the remote SCP */,
132 ErrorCode_DicomMoveUnavailable = 2017 /*!< DicomUserConnection: The C-MOVE command is not supported by the remote SCP */,
133 ErrorCode_CannotStoreInstance = 2018 /*!< Cannot store an instance */,
134 ErrorCode_CreateDicomNotString = 2019 /*!< Only string values are supported when creating DICOM instances */,
135 ErrorCode_CreateDicomOverrideTag = 2020 /*!< Trying to override a value inherited from a parent module */,
136 ErrorCode_CreateDicomUseContent = 2021 /*!< Use \"Content\" to inject an image into a new DICOM instance */,
137 ErrorCode_CreateDicomNoPayload = 2022 /*!< No payload is present for one instance in the series */,
138 ErrorCode_CreateDicomUseDataUriScheme = 2023 /*!< The payload of the DICOM instance must be specified according to Data URI scheme */,
139 ErrorCode_CreateDicomBadParent = 2024 /*!< Trying to attach a new DICOM instance to an inexistent resource */,
140 ErrorCode_CreateDicomParentIsInstance = 2025 /*!< Trying to attach a new DICOM instance to an instance (must be a series, study or patient) */,
141 ErrorCode_CreateDicomParentEncoding = 2026 /*!< Unable to get the encoding of the parent resource */,
142 ErrorCode_UnknownModality = 2027 /*!< Unknown modality */,
143 ErrorCode_BadJobOrdering = 2028 /*!< Bad ordering of filters in a job */,
144 ErrorCode_JsonToLuaTable = 2029 /*!< Cannot convert the given JSON object to a Lua table */,
145 ErrorCode_CannotCreateLua = 2030 /*!< Cannot create the Lua context */,
146 ErrorCode_CannotExecuteLua = 2031 /*!< Cannot execute a Lua command */,
147 ErrorCode_LuaAlreadyExecuted = 2032 /*!< Arguments cannot be pushed after the Lua function is executed */,
148 ErrorCode_LuaBadOutput = 2033 /*!< The Lua function does not give the expected number of outputs */,
149 ErrorCode_NotLuaPredicate = 2034 /*!< The Lua function is not a predicate (only true/false outputs allowed) */,
150 ErrorCode_LuaReturnsNoString = 2035 /*!< The Lua function does not return a string */,
151 ErrorCode_StorageAreaAlreadyRegistered = 2036 /*!< Another plugin has already registered a custom storage area */,
152 ErrorCode_DatabaseBackendAlreadyRegistered = 2037 /*!< Another plugin has already registered a custom database back-end */,
153 ErrorCode_DatabaseNotInitialized = 2038 /*!< Plugin trying to call the database during its initialization */,
154 ErrorCode_SslDisabled = 2039 /*!< Orthanc has been built without SSL support */,
155 ErrorCode_CannotOrderSlices = 2040 /*!< Unable to order the slices of the series */,
156 ErrorCode_NoWorklistHandler = 2041 /*!< No request handler factory for DICOM C-Find Modality SCP */,
157 ErrorCode_AlreadyExistingTag = 2042 /*!< Cannot override the value of a tag that already exists */,
158 ErrorCode_START_PLUGINS = 1000000
159 };
160
161 enum LogLevel
162 {
163 LogLevel_Error,
164 LogLevel_Warning,
165 LogLevel_Info,
166 LogLevel_Trace
167 };
168
169
170 /**
171 * {summary}{The memory layout of the pixels (resp. voxels) of a 2D (resp. 3D) image.}
172 **/
173 enum PixelFormat
174 {
175 /**
176 * {summary}{Color image in RGB24 format.}
177 * {description}{This format describes a color image. The pixels are stored in 3
178 * consecutive bytes. The memory layout is RGB.}
179 **/
180 PixelFormat_RGB24 = 1,
181
182 /**
183 * {summary}{Color image in RGBA32 format.}
184 * {description}{This format describes a color image. The pixels are stored in 4
185 * consecutive bytes. The memory layout is RGBA.}
186 **/
187 PixelFormat_RGBA32 = 2,
188
189 /**
190 * {summary}{Graylevel 8bpp image.}
191 * {description}{The image is graylevel. Each pixel is unsigned and stored in one byte.}
192 **/
193 PixelFormat_Grayscale8 = 3,
194
195 /**
196 * {summary}{Graylevel, unsigned 16bpp image.}
197 * {description}{The image is graylevel. Each pixel is unsigned and stored in two bytes.}
198 **/
199 PixelFormat_Grayscale16 = 4,
200
201 /**
202 * {summary}{Graylevel, signed 16bpp image.}
203 * {description}{The image is graylevel. Each pixel is signed and stored in two bytes.}
204 **/
205 PixelFormat_SignedGrayscale16 = 5,
206
207 /**
208 * {summary}{Graylevel, floating-point image.}
209 * {description}{The image is graylevel. Each pixel is floating-point and stored in 4 bytes.}
210 **/
211 PixelFormat_Float32 = 6,
212
213 // This is the memory layout for Cairo (for internal use in Stone of Orthanc)
214 PixelFormat_BGRA32 = 7,
215
216 /**
217 * {summary}{Graylevel, unsigned 32bpp image.}
218 * {description}{The image is graylevel. Each pixel is unsigned and stored in 4 bytes.}
219 **/
220 PixelFormat_Grayscale32 = 8,
221
222 /**
223 * {summary}{Color image in RGB48 format.}
224 * {description}{This format describes a color image. The pixels are stored in 6
225 * consecutive bytes. The memory layout is RGB.}
226 **/
227 PixelFormat_RGB48 = 9
228 };
229
230
231 /**
232 * {summary}{The extraction mode specifies the way the values of the pixels are scaled when downloading a 2D image.}
233 **/
234 enum ImageExtractionMode
235 {
236 /**
237 * {summary}{Rescaled to 8bpp.}
238 * {description}{The minimum value of the image is set to 0, and its maximum value is set to 255.}
239 **/
240 ImageExtractionMode_Preview = 1,
241
242 /**
243 * {summary}{Truncation to the [0, 255] range.}
244 **/
245 ImageExtractionMode_UInt8 = 2,
246
247 /**
248 * {summary}{Truncation to the [0, 65535] range.}
249 **/
250 ImageExtractionMode_UInt16 = 3,
251
252 /**
253 * {summary}{Truncation to the [-32768, 32767] range.}
254 **/
255 ImageExtractionMode_Int16 = 4
256 };
257
258
259 /**
260 * Most common, non-joke and non-experimental HTTP status codes
261 * http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
262 **/
263 enum HttpStatus
264 {
265 HttpStatus_None = -1,
266
267 // 1xx Informational
268 HttpStatus_100_Continue = 100,
269 HttpStatus_101_SwitchingProtocols = 101,
270 HttpStatus_102_Processing = 102,
271
272 // 2xx Success
273 HttpStatus_200_Ok = 200,
274 HttpStatus_201_Created = 201,
275 HttpStatus_202_Accepted = 202,
276 HttpStatus_203_NonAuthoritativeInformation = 203,
277 HttpStatus_204_NoContent = 204,
278 HttpStatus_205_ResetContent = 205,
279 HttpStatus_206_PartialContent = 206,
280 HttpStatus_207_MultiStatus = 207,
281 HttpStatus_208_AlreadyReported = 208,
282 HttpStatus_226_IMUsed = 226,
283
284 // 3xx Redirection
285 HttpStatus_300_MultipleChoices = 300,
286 HttpStatus_301_MovedPermanently = 301,
287 HttpStatus_302_Found = 302,
288 HttpStatus_303_SeeOther = 303,
289 HttpStatus_304_NotModified = 304,
290 HttpStatus_305_UseProxy = 305,
291 HttpStatus_307_TemporaryRedirect = 307,
292
293 // 4xx Client Error
294 HttpStatus_400_BadRequest = 400,
295 HttpStatus_401_Unauthorized = 401,
296 HttpStatus_402_PaymentRequired = 402,
297 HttpStatus_403_Forbidden = 403,
298 HttpStatus_404_NotFound = 404,
299 HttpStatus_405_MethodNotAllowed = 405,
300 HttpStatus_406_NotAcceptable = 406,
301 HttpStatus_407_ProxyAuthenticationRequired = 407,
302 HttpStatus_408_RequestTimeout = 408,
303 HttpStatus_409_Conflict = 409,
304 HttpStatus_410_Gone = 410,
305 HttpStatus_411_LengthRequired = 411,
306 HttpStatus_412_PreconditionFailed = 412,
307 HttpStatus_413_RequestEntityTooLarge = 413,
308 HttpStatus_414_RequestUriTooLong = 414,
309 HttpStatus_415_UnsupportedMediaType = 415,
310 HttpStatus_416_RequestedRangeNotSatisfiable = 416,
311 HttpStatus_417_ExpectationFailed = 417,
312 HttpStatus_422_UnprocessableEntity = 422,
313 HttpStatus_423_Locked = 423,
314 HttpStatus_424_FailedDependency = 424,
315 HttpStatus_426_UpgradeRequired = 426,
316
317 // 5xx Server Error
318 HttpStatus_500_InternalServerError = 500,
319 HttpStatus_501_NotImplemented = 501,
320 HttpStatus_502_BadGateway = 502,
321 HttpStatus_503_ServiceUnavailable = 503,
322 HttpStatus_504_GatewayTimeout = 504,
323 HttpStatus_505_HttpVersionNotSupported = 505,
324 HttpStatus_506_VariantAlsoNegotiates = 506,
325 HttpStatus_507_InsufficientStorage = 507,
326 HttpStatus_509_BandwidthLimitExceeded = 509,
327 HttpStatus_510_NotExtended = 510
328 };
329
330
331 enum HttpMethod
332 {
333 HttpMethod_Get = 0,
334 HttpMethod_Post = 1,
335 HttpMethod_Delete = 2,
336 HttpMethod_Put = 3
337 };
338
339
340 enum ImageFormat
341 {
342 ImageFormat_Png = 1
343 };
344
345
346 // https://en.wikipedia.org/wiki/HTTP_compression
347 enum HttpCompression
348 {
349 HttpCompression_None,
350 HttpCompression_Deflate,
351 HttpCompression_Gzip
352 };
353
354
355 // Specific Character Sets
356 // http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.12.1.1.2
357 enum Encoding
358 {
359 Encoding_Ascii,
360 Encoding_Utf8,
361 Encoding_Latin1,
362 Encoding_Latin2,
363 Encoding_Latin3,
364 Encoding_Latin4,
365 Encoding_Latin5, // Turkish
366 Encoding_Cyrillic,
367 Encoding_Windows1251, // Windows-1251 (commonly used for Cyrillic)
368 Encoding_Arabic,
369 Encoding_Greek,
370 Encoding_Hebrew,
371 Encoding_Thai, // TIS 620-2533
372 Encoding_Japanese, // JIS X 0201 (Shift JIS): Katakana
373 Encoding_Chinese // GB18030 - Chinese simplified
374 //Encoding_JapaneseKanji, // Multibyte - JIS X 0208: Kanji
375 //Encoding_JapaneseSupplementaryKanji, // Multibyte - JIS X 0212: Supplementary Kanji set
376 //Encoding_Korean, // Multibyte - KS X 1001: Hangul and Hanja
377 };
378
379
380 // http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.6.3.1.2
381 enum PhotometricInterpretation
382 {
383 PhotometricInterpretation_ARGB, // Retired
384 PhotometricInterpretation_CMYK, // Retired
385 PhotometricInterpretation_HSV, // Retired
386 PhotometricInterpretation_Monochrome1,
387 PhotometricInterpretation_Monochrome2,
388 PhotometricInterpretation_Palette,
389 PhotometricInterpretation_RGB,
390 PhotometricInterpretation_YBRFull,
391 PhotometricInterpretation_YBRFull422,
392 PhotometricInterpretation_YBRPartial420,
393 PhotometricInterpretation_YBRPartial422,
394 PhotometricInterpretation_YBR_ICT,
395 PhotometricInterpretation_YBR_RCT,
396 PhotometricInterpretation_Unknown
397 };
398
399 enum DicomModule
400 {
401 DicomModule_Patient,
402 DicomModule_Study,
403 DicomModule_Series,
404 DicomModule_Instance,
405 DicomModule_Image
406 };
407
408 enum RequestOrigin
409 {
410 RequestOrigin_Unknown,
411 RequestOrigin_DicomProtocol,
412 RequestOrigin_RestApi,
413 RequestOrigin_Plugins,
414 RequestOrigin_Lua
415 };
416
417 enum ServerBarrierEvent
418 {
419 ServerBarrierEvent_Stop,
420 ServerBarrierEvent_Reload // SIGHUP signal: reload configuration file
421 };
422
423 enum FileMode
424 {
425 FileMode_ReadBinary,
426 FileMode_WriteBinary
427 };
428
429 /**
430 * The value representations Orthanc knows about. They correspond to
431 * the DICOM 2016b version of the standard.
432 * http://dicom.nema.org/medical/dicom/current/output/chtml/part05/sect_6.2.html
433 **/
434 enum ValueRepresentation
435 {
436 ValueRepresentation_ApplicationEntity = 1, // AE
437 ValueRepresentation_AgeString = 2, // AS
438 ValueRepresentation_AttributeTag = 3, // AT (2 x uint16_t)
439 ValueRepresentation_CodeString = 4, // CS
440 ValueRepresentation_Date = 5, // DA
441 ValueRepresentation_DecimalString = 6, // DS
442 ValueRepresentation_DateTime = 7, // DT
443 ValueRepresentation_FloatingPointSingle = 8, // FL (float)
444 ValueRepresentation_FloatingPointDouble = 9, // FD (double)
445 ValueRepresentation_IntegerString = 10, // IS
446 ValueRepresentation_LongString = 11, // LO
447 ValueRepresentation_LongText = 12, // LT
448 ValueRepresentation_OtherByte = 13, // OB
449 ValueRepresentation_OtherDouble = 14, // OD
450 ValueRepresentation_OtherFloat = 15, // OF
451 ValueRepresentation_OtherLong = 16, // OL
452 ValueRepresentation_OtherWord = 17, // OW
453 ValueRepresentation_PersonName = 18, // PN
454 ValueRepresentation_ShortString = 19, // SH
455 ValueRepresentation_SignedLong = 20, // SL (int32_t)
456 ValueRepresentation_Sequence = 21, // SQ
457 ValueRepresentation_SignedShort = 22, // SS (int16_t)
458 ValueRepresentation_ShortText = 23, // ST
459 ValueRepresentation_Time = 24, // TM
460 ValueRepresentation_UnlimitedCharacters = 25, // UC
461 ValueRepresentation_UniqueIdentifier = 26, // UI (UID)
462 ValueRepresentation_UnsignedLong = 27, // UL (uint32_t)
463 ValueRepresentation_Unknown = 28, // UN
464 ValueRepresentation_UniversalResource = 29, // UR (URI or URL)
465 ValueRepresentation_UnsignedShort = 30, // US (uint16_t)
466 ValueRepresentation_UnlimitedText = 31, // UT
467 ValueRepresentation_NotSupported // Not supported by Orthanc, or tag not in dictionary
468 };
469
470 enum DicomReplaceMode
471 {
472 DicomReplaceMode_InsertIfAbsent,
473 DicomReplaceMode_ThrowIfAbsent,
474 DicomReplaceMode_IgnoreIfAbsent
475 };
476
477 enum DicomToJsonFormat
478 {
479 DicomToJsonFormat_Full,
480 DicomToJsonFormat_Short,
481 DicomToJsonFormat_Human
482 };
483
484 enum DicomToJsonFlags
485 {
486 DicomToJsonFlags_IncludeBinary = (1 << 0),
487 DicomToJsonFlags_IncludePrivateTags = (1 << 1),
488 DicomToJsonFlags_IncludeUnknownTags = (1 << 2),
489 DicomToJsonFlags_IncludePixelData = (1 << 3),
490 DicomToJsonFlags_ConvertBinaryToAscii = (1 << 4),
491 DicomToJsonFlags_ConvertBinaryToNull = (1 << 5),
492
493 // Some predefined combinations
494 DicomToJsonFlags_None = 0,
495 DicomToJsonFlags_Default = (DicomToJsonFlags_IncludeBinary |
496 DicomToJsonFlags_IncludePixelData |
497 DicomToJsonFlags_IncludePrivateTags |
498 DicomToJsonFlags_IncludeUnknownTags |
499 DicomToJsonFlags_ConvertBinaryToNull)
500 };
501
502 enum DicomFromJsonFlags
503 {
504 DicomFromJsonFlags_DecodeDataUriScheme = (1 << 0),
505 DicomFromJsonFlags_GenerateIdentifiers = (1 << 1)
506 };
507
508 enum DicomVersion
509 {
510 DicomVersion_2008,
511 DicomVersion_2017c
512 };
513
514 enum ModalityManufacturer
515 {
516 ModalityManufacturer_Generic,
517 ModalityManufacturer_GenericNoWildcardInDates,
518 ModalityManufacturer_GenericNoUniversalWildcard,
519 ModalityManufacturer_StoreScp,
520 ModalityManufacturer_ClearCanvas,
521 ModalityManufacturer_Dcm4Chee,
522 ModalityManufacturer_Vitrea
523 };
524
525 enum DicomRequestType
526 {
527 DicomRequestType_Echo,
528 DicomRequestType_Find,
529 DicomRequestType_Get,
530 DicomRequestType_Move,
531 DicomRequestType_Store
532 };
533
534 enum TransferSyntax
535 {
536 TransferSyntax_Deflated,
537 TransferSyntax_Jpeg,
538 TransferSyntax_Jpeg2000,
539 TransferSyntax_JpegLossless,
540 TransferSyntax_Jpip,
541 TransferSyntax_Mpeg2,
542 TransferSyntax_Rle
543 };
544
545
546 /**
547 * WARNING: Do not change the explicit values in the enumerations
548 * below this point. This would result in incompatible databases
549 * between versions of Orthanc!
550 **/
551
552 enum CompressionType
553 {
554 /**
555 * Buffer/file that is stored as-is, in a raw fashion, without
556 * compression.
557 **/
558 CompressionType_None = 1,
559
560 /**
561 * Buffer that is compressed using the "deflate" algorithm (RFC
562 * 1951), wrapped inside the zlib data format (RFC 1950), prefixed
563 * with a "uint64_t" (8 bytes) that encodes the size of the
564 * uncompressed buffer. If the compressed buffer is empty, its
565 * represents an empty uncompressed buffer. This format is
566 * internal to Orthanc. If the 8 first bytes are skipped AND the
567 * buffer is non-empty, the buffer is compatible with the
568 * "deflate" HTTP compression.
569 **/
570 CompressionType_ZlibWithSize = 2
571 };
572
573 enum FileContentType
574 {
575 // If you add a value below, insert it in "PluginStorageArea" in
576 // the file "Plugins/Engine/OrthancPlugins.cpp"
577 FileContentType_Unknown = 0,
578 FileContentType_Dicom = 1,
579 FileContentType_DicomAsJson = 2,
580
581 // Make sure that the value "65535" can be stored into this enumeration
582 FileContentType_StartUser = 1024,
583 FileContentType_EndUser = 65535
584 };
585
586 enum ResourceType
587 {
588 ResourceType_Patient = 1,
589 ResourceType_Study = 2,
590 ResourceType_Series = 3,
591 ResourceType_Instance = 4
592 };
593
594
595 const char* EnumerationToString(ErrorCode code);
596
597 const char* EnumerationToString(HttpMethod method);
598
599 const char* EnumerationToString(HttpStatus status);
600
601 const char* EnumerationToString(ResourceType type);
602
603 const char* EnumerationToString(ImageFormat format);
604
605 const char* EnumerationToString(Encoding encoding);
606
607 const char* EnumerationToString(PhotometricInterpretation photometric);
608
609 const char* EnumerationToString(LogLevel level);
610
611 const char* EnumerationToString(RequestOrigin origin);
612
613 const char* EnumerationToString(PixelFormat format);
614
615 const char* EnumerationToString(ModalityManufacturer manufacturer);
616
617 const char* EnumerationToString(DicomRequestType type);
618
619 const char* EnumerationToString(TransferSyntax syntax);
620
621 const char* EnumerationToString(DicomVersion version);
622
623 Encoding StringToEncoding(const char* encoding);
624
625 ResourceType StringToResourceType(const char* type);
626
627 ImageFormat StringToImageFormat(const char* format);
628
629 LogLevel StringToLogLevel(const char* level);
630
631 ValueRepresentation StringToValueRepresentation(const std::string& vr,
632 bool throwIfUnsupported);
633
634 PhotometricInterpretation StringToPhotometricInterpretation(const char* value);
635
636 ModalityManufacturer StringToModalityManufacturer(const std::string& manufacturer);
637
638 DicomVersion StringToDicomVersion(const std::string& version);
639
640 unsigned int GetBytesPerPixel(PixelFormat format);
641
642 bool GetDicomEncoding(Encoding& encoding,
643 const char* specificCharacterSet);
644
645 ResourceType GetChildResourceType(ResourceType type);
646
647 ResourceType GetParentResourceType(ResourceType type);
648
649 DicomModule GetModule(ResourceType type);
650
651 const char* GetDicomSpecificCharacterSet(Encoding encoding);
652
653 HttpStatus ConvertErrorCodeToHttpStatus(ErrorCode error);
654
655 bool IsUserContentType(FileContentType type);
656
657 bool IsBinaryValueRepresentation(ValueRepresentation vr);
658
659 Encoding GetDefaultDicomEncoding();
660
661 void SetDefaultDicomEncoding(Encoding encoding);
662 }