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