annotate Core/Enumerations.cpp @ 1578:09715095fc53

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