comparison OrthancFramework/Sources/Enumerations.h @ 4044:d25f4c0fa160 framework

splitting code into OrthancFramework and OrthancServer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 20:30:34 +0200
parents Core/Enumerations.h@b3f09bc9734b
children 7116e34221fe
comparison
equal deleted inserted replaced
4043:6c6239aec462 4044:d25f4c0fa160
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-2020 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 "OrthancFramework.h"
37
38 #include <string>
39
40
41 // Macro "ORTHANC_FORCE_INLINE" forces a function/method to be inlined
42 #if defined(_MSC_VER)
43 # define ORTHANC_FORCE_INLINE __forceinline
44 #elif defined(__GNUC__) || defined(__clang__) || defined(__EMSCRIPTEN__)
45 # define ORTHANC_FORCE_INLINE inline __attribute((always_inline))
46 #else
47 # error Please support your compiler here
48 #endif
49
50
51 // Macros "ORTHANC_OVERRIDE" and "ORTHANC_FINAL" wrap the "override"
52 // and "final" keywords introduced in C++11, to do compile-time
53 // checking of virtual methods
54 // The __cplusplus macro is broken in Visual Studio up to 15.6 and, in
55 // later versions, require the usage of the /Zc:__cplusplus flag
56 // We thus use an alternate way of checking for 'override' support
57 #ifdef ORTHANC_OVERRIDE_SUPPORTED
58 #error ORTHANC_OVERRIDE_SUPPORTED cannot be defined at this point
59 #endif
60
61 #if __cplusplus >= 201103L
62 # define ORTHANC_OVERRIDE_SUPPORTED 1
63 #else
64 # ifdef _MSC_VER
65 # if _MSC_VER >= 1600
66 # define ORTHANC_OVERRIDE_SUPPORTED 1
67 # endif
68 # endif
69 #endif
70
71 #if ORTHANC_OVERRIDE_SUPPORTED
72 // The override keyword (C++11) is enabled
73 # define ORTHANC_OVERRIDE override
74 # define ORTHANC_FINAL final
75 #else
76 // The override keyword (C++11) is not available
77 # define ORTHANC_OVERRIDE
78 # define ORTHANC_FINAL
79 #endif
80
81 namespace Orthanc
82 {
83 static const char* const URI_SCHEME_PREFIX_BINARY = "data:application/octet-stream;base64,";
84
85 static const char* const MIME_BINARY = "application/octet-stream";
86 static const char* const MIME_JPEG = "image/jpeg";
87 static const char* const MIME_JSON = "application/json";
88 static const char* const MIME_JSON_UTF8 = "application/json; charset=utf-8";
89 static const char* const MIME_PDF = "application/pdf";
90 static const char* const MIME_PNG = "image/png";
91 static const char* const MIME_XML = "application/xml";
92 static const char* const MIME_XML_UTF8 = "application/xml; charset=utf-8";
93
94 /**
95 * "No Internet Media Type (aka MIME type, content type) for PBM has
96 * been registered with IANA, but the unofficial value
97 * image/x-portable-arbitrarymap is assigned by this specification,
98 * to be consistent with conventional values for the older Netpbm
99 * formats." http://netpbm.sourceforge.net/doc/pam.html
100 **/
101 static const char* const MIME_PAM = "image/x-portable-arbitrarymap";
102
103
104 enum MimeType
105 {
106 MimeType_Binary,
107 MimeType_Css,
108 MimeType_Dicom,
109 MimeType_Gif,
110 MimeType_Gzip,
111 MimeType_Html,
112 MimeType_JavaScript,
113 MimeType_Jpeg,
114 MimeType_Jpeg2000,
115 MimeType_Json,
116 MimeType_NaCl,
117 MimeType_PNaCl,
118 MimeType_Pam,
119 MimeType_Pdf,
120 MimeType_PlainText,
121 MimeType_Png,
122 MimeType_Svg,
123 MimeType_WebAssembly,
124 MimeType_Xml,
125 MimeType_Woff, // Web Open Font Format
126 MimeType_Woff2,
127 MimeType_Zip,
128 MimeType_PrometheusText, // Prometheus text-based exposition format (for metrics)
129 MimeType_DicomWebJson,
130 MimeType_DicomWebXml
131 };
132
133
134 enum Endianness
135 {
136 Endianness_Unknown,
137 Endianness_Big,
138 Endianness_Little
139 };
140
141 // This enumeration is autogenerated by the script
142 // "Resources/GenerateErrorCodes.py"
143 enum ErrorCode
144 {
145 ErrorCode_InternalError = -1 /*!< Internal error */,
146 ErrorCode_Success = 0 /*!< Success */,
147 ErrorCode_Plugin = 1 /*!< Error encountered within the plugin engine */,
148 ErrorCode_NotImplemented = 2 /*!< Not implemented yet */,
149 ErrorCode_ParameterOutOfRange = 3 /*!< Parameter out of range */,
150 ErrorCode_NotEnoughMemory = 4 /*!< The server hosting Orthanc is running out of memory */,
151 ErrorCode_BadParameterType = 5 /*!< Bad type for a parameter */,
152 ErrorCode_BadSequenceOfCalls = 6 /*!< Bad sequence of calls */,
153 ErrorCode_InexistentItem = 7 /*!< Accessing an inexistent item */,
154 ErrorCode_BadRequest = 8 /*!< Bad request */,
155 ErrorCode_NetworkProtocol = 9 /*!< Error in the network protocol */,
156 ErrorCode_SystemCommand = 10 /*!< Error while calling a system command */,
157 ErrorCode_Database = 11 /*!< Error with the database engine */,
158 ErrorCode_UriSyntax = 12 /*!< Badly formatted URI */,
159 ErrorCode_InexistentFile = 13 /*!< Inexistent file */,
160 ErrorCode_CannotWriteFile = 14 /*!< Cannot write to file */,
161 ErrorCode_BadFileFormat = 15 /*!< Bad file format */,
162 ErrorCode_Timeout = 16 /*!< Timeout */,
163 ErrorCode_UnknownResource = 17 /*!< Unknown resource */,
164 ErrorCode_IncompatibleDatabaseVersion = 18 /*!< Incompatible version of the database */,
165 ErrorCode_FullStorage = 19 /*!< The file storage is full */,
166 ErrorCode_CorruptedFile = 20 /*!< Corrupted file (e.g. inconsistent MD5 hash) */,
167 ErrorCode_InexistentTag = 21 /*!< Inexistent tag */,
168 ErrorCode_ReadOnly = 22 /*!< Cannot modify a read-only data structure */,
169 ErrorCode_IncompatibleImageFormat = 23 /*!< Incompatible format of the images */,
170 ErrorCode_IncompatibleImageSize = 24 /*!< Incompatible size of the images */,
171 ErrorCode_SharedLibrary = 25 /*!< Error while using a shared library (plugin) */,
172 ErrorCode_UnknownPluginService = 26 /*!< Plugin invoking an unknown service */,
173 ErrorCode_UnknownDicomTag = 27 /*!< Unknown DICOM tag */,
174 ErrorCode_BadJson = 28 /*!< Cannot parse a JSON document */,
175 ErrorCode_Unauthorized = 29 /*!< Bad credentials were provided to an HTTP request */,
176 ErrorCode_BadFont = 30 /*!< Badly formatted font file */,
177 ErrorCode_DatabasePlugin = 31 /*!< The plugin implementing a custom database back-end does not fulfill the proper interface */,
178 ErrorCode_StorageAreaPlugin = 32 /*!< Error in the plugin implementing a custom storage area */,
179 ErrorCode_EmptyRequest = 33 /*!< The request is empty */,
180 ErrorCode_NotAcceptable = 34 /*!< Cannot send a response which is acceptable according to the Accept HTTP header */,
181 ErrorCode_NullPointer = 35 /*!< Cannot handle a NULL pointer */,
182 ErrorCode_DatabaseUnavailable = 36 /*!< The database is currently not available (probably a transient situation) */,
183 ErrorCode_CanceledJob = 37 /*!< This job was canceled */,
184 ErrorCode_BadGeometry = 38 /*!< Geometry error encountered in Stone */,
185 ErrorCode_SslInitialization = 39 /*!< Cannot initialize SSL encryption, check out your certificates */,
186 ErrorCode_SQLiteNotOpened = 1000 /*!< SQLite: The database is not opened */,
187 ErrorCode_SQLiteAlreadyOpened = 1001 /*!< SQLite: Connection is already open */,
188 ErrorCode_SQLiteCannotOpen = 1002 /*!< SQLite: Unable to open the database */,
189 ErrorCode_SQLiteStatementAlreadyUsed = 1003 /*!< SQLite: This cached statement is already being referred to */,
190 ErrorCode_SQLiteExecute = 1004 /*!< SQLite: Cannot execute a command */,
191 ErrorCode_SQLiteRollbackWithoutTransaction = 1005 /*!< SQLite: Rolling back a nonexistent transaction (have you called Begin()?) */,
192 ErrorCode_SQLiteCommitWithoutTransaction = 1006 /*!< SQLite: Committing a nonexistent transaction */,
193 ErrorCode_SQLiteRegisterFunction = 1007 /*!< SQLite: Unable to register a function */,
194 ErrorCode_SQLiteFlush = 1008 /*!< SQLite: Unable to flush the database */,
195 ErrorCode_SQLiteCannotRun = 1009 /*!< SQLite: Cannot run a cached statement */,
196 ErrorCode_SQLiteCannotStep = 1010 /*!< SQLite: Cannot step over a cached statement */,
197 ErrorCode_SQLiteBindOutOfRange = 1011 /*!< SQLite: Bing a value while out of range (serious error) */,
198 ErrorCode_SQLitePrepareStatement = 1012 /*!< SQLite: Cannot prepare a cached statement */,
199 ErrorCode_SQLiteTransactionAlreadyStarted = 1013 /*!< SQLite: Beginning the same transaction twice */,
200 ErrorCode_SQLiteTransactionCommit = 1014 /*!< SQLite: Failure when committing the transaction */,
201 ErrorCode_SQLiteTransactionBegin = 1015 /*!< SQLite: Cannot start a transaction */,
202 ErrorCode_DirectoryOverFile = 2000 /*!< The directory to be created is already occupied by a regular file */,
203 ErrorCode_FileStorageCannotWrite = 2001 /*!< Unable to create a subdirectory or a file in the file storage */,
204 ErrorCode_DirectoryExpected = 2002 /*!< The specified path does not point to a directory */,
205 ErrorCode_HttpPortInUse = 2003 /*!< The TCP port of the HTTP server is privileged or already in use */,
206 ErrorCode_DicomPortInUse = 2004 /*!< The TCP port of the DICOM server is privileged or already in use */,
207 ErrorCode_BadHttpStatusInRest = 2005 /*!< This HTTP status is not allowed in a REST API */,
208 ErrorCode_RegularFileExpected = 2006 /*!< The specified path does not point to a regular file */,
209 ErrorCode_PathToExecutable = 2007 /*!< Unable to get the path to the executable */,
210 ErrorCode_MakeDirectory = 2008 /*!< Cannot create a directory */,
211 ErrorCode_BadApplicationEntityTitle = 2009 /*!< An application entity title (AET) cannot be empty or be longer than 16 characters */,
212 ErrorCode_NoCFindHandler = 2010 /*!< No request handler factory for DICOM C-FIND SCP */,
213 ErrorCode_NoCMoveHandler = 2011 /*!< No request handler factory for DICOM C-MOVE SCP */,
214 ErrorCode_NoCStoreHandler = 2012 /*!< No request handler factory for DICOM C-STORE SCP */,
215 ErrorCode_NoApplicationEntityFilter = 2013 /*!< No application entity filter */,
216 ErrorCode_NoSopClassOrInstance = 2014 /*!< DicomUserConnection: Unable to find the SOP class and instance */,
217 ErrorCode_NoPresentationContext = 2015 /*!< DicomUserConnection: No acceptable presentation context for modality */,
218 ErrorCode_DicomFindUnavailable = 2016 /*!< DicomUserConnection: The C-FIND command is not supported by the remote SCP */,
219 ErrorCode_DicomMoveUnavailable = 2017 /*!< DicomUserConnection: The C-MOVE command is not supported by the remote SCP */,
220 ErrorCode_CannotStoreInstance = 2018 /*!< Cannot store an instance */,
221 ErrorCode_CreateDicomNotString = 2019 /*!< Only string values are supported when creating DICOM instances */,
222 ErrorCode_CreateDicomOverrideTag = 2020 /*!< Trying to override a value inherited from a parent module */,
223 ErrorCode_CreateDicomUseContent = 2021 /*!< Use \"Content\" to inject an image into a new DICOM instance */,
224 ErrorCode_CreateDicomNoPayload = 2022 /*!< No payload is present for one instance in the series */,
225 ErrorCode_CreateDicomUseDataUriScheme = 2023 /*!< The payload of the DICOM instance must be specified according to Data URI scheme */,
226 ErrorCode_CreateDicomBadParent = 2024 /*!< Trying to attach a new DICOM instance to an inexistent resource */,
227 ErrorCode_CreateDicomParentIsInstance = 2025 /*!< Trying to attach a new DICOM instance to an instance (must be a series, study or patient) */,
228 ErrorCode_CreateDicomParentEncoding = 2026 /*!< Unable to get the encoding of the parent resource */,
229 ErrorCode_UnknownModality = 2027 /*!< Unknown modality */,
230 ErrorCode_BadJobOrdering = 2028 /*!< Bad ordering of filters in a job */,
231 ErrorCode_JsonToLuaTable = 2029 /*!< Cannot convert the given JSON object to a Lua table */,
232 ErrorCode_CannotCreateLua = 2030 /*!< Cannot create the Lua context */,
233 ErrorCode_CannotExecuteLua = 2031 /*!< Cannot execute a Lua command */,
234 ErrorCode_LuaAlreadyExecuted = 2032 /*!< Arguments cannot be pushed after the Lua function is executed */,
235 ErrorCode_LuaBadOutput = 2033 /*!< The Lua function does not give the expected number of outputs */,
236 ErrorCode_NotLuaPredicate = 2034 /*!< The Lua function is not a predicate (only true/false outputs allowed) */,
237 ErrorCode_LuaReturnsNoString = 2035 /*!< The Lua function does not return a string */,
238 ErrorCode_StorageAreaAlreadyRegistered = 2036 /*!< Another plugin has already registered a custom storage area */,
239 ErrorCode_DatabaseBackendAlreadyRegistered = 2037 /*!< Another plugin has already registered a custom database back-end */,
240 ErrorCode_DatabaseNotInitialized = 2038 /*!< Plugin trying to call the database during its initialization */,
241 ErrorCode_SslDisabled = 2039 /*!< Orthanc has been built without SSL support */,
242 ErrorCode_CannotOrderSlices = 2040 /*!< Unable to order the slices of the series */,
243 ErrorCode_NoWorklistHandler = 2041 /*!< No request handler factory for DICOM C-Find Modality SCP */,
244 ErrorCode_AlreadyExistingTag = 2042 /*!< Cannot override the value of a tag that already exists */,
245 ErrorCode_NoStorageCommitmentHandler = 2043 /*!< No request handler factory for DICOM N-ACTION SCP (storage commitment) */,
246 ErrorCode_NoCGetHandler = 2044 /*!< No request handler factory for DICOM C-GET SCP */,
247 ErrorCode_UnsupportedMediaType = 3000 /*!< Unsupported media type */,
248 ErrorCode_START_PLUGINS = 1000000
249 };
250
251 // This enumeration is autogenerated by the script
252 // "Resources/GenerateTransferSyntaxes.py"
253 enum DicomTransferSyntax
254 {
255 DicomTransferSyntax_LittleEndianImplicit /*!< Implicit VR Little Endian */,
256 DicomTransferSyntax_LittleEndianExplicit /*!< Explicit VR Little Endian */,
257 DicomTransferSyntax_DeflatedLittleEndianExplicit /*!< Deflated Explicit VR Little Endian */,
258 DicomTransferSyntax_BigEndianExplicit /*!< Explicit VR Big Endian */,
259 DicomTransferSyntax_JPEGProcess1 /*!< JPEG Baseline (process 1, lossy) */,
260 DicomTransferSyntax_JPEGProcess2_4 /*!< JPEG Extended Sequential (processes 2 & 4) */,
261 DicomTransferSyntax_JPEGProcess3_5 /*!< JPEG Extended Sequential (lossy, 8/12 bit), arithmetic coding */,
262 DicomTransferSyntax_JPEGProcess6_8 /*!< JPEG Spectral Selection, Nonhierarchical (lossy, 8/12 bit) */,
263 DicomTransferSyntax_JPEGProcess7_9 /*!< JPEG Spectral Selection, Nonhierarchical (lossy, 8/12 bit), arithmetic coding */,
264 DicomTransferSyntax_JPEGProcess10_12 /*!< JPEG Full Progression, Nonhierarchical (lossy, 8/12 bit) */,
265 DicomTransferSyntax_JPEGProcess11_13 /*!< JPEG Full Progression, Nonhierarchical (lossy, 8/12 bit), arithmetic coding */,
266 DicomTransferSyntax_JPEGProcess14 /*!< JPEG Lossless, Nonhierarchical with any selection value (process 14) */,
267 DicomTransferSyntax_JPEGProcess15 /*!< JPEG Lossless with any selection value, arithmetic coding */,
268 DicomTransferSyntax_JPEGProcess16_18 /*!< JPEG Extended Sequential, Hierarchical (lossy, 8/12 bit) */,
269 DicomTransferSyntax_JPEGProcess17_19 /*!< JPEG Extended Sequential, Hierarchical (lossy, 8/12 bit), arithmetic coding */,
270 DicomTransferSyntax_JPEGProcess20_22 /*!< JPEG Spectral Selection, Hierarchical (lossy, 8/12 bit) */,
271 DicomTransferSyntax_JPEGProcess21_23 /*!< JPEG Spectral Selection, Hierarchical (lossy, 8/12 bit), arithmetic coding */,
272 DicomTransferSyntax_JPEGProcess24_26 /*!< JPEG Full Progression, Hierarchical (lossy, 8/12 bit) */,
273 DicomTransferSyntax_JPEGProcess25_27 /*!< JPEG Full Progression, Hierarchical (lossy, 8/12 bit), arithmetic coding */,
274 DicomTransferSyntax_JPEGProcess28 /*!< JPEG Lossless, Hierarchical */,
275 DicomTransferSyntax_JPEGProcess29 /*!< JPEG Lossless, Hierarchical, arithmetic coding */,
276 DicomTransferSyntax_JPEGProcess14SV1 /*!< JPEG Lossless, Nonhierarchical, First-Order Prediction (Processes 14 [Selection Value 1]) */,
277 DicomTransferSyntax_JPEGLSLossless /*!< JPEG-LS (lossless) */,
278 DicomTransferSyntax_JPEGLSLossy /*!< JPEG-LS (lossy or near-lossless) */,
279 DicomTransferSyntax_JPEG2000LosslessOnly /*!< JPEG 2000 (lossless) */,
280 DicomTransferSyntax_JPEG2000 /*!< JPEG 2000 (lossless or lossy) */,
281 DicomTransferSyntax_JPEG2000MulticomponentLosslessOnly /*!< JPEG 2000 part 2 multicomponent extensions (lossless) */,
282 DicomTransferSyntax_JPEG2000Multicomponent /*!< JPEG 2000 part 2 multicomponent extensions (lossless or lossy) */,
283 DicomTransferSyntax_JPIPReferenced /*!< JPIP Referenced */,
284 DicomTransferSyntax_JPIPReferencedDeflate /*!< JPIP Referenced Deflate */,
285 DicomTransferSyntax_MPEG2MainProfileAtMainLevel /*!< MPEG2 Main Profile / Main Level */,
286 DicomTransferSyntax_MPEG2MainProfileAtHighLevel /*!< MPEG2 Main Profile / High Level */,
287 DicomTransferSyntax_MPEG4HighProfileLevel4_1 /*!< MPEG4 AVC/H.264 High Profile / Level 4.1 */,
288 DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1 /*!< MPEG4 AVC/H.264 BD-compatible High Profile / Level 4.1 */,
289 DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo /*!< MPEG4 AVC/H.264 High Profile / Level 4.2 For 2D Video */,
290 DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo /*!< MPEG4 AVC/H.264 High Profile / Level 4.2 For 3D Video */,
291 DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2 /*!< MPEG4 AVC/H.264 Stereo High Profile / Level 4.2 */,
292 DicomTransferSyntax_HEVCMainProfileLevel5_1 /*!< HEVC/H.265 Main Profile / Level 5.1 */,
293 DicomTransferSyntax_HEVCMain10ProfileLevel5_1 /*!< HEVC/H.265 Main 10 Profile / Level 5.1 */,
294 DicomTransferSyntax_RLELossless /*!< RLE - Run Length Encoding (lossless) */,
295 DicomTransferSyntax_RFC2557MimeEncapsulation /*!< RFC 2557 MIME Encapsulation */,
296 DicomTransferSyntax_XML /*!< XML Encoding */
297 };
298
299
300 /**
301 * {summary}{The memory layout of the pixels (resp. voxels) of a 2D (resp. 3D) image.}
302 **/
303 enum PixelFormat
304 {
305 /**
306 * {summary}{Color image in RGB24 format.}
307 * {description}{This format describes a color image. The pixels are stored in 3
308 * consecutive bytes. The memory layout is RGB.}
309 **/
310 PixelFormat_RGB24 = 1,
311
312 /**
313 * {summary}{Color image in RGBA32 format.}
314 * {description}{This format describes a color image. The pixels are stored in 4
315 * consecutive bytes. The memory layout is RGBA.}
316 **/
317 PixelFormat_RGBA32 = 2,
318
319 /**
320 * {summary}{Graylevel 8bpp image.}
321 * {description}{The image is graylevel. Each pixel is unsigned and stored in one byte.}
322 **/
323 PixelFormat_Grayscale8 = 3,
324
325 /**
326 * {summary}{Graylevel, unsigned 16bpp image.}
327 * {description}{The image is graylevel. Each pixel is unsigned and stored in two bytes.}
328 **/
329 PixelFormat_Grayscale16 = 4,
330
331 /**
332 * {summary}{Graylevel, signed 16bpp image.}
333 * {description}{The image is graylevel. Each pixel is signed and stored in two bytes.}
334 **/
335 PixelFormat_SignedGrayscale16 = 5,
336
337 /**
338 * {summary}{Graylevel, floating-point image.}
339 * {description}{The image is graylevel. Each pixel is floating-point and stored in 4 bytes.}
340 **/
341 PixelFormat_Float32 = 6,
342
343 // This is the memory layout for Cairo (for internal use in Stone of Orthanc)
344 PixelFormat_BGRA32 = 7,
345
346 /**
347 * {summary}{Graylevel, unsigned 32bpp image.}
348 * {description}{The image is graylevel. Each pixel is unsigned and stored in 4 bytes.}
349 **/
350 PixelFormat_Grayscale32 = 8,
351
352 /**
353 * {summary}{Color image in RGB48 format.}
354 * {description}{This format describes a color image. The pixels are stored in 6
355 * consecutive bytes. The memory layout is RGB.}
356 **/
357 PixelFormat_RGB48 = 9,
358
359 /**
360 * {summary}{Graylevel, unsigned 64bpp image.}
361 * {description}{The image is graylevel. Each pixel is unsigned and stored in 8 bytes.}
362 **/
363 PixelFormat_Grayscale64 = 10
364 };
365
366
367 /**
368 * {summary}{The extraction mode specifies the way the values of the pixels are scaled when downloading a 2D image.}
369 **/
370 enum ImageExtractionMode
371 {
372 /**
373 * {summary}{Rescaled to 8bpp.}
374 * {description}{The minimum value of the image is set to 0, and its maximum value is set to 255.}
375 **/
376 ImageExtractionMode_Preview = 1,
377
378 /**
379 * {summary}{Truncation to the [0, 255] range.}
380 **/
381 ImageExtractionMode_UInt8 = 2,
382
383 /**
384 * {summary}{Truncation to the [0, 65535] range.}
385 **/
386 ImageExtractionMode_UInt16 = 3,
387
388 /**
389 * {summary}{Truncation to the [-32768, 32767] range.}
390 **/
391 ImageExtractionMode_Int16 = 4
392 };
393
394
395 /**
396 * Most common, non-joke and non-experimental HTTP status codes
397 * http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
398 **/
399 enum HttpStatus
400 {
401 HttpStatus_None = -1,
402
403 // 1xx Informational
404 HttpStatus_100_Continue = 100,
405 HttpStatus_101_SwitchingProtocols = 101,
406 HttpStatus_102_Processing = 102,
407
408 // 2xx Success
409 HttpStatus_200_Ok = 200,
410 HttpStatus_201_Created = 201,
411 HttpStatus_202_Accepted = 202,
412 HttpStatus_203_NonAuthoritativeInformation = 203,
413 HttpStatus_204_NoContent = 204,
414 HttpStatus_205_ResetContent = 205,
415 HttpStatus_206_PartialContent = 206,
416 HttpStatus_207_MultiStatus = 207,
417 HttpStatus_208_AlreadyReported = 208,
418 HttpStatus_226_IMUsed = 226,
419
420 // 3xx Redirection
421 HttpStatus_300_MultipleChoices = 300,
422 HttpStatus_301_MovedPermanently = 301,
423 HttpStatus_302_Found = 302,
424 HttpStatus_303_SeeOther = 303,
425 HttpStatus_304_NotModified = 304,
426 HttpStatus_305_UseProxy = 305,
427 HttpStatus_307_TemporaryRedirect = 307,
428
429 // 4xx Client Error
430 HttpStatus_400_BadRequest = 400,
431 HttpStatus_401_Unauthorized = 401,
432 HttpStatus_402_PaymentRequired = 402,
433 HttpStatus_403_Forbidden = 403,
434 HttpStatus_404_NotFound = 404,
435 HttpStatus_405_MethodNotAllowed = 405,
436 HttpStatus_406_NotAcceptable = 406,
437 HttpStatus_407_ProxyAuthenticationRequired = 407,
438 HttpStatus_408_RequestTimeout = 408,
439 HttpStatus_409_Conflict = 409,
440 HttpStatus_410_Gone = 410,
441 HttpStatus_411_LengthRequired = 411,
442 HttpStatus_412_PreconditionFailed = 412,
443 HttpStatus_413_RequestEntityTooLarge = 413,
444 HttpStatus_414_RequestUriTooLong = 414,
445 HttpStatus_415_UnsupportedMediaType = 415,
446 HttpStatus_416_RequestedRangeNotSatisfiable = 416,
447 HttpStatus_417_ExpectationFailed = 417,
448 HttpStatus_422_UnprocessableEntity = 422,
449 HttpStatus_423_Locked = 423,
450 HttpStatus_424_FailedDependency = 424,
451 HttpStatus_426_UpgradeRequired = 426,
452
453 // 5xx Server Error
454 HttpStatus_500_InternalServerError = 500,
455 HttpStatus_501_NotImplemented = 501,
456 HttpStatus_502_BadGateway = 502,
457 HttpStatus_503_ServiceUnavailable = 503,
458 HttpStatus_504_GatewayTimeout = 504,
459 HttpStatus_505_HttpVersionNotSupported = 505,
460 HttpStatus_506_VariantAlsoNegotiates = 506,
461 HttpStatus_507_InsufficientStorage = 507,
462 HttpStatus_509_BandwidthLimitExceeded = 509,
463 HttpStatus_510_NotExtended = 510
464 };
465
466
467 enum HttpMethod
468 {
469 HttpMethod_Get = 0,
470 HttpMethod_Post = 1,
471 HttpMethod_Delete = 2,
472 HttpMethod_Put = 3
473 };
474
475
476 enum ImageFormat
477 {
478 ImageFormat_Png = 1
479 };
480
481
482 // https://en.wikipedia.org/wiki/HTTP_compression
483 enum HttpCompression
484 {
485 HttpCompression_None,
486 HttpCompression_Deflate,
487 HttpCompression_Gzip
488 };
489
490
491 // Specific Character Sets
492 // http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.12.1.1.2
493 enum Encoding
494 {
495 Encoding_Ascii,
496 Encoding_Utf8,
497 Encoding_Latin1,
498 Encoding_Latin2,
499 Encoding_Latin3,
500 Encoding_Latin4,
501 Encoding_Latin5, // Turkish
502 Encoding_Cyrillic,
503 Encoding_Windows1251, // Windows-1251 (commonly used for Cyrillic)
504 Encoding_Arabic,
505 Encoding_Greek,
506 Encoding_Hebrew,
507 Encoding_Thai, // TIS 620-2533
508 Encoding_Japanese, // JIS X 0201 (Shift JIS): Katakana
509 Encoding_Chinese, // GB18030 - Chinese simplified
510 Encoding_JapaneseKanji, // Multibyte - JIS X 0208: Kanji
511 //Encoding_JapaneseSupplementaryKanji, // Multibyte - JIS X 0212: Supplementary Kanji set
512 Encoding_Korean, // Multibyte - KS X 1001: Hangul and Hanja
513 Encoding_SimplifiedChinese // ISO 2022 IR 58
514 };
515
516
517 // http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.6.3.1.2
518 enum PhotometricInterpretation
519 {
520 PhotometricInterpretation_ARGB, // Retired
521 PhotometricInterpretation_CMYK, // Retired
522 PhotometricInterpretation_HSV, // Retired
523 PhotometricInterpretation_Monochrome1,
524 PhotometricInterpretation_Monochrome2,
525 PhotometricInterpretation_Palette,
526 PhotometricInterpretation_RGB,
527 PhotometricInterpretation_YBRFull,
528 PhotometricInterpretation_YBRFull422,
529 PhotometricInterpretation_YBRPartial420,
530 PhotometricInterpretation_YBRPartial422,
531 PhotometricInterpretation_YBR_ICT,
532 PhotometricInterpretation_YBR_RCT,
533 PhotometricInterpretation_Unknown
534 };
535
536 enum DicomModule
537 {
538 DicomModule_Patient,
539 DicomModule_Study,
540 DicomModule_Series,
541 DicomModule_Instance,
542 DicomModule_Image
543 };
544
545 enum RequestOrigin
546 {
547 RequestOrigin_Unknown,
548 RequestOrigin_DicomProtocol,
549 RequestOrigin_RestApi,
550 RequestOrigin_Plugins,
551 RequestOrigin_Lua
552 };
553
554 enum ServerBarrierEvent
555 {
556 ServerBarrierEvent_Stop,
557 ServerBarrierEvent_Reload // SIGHUP signal: reload configuration file
558 };
559
560 enum FileMode
561 {
562 FileMode_ReadBinary,
563 FileMode_WriteBinary
564 };
565
566 /**
567 * The value representations Orthanc knows about. They correspond to
568 * the DICOM 2016b version of the standard.
569 * http://dicom.nema.org/medical/dicom/current/output/chtml/part05/sect_6.2.html
570 **/
571 enum ValueRepresentation
572 {
573 ValueRepresentation_ApplicationEntity = 1, // AE
574 ValueRepresentation_AgeString = 2, // AS
575 ValueRepresentation_AttributeTag = 3, // AT (2 x uint16_t)
576 ValueRepresentation_CodeString = 4, // CS
577 ValueRepresentation_Date = 5, // DA
578 ValueRepresentation_DecimalString = 6, // DS
579 ValueRepresentation_DateTime = 7, // DT
580 ValueRepresentation_FloatingPointSingle = 8, // FL (float)
581 ValueRepresentation_FloatingPointDouble = 9, // FD (double)
582 ValueRepresentation_IntegerString = 10, // IS
583 ValueRepresentation_LongString = 11, // LO
584 ValueRepresentation_LongText = 12, // LT
585 ValueRepresentation_OtherByte = 13, // OB
586 ValueRepresentation_OtherDouble = 14, // OD
587 ValueRepresentation_OtherFloat = 15, // OF
588 ValueRepresentation_OtherLong = 16, // OL
589 ValueRepresentation_OtherWord = 17, // OW
590 ValueRepresentation_PersonName = 18, // PN
591 ValueRepresentation_ShortString = 19, // SH
592 ValueRepresentation_SignedLong = 20, // SL (int32_t)
593 ValueRepresentation_Sequence = 21, // SQ
594 ValueRepresentation_SignedShort = 22, // SS (int16_t)
595 ValueRepresentation_ShortText = 23, // ST
596 ValueRepresentation_Time = 24, // TM
597 ValueRepresentation_UnlimitedCharacters = 25, // UC
598 ValueRepresentation_UniqueIdentifier = 26, // UI (UID)
599 ValueRepresentation_UnsignedLong = 27, // UL (uint32_t)
600 ValueRepresentation_Unknown = 28, // UN
601 ValueRepresentation_UniversalResource = 29, // UR (URI or URL)
602 ValueRepresentation_UnsignedShort = 30, // US (uint16_t)
603 ValueRepresentation_UnlimitedText = 31, // UT
604 ValueRepresentation_NotSupported // Not supported by Orthanc, or tag not in dictionary
605 };
606
607 enum DicomReplaceMode
608 {
609 DicomReplaceMode_InsertIfAbsent,
610 DicomReplaceMode_ThrowIfAbsent,
611 DicomReplaceMode_IgnoreIfAbsent
612 };
613
614 enum DicomToJsonFormat
615 {
616 DicomToJsonFormat_Full,
617 DicomToJsonFormat_Short,
618 DicomToJsonFormat_Human
619 };
620
621 enum DicomToJsonFlags
622 {
623 DicomToJsonFlags_IncludeBinary = (1 << 0),
624 DicomToJsonFlags_IncludePrivateTags = (1 << 1),
625 DicomToJsonFlags_IncludeUnknownTags = (1 << 2),
626 DicomToJsonFlags_IncludePixelData = (1 << 3),
627 DicomToJsonFlags_ConvertBinaryToAscii = (1 << 4),
628 DicomToJsonFlags_ConvertBinaryToNull = (1 << 5),
629
630 // Some predefined combinations
631 DicomToJsonFlags_None = 0,
632 DicomToJsonFlags_Default = (DicomToJsonFlags_IncludeBinary |
633 DicomToJsonFlags_IncludePixelData |
634 DicomToJsonFlags_IncludePrivateTags |
635 DicomToJsonFlags_IncludeUnknownTags |
636 DicomToJsonFlags_ConvertBinaryToNull)
637 };
638
639 enum DicomFromJsonFlags
640 {
641 DicomFromJsonFlags_DecodeDataUriScheme = (1 << 0),
642 DicomFromJsonFlags_GenerateIdentifiers = (1 << 1),
643
644 // Some predefined combinations
645 DicomFromJsonFlags_None = 0
646 };
647
648 enum DicomVersion
649 {
650 DicomVersion_2008,
651 DicomVersion_2017c
652 };
653
654 enum ModalityManufacturer
655 {
656 ModalityManufacturer_Generic,
657 ModalityManufacturer_GenericNoWildcardInDates,
658 ModalityManufacturer_GenericNoUniversalWildcard,
659 ModalityManufacturer_StoreScp,
660 ModalityManufacturer_Vitrea,
661 ModalityManufacturer_GE
662 };
663
664 enum DicomRequestType
665 {
666 DicomRequestType_Echo,
667 DicomRequestType_Find,
668 DicomRequestType_Get,
669 DicomRequestType_Move,
670 DicomRequestType_Store,
671 DicomRequestType_NAction,
672 DicomRequestType_NEventReport
673 };
674
675 enum TransferSyntax
676 {
677 TransferSyntax_Deflated,
678 TransferSyntax_Jpeg,
679 TransferSyntax_Jpeg2000,
680 TransferSyntax_JpegLossless,
681 TransferSyntax_Jpip,
682 TransferSyntax_Mpeg2,
683 TransferSyntax_Mpeg4, // New in Orthanc 1.6.0
684 TransferSyntax_Rle
685 };
686
687 enum JobState
688 {
689 JobState_Pending,
690 JobState_Running,
691 JobState_Success,
692 JobState_Failure,
693 JobState_Paused,
694 JobState_Retry
695 };
696
697 enum JobStepCode
698 {
699 JobStepCode_Success,
700 JobStepCode_Failure,
701 JobStepCode_Continue,
702 JobStepCode_Retry
703 };
704
705 enum JobStopReason
706 {
707 JobStopReason_Paused,
708 JobStopReason_Canceled,
709 JobStopReason_Success,
710 JobStopReason_Failure,
711 JobStopReason_Retry
712 };
713
714
715 // http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.14.html#sect_C.14.1.1
716 enum StorageCommitmentFailureReason
717 {
718 StorageCommitmentFailureReason_Success = 0,
719
720 // A general failure in processing the operation was encountered
721 StorageCommitmentFailureReason_ProcessingFailure = 0x0110,
722
723 // One or more of the elements in the Referenced SOP Instance
724 // Sequence was not available
725 StorageCommitmentFailureReason_NoSuchObjectInstance = 0x0112,
726
727 // The SCP does not currently have enough resources to store the
728 // requested SOP Instance(s)
729 StorageCommitmentFailureReason_ResourceLimitation = 0x0213,
730
731 // Storage Commitment has been requested for a SOP Instance with a
732 // SOP Class that is not supported by the SCP
733 StorageCommitmentFailureReason_ReferencedSOPClassNotSupported = 0x0122,
734
735 // The SOP Class of an element in the Referenced SOP Instance
736 // Sequence did not correspond to the SOP class registered for
737 // this SOP Instance at the SCP
738 StorageCommitmentFailureReason_ClassInstanceConflict = 0x0119,
739
740 // The Transaction UID of the Storage Commitment Request is already in use
741 StorageCommitmentFailureReason_DuplicateTransactionUID = 0x0131
742 };
743
744
745 enum DicomAssociationRole
746 {
747 DicomAssociationRole_Default,
748 DicomAssociationRole_Scu,
749 DicomAssociationRole_Scp
750 };
751
752
753 /**
754 * WARNING: Do not change the explicit values in the enumerations
755 * below this point. This would result in incompatible databases
756 * between versions of Orthanc!
757 **/
758
759 enum CompressionType
760 {
761 /**
762 * Buffer/file that is stored as-is, in a raw fashion, without
763 * compression.
764 **/
765 CompressionType_None = 1,
766
767 /**
768 * Buffer that is compressed using the "deflate" algorithm (RFC
769 * 1951), wrapped inside the zlib data format (RFC 1950), prefixed
770 * with a "uint64_t" (8 bytes) that encodes the size of the
771 * uncompressed buffer. If the compressed buffer is empty, its
772 * represents an empty uncompressed buffer. This format is
773 * internal to Orthanc. If the 8 first bytes are skipped AND the
774 * buffer is non-empty, the buffer is compatible with the
775 * "deflate" HTTP compression.
776 **/
777 CompressionType_ZlibWithSize = 2
778 };
779
780 enum FileContentType
781 {
782 // If you add a value below, insert it in "PluginStorageArea" in
783 // the file "Plugins/Engine/OrthancPlugins.cpp"
784 FileContentType_Unknown = 0,
785 FileContentType_Dicom = 1,
786 FileContentType_DicomAsJson = 2,
787
788 // Make sure that the value "65535" can be stored into this enumeration
789 FileContentType_StartUser = 1024,
790 FileContentType_EndUser = 65535
791 };
792
793 enum ResourceType
794 {
795 ResourceType_Patient = 1,
796 ResourceType_Study = 2,
797 ResourceType_Series = 3,
798 ResourceType_Instance = 4
799 };
800
801
802 ORTHANC_PUBLIC
803 const char* EnumerationToString(ErrorCode code);
804
805 ORTHANC_PUBLIC
806 const char* EnumerationToString(HttpMethod method);
807
808 ORTHANC_PUBLIC
809 const char* EnumerationToString(HttpStatus status);
810
811 ORTHANC_PUBLIC
812 const char* EnumerationToString(ResourceType type);
813
814 ORTHANC_PUBLIC
815 const char* EnumerationToString(ImageFormat format);
816
817 ORTHANC_PUBLIC
818 const char* EnumerationToString(Encoding encoding);
819
820 ORTHANC_PUBLIC
821 const char* EnumerationToString(PhotometricInterpretation photometric);
822
823 ORTHANC_PUBLIC
824 const char* EnumerationToString(RequestOrigin origin);
825
826 ORTHANC_PUBLIC
827 const char* EnumerationToString(PixelFormat format);
828
829 ORTHANC_PUBLIC
830 const char* EnumerationToString(ModalityManufacturer manufacturer);
831
832 ORTHANC_PUBLIC
833 const char* EnumerationToString(DicomRequestType type);
834
835 ORTHANC_PUBLIC
836 const char* EnumerationToString(TransferSyntax syntax);
837
838 ORTHANC_PUBLIC
839 const char* EnumerationToString(DicomVersion version);
840
841 ORTHANC_PUBLIC
842 const char* EnumerationToString(ValueRepresentation vr);
843
844 ORTHANC_PUBLIC
845 const char* EnumerationToString(JobState state);
846
847 ORTHANC_PUBLIC
848 const char* EnumerationToString(MimeType mime);
849
850 ORTHANC_PUBLIC
851 const char* EnumerationToString(Endianness endianness);
852
853 ORTHANC_PUBLIC
854 const char* EnumerationToString(StorageCommitmentFailureReason reason);
855
856 ORTHANC_PUBLIC
857 Encoding StringToEncoding(const char* encoding);
858
859 ORTHANC_PUBLIC
860 ResourceType StringToResourceType(const char* type);
861
862 ORTHANC_PUBLIC
863 ImageFormat StringToImageFormat(const char* format);
864
865 ORTHANC_PUBLIC
866 ValueRepresentation StringToValueRepresentation(const std::string& vr,
867 bool throwIfUnsupported);
868
869 ORTHANC_PUBLIC
870 PhotometricInterpretation StringToPhotometricInterpretation(const char* value);
871
872 ORTHANC_PUBLIC
873 ModalityManufacturer StringToModalityManufacturer(const std::string& manufacturer);
874
875 ORTHANC_PUBLIC
876 DicomVersion StringToDicomVersion(const std::string& version);
877
878 ORTHANC_PUBLIC
879 JobState StringToJobState(const std::string& state);
880
881 ORTHANC_PUBLIC
882 RequestOrigin StringToRequestOrigin(const std::string& origin);
883
884 ORTHANC_PUBLIC
885 MimeType StringToMimeType(const std::string& mime);
886
887 ORTHANC_PUBLIC
888 unsigned int GetBytesPerPixel(PixelFormat format);
889
890 ORTHANC_PUBLIC
891 bool GetDicomEncoding(Encoding& encoding,
892 const char* specificCharacterSet);
893
894 ORTHANC_PUBLIC
895 ResourceType GetChildResourceType(ResourceType type);
896
897 ORTHANC_PUBLIC
898 ResourceType GetParentResourceType(ResourceType type);
899
900 ORTHANC_PUBLIC
901 bool IsResourceLevelAboveOrEqual(ResourceType level,
902 ResourceType reference);
903
904 ORTHANC_PUBLIC
905 DicomModule GetModule(ResourceType type);
906
907 ORTHANC_PUBLIC
908 const char* GetDicomSpecificCharacterSet(Encoding encoding);
909
910 ORTHANC_PUBLIC
911 HttpStatus ConvertErrorCodeToHttpStatus(ErrorCode error);
912
913 ORTHANC_PUBLIC
914 bool IsUserContentType(FileContentType type);
915
916 ORTHANC_PUBLIC
917 bool IsBinaryValueRepresentation(ValueRepresentation vr);
918
919 ORTHANC_PUBLIC
920 Encoding GetDefaultDicomEncoding();
921
922 ORTHANC_PUBLIC
923 void SetDefaultDicomEncoding(Encoding encoding);
924
925 ORTHANC_PUBLIC
926 const char* GetTransferSyntaxUid(DicomTransferSyntax syntax);
927
928 ORTHANC_PUBLIC
929 bool IsRetiredTransferSyntax(DicomTransferSyntax syntax);
930
931 ORTHANC_PUBLIC
932 bool LookupTransferSyntax(DicomTransferSyntax& target,
933 const std::string& uid);
934 }