comparison Framework/Messaging/MessagingToolbox.cpp @ 31:9aace933cb64

sharing code with the Orthanc core
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 16 Dec 2016 15:41:20 +0100
parents b01d46e5a2b3
children a865c7992a87
comparison
equal deleted inserted replaced
30:1099a148f7e5 31:9aace933cb64
171 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); 171 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat);
172 } 172 }
173 } 173 }
174 174
175 void RestApiGet(Json::Value& target, 175 void RestApiGet(Json::Value& target,
176 IOrthancConnection& orthanc, 176 OrthancPlugins::IOrthancConnection& orthanc,
177 const std::string& uri) 177 const std::string& uri)
178 { 178 {
179 std::string tmp; 179 std::string tmp;
180 orthanc.RestApiGet(tmp, uri); 180 orthanc.RestApiGet(tmp, uri);
181 ParseJson(target, tmp); 181 ParseJson(target, tmp);
182 } 182 }
183 183
184 184
185 bool HasWebViewerInstalled(IOrthancConnection& orthanc) 185 bool HasWebViewerInstalled(OrthancPlugins::IOrthancConnection& orthanc)
186 { 186 {
187 try 187 try
188 { 188 {
189 Json::Value json; 189 Json::Value json;
190 RestApiGet(json, orthanc, "/plugins/web-viewer"); 190 RestApiGet(json, orthanc, "/plugins/web-viewer");
195 return false; 195 return false;
196 } 196 }
197 } 197 }
198 198
199 199
200 bool CheckOrthancVersion(IOrthancConnection& orthanc) 200 bool CheckOrthancVersion(OrthancPlugins::IOrthancConnection& orthanc)
201 { 201 {
202 Json::Value json; 202 Json::Value json;
203 std::string version; 203 std::string version;
204 unsigned int major, minor, patch; 204 unsigned int major, minor, patch;
205 205
248 return (major >= 3 || 248 return (major >= 3 ||
249 (major == 2 && minor >= 2)); 249 (major == 2 && minor >= 2));
250 } 250 }
251 251
252 252
253 Orthanc::ImageAccessor* DecodeFrame(IOrthancConnection& orthanc, 253 Orthanc::ImageAccessor* DecodeFrame(OrthancPlugins::IOrthancConnection& orthanc,
254 const std::string& instance, 254 const std::string& instance,
255 unsigned int frame, 255 unsigned int frame,
256 Orthanc::PixelFormat targetFormat) 256 Orthanc::PixelFormat targetFormat)
257 { 257 {
258 std::string uri = ("instances/" + instance + "/frames/" + 258 std::string uri = ("instances/" + instance + "/frames/" +
295 295
296 return result.release(); 296 return result.release();
297 } 297 }
298 298
299 299
300 Orthanc::ImageAccessor* DecodeJpegFrame(IOrthancConnection& orthanc, 300 Orthanc::ImageAccessor* DecodeJpegFrame(OrthancPlugins::IOrthancConnection& orthanc,
301 const std::string& instance, 301 const std::string& instance,
302 unsigned int frame, 302 unsigned int frame,
303 unsigned int quality, 303 unsigned int quality,
304 Orthanc::PixelFormat targetFormat) 304 Orthanc::PixelFormat targetFormat)
305 { 305 {