annotate Core/Enumerations.cpp @ 2368:5998f81bfbd1

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 22 Aug 2017 17:46:59 +0200
parents e002430baa41
children b8969010b534
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
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1823
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1206
diff changeset
4 * Department, University Hospital of Liege, Belgium
2244
a3a65de1840f shared copyright with osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
5 * Copyright (C) 2017 Osimis, Belgium
477
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
824
a811bdf8b8eb precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 800
diff changeset
34 #include "PrecompiledHeaders.h"
477
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include "Enumerations.h"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include "OrthancException.h"
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
38 #include "Toolbox.h"
2006
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
39 #include "Logging.h"
477
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
1495
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
41 #include <string.h>
1993
e2a3ff770b48 introducing float32 images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1980
diff changeset
42 #include <cassert>
1495
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
43
477
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 namespace Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 {
1578
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1577
diff changeset
46 // This function is autogenerated by the script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1577
diff changeset
47 // "Resources/GenerateErrorCodes.py"
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
48 const char* EnumerationToString(ErrorCode error)
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
49 {
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
50 switch (error)
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
51 {
1579
b93c398f934d check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1578
diff changeset
52 case ErrorCode_InternalError:
b93c398f934d check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1578
diff changeset
53 return "Internal error";
b93c398f934d check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1578
diff changeset
54
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
55 case ErrorCode_Success:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
56 return "Success";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
57
1579
b93c398f934d check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1578
diff changeset
58 case ErrorCode_Plugin:
b93c398f934d check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1578
diff changeset
59 return "Error encountered within the plugin engine";
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
60
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
61 case ErrorCode_NotImplemented:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
62 return "Not implemented yet";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
63
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
64 case ErrorCode_ParameterOutOfRange:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
65 return "Parameter out of range";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
66
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
67 case ErrorCode_NotEnoughMemory:
2133
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2132
diff changeset
68 return "The server hosting Orthanc is running out of memory";
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
69
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
70 case ErrorCode_BadParameterType:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
71 return "Bad type for a parameter";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
72
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
73 case ErrorCode_BadSequenceOfCalls:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
74 return "Bad sequence of calls";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
75
1577
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
76 case ErrorCode_InexistentItem:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
77 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
78
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
79 case ErrorCode_BadRequest:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
80 return "Bad request";
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
81
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
82 case ErrorCode_NetworkProtocol:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
83 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
84
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
85 case ErrorCode_SystemCommand:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
86 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
87
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
88 case ErrorCode_Database:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
89 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
90
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
91 case ErrorCode_UriSyntax:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
92 return "Badly formatted URI";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
93
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
94 case ErrorCode_InexistentFile:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
95 return "Inexistent file";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
96
1577
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
97 case ErrorCode_CannotWriteFile:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
98 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
99
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
100 case ErrorCode_BadFileFormat:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
101 return "Bad file format";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
102
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
103 case ErrorCode_Timeout:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
104 return "Timeout";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
105
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
106 case ErrorCode_UnknownResource:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
107 return "Unknown resource";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
108
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
109 case ErrorCode_IncompatibleDatabaseVersion:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
110 return "Incompatible version of the database";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
111
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
112 case ErrorCode_FullStorage:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
113 return "The file storage is full";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
114
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
115 case ErrorCode_CorruptedFile:
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
116 return "Corrupted file (e.g. inconsistent MD5 hash)";
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
117
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
118 case ErrorCode_InexistentTag:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
119 return "Inexistent tag";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
120
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
121 case ErrorCode_ReadOnly:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
122 return "Cannot modify a read-only data structure";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
123
1577
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
124 case ErrorCode_IncompatibleImageFormat:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
125 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
126
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
127 case ErrorCode_IncompatibleImageSize:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
128 return "Incompatible size of the images";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
129
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
130 case ErrorCode_SharedLibrary:
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
131 return "Error while using a shared library (plugin)";
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
132
1581
357c4bb15701 Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1579
diff changeset
133 case ErrorCode_UnknownPluginService:
357c4bb15701 Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1579
diff changeset
134 return "Plugin invoking an unknown service";
357c4bb15701 Plugins have access to explicit error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1579
diff changeset
135
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
136 case ErrorCode_UnknownDicomTag:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
137 return "Unknown DICOM tag";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
138
1596
f2e3d030ea59 BadJson error code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1583
diff changeset
139 case ErrorCode_BadJson:
f2e3d030ea59 BadJson error code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1583
diff changeset
140 return "Cannot parse a JSON document";
f2e3d030ea59 BadJson error code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1583
diff changeset
141
1606
31f4adefb88f issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
142 case ErrorCode_Unauthorized:
31f4adefb88f issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
143 return "Bad credentials were provided to an HTTP request";
31f4adefb88f issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
144
1610
2dff2bdffdb8 font support within Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1606
diff changeset
145 case ErrorCode_BadFont:
2dff2bdffdb8 font support within Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1606
diff changeset
146 return "Badly formatted font file";
2dff2bdffdb8 font support within Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1606
diff changeset
147
1643
87c77b9b3679 provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1630
diff changeset
148 case ErrorCode_DatabasePlugin:
87c77b9b3679 provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1630
diff changeset
149 return "The plugin implementing a custom database back-end does not fulfill the proper interface";
87c77b9b3679 provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1630
diff changeset
150
87c77b9b3679 provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1630
diff changeset
151 case ErrorCode_StorageAreaPlugin:
87c77b9b3679 provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1630
diff changeset
152 return "Error in the plugin implementing a custom storage area";
87c77b9b3679 provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1630
diff changeset
153
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
154 case ErrorCode_EmptyRequest:
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
155 return "The request is empty";
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
156
1781
5ad4e4d92ecb AcceptMediaDispatcher bootstrap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1773
diff changeset
157 case ErrorCode_NotAcceptable:
5ad4e4d92ecb AcceptMediaDispatcher bootstrap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1773
diff changeset
158 return "Cannot send a response which is acceptable according to the Accept HTTP header";
5ad4e4d92ecb AcceptMediaDispatcher bootstrap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1773
diff changeset
159
2132
a43708636890 ErrorCode_NotEnoughMemory and ErrorCode_NullPointer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2089
diff changeset
160 case ErrorCode_NullPointer:
a43708636890 ErrorCode_NotEnoughMemory and ErrorCode_NullPointer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2089
diff changeset
161 return "Cannot handle a NULL pointer";
a43708636890 ErrorCode_NotEnoughMemory and ErrorCode_NullPointer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2089
diff changeset
162
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
163 case ErrorCode_SQLiteNotOpened:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
164 return "SQLite: The database is not opened";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
165
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
166 case ErrorCode_SQLiteAlreadyOpened:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
167 return "SQLite: Connection is already open";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
168
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
169 case ErrorCode_SQLiteCannotOpen:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
170 return "SQLite: Unable to open the database";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
171
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
172 case ErrorCode_SQLiteStatementAlreadyUsed:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
173 return "SQLite: This cached statement is already being referred to";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
174
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
175 case ErrorCode_SQLiteExecute:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
176 return "SQLite: Cannot execute a command";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
177
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
178 case ErrorCode_SQLiteRollbackWithoutTransaction:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
179 return "SQLite: Rolling back a nonexistent transaction (have you called Begin()?)";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
180
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
181 case ErrorCode_SQLiteCommitWithoutTransaction:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
182 return "SQLite: Committing a nonexistent transaction";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
183
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
184 case ErrorCode_SQLiteRegisterFunction:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
185 return "SQLite: Unable to register a function";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
186
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
187 case ErrorCode_SQLiteFlush:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
188 return "SQLite: Unable to flush the database";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
189
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
190 case ErrorCode_SQLiteCannotRun:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
191 return "SQLite: Cannot run a cached statement";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
192
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
193 case ErrorCode_SQLiteCannotStep:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
194 return "SQLite: Cannot step over a cached statement";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
195
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
196 case ErrorCode_SQLiteBindOutOfRange:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
197 return "SQLite: Bing a value while out of range (serious error)";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
198
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
199 case ErrorCode_SQLitePrepareStatement:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
200 return "SQLite: Cannot prepare a cached statement";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
201
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
202 case ErrorCode_SQLiteTransactionAlreadyStarted:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
203 return "SQLite: Beginning the same transaction twice";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
204
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
205 case ErrorCode_SQLiteTransactionCommit:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
206 return "SQLite: Failure when committing the transaction";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
207
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
208 case ErrorCode_SQLiteTransactionBegin:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
209 return "SQLite: Cannot start a transaction";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
210
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
211 case ErrorCode_DirectoryOverFile:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
212 return "The directory to be created is already occupied by a regular file";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
213
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
214 case ErrorCode_FileStorageCannotWrite:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
215 return "Unable to create a subdirectory or a file in the file storage";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
216
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
217 case ErrorCode_DirectoryExpected:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
218 return "The specified path does not point to a directory";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
219
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
220 case ErrorCode_HttpPortInUse:
1949
d90f737f2dde warn about the use of privileged ports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1926
diff changeset
221 return "The TCP port of the HTTP server is privileged or already in use";
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
222
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
223 case ErrorCode_DicomPortInUse:
1949
d90f737f2dde warn about the use of privileged ports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1926
diff changeset
224 return "The TCP port of the DICOM server is privileged or already in use";
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
225
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
226 case ErrorCode_BadHttpStatusInRest:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
227 return "This HTTP status is not allowed in a REST API";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
228
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
229 case ErrorCode_RegularFileExpected:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
230 return "The specified path does not point to a regular file";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
231
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
232 case ErrorCode_PathToExecutable:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
233 return "Unable to get the path to the executable";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
234
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
235 case ErrorCode_MakeDirectory:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
236 return "Cannot create a directory";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
237
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
238 case ErrorCode_BadApplicationEntityTitle:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
239 return "An application entity title (AET) cannot be empty or be longer than 16 characters";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
240
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
241 case ErrorCode_NoCFindHandler:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
242 return "No request handler factory for DICOM C-FIND SCP";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
243
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
244 case ErrorCode_NoCMoveHandler:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
245 return "No request handler factory for DICOM C-MOVE SCP";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
246
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
247 case ErrorCode_NoCStoreHandler:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
248 return "No request handler factory for DICOM C-STORE SCP";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
249
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
250 case ErrorCode_NoApplicationEntityFilter:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
251 return "No application entity filter";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
252
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
253 case ErrorCode_NoSopClassOrInstance:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
254 return "DicomUserConnection: Unable to find the SOP class and instance";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
255
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
256 case ErrorCode_NoPresentationContext:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
257 return "DicomUserConnection: No acceptable presentation context for modality";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
258
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
259 case ErrorCode_DicomFindUnavailable:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
260 return "DicomUserConnection: The C-FIND command is not supported by the remote SCP";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
261
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
262 case ErrorCode_DicomMoveUnavailable:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
263 return "DicomUserConnection: The C-MOVE command is not supported by the remote SCP";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
264
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
265 case ErrorCode_CannotStoreInstance:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
266 return "Cannot store an instance";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
267
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
268 case ErrorCode_CreateDicomNotString:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
269 return "Only string values are supported when creating DICOM instances";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
270
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
271 case ErrorCode_CreateDicomOverrideTag:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
272 return "Trying to override a value inherited from a parent module";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
273
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
274 case ErrorCode_CreateDicomUseContent:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
275 return "Use \"Content\" to inject an image into a new DICOM instance";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
276
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
277 case ErrorCode_CreateDicomNoPayload:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
278 return "No payload is present for one instance in the series";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
279
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
280 case ErrorCode_CreateDicomUseDataUriScheme:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
281 return "The payload of the DICOM instance must be specified according to Data URI scheme";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
282
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
283 case ErrorCode_CreateDicomBadParent:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
284 return "Trying to attach a new DICOM instance to an inexistent resource";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
285
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
286 case ErrorCode_CreateDicomParentIsInstance:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
287 return "Trying to attach a new DICOM instance to an instance (must be a series, study or patient)";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
288
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
289 case ErrorCode_CreateDicomParentEncoding:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
290 return "Unable to get the encoding of the parent resource";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
291
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
292 case ErrorCode_UnknownModality:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
293 return "Unknown modality";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
294
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
295 case ErrorCode_BadJobOrdering:
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
296 return "Bad ordering of filters in a job";
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1581
diff changeset
297
1583
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
298 case ErrorCode_JsonToLuaTable:
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
299 return "Cannot convert the given JSON object to a Lua table";
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
300
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
301 case ErrorCode_CannotCreateLua:
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
302 return "Cannot create the Lua context";
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
303
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
304 case ErrorCode_CannotExecuteLua:
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
305 return "Cannot execute a Lua command";
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
306
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
307 case ErrorCode_LuaAlreadyExecuted:
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
308 return "Arguments cannot be pushed after the Lua function is executed";
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
309
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
310 case ErrorCode_LuaBadOutput:
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
311 return "The Lua function does not give the expected number of outputs";
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
312
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
313 case ErrorCode_NotLuaPredicate:
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
314 return "The Lua function is not a predicate (only true/false outputs allowed)";
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
315
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
316 case ErrorCode_LuaReturnsNoString:
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
317 return "The Lua function does not return a string";
9ea3d082b064 got rid of custom exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
318
1630
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1610
diff changeset
319 case ErrorCode_StorageAreaAlreadyRegistered:
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1610
diff changeset
320 return "Another plugin has already registered a custom storage area";
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1610
diff changeset
321
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1610
diff changeset
322 case ErrorCode_DatabaseBackendAlreadyRegistered:
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1610
diff changeset
323 return "Another plugin has already registered a custom database back-end";
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1610
diff changeset
324
1643
87c77b9b3679 provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1630
diff changeset
325 case ErrorCode_DatabaseNotInitialized:
87c77b9b3679 provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1630
diff changeset
326 return "Plugin trying to call the database during its initialization";
1630
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1610
diff changeset
327
1703
b80e76dd1d56 ordered-slices continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
328 case ErrorCode_SslDisabled:
b80e76dd1d56 ordered-slices continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
329 return "Orthanc has been built without SSL support";
b80e76dd1d56 ordered-slices continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
330
b80e76dd1d56 ordered-slices continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
331 case ErrorCode_CannotOrderSlices:
b80e76dd1d56 ordered-slices continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
332 return "Unable to order the slices of the series";
b80e76dd1d56 ordered-slices continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
333
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1781
diff changeset
334 case ErrorCode_NoWorklistHandler:
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1781
diff changeset
335 return "No request handler factory for DICOM C-Find Modality SCP";
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1781
diff changeset
336
1980
ebce5f456b8e new error code: ErrorCode_AlreadyExistingTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
337 case ErrorCode_AlreadyExistingTag:
ebce5f456b8e new error code: ErrorCode_AlreadyExistingTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
338 return "Cannot override the value of a tag that already exists";
ebce5f456b8e new error code: ErrorCode_AlreadyExistingTag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
339
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
340 default:
1703
b80e76dd1d56 ordered-slices continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
341 if (error >= ErrorCode_START_PLUGINS)
b80e76dd1d56 ordered-slices continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
342 {
b80e76dd1d56 ordered-slices continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
343 return "Error encountered within some plugin";
b80e76dd1d56 ordered-slices continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
344 }
b80e76dd1d56 ordered-slices continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
345 else
b80e76dd1d56 ordered-slices continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
346 {
b80e76dd1d56 ordered-slices continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
347 return "Unknown error code";
b80e76dd1d56 ordered-slices continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
348 }
1575
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
349 }
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
350 }
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
351
f8aae45011c9 exceptions now carry HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1572
diff changeset
352
477
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 const char* EnumerationToString(HttpMethod method)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 switch (method)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 case HttpMethod_Get:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 return "GET";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 case HttpMethod_Post:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361 return "POST";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 case HttpMethod_Delete:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 return "DELETE";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 case HttpMethod_Put:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 return "PUT";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 default:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370 return "?";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 const char* EnumerationToString(HttpStatus status)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 switch (status)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 case HttpStatus_100_Continue:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 return "Continue";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 case HttpStatus_101_SwitchingProtocols:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 return "Switching Protocols";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 case HttpStatus_102_Processing:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 return "Processing";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 case HttpStatus_200_Ok:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 return "OK";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 case HttpStatus_201_Created:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 return "Created";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 case HttpStatus_202_Accepted:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 return "Accepted";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 case HttpStatus_203_NonAuthoritativeInformation:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 return "Non-Authoritative Information";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 case HttpStatus_204_NoContent:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 return "No Content";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 case HttpStatus_205_ResetContent:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404 return "Reset Content";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 case HttpStatus_206_PartialContent:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407 return "Partial Content";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 case HttpStatus_207_MultiStatus:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 return "Multi-Status";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 case HttpStatus_208_AlreadyReported:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413 return "Already Reported";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 case HttpStatus_226_IMUsed:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 return "IM Used";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 case HttpStatus_300_MultipleChoices:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 return "Multiple Choices";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 case HttpStatus_301_MovedPermanently:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 return "Moved Permanently";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424 case HttpStatus_302_Found:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425 return "Found";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 case HttpStatus_303_SeeOther:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428 return "See Other";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430 case HttpStatus_304_NotModified:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431 return "Not Modified";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 case HttpStatus_305_UseProxy:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 return "Use Proxy";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436 case HttpStatus_307_TemporaryRedirect:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 return "Temporary Redirect";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439 case HttpStatus_400_BadRequest:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440 return "Bad Request";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 case HttpStatus_401_Unauthorized:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443 return "Unauthorized";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445 case HttpStatus_402_PaymentRequired:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446 return "Payment Required";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 case HttpStatus_403_Forbidden:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449 return "Forbidden";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
450
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
451 case HttpStatus_404_NotFound:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
452 return "Not Found";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 case HttpStatus_405_MethodNotAllowed:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455 return "Method Not Allowed";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 case HttpStatus_406_NotAcceptable:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 return "Not Acceptable";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460 case HttpStatus_407_ProxyAuthenticationRequired:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461 return "Proxy Authentication Required";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463 case HttpStatus_408_RequestTimeout:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464 return "Request Timeout";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466 case HttpStatus_409_Conflict:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467 return "Conflict";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469 case HttpStatus_410_Gone:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
470 return "Gone";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
471
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472 case HttpStatus_411_LengthRequired:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
473 return "Length Required";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
474
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
475 case HttpStatus_412_PreconditionFailed:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476 return "Precondition Failed";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 case HttpStatus_413_RequestEntityTooLarge:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
479 return "Request Entity Too Large";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
480
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
481 case HttpStatus_414_RequestUriTooLong:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482 return "Request-URI Too Long";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
483
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 case HttpStatus_415_UnsupportedMediaType:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
485 return "Unsupported Media Type";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487 case HttpStatus_416_RequestedRangeNotSatisfiable:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488 return "Requested Range Not Satisfiable";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
490 case HttpStatus_417_ExpectationFailed:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
491 return "Expectation Failed";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
492
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493 case HttpStatus_422_UnprocessableEntity:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
494 return "Unprocessable Entity";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
495
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
496 case HttpStatus_423_Locked:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
497 return "Locked";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
498
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499 case HttpStatus_424_FailedDependency:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
500 return "Failed Dependency";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
501
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502 case HttpStatus_426_UpgradeRequired:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
503 return "Upgrade Required";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
504
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
505 case HttpStatus_500_InternalServerError:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
506 return "Internal Server Error";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
507
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
508 case HttpStatus_501_NotImplemented:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
509 return "Not Implemented";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
510
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
511 case HttpStatus_502_BadGateway:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
512 return "Bad Gateway";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
513
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514 case HttpStatus_503_ServiceUnavailable:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
515 return "Service Unavailable";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
517 case HttpStatus_504_GatewayTimeout:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
518 return "Gateway Timeout";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
519
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
520 case HttpStatus_505_HttpVersionNotSupported:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
521 return "HTTP Version Not Supported";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
522
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
523 case HttpStatus_506_VariantAlsoNegotiates:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
524 return "Variant Also Negotiates";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
525
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
526 case HttpStatus_507_InsufficientStorage:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527 return "Insufficient Storage";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
528
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
529 case HttpStatus_509_BandwidthLimitExceeded:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
530 return "Bandwidth Limit Exceeded";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
531
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
532 case HttpStatus_510_NotExtended:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
533 return "Not Extended";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
534
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
535 default:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
536 throw OrthancException(ErrorCode_ParameterOutOfRange);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
537 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
538 }
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
539
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
540
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
541 const char* EnumerationToString(ResourceType type)
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
542 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
543 switch (type)
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
544 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
545 case ResourceType_Patient:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
546 return "Patient";
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
547
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
548 case ResourceType_Study:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
549 return "Study";
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
550
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
551 case ResourceType_Series:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
552 return "Series";
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
553
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
554 case ResourceType_Instance:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
555 return "Instance";
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
556
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
557 default:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
558 throw OrthancException(ErrorCode_ParameterOutOfRange);
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
559 }
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
560 }
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
561
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
562
800
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
563 const char* EnumerationToString(ImageFormat format)
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
564 {
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
565 switch (format)
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
566 {
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
567 case ImageFormat_Png:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
568 return "Png";
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
569
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
570 default:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
571 throw OrthancException(ErrorCode_ParameterOutOfRange);
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
572 }
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
573 }
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
574
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
575
1086
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
576 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
577 {
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
578 switch (encoding)
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
579 {
1087
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
580 case Encoding_Ascii:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
581 return "Ascii";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
582
1086
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
583 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
584 return "Utf8";
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
585
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
586 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
587 return "Latin1";
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
588
1087
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
589 case Encoding_Latin2:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
590 return "Latin2";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
591
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
592 case Encoding_Latin3:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
593 return "Latin3";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
594
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
595 case Encoding_Latin4:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
596 return "Latin4";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
597
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
598 case Encoding_Latin5:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
599 return "Latin5";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
600
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
601 case Encoding_Cyrillic:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
602 return "Cyrillic";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
603
1347
60cc0ee61edb fix issue 32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
604 case Encoding_Windows1251:
60cc0ee61edb fix issue 32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
605 return "Windows1251";
60cc0ee61edb fix issue 32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
606
1087
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
607 case Encoding_Arabic:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
608 return "Arabic";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
609
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
610 case Encoding_Greek:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
611 return "Greek";
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
612
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
613 case Encoding_Hebrew:
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
614 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
615
1090
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
616 case Encoding_Thai:
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
617 return "Thai";
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
618
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
619 case Encoding_Japanese:
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
620 return "Japanese";
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
621
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
622 case Encoding_Chinese:
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
623 return "Chinese";
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
624
1086
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
625 default:
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
626 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
627 }
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
628 }
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
629
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
630
1206
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
631 const char* EnumerationToString(PhotometricInterpretation photometric)
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
632 {
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
633 switch (photometric)
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
634 {
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
635 case PhotometricInterpretation_RGB:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
636 return "RGB";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
637
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
638 case PhotometricInterpretation_Monochrome1:
2281
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
639 return "MONOCHROME1";
1206
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
640
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
641 case PhotometricInterpretation_Monochrome2:
2281
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
642 return "MONOCHROME2";
1206
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
643
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
644 case PhotometricInterpretation_ARGB:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
645 return "ARGB";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
646
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
647 case PhotometricInterpretation_CMYK:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
648 return "CMYK";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
649
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
650 case PhotometricInterpretation_HSV:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
651 return "HSV";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
652
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
653 case PhotometricInterpretation_Palette:
2281
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
654 return "PALETTE COLOR";
1206
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
655
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
656 case PhotometricInterpretation_YBRFull:
2281
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
657 return "YBR_FULL";
1206
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
658
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
659 case PhotometricInterpretation_YBRFull422:
2281
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
660 return "YBR_FULL_422";
1206
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
661
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
662 case PhotometricInterpretation_YBRPartial420:
2281
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
663 return "YBR_PARTIAL_420";
1206
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
664
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
665 case PhotometricInterpretation_YBRPartial422:
2281
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
666 return "YBR_PARTIAL_422";
1206
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
667
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
668 case PhotometricInterpretation_YBR_ICT:
2281
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
669 return "YBR_ICT";
1206
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
670
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
671 case PhotometricInterpretation_YBR_RCT:
2281
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
672 return "YBR_RCT";
1206
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
673
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
674 case PhotometricInterpretation_Unknown:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
675 return "Unknown";
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
676
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
677 default:
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
678 throw OrthancException(ErrorCode_ParameterOutOfRange);
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
679 }
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
680 }
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
681
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1146
diff changeset
682
1571
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
683 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
684 {
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
685 switch (origin)
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
686 {
1572
904096e7367e More information about the origin request in OnStoredInstance() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1571
diff changeset
687 case RequestOrigin_Unknown:
904096e7367e More information about the origin request in OnStoredInstance() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1571
diff changeset
688 return "Unknown";
904096e7367e More information about the origin request in OnStoredInstance() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1571
diff changeset
689
1571
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
690 case RequestOrigin_DicomProtocol:
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
691 return "DicomProtocol";
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
692
1823
0ef4e6e66b56 "Origin" metadata for the instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
693 case RequestOrigin_RestApi:
0ef4e6e66b56 "Origin" metadata for the instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
694 return "RestApi";
1571
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
695
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
696 case RequestOrigin_Plugins:
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
697 return "Plugins";
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
698
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
699 case RequestOrigin_Lua:
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
700 return "Lua";
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
701
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
702 default:
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
703 throw OrthancException(ErrorCode_ParameterOutOfRange);
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
704 }
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
705 }
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
706
3232f1c995a5 provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1565
diff changeset
707
1495
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
708 const char* EnumerationToString(LogLevel level)
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
709 {
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
710 switch (level)
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
711 {
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
712 case LogLevel_Error:
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
713 return "ERROR";
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
714
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
715 case LogLevel_Warning:
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
716 return "WARNING";
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
717
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
718 case LogLevel_Info:
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
719 return "INFO";
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
720
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
721 case LogLevel_Trace:
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
722 return "TRACE";
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
723
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
724 default:
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
725 throw OrthancException(ErrorCode_ParameterOutOfRange);
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
726 }
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
727 }
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
728
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
729
1926
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
730 const char* EnumerationToString(PixelFormat format)
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
731 {
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
732 switch (format)
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
733 {
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
734 case PixelFormat_RGB24:
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
735 return "RGB24";
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
736
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
737 case PixelFormat_RGBA32:
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
738 return "RGBA32";
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
739
2089
7a969f235adf PixelFormat_BGRA32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
740 case PixelFormat_BGRA32:
7a969f235adf PixelFormat_BGRA32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
741 return "BGRA32";
7a969f235adf PixelFormat_BGRA32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
742
1926
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
743 case PixelFormat_Grayscale8:
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
744 return "Grayscale (unsigned 8bpp)";
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
745
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
746 case PixelFormat_Grayscale16:
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
747 return "Grayscale (unsigned 16bpp)";
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
748
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
749 case PixelFormat_SignedGrayscale16:
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
750 return "Grayscale (signed 16bpp)";
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
751
1993
e2a3ff770b48 introducing float32 images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1980
diff changeset
752 case PixelFormat_Float32:
e2a3ff770b48 introducing float32 images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1980
diff changeset
753 return "Grayscale (float 32bpp)";
e2a3ff770b48 introducing float32 images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1980
diff changeset
754
1926
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
755 default:
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
756 throw OrthancException(ErrorCode_ParameterOutOfRange);
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
757 }
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
758 }
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
759
2a129de4b5e2 EnumerationToString for PixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1908
diff changeset
760
1086
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
761 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
762 {
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
763 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
764 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
765
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
766 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
767 {
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
768 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
769 }
1087
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
770
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
771 if (s == "ASCII")
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
772 {
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
773 return Encoding_Ascii;
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
774 }
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
775
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
776 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
777 {
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
778 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
779 }
1087
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
780
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
781 if (s == "LATIN2")
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
782 {
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
783 return Encoding_Latin2;
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
784 }
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
785
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
786 if (s == "LATIN3")
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
787 {
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
788 return Encoding_Latin3;
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
789 }
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
790
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
791 if (s == "LATIN4")
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
792 {
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
793 return Encoding_Latin4;
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
794 }
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
795
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
796 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
797 {
1087
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
798 return Encoding_Latin5;
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
799 }
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
800
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
801 if (s == "CYRILLIC")
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
802 {
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
803 return Encoding_Cyrillic;
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
804 }
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
805
1347
60cc0ee61edb fix issue 32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
806 if (s == "WINDOWS1251")
60cc0ee61edb fix issue 32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
807 {
60cc0ee61edb fix issue 32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
808 return Encoding_Windows1251;
60cc0ee61edb fix issue 32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
809 }
60cc0ee61edb fix issue 32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
810
1087
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
811 if (s == "ARABIC")
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
812 {
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
813 return Encoding_Arabic;
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
814 }
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
815
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
816 if (s == "GREEK")
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
817 {
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
818 return Encoding_Greek;
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
819 }
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
820
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
821 if (s == "HEBREW")
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
822 {
e07b90fb00eb more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1086
diff changeset
823 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
824 }
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
825
1090
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
826 if (s == "THAI")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
827 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
828 return Encoding_Thai;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
829 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
830
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
831 if (s == "JAPANESE")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
832 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
833 return Encoding_Japanese;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
834 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
835
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
836 if (s == "CHINESE")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
837 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
838 return Encoding_Chinese;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
839 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
840
1086
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
841 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
842 }
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
843
e56c3ed8d738 Parameter to set the default encoding for DICOM files without SpecificCharacterSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
844
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
845 ResourceType StringToResourceType(const char* type)
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
846 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
847 std::string s(type);
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
848 Toolbox::ToUpperCase(s);
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
849
697
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
850 if (s == "PATIENT" || s == "PATIENTS")
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
851 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
852 return ResourceType_Patient;
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
853 }
697
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
854 else if (s == "STUDY" || s == "STUDIES")
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
855 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
856 return ResourceType_Study;
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
857 }
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
858 else if (s == "SERIES")
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
859 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
860 return ResourceType_Series;
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
861 }
697
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
862 else if (s == "INSTANCE" || s == "IMAGE" ||
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
863 s == "INSTANCES" || s == "IMAGES")
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
864 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
865 return ResourceType_Instance;
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
866 }
800
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
867
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
868 throw OrthancException(ErrorCode_ParameterOutOfRange);
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
869 }
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
870
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
871
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
872 ImageFormat StringToImageFormat(const char* format)
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
873 {
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
874 std::string s(format);
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
875 Toolbox::ToUpperCase(s);
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
876
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
877 if (s == "PNG")
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
878 {
800
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
879 return ImageFormat_Png;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
880 }
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
881
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
882 throw OrthancException(ErrorCode_ParameterOutOfRange);
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
883 }
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
884
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
885
1495
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
886 LogLevel StringToLogLevel(const char *level)
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
887 {
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
888 if (strcmp(level, "ERROR") == 0)
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
889 {
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
890 return LogLevel_Error;
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
891 }
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
892 else if (strcmp(level, "WARNING") == 0)
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
893 {
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
894 return LogLevel_Warning;
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
895 }
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
896 else if (strcmp(level, "INFO") == 0)
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
897 {
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
898 return LogLevel_Info;
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
899 }
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
900 else if (strcmp(level, "TRACE") == 0)
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
901 {
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
902 return LogLevel_Trace;
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
903 }
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
904 else
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
905 {
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
906 throw OrthancException(ErrorCode_InternalError);
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
907 }
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
908 }
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
909
fbe40117eb21 improve the performance of the internal logger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1347
diff changeset
910
2006
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
911 ValueRepresentation StringToValueRepresentation(const std::string& vr,
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
912 bool throwIfUnsupported)
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
913 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
914 if (vr == "AE")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
915 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
916 return ValueRepresentation_ApplicationEntity;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
917 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
918 else if (vr == "AS")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
919 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
920 return ValueRepresentation_AgeString;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
921 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
922 else if (vr == "AT")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
923 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
924 return ValueRepresentation_AttributeTag;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
925 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
926 else if (vr == "CS")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
927 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
928 return ValueRepresentation_CodeString;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
929 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
930 else if (vr == "DA")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
931 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
932 return ValueRepresentation_Date;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
933 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
934 else if (vr == "DS")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
935 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
936 return ValueRepresentation_DecimalString;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
937 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
938 else if (vr == "DT")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
939 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
940 return ValueRepresentation_DateTime;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
941 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
942 else if (vr == "FL")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
943 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
944 return ValueRepresentation_FloatingPointSingle;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
945 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
946 else if (vr == "FD")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
947 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
948 return ValueRepresentation_FloatingPointDouble;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
949 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
950 else if (vr == "IS")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
951 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
952 return ValueRepresentation_IntegerString;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
953 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
954 else if (vr == "LO")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
955 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
956 return ValueRepresentation_LongString;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
957 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
958 else if (vr == "LT")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
959 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
960 return ValueRepresentation_LongText;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
961 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
962 else if (vr == "OB")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
963 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
964 return ValueRepresentation_OtherByte;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
965 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
966 else if (vr == "OD")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
967 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
968 return ValueRepresentation_OtherDouble;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
969 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
970 else if (vr == "OF")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
971 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
972 return ValueRepresentation_OtherFloat;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
973 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
974 else if (vr == "OL")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
975 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
976 return ValueRepresentation_OtherLong;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
977 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
978 else if (vr == "OW")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
979 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
980 return ValueRepresentation_OtherWord;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
981 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
982 else if (vr == "PN")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
983 {
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
984 return ValueRepresentation_PersonName;
2006
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
985 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
986 else if (vr == "SH")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
987 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
988 return ValueRepresentation_ShortString;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
989 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
990 else if (vr == "SL")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
991 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
992 return ValueRepresentation_SignedLong;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
993 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
994 else if (vr == "SQ")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
995 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
996 return ValueRepresentation_Sequence;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
997 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
998 else if (vr == "SS")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
999 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1000 return ValueRepresentation_SignedShort;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1001 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1002 else if (vr == "ST")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1003 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1004 return ValueRepresentation_ShortText;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1005 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1006 else if (vr == "TM")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1007 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1008 return ValueRepresentation_Time;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1009 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1010 else if (vr == "UC")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1011 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1012 return ValueRepresentation_UnlimitedCharacters;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1013 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1014 else if (vr == "UI")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1015 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1016 return ValueRepresentation_UniqueIdentifier;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1017 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1018 else if (vr == "UL")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1019 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1020 return ValueRepresentation_UnsignedLong;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1021 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1022 else if (vr == "UN")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1023 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1024 return ValueRepresentation_Unknown;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1025 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1026 else if (vr == "UR")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1027 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1028 return ValueRepresentation_UniversalResource;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1029 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1030 else if (vr == "US")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1031 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1032 return ValueRepresentation_UnsignedShort;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1033 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1034 else if (vr == "UT")
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1035 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1036 return ValueRepresentation_UnlimitedText;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1037 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1038 else
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1039 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1040 std::string s = "Unsupported value representation encountered: " + vr;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1041
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1042 if (throwIfUnsupported)
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1043 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1044 LOG(ERROR) << s;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1045 throw OrthancException(ErrorCode_ParameterOutOfRange);
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1046 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1047 else
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1048 {
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1049 LOG(INFO) << s;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1050 return ValueRepresentation_NotSupported;
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1051 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1052 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1053 }
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1054
6301bbcbcaed more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1055
2281
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1056 PhotometricInterpretation StringToPhotometricInterpretation(const char* value)
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1057 {
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1058 // http://dicom.nema.org/medical/dicom/2017a/output/chtml/part03/sect_C.7.6.3.html#sect_C.7.6.3.1.2
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1059 std::string s(value);
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1060
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1061 if (s == "MONOCHROME1")
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1062 {
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1063 return PhotometricInterpretation_Monochrome1;
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1064 }
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1065
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1066 if (s == "MONOCHROME2")
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1067 {
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1068 return PhotometricInterpretation_Monochrome2;
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1069 }
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1070
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1071 if (s == "PALETTE COLOR")
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1072 {
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1073 return PhotometricInterpretation_Palette;
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1074 }
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1075
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1076 if (s == "RGB")
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1077 {
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1078 return PhotometricInterpretation_RGB;
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1079 }
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1080
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1081 if (s == "HSV")
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1082 {
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1083 return PhotometricInterpretation_HSV;
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1084 }
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1085
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1086 if (s == "ARGB")
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1087 {
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1088 return PhotometricInterpretation_ARGB;
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1089 }
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1090
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1091 if (s == "CMYK")
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1092 {
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1093 return PhotometricInterpretation_CMYK;
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1094 }
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1095
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1096 if (s == "YBR_FULL")
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1097 {
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1098 return PhotometricInterpretation_YBRFull;
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1099 }
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1100
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1101 if (s == "YBR_FULL_422")
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1102 {
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1103 return PhotometricInterpretation_YBRFull422;
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1104 }
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1105
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1106 if (s == "YBR_PARTIAL_422")
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1107 {
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1108 return PhotometricInterpretation_YBRPartial422;
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1109 }
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1110
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1111 if (s == "YBR_PARTIAL_420")
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1112 {
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1113 return PhotometricInterpretation_YBRPartial420;
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1114 }
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1115
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1116 if (s == "YBR_ICT")
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1117 {
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1118 return PhotometricInterpretation_YBR_ICT;
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1119 }
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1120
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1121 if (s == "YBR_RCT")
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1122 {
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1123 return PhotometricInterpretation_YBR_RCT;
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1124 }
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1125
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1126 throw OrthancException(ErrorCode_ParameterOutOfRange);
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1127 }
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1128
e002430baa41 Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1129
800
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1130 unsigned int GetBytesPerPixel(PixelFormat format)
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1131 {
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1132 switch (format)
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1133 {
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1134 case PixelFormat_Grayscale8:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1135 return 1;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1136
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1137 case PixelFormat_Grayscale16:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1138 case PixelFormat_SignedGrayscale16:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1139 return 2;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1140
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1141 case PixelFormat_RGB24:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1142 return 3;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1143
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1144 case PixelFormat_RGBA32:
2089
7a969f235adf PixelFormat_BGRA32
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1145 case PixelFormat_BGRA32:
800
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1146 return 4;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1147
1993
e2a3ff770b48 introducing float32 images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1980
diff changeset
1148 case PixelFormat_Float32:
e2a3ff770b48 introducing float32 images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1980
diff changeset
1149 assert(sizeof(float) == 4);
e2a3ff770b48 introducing float32 images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1980
diff changeset
1150 return 4;
e2a3ff770b48 introducing float32 images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1980
diff changeset
1151
800
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1152 default:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
1153 throw OrthancException(ErrorCode_ParameterOutOfRange);
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
1154 }
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
1155 }
1090
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1156
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1157
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1158 bool GetDicomEncoding(Encoding& encoding,
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1159 const char* specificCharacterSet)
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1160 {
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2133
diff changeset
1161 std::string s = Toolbox::StripSpaces(specificCharacterSet);
1090
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1162 Toolbox::ToUpperCase(s);
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1163
1908
5096681efce6 direct hyperlinks to the DICOM standard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1164 // http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.12.1.1.2
1090
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1165 // 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
1166 if (s == "ISO_IR 6" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1167 s == "ISO 2022 IR 6")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1168 {
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2133
diff changeset
1169 encoding = Encoding_Ascii;
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2133
diff changeset
1170 }
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2133
diff changeset
1171 else if (s == "ISO_IR 192")
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2133
diff changeset
1172 {
1090
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1173 encoding = Encoding_Utf8;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1174 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1175 else if (s == "ISO_IR 100" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1176 s == "ISO 2022 IR 100")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1177 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1178 encoding = Encoding_Latin1;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1179 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1180 else if (s == "ISO_IR 101" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1181 s == "ISO 2022 IR 101")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1182 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1183 encoding = Encoding_Latin2;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1184 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1185 else if (s == "ISO_IR 109" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1186 s == "ISO 2022 IR 109")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1187 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1188 encoding = Encoding_Latin3;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1189 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1190 else if (s == "ISO_IR 110" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1191 s == "ISO 2022 IR 110")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1192 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1193 encoding = Encoding_Latin4;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1194 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1195 else if (s == "ISO_IR 148" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1196 s == "ISO 2022 IR 148")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1197 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1198 encoding = Encoding_Latin5;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1199 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1200 else if (s == "ISO_IR 144" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1201 s == "ISO 2022 IR 144")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1202 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1203 encoding = Encoding_Cyrillic;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1204 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1205 else if (s == "ISO_IR 127" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1206 s == "ISO 2022 IR 127")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1207 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1208 encoding = Encoding_Arabic;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1209 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1210 else if (s == "ISO_IR 126" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1211 s == "ISO 2022 IR 126")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1212 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1213 encoding = Encoding_Greek;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1214 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1215 else if (s == "ISO_IR 138" ||
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1216 s == "ISO 2022 IR 138")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1217 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1218 encoding = Encoding_Hebrew;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1219 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1220 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
1221 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1222 encoding = Encoding_Thai;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1223 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1224 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
1225 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1226 encoding = Encoding_Japanese;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1227 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1228 else if (s == "GB18030")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1229 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1230 encoding = Encoding_Chinese;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1231 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1232 /*
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1233 else if (s == "ISO 2022 IR 149")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1234 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1235 TODO
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1236 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1237 else if (s == "ISO 2022 IR 159")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1238 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1239 TODO
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1240 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1241 else if (s == "ISO 2022 IR 87")
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1242 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1243 TODO
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1244 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1245 */
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1246 else
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1247 {
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1248 return false;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1249 }
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1250
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1251 // The encoding was properly detected
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1252 return true;
e494ceb8d763 support more encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1087
diff changeset
1253 }
1146
200fcac0deb4 optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1090
diff changeset
1254
200fcac0deb4 optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1090
diff changeset
1255
1555
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1256 ResourceType GetChildResourceType(ResourceType type)
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1257 {
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1258 switch (type)
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1259 {
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1260 case ResourceType_Patient:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1261 return ResourceType_Study;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1262
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1263 case ResourceType_Study:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1264 return ResourceType_Series;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1265
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1266 case ResourceType_Series:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1267 return ResourceType_Instance;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1268
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1269 default:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1270 throw OrthancException(ErrorCode_ParameterOutOfRange);
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1271 }
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1272 }
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1273
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1274
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1275 ResourceType GetParentResourceType(ResourceType type)
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1276 {
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1277 switch (type)
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1278 {
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1279 case ResourceType_Study:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1280 return ResourceType_Patient;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1281
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1282 case ResourceType_Series:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1283 return ResourceType_Study;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1284
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1285 case ResourceType_Instance:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1286 return ResourceType_Series;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1287
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1288 default:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1289 throw OrthancException(ErrorCode_ParameterOutOfRange);
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1290 }
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1291 }
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1292
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1293
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1294 DicomModule GetModule(ResourceType type)
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1295 {
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1296 switch (type)
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1297 {
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1298 case ResourceType_Patient:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1299 return DicomModule_Patient;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1300
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1301 case ResourceType_Study:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1302 return DicomModule_Study;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1303
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1304 case ResourceType_Series:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1305 return DicomModule_Series;
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1306
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1307 default:
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1308 throw OrthancException(ErrorCode_ParameterOutOfRange);
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1309 }
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1548
diff changeset
1310 }
1565
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1311
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1312
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1313
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1314 const char* GetDicomSpecificCharacterSet(Encoding encoding)
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1315 {
1908
5096681efce6 direct hyperlinks to the DICOM standard
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1316 // http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.12.1.1.2
1565
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1317 switch (encoding)
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1318 {
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2133
diff changeset
1319 case Encoding_Ascii:
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2133
diff changeset
1320 return "ISO_IR 6";
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2133
diff changeset
1321
1565
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1322 case Encoding_Utf8:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1323 return "ISO_IR 192";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1324
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1325 case Encoding_Latin1:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1326 return "ISO_IR 100";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1327
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1328 case Encoding_Latin2:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1329 return "ISO_IR 101";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1330
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1331 case Encoding_Latin3:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1332 return "ISO_IR 109";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1333
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1334 case Encoding_Latin4:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1335 return "ISO_IR 110";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1336
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1337 case Encoding_Latin5:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1338 return "ISO_IR 148";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1339
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1340 case Encoding_Cyrillic:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1341 return "ISO_IR 144";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1342
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1343 case Encoding_Arabic:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1344 return "ISO_IR 127";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1345
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1346 case Encoding_Greek:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1347 return "ISO_IR 126";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1348
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1349 case Encoding_Hebrew:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1350 return "ISO_IR 138";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1351
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1352 case Encoding_Japanese:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1353 return "ISO_IR 13";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1354
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1355 case Encoding_Chinese:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1356 return "GB18030";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1357
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1358 case Encoding_Thai:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1359 return "ISO_IR 166";
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1360
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1361 default:
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1362 throw OrthancException(ErrorCode_ParameterOutOfRange);
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1363 }
4b23310eb7e8 add tags per instances in a series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
1364 }
1576
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1365
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1366
1578
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1577
diff changeset
1367 // This function is autogenerated by the script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1577
diff changeset
1368 // "Resources/GenerateErrorCodes.py"
1576
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1369 HttpStatus ConvertErrorCodeToHttpStatus(ErrorCode error)
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1370 {
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1371 switch (error)
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1372 {
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1373 case ErrorCode_Success:
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1374 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
1375
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1376 case ErrorCode_ParameterOutOfRange:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1377 return HttpStatus_400_BadRequest;
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1378
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1379 case ErrorCode_BadParameterType:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1380 return HttpStatus_400_BadRequest;
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1381
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1382 case ErrorCode_InexistentItem:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1383 return HttpStatus_404_NotFound;
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1384
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1385 case ErrorCode_BadRequest:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1386 return HttpStatus_400_BadRequest;
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1387
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1388 case ErrorCode_UriSyntax:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1389 return HttpStatus_400_BadRequest;
1576
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1390
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1391 case ErrorCode_InexistentFile:
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1392 return HttpStatus_404_NotFound;
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1393
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1394 case ErrorCode_BadFileFormat:
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1395 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
1396
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1397 case ErrorCode_UnknownResource:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1398 return HttpStatus_404_NotFound;
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1399
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1400 case ErrorCode_InexistentTag:
7aac0cddd42e generation of the error codes from a Python script
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
1401 return HttpStatus_404_NotFound;
1576
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1402
1596
f2e3d030ea59 BadJson error code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1583
diff changeset
1403 case ErrorCode_BadJson:
f2e3d030ea59 BadJson error code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1583
diff changeset
1404 return HttpStatus_400_BadRequest;
f2e3d030ea59 BadJson error code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1583
diff changeset
1405
1606
31f4adefb88f issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1406 case ErrorCode_Unauthorized:
31f4adefb88f issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1407 return HttpStatus_401_Unauthorized;
31f4adefb88f issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1408
1781
5ad4e4d92ecb AcceptMediaDispatcher bootstrap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1773
diff changeset
1409 case ErrorCode_NotAcceptable:
5ad4e4d92ecb AcceptMediaDispatcher bootstrap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1773
diff changeset
1410 return HttpStatus_406_NotAcceptable;
5ad4e4d92ecb AcceptMediaDispatcher bootstrap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1773
diff changeset
1411
1576
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1412 default:
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1413 return HttpStatus_500_InternalServerError;
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1414 }
de54c19fc44d refactoring OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1575
diff changeset
1415 }
1773
613df4362575 New UpdatedAttachment and UpdatedMetadata events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1772
diff changeset
1416
613df4362575 New UpdatedAttachment and UpdatedMetadata events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1772
diff changeset
1417
613df4362575 New UpdatedAttachment and UpdatedMetadata events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1772
diff changeset
1418 bool IsUserContentType(FileContentType type)
613df4362575 New UpdatedAttachment and UpdatedMetadata events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1772
diff changeset
1419 {
613df4362575 New UpdatedAttachment and UpdatedMetadata events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1772
diff changeset
1420 return (type >= FileContentType_StartUser &&
613df4362575 New UpdatedAttachment and UpdatedMetadata events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1772
diff changeset
1421 type <= FileContentType_EndUser);
613df4362575 New UpdatedAttachment and UpdatedMetadata events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1772
diff changeset
1422 }
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1423
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1424
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1425 bool IsBinaryValueRepresentation(ValueRepresentation vr)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1426 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1427 // http://dicom.nema.org/medical/dicom/current/output/chtml/part05/sect_6.2.html
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1428
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1429 switch (vr)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1430 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1431 case ValueRepresentation_ApplicationEntity: // AE
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1432 case ValueRepresentation_AgeString: // AS
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1433 case ValueRepresentation_CodeString: // CS
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1434 case ValueRepresentation_Date: // DA
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1435 case ValueRepresentation_DecimalString: // DS
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1436 case ValueRepresentation_DateTime: // DT
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1437 case ValueRepresentation_IntegerString: // IS
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1438 case ValueRepresentation_LongString: // LO
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1439 case ValueRepresentation_LongText: // LT
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1440 case ValueRepresentation_PersonName: // PN
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1441 case ValueRepresentation_ShortString: // SH
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1442 case ValueRepresentation_ShortText: // ST
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1443 case ValueRepresentation_Time: // TM
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1444 case ValueRepresentation_UnlimitedCharacters: // UC
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1445 case ValueRepresentation_UniqueIdentifier: // UI (UID)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1446 case ValueRepresentation_UniversalResource: // UR (URI or URL)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1447 case ValueRepresentation_UnlimitedText: // UT
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1448 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1449 return false;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1450 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1451
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1452 /**
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1453 * Below are all the VR whose character repertoire is tagged as
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1454 * "not applicable"
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1455 **/
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1456 case ValueRepresentation_AttributeTag: // AT (2 x uint16_t)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1457 case ValueRepresentation_FloatingPointSingle: // FL (float)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1458 case ValueRepresentation_FloatingPointDouble: // FD (double)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1459 case ValueRepresentation_OtherByte: // OB
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1460 case ValueRepresentation_OtherDouble: // OD
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1461 case ValueRepresentation_OtherFloat: // OF
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1462 case ValueRepresentation_OtherLong: // OL
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1463 case ValueRepresentation_OtherWord: // OW
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1464 case ValueRepresentation_SignedLong: // SL (int32_t)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1465 case ValueRepresentation_Sequence: // SQ
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1466 case ValueRepresentation_SignedShort: // SS (int16_t)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1467 case ValueRepresentation_UnsignedLong: // UL (uint32_t)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1468 case ValueRepresentation_Unknown: // UN
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1469 case ValueRepresentation_UnsignedShort: // US (uint16_t)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1470 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1471 return true;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1472 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1473
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1474 case ValueRepresentation_NotSupported:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1475 default:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1476 throw OrthancException(ErrorCode_ParameterOutOfRange);
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1477 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1478 }
477
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1479 }