comparison Plugins/Engine/PluginsEnumerations.cpp @ 1625:c17b1142caab

reorganization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 18 Sep 2015 12:58:51 +0200
parents
children 8dc468f44661
comparison
equal deleted inserted replaced
1624:0a2ad4a6858f 1625:c17b1142caab
1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 *
6 * This program is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * In addition, as a special exception, the copyright holders of this
12 * program give permission to link the code of its release with the
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
14 * that use the same license as the "OpenSSL" library), and distribute
15 * the linked executables. You must obey the GNU General Public License
16 * in all respects for all of the code used other than "OpenSSL". If you
17 * modify file(s) with this exception, you may extend this exception to
18 * your version of the file(s), but you are not obligated to do so. If
19 * you do not wish to do so, delete this exception statement from your
20 * version. If you delete this exception statement from all source files
21 * in the program, then also delete it here.
22 *
23 * This program is distributed in the hope that it will be useful, but
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 * General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
30 **/
31
32
33 #include "../../OrthancServer/PrecompiledHeadersServer.h"
34 #include "PluginsEnumerations.h"
35
36 #include "../../Core/OrthancException.h"
37
38 namespace Orthanc
39 {
40 namespace Plugins
41 {
42 OrthancPluginResourceType Convert(ResourceType type)
43 {
44 switch (type)
45 {
46 case ResourceType_Patient:
47 return OrthancPluginResourceType_Patient;
48
49 case ResourceType_Study:
50 return OrthancPluginResourceType_Study;
51
52 case ResourceType_Series:
53 return OrthancPluginResourceType_Series;
54
55 case ResourceType_Instance:
56 return OrthancPluginResourceType_Instance;
57
58 default:
59 throw OrthancException(ErrorCode_ParameterOutOfRange);
60 }
61 }
62
63
64 OrthancPluginChangeType Convert(ChangeType type)
65 {
66 switch (type)
67 {
68 case ChangeType_CompletedSeries:
69 return OrthancPluginChangeType_CompletedSeries;
70
71 case ChangeType_Deleted:
72 return OrthancPluginChangeType_Deleted;
73
74 case ChangeType_NewChildInstance:
75 return OrthancPluginChangeType_NewChildInstance;
76
77 case ChangeType_NewInstance:
78 return OrthancPluginChangeType_NewInstance;
79
80 case ChangeType_NewPatient:
81 return OrthancPluginChangeType_NewPatient;
82
83 case ChangeType_NewSeries:
84 return OrthancPluginChangeType_NewSeries;
85
86 case ChangeType_NewStudy:
87 return OrthancPluginChangeType_NewStudy;
88
89 case ChangeType_StablePatient:
90 return OrthancPluginChangeType_StablePatient;
91
92 case ChangeType_StableSeries:
93 return OrthancPluginChangeType_StableSeries;
94
95 case ChangeType_StableStudy:
96 return OrthancPluginChangeType_StableStudy;
97
98 default:
99 throw OrthancException(ErrorCode_ParameterOutOfRange);
100 }
101 }
102
103
104 OrthancPluginPixelFormat Convert(PixelFormat format)
105 {
106 switch (format)
107 {
108 case PixelFormat_Grayscale16:
109 return OrthancPluginPixelFormat_Grayscale16;
110
111 case PixelFormat_Grayscale8:
112 return OrthancPluginPixelFormat_Grayscale8;
113
114 case PixelFormat_RGB24:
115 return OrthancPluginPixelFormat_RGB24;
116
117 case PixelFormat_RGBA32:
118 return OrthancPluginPixelFormat_RGBA32;
119
120 case PixelFormat_SignedGrayscale16:
121 return OrthancPluginPixelFormat_SignedGrayscale16;
122
123 default:
124 throw OrthancException(ErrorCode_ParameterOutOfRange);
125 }
126 }
127
128
129 PixelFormat Convert(OrthancPluginPixelFormat format)
130 {
131 switch (format)
132 {
133 case OrthancPluginPixelFormat_Grayscale16:
134 return PixelFormat_Grayscale16;
135
136 case OrthancPluginPixelFormat_Grayscale8:
137 return PixelFormat_Grayscale8;
138
139 case OrthancPluginPixelFormat_RGB24:
140 return PixelFormat_RGB24;
141
142 case OrthancPluginPixelFormat_RGBA32:
143 return PixelFormat_RGBA32;
144
145 case OrthancPluginPixelFormat_SignedGrayscale16:
146 return PixelFormat_SignedGrayscale16;
147
148 default:
149 throw OrthancException(ErrorCode_ParameterOutOfRange);
150 }
151 }
152
153
154 OrthancPluginContentType Convert(FileContentType type)
155 {
156 switch (type)
157 {
158 case FileContentType_Dicom:
159 return OrthancPluginContentType_Dicom;
160
161 case FileContentType_DicomAsJson:
162 return OrthancPluginContentType_DicomAsJson;
163
164 default:
165 return OrthancPluginContentType_Unknown;
166 }
167 }
168
169
170 FileContentType Convert(OrthancPluginContentType type)
171 {
172 switch (type)
173 {
174 case OrthancPluginContentType_Dicom:
175 return FileContentType_Dicom;
176
177 case OrthancPluginContentType_DicomAsJson:
178 return FileContentType_DicomAsJson;
179
180 default:
181 return FileContentType_Unknown;
182 }
183 }
184 }
185 }