annotate Core/Enumerations.cpp @ 1577:7aac0cddd42e

generation of the error codes from a Python script
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 15:10:45 +0200
parents de54c19fc44d
children 09715095fc53
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 {
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
43 const char* EnumerationToString(ErrorCode error)
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
44 {
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
45 switch (error)
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
46 {
1577
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
47 case ErrorCode_Custom:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
48 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
49
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
50 case ErrorCode_Success:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
51 return "Success";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
52
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
53 case ErrorCode_InternalError:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
54 return "Internal error";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
55
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
56 case ErrorCode_NotImplemented:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
57 return "Not implemented yet";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
58
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
59 case ErrorCode_ParameterOutOfRange:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
60 return "Parameter out of range";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
61
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
62 case ErrorCode_NotEnoughMemory:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
63 return "Not enough memory";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
64
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
65 case ErrorCode_BadParameterType:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
66 return "Bad type for a parameter";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
67
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
68 case ErrorCode_BadSequenceOfCalls:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
69 return "Bad sequence of calls";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
70
1577
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
71 case ErrorCode_InexistentItem:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
72 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
73
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
74 case ErrorCode_BadRequest:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
75 return "Bad request";
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
76
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
77 case ErrorCode_NetworkProtocol:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
78 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
79
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
80 case ErrorCode_SystemCommand:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
81 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
82
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
83 case ErrorCode_Database:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
84 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
85
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
86 case ErrorCode_UriSyntax:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
87 return "Badly formatted URI";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
88
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
89 case ErrorCode_InexistentFile:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
90 return "Inexistent file";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
91
1577
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
92 case ErrorCode_CannotWriteFile:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
93 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
94
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
95 case ErrorCode_BadFileFormat:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
96 return "Bad file format";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
97
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
98 case ErrorCode_Timeout:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
99 return "Timeout";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
100
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
101 case ErrorCode_UnknownResource:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
102 return "Unknown resource";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
103
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
104 case ErrorCode_IncompatibleDatabaseVersion:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
105 return "Incompatible version of the database";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
106
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
107 case ErrorCode_FullStorage:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
108 return "The file storage is full";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
109
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
110 case ErrorCode_CorruptedFile:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
111 return "Corrupted file (inconsistent MD5 hash)";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
112
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
113 case ErrorCode_InexistentTag:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
114 return "Inexistent tag";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
115
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
116 case ErrorCode_ReadOnly:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
117 return "Cannot modify a read-only data structure";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
118
1577
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
119 case ErrorCode_IncompatibleImageFormat:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
120 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
121
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
122 case ErrorCode_IncompatibleImageSize:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
123 return "Incompatible size of the images";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
124
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
125 case ErrorCode_SharedLibrary:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
126 return "Error while using a shared library (plugin)";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
127
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
128 case ErrorCode_Plugin:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
129 return "Error encountered inside a plugin";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
130
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
131 default:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
132 return "Unknown error code";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
133 }
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
134 }
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
477
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 const char* EnumerationToString(HttpMethod method)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 switch (method)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 case HttpMethod_Get:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 return "GET";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 case HttpMethod_Post:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 return "POST";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 case HttpMethod_Delete:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 return "DELETE";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 case HttpMethod_Put:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 return "PUT";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 default:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 return "?";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 }
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 const char* EnumerationToString(HttpStatus status)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 switch (status)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 case HttpStatus_100_Continue:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 return "Continue";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 case HttpStatus_101_SwitchingProtocols:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 return "Switching Protocols";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 case HttpStatus_102_Processing:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 return "Processing";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 case HttpStatus_200_Ok:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 return "OK";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 case HttpStatus_201_Created:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 return "Created";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 case HttpStatus_202_Accepted:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 return "Accepted";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 case HttpStatus_203_NonAuthoritativeInformation:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 return "Non-Authoritative Information";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 case HttpStatus_204_NoContent:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 return "No Content";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 case HttpStatus_205_ResetContent:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 return "Reset Content";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 case HttpStatus_206_PartialContent:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 return "Partial Content";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 case HttpStatus_207_MultiStatus:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 return "Multi-Status";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 case HttpStatus_208_AlreadyReported:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 return "Already Reported";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 case HttpStatus_226_IMUsed:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 return "IM Used";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 case HttpStatus_300_MultipleChoices:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 return "Multiple Choices";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 case HttpStatus_301_MovedPermanently:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 return "Moved Permanently";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 case HttpStatus_302_Found:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 return "Found";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 case HttpStatus_303_SeeOther:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 return "See Other";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 case HttpStatus_304_NotModified:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 return "Not Modified";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 case HttpStatus_305_UseProxy:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 return "Use Proxy";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 case HttpStatus_307_TemporaryRedirect:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 return "Temporary Redirect";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 case HttpStatus_400_BadRequest:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 return "Bad Request";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 case HttpStatus_401_Unauthorized:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 return "Unauthorized";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 case HttpStatus_402_PaymentRequired:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 return "Payment Required";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 case HttpStatus_403_Forbidden:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 return "Forbidden";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 case HttpStatus_404_NotFound:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 return "Not Found";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 case HttpStatus_405_MethodNotAllowed:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 return "Method Not Allowed";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 case HttpStatus_406_NotAcceptable:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 return "Not Acceptable";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 case HttpStatus_407_ProxyAuthenticationRequired:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 return "Proxy Authentication Required";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 case HttpStatus_408_RequestTimeout:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 return "Request Timeout";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 case HttpStatus_409_Conflict:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 return "Conflict";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 case HttpStatus_410_Gone:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 return "Gone";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 case HttpStatus_411_LengthRequired:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 return "Length Required";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 case HttpStatus_412_PreconditionFailed:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 return "Precondition Failed";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 case HttpStatus_413_RequestEntityTooLarge:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 return "Request Entity Too Large";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 case HttpStatus_414_RequestUriTooLong:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 return "Request-URI Too Long";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 case HttpStatus_415_UnsupportedMediaType:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 return "Unsupported Media Type";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 case HttpStatus_416_RequestedRangeNotSatisfiable:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 return "Requested Range Not Satisfiable";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 case HttpStatus_417_ExpectationFailed:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 return "Expectation Failed";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 case HttpStatus_422_UnprocessableEntity:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 return "Unprocessable Entity";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 case HttpStatus_423_Locked:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 return "Locked";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 case HttpStatus_424_FailedDependency:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 return "Failed Dependency";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 case HttpStatus_426_UpgradeRequired:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 return "Upgrade Required";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 case HttpStatus_500_InternalServerError:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 return "Internal Server Error";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 case HttpStatus_501_NotImplemented:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 return "Not Implemented";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 case HttpStatus_502_BadGateway:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 return "Bad Gateway";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 case HttpStatus_503_ServiceUnavailable:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 return "Service Unavailable";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 case HttpStatus_504_GatewayTimeout:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 return "Gateway Timeout";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 case HttpStatus_505_HttpVersionNotSupported:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305 return "HTTP Version Not Supported";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 case HttpStatus_506_VariantAlsoNegotiates:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 return "Variant Also Negotiates";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310 case HttpStatus_507_InsufficientStorage:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 return "Insufficient Storage";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 case HttpStatus_509_BandwidthLimitExceeded:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 return "Bandwidth Limit Exceeded";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 case HttpStatus_510_NotExtended:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 return "Not Extended";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 default:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 throw OrthancException(ErrorCode_ParameterOutOfRange);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 }
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
323
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
324
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
325 const char* EnumerationToString(ResourceType type)
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 switch (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 case ResourceType_Patient:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
330 return "Patient";
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
331
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
332 case ResourceType_Study:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
333 return "Study";
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
334
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
335 case ResourceType_Series:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
336 return "Series";
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
337
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
338 case ResourceType_Instance:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
339 return "Instance";
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
340
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
341 default:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
342 throw OrthancException(ErrorCode_ParameterOutOfRange);
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
343 }
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
344 }
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
800
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
347 const char* EnumerationToString(ImageFormat format)
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
348 {
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
349 switch (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 case ImageFormat_Png:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
352 return "Png";
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
353
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
354 default:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
355 throw OrthancException(ErrorCode_ParameterOutOfRange);
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
356 }
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
357 }
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
1086
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
360 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
361 {
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
362 switch (encoding)
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
363 {
1087
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
364 case Encoding_Ascii:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
365 return "Ascii";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
366
1086
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
367 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
368 return "Utf8";
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
369
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
370 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
371 return "Latin1";
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
372
1087
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
373 case Encoding_Latin2:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
374 return "Latin2";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
375
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
376 case Encoding_Latin3:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
377 return "Latin3";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
378
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
379 case Encoding_Latin4:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
380 return "Latin4";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
381
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
382 case Encoding_Latin5:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
383 return "Latin5";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
384
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
385 case Encoding_Cyrillic:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
386 return "Cyrillic";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
387
1347
60cc0ee61edb fix issue 32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
388 case Encoding_Windows1251:
60cc0ee61edb fix issue 32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
389 return "Windows1251";
60cc0ee61edb fix issue 32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
390
1087
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
391 case Encoding_Arabic:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
392 return "Arabic";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
393
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
394 case Encoding_Greek:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
395 return "Greek";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
396
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
397 case Encoding_Hebrew:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
398 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
399
1090
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
400 case Encoding_Thai:
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
401 return "Thai";
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
402
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
403 case Encoding_Japanese:
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
404 return "Japanese";
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
405
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
406 case Encoding_Chinese:
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
407 return "Chinese";
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
408
1086
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
409 default:
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
410 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
411 }
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
412 }
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
1206
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
415 const char* EnumerationToString(PhotometricInterpretation photometric)
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
416 {
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
417 switch (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 case PhotometricInterpretation_RGB:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
420 return "RGB";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
421
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
422 case PhotometricInterpretation_Monochrome1:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
423 return "Monochrome1";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
424
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
425 case PhotometricInterpretation_Monochrome2:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
426 return "Monochrome2";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
427
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
428 case PhotometricInterpretation_ARGB:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
429 return "ARGB";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
430
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
431 case PhotometricInterpretation_CMYK:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
432 return "CMYK";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
433
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
434 case PhotometricInterpretation_HSV:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
435 return "HSV";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
436
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
437 case PhotometricInterpretation_Palette:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
438 return "Palette color";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
439
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
440 case PhotometricInterpretation_YBRFull:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
441 return "YBR full";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
442
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
443 case PhotometricInterpretation_YBRFull422:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
444 return "YBR full 422";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
445
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
446 case PhotometricInterpretation_YBRPartial420:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
447 return "YBR partial 420";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
448
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
449 case PhotometricInterpretation_YBRPartial422:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
450 return "YBR partial 422";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
451
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
452 case PhotometricInterpretation_YBR_ICT:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
453 return "YBR ICT";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
454
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
455 case PhotometricInterpretation_YBR_RCT:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
456 return "YBR RCT";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
457
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
458 case PhotometricInterpretation_Unknown:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
459 return "Unknown";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
460
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
461 default:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
462 throw OrthancException(ErrorCode_ParameterOutOfRange);
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
463 }
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
464 }
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
1571
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
467 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
468 {
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
469 switch (origin)
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
470 {
1572
904096e7367e More information about the origin request in OnStoredInstance() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1571
diff changeset
471 case RequestOrigin_Unknown:
904096e7367e More information about the origin request in OnStoredInstance() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1571
diff changeset
472 return "Unknown";
904096e7367e More information about the origin request in OnStoredInstance() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1571
diff changeset
473
1571
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
474 case RequestOrigin_DicomProtocol:
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
475 return "DicomProtocol";
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
476
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
477 case RequestOrigin_Http:
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
478 return "Http";
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
479
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
480 case RequestOrigin_Plugins:
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
481 return "Plugins";
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
482
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
483 case RequestOrigin_Lua:
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
484 return "Lua";
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
485
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
486 default:
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
487 throw OrthancException(ErrorCode_ParameterOutOfRange);
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
488 }
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
489 }
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
1495
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
492 const char* EnumerationToString(LogLevel level)
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
493 {
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
494 switch (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 case LogLevel_Error:
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
497 return "ERROR";
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
498
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
499 case LogLevel_Warning:
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
500 return "WARNING";
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
501
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
502 case LogLevel_Info:
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
503 return "INFO";
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
504
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
505 case LogLevel_Trace:
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
506 return "TRACE";
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
507
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
508 default:
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
509 throw OrthancException(ErrorCode_ParameterOutOfRange);
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
510 }
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
511 }
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
1086
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
514 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
515 {
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
516 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
517 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
518
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
519 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
520 {
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
521 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
522 }
1087
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
523
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
524 if (s == "ASCII")
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 return Encoding_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
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
529 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
530 {
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
531 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
532 }
1087
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
533
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
534 if (s == "LATIN2")
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 return Encoding_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
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
539 if (s == "LATIN3")
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 return Encoding_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
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
544 if (s == "LATIN4")
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 return Encoding_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
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
549 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
550 {
1087
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
551 return Encoding_Latin5;
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
552 }
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
553
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
554 if (s == "CYRILLIC")
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 return Encoding_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
1347
60cc0ee61edb fix issue 32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
559 if (s == "WINDOWS1251")
60cc0ee61edb fix issue 32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
560 {
60cc0ee61edb fix issue 32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
561 return Encoding_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
1087
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
564 if (s == "ARABIC")
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
565 {
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
566 return Encoding_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
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
569 if (s == "GREEK")
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 return Encoding_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
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
574 if (s == "HEBREW")
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 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
577 }
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
578
1090
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
579 if (s == "THAI")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
580 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
581 return Encoding_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
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
584 if (s == "JAPANESE")
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 return Encoding_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
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
589 if (s == "CHINESE")
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 return Encoding_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
1086
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
594 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
595 }
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
596
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
597
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
598 ResourceType StringToResourceType(const char* type)
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
599 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
600 std::string s(type);
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
601 Toolbox::ToUpperCase(s);
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
602
697
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
603 if (s == "PATIENT" || s == "PATIENTS")
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
604 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
605 return ResourceType_Patient;
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
606 }
697
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
607 else if (s == "STUDY" || s == "STUDIES")
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
608 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
609 return ResourceType_Study;
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 else if (s == "SERIES")
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 return ResourceType_Series;
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
614 }
697
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
615 else if (s == "INSTANCE" || s == "IMAGE" ||
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
616 s == "INSTANCES" || s == "IMAGES")
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
617 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
618 return ResourceType_Instance;
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
619 }
800
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
620
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
621 throw OrthancException(ErrorCode_ParameterOutOfRange);
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
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 ImageFormat StringToImageFormat(const char* format)
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 std::string s(format);
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
628 Toolbox::ToUpperCase(s);
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
629
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
630 if (s == "PNG")
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
631 {
800
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
632 return ImageFormat_Png;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
633 }
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
634
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
635 throw OrthancException(ErrorCode_ParameterOutOfRange);
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
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
638
1495
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
639 LogLevel StringToLogLevel(const char *level)
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
640 {
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
641 if (strcmp(level, "ERROR") == 0)
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 return LogLevel_Error;
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 else if (strcmp(level, "WARNING") == 0)
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 return LogLevel_Warning;
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 else if (strcmp(level, "INFO") == 0)
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 return LogLevel_Info;
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 else if (strcmp(level, "TRACE") == 0)
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 return LogLevel_Trace;
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 else
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 throw OrthancException(ErrorCode_InternalError);
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 }
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
800
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
664 unsigned int GetBytesPerPixel(PixelFormat format)
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
665 {
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
666 switch (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 case PixelFormat_Grayscale8:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
669 return 1;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
670
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
671 case PixelFormat_Grayscale16:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
672 case PixelFormat_SignedGrayscale16:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
673 return 2;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
674
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
675 case PixelFormat_RGB24:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
676 return 3;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
677
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
678 case PixelFormat_RGBA32:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
679 return 4;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
680
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
681 default:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
682 throw OrthancException(ErrorCode_ParameterOutOfRange);
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
683 }
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
684 }
1090
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
685
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
686
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
687 bool GetDicomEncoding(Encoding& encoding,
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
688 const char* specificCharacterSet)
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
689 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
690 std::string s = specificCharacterSet;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
691 Toolbox::ToUpperCase(s);
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
692
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
693 // 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
694 // 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
695 if (s == "ISO_IR 6" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
696 s == "ISO_IR 192" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
697 s == "ISO 2022 IR 6")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
698 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
699 encoding = Encoding_Utf8;
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 else if (s == "ISO_IR 100" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
702 s == "ISO 2022 IR 100")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
703 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
704 encoding = Encoding_Latin1;
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 else if (s == "ISO_IR 101" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
707 s == "ISO 2022 IR 101")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
708 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
709 encoding = Encoding_Latin2;
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 else if (s == "ISO_IR 109" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
712 s == "ISO 2022 IR 109")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
713 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
714 encoding = Encoding_Latin3;
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 else if (s == "ISO_IR 110" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
717 s == "ISO 2022 IR 110")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
718 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
719 encoding = Encoding_Latin4;
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 else if (s == "ISO_IR 148" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
722 s == "ISO 2022 IR 148")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
723 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
724 encoding = Encoding_Latin5;
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 else if (s == "ISO_IR 144" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
727 s == "ISO 2022 IR 144")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
728 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
729 encoding = Encoding_Cyrillic;
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 else if (s == "ISO_IR 127" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
732 s == "ISO 2022 IR 127")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
733 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
734 encoding = Encoding_Arabic;
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 else if (s == "ISO_IR 126" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
737 s == "ISO 2022 IR 126")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
738 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
739 encoding = Encoding_Greek;
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 else if (s == "ISO_IR 138" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
742 s == "ISO 2022 IR 138")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
743 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
744 encoding = Encoding_Hebrew;
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 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
747 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
748 encoding = Encoding_Thai;
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 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
751 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
752 encoding = Encoding_Japanese;
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 else if (s == "GB18030")
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 encoding = Encoding_Chinese;
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 /*
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
759 else if (s == "ISO 2022 IR 149")
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 TODO
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 else if (s == "ISO 2022 IR 159")
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 TODO
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 else if (s == "ISO 2022 IR 87")
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 TODO
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 */
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
772 else
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 return false;
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
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
777 // The encoding was properly detected
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
778 return true;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
779 }
1146
200fcac0deb4 optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1090
diff changeset
780
200fcac0deb4 optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1090
diff changeset
781
200fcac0deb4 optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1090
diff changeset
782 const char* GetMimeType(FileContentType type)
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 switch (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 case FileContentType_Dicom:
200fcac0deb4 optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1090
diff changeset
787 return "application/dicom";
200fcac0deb4 optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1090
diff changeset
788
200fcac0deb4 optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1090
diff changeset
789 case FileContentType_DicomAsJson:
200fcac0deb4 optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1090
diff changeset
790 return "application/json";
200fcac0deb4 optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1090
diff changeset
791
200fcac0deb4 optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1090
diff changeset
792 default:
200fcac0deb4 optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1090
diff changeset
793 return "application/octet-stream";
200fcac0deb4 optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1090
diff changeset
794 }
200fcac0deb4 optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1090
diff changeset
795 }
1548
e9325f3ac496 Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1495
diff changeset
796
e9325f3ac496 Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1495
diff changeset
797
e9325f3ac496 Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1495
diff changeset
798 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
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 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
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 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
803 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
804
e9325f3ac496 Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1495
diff changeset
805 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
806 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
807
e9325f3ac496 Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1495
diff changeset
808 default:
e9325f3ac496 Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1495
diff changeset
809 // 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
810 return "";
e9325f3ac496 Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1495
diff changeset
811 }
e9325f3ac496 Bypass zlib uncompression if "StorageCompression" is enabled and HTTP client supports deflate
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1495
diff changeset
812 }
1555
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
813
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
814
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
815 ResourceType GetChildResourceType(ResourceType type)
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 switch (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 case ResourceType_Patient:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
820 return ResourceType_Study;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
821
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
822 case ResourceType_Study:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
823 return ResourceType_Series;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
824
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
825 case ResourceType_Series:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
826 return ResourceType_Instance;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
827
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
828 default:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
829 throw OrthancException(ErrorCode_ParameterOutOfRange);
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
830 }
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
831 }
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 ResourceType GetParentResourceType(ResourceType type)
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 switch (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 case ResourceType_Study:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
839 return ResourceType_Patient;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
840
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
841 case ResourceType_Series:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
842 return ResourceType_Study;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
843
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
844 case ResourceType_Instance:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
845 return ResourceType_Series;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
846
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
847 default:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
848 throw OrthancException(ErrorCode_ParameterOutOfRange);
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
849 }
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
850 }
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 DicomModule GetModule(ResourceType type)
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 switch (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 case ResourceType_Patient:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
858 return DicomModule_Patient;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
859
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
860 case ResourceType_Study:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
861 return DicomModule_Study;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
862
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
863 case ResourceType_Series:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
864 return DicomModule_Series;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
865
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
866 default:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
867 throw OrthancException(ErrorCode_ParameterOutOfRange);
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
868 }
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
869 }
1565
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
870
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
871
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 const char* GetDicomSpecificCharacterSet(Encoding encoding)
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 // 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
876 switch (encoding)
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
877 {
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
878 case Encoding_Utf8:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
879 case Encoding_Ascii:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
880 return "ISO_IR 192";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
881
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
882 case Encoding_Latin1:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
883 return "ISO_IR 100";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
884
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
885 case Encoding_Latin2:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
886 return "ISO_IR 101";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
887
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
888 case Encoding_Latin3:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
889 return "ISO_IR 109";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
890
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
891 case Encoding_Latin4:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
892 return "ISO_IR 110";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
893
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
894 case Encoding_Latin5:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
895 return "ISO_IR 148";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
896
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
897 case Encoding_Cyrillic:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
898 return "ISO_IR 144";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
899
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
900 case Encoding_Arabic:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
901 return "ISO_IR 127";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
902
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
903 case Encoding_Greek:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
904 return "ISO_IR 126";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
905
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
906 case Encoding_Hebrew:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
907 return "ISO_IR 138";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
908
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
909 case Encoding_Japanese:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
910 return "ISO_IR 13";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
911
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
912 case Encoding_Chinese:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
913 return "GB18030";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
914
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
915 case Encoding_Thai:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
916 return "ISO_IR 166";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
917
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
918 default:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
919 throw OrthancException(ErrorCode_ParameterOutOfRange);
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
920 }
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
921 }
1576
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
922
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
923
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
924 HttpStatus ConvertErrorCodeToHttpStatus(ErrorCode error)
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
925 {
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
926 switch (error)
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
927 {
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
928 case ErrorCode_Success:
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
929 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
930
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
931 case ErrorCode_ParameterOutOfRange:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
932 return HttpStatus_400_BadRequest;
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
933
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
934 case ErrorCode_BadParameterType:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
935 return HttpStatus_400_BadRequest;
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
936
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
937 case ErrorCode_InexistentItem:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
938 return HttpStatus_404_NotFound;
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
939
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
940 case ErrorCode_BadRequest:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
941 return HttpStatus_400_BadRequest;
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
942
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
943 case ErrorCode_UriSyntax:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
944 return HttpStatus_400_BadRequest;
1576
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
945
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
946 case ErrorCode_InexistentFile:
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
947 return HttpStatus_404_NotFound;
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
948
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
949 case ErrorCode_BadFileFormat:
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
950 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
951
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
952 case ErrorCode_UnknownResource:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
953 return HttpStatus_404_NotFound;
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
954
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
955 case ErrorCode_InexistentTag:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
956 return HttpStatus_404_NotFound;
1576
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
957
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
958 default:
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
959 return HttpStatus_500_InternalServerError;
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
960 }
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
961 }
477
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
962 }