comparison OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h @ 0:ebc1e38ef615

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 01 Jun 2015 09:47:32 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:ebc1e38ef615
1 /**
2 * Laaw - Lightweight, Automated API Wrapper
3 * Copyright (C) 2010-2013 Jomago - Alain Mazy, Benjamin Golinvaux,
4 * Sebastien Jodogne
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 /**
34 * @file
35 **/
36
37 #pragma once
38
39 #include <stdexcept>
40 #include <memory>
41 #include <string>
42 #include <string.h>
43
44 #if defined(_WIN32)
45
46 /********************************************************************
47 ** This is the Windows-specific section
48 ********************************************************************/
49
50 #include <windows.h>
51
52 /* cf. http://sourceforge.net/p/predef/wiki/Architectures/ */
53 #ifdef _M_X64
54 /* 64 bits target */
55 #define LAAW_ORTHANC_CLIENT_CALL_CONV __fastcall
56 #define LAAW_ORTHANC_CLIENT_CALL_DECORATION(Name, StdCallSuffix) Name
57 #define LAAW_ORTHANC_CLIENT_DEFAULT_PATH "OrthancClient_Windows64.dll"
58 #else
59 /* 32 bits target */
60 #define LAAW_ORTHANC_CLIENT_CALL_CONV __stdcall
61 #define LAAW_ORTHANC_CLIENT_CALL_DECORATION(Name, StdCallSuffix) "_" Name "@" StdCallSuffix
62 #define LAAW_ORTHANC_CLIENT_DEFAULT_PATH "OrthancClient_Windows32.dll"
63 #endif
64
65 #define LAAW_ORTHANC_CLIENT_HANDLE_TYPE HINSTANCE
66 #define LAAW_ORTHANC_CLIENT_HANDLE_NULL 0
67 #define LAAW_ORTHANC_CLIENT_FUNCTION_TYPE FARPROC
68 #define LAAW_ORTHANC_CLIENT_LOADER(path) LoadLibraryA(path)
69 #define LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle, name, decoration) GetProcAddress(handle, LAAW_ORTHANC_CLIENT_CALL_DECORATION(name, decoration))
70 #define LAAW_ORTHANC_CLIENT_CLOSER(handle) FreeLibrary(handle)
71
72
73 /********************************************************************
74 ** This is the Linux-specific section
75 ********************************************************************/
76
77 #elif defined (__linux)
78
79 #include <stdlib.h>
80 #include <dlfcn.h>
81
82 /* cf. http://sourceforge.net/p/predef/wiki/Architectures/ */
83 #ifdef __amd64__
84 #define LAAW_ORTHANC_CLIENT_DEFAULT_PATH "libOrthancClient.so.0.8"
85 #else
86 #define LAAW_ORTHANC_CLIENT_DEFAULT_PATH "libOrthancClient.so.0.8"
87 #endif
88
89 #define LAAW_ORTHANC_CLIENT_CALL_CONV
90 #define LAAW_ORTHANC_CLIENT_HANDLE_TYPE void*
91 #define LAAW_ORTHANC_CLIENT_HANDLE_NULL NULL
92 #define LAAW_ORTHANC_CLIENT_FUNCTION_TYPE intptr_t
93 #define LAAW_ORTHANC_CLIENT_LOADER(path) dlopen(path, RTLD_LAZY)
94 #define LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle, name, decoration) (LAAW_ORTHANC_CLIENT_FUNCTION_TYPE) dlsym(handle, name)
95 #define LAAW_ORTHANC_CLIENT_CLOSER(handle) dlclose(handle)
96
97
98 #else
99 #error Please support your platform here
100 #endif
101
102
103 /********************************************************************
104 ** Definition of the integer types
105 ********************************************************************/
106
107 #ifndef LAAW_INT8 // Only define the integer types once
108
109 #if defined(__GNUC__)
110
111 // Under GCC (including MinGW), the stdint.h standard header is used.
112
113 #include <stdint.h>
114
115 #define LAAW_INT8 int8_t
116 #define LAAW_UINT8 uint8_t
117 #define LAAW_INT16 int16_t
118 #define LAAW_UINT16 uint16_t
119 #define LAAW_INT32 int32_t
120 #define LAAW_UINT32 uint32_t
121 #define LAAW_INT64 int64_t
122 #define LAAW_UINT64 uint64_t
123
124 #elif defined(_MSC_VER)
125
126 // Under Visual Studio, it is required to define the various integer
127 // types by hand.
128
129 #if (_MSC_VER < 1300)
130 typedef signed char LAAW_INT8;
131 typedef signed short LAAW_INT16;
132 typedef signed int LAAW_INT32;
133 typedef unsigned char LAAW_UINT8;
134 typedef unsigned short LAAW_UINT16;
135 typedef unsigned int LAAW_UINT32;
136 #else
137 typedef signed __int8 LAAW_INT8;
138 typedef signed __int16 LAAW_INT16;
139 typedef signed __int32 LAAW_INT32;
140 typedef unsigned __int8 LAAW_UINT8;
141 typedef unsigned __int16 LAAW_UINT16;
142 typedef unsigned __int32 LAAW_UINT32;
143 #endif
144
145 typedef signed __int64 LAAW_INT64;
146 typedef unsigned __int64 LAAW_UINT64;
147
148 #else
149 #error "Please support your compiler here"
150 #endif
151
152 #endif
153
154
155
156
157
158 /********************************************************************
159 ** This is a shared section between Windows and Linux
160 ********************************************************************/
161
162 namespace OrthancClient {
163 /**
164 * @brief Exception class that is thrown by the functions of this shared library.
165 **/
166 class OrthancClientException : public std::exception
167 {
168 private:
169 std::string message_;
170
171 public:
172 /**
173 * @brief Constructs an exception.
174 * @param message The error message.
175 **/
176 OrthancClientException(std::string message) : message_(message)
177 {
178 }
179
180 ~OrthancClientException() throw()
181 {
182 }
183
184 /**
185 * @brief Get the error message associated with this exception.
186 * @returns The error message.
187 **/
188 const std::string& What() const throw()
189 {
190 return message_;
191 }
192 };
193 }
194
195
196 namespace OrthancClient { namespace Internals {
197 /**
198 * This internal class implements a Singleton design pattern that will
199 * store a reference to the shared library handle, together with a
200 * pointer to each function in the shared library.
201 **/
202 class Library
203 {
204 private:
205 LAAW_ORTHANC_CLIENT_HANDLE_TYPE handle_;
206 LAAW_ORTHANC_CLIENT_FUNCTION_TYPE functionsIndex_[63 + 1];
207
208
209
210 void Load(const char* sharedLibraryPath)
211 {
212
213 if (handle_ != LAAW_ORTHANC_CLIENT_HANDLE_NULL)
214 {
215 // Do nothing if the library is already loaded
216 return;
217 }
218
219 /* Setup the path to the default shared library if not provided */
220 if (sharedLibraryPath == NULL)
221 {
222 sharedLibraryPath = LAAW_ORTHANC_CLIENT_DEFAULT_PATH;
223 }
224
225 /* Load the shared library */
226 handle_ = LAAW_ORTHANC_CLIENT_LOADER(sharedLibraryPath);
227
228
229 if (handle_ == LAAW_ORTHANC_CLIENT_HANDLE_NULL)
230 {
231 throw ::OrthancClient::OrthancClientException("Error loading shared library");
232 }
233
234 LoadFunctions();
235 }
236
237 inline void LoadFunctions();
238
239 void FreeString(char* str)
240 {
241 typedef void (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (char*);
242 Function function = (Function) GetFunction(63);
243 function(str);
244 }
245
246 Library()
247 {
248 handle_ = LAAW_ORTHANC_CLIENT_HANDLE_NULL;
249 }
250
251 ~Library()
252 {
253 Finalize();
254 }
255
256 public:
257 LAAW_ORTHANC_CLIENT_FUNCTION_TYPE GetFunction(unsigned int index)
258 {
259 /**
260 * If the library has not been manually initialized by a call to
261 * ::OrthancClient::Initialize(), it is loaded from
262 * the default location (lazy initialization).
263 **/
264 if (handle_ == NULL)
265 {
266 Load(NULL);
267 }
268
269 return functionsIndex_[index];
270 }
271
272 void ThrowExceptionIfNeeded(char* message)
273 {
274 if (message != NULL)
275 {
276 std::string tmp(message);
277 FreeString(message);
278 throw ::OrthancClient::OrthancClientException(tmp);
279 }
280 }
281
282 static inline Library& GetInstance()
283 {
284 /**
285 * This function defines a "static variable" inside a "static
286 * inline method" of a class. This ensures that a single
287 * instance of this variable will be used across all the
288 * compilation modules of the software.
289 * http://stackoverflow.com/a/1389403/881731
290 **/
291
292 static Library singleton;
293 return singleton;
294 }
295
296 static void Initialize(const char* sharedLibraryPath)
297 {
298 GetInstance().Load(sharedLibraryPath);
299 }
300
301 void Finalize()
302 {
303 if (handle_ != LAAW_ORTHANC_CLIENT_HANDLE_NULL)
304 {
305 #if 0
306 /**
307 * Do not explicitly unload the shared library, as it might
308 * interfere with the destruction of static objects declared
309 * inside the library (e.g. this is the case of gflags that is
310 * internally used by googlelog).
311 **/
312 LAAW_ORTHANC_CLIENT_CLOSER(handle_);
313 #endif
314 handle_ = LAAW_ORTHANC_CLIENT_HANDLE_NULL;
315 }
316 }
317 };
318 }}
319
320
321 /*!
322 * \addtogroup Global Global definitions.
323 * @{
324 * @}
325 */
326
327
328 namespace OrthancClient {
329 /*!
330 * \addtogroup Initialization Initialization of the shared library.
331 * @{
332 */
333
334 /**
335 * @brief Manually initialize the shared library, using the default library name.
336 *
337 * Call this method before using the library to ensure correct
338 * behaviour in multi-threaded applications. This method is also
339 * useful to control the time at which the shared library is
340 * loaded (e.g. for real-time applications).
341 **/
342 inline void Initialize()
343 {
344 ::OrthancClient::Internals::Library::Initialize(NULL);
345 }
346
347 /**
348 * @brief Manually initialize the shared library.
349 *
350 * Call this method before using the library to ensure correct
351 * behaviour in multi-threaded applications. This method is also
352 * useful to control the time at which the shared library is
353 * loaded (e.g. for real-time applications).
354 *
355 * @param sharedLibraryPath The path to the shared library that
356 * contains the module.
357 **/
358 inline void Initialize(const std::string& sharedLibraryPath)
359 {
360 ::OrthancClient::Internals::Library::Initialize(sharedLibraryPath.c_str());
361 }
362
363 /**
364 * @brief Manually finalize the shared library.
365 *
366 * Calling explicitly this function is not mandatory. It is useful to
367 * force the release of the resources acquired by the shared library,
368 * or to manually control the order in which the global variables get
369 * deleted.
370 **/
371 inline void Finalize()
372 {
373 ::OrthancClient::Internals::Library::GetInstance().Finalize();
374 }
375
376
377 /**
378 * @}
379 */
380 }
381
382
383 namespace OrthancClient { namespace Internals {
384 inline void Library::LoadFunctions()
385 {
386 typedef const char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) ();
387 Function getVersion = (Function) LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_GetVersion", "0");
388 if (getVersion == NULL)
389 {
390 throw ::OrthancClient::OrthancClientException("Unable to get the library version");
391 }
392
393 /**
394 * It is assumed that the API does not change when the revision
395 * number (MAJOR.MINOR.REVISION) changes.
396 **/
397 if (strcmp(getVersion(), "0.8"))
398 {
399 throw ::OrthancClient::OrthancClientException("Mismatch between the C++ header and the library version");
400 }
401
402 functionsIndex_[63] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_FreeString", "4");
403 functionsIndex_[3] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_557aee7b61817292a0f31269d3c35db7", "8");
404 functionsIndex_[4] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_0b8dff0ce67f10954a49b059e348837e", "8");
405 functionsIndex_[5] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_e05097c153f676e5a5ee54dcfc78256f", "4");
406 functionsIndex_[6] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_e840242bf58d17d3c1d722da09ce88e0", "8");
407 functionsIndex_[7] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_c9af31433001b5dfc012a552dc6d0050", "8");
408 functionsIndex_[8] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_3fba4d6b818180a44cd1cae6046334dc", "12");
409 functionsIndex_[9] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_aeb20dc75b9246188db857317e5e0ce7", "8");
410 functionsIndex_[10] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_62689803d9871e4d9c51a648640b320b", "8");
411 functionsIndex_[11] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2fb64c9e5a67eccd413b0e913469a421", "16");
412 functionsIndex_[0] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1f1acb322ea4d0aad65172824607673c", "8");
413 functionsIndex_[1] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_f3fd272e4636f6a531aabb72ee01cd5b", "16");
414 functionsIndex_[2] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_12d3de0a96e9efb11136a9811bb9ed38", "4");
415 functionsIndex_[14] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_f756172daf04516eec3a566adabb4335", "4");
416 functionsIndex_[15] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_ddb68763ec902a97d579666a73a20118", "8");
417 functionsIndex_[16] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_fba3c68b4be7558dbc65f7ce1ab57d63", "12");
418 functionsIndex_[17] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b4ca99d958f843493e58d1ef967340e1", "8");
419 functionsIndex_[18] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_78d5cc76d282437b6f93ec3b82c35701", "16");
420 functionsIndex_[12] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_6cf0d7268667f9b0aa4511bacf184919", "12");
421 functionsIndex_[13] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_7d81cd502ee27e859735d0ea7112b5a1", "4");
422 functionsIndex_[21] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_48a2a1a9d68c047e22bfba23014643d2", "4");
423 functionsIndex_[22] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_852bf8296ca21c5fde5ec565cc10721d", "8");
424 functionsIndex_[23] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_efd04574e0779faa83df1f2d8f9888db", "12");
425 functionsIndex_[24] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_736247ff5e8036dac38163da6f666ed5", "8");
426 functionsIndex_[25] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_d82d2598a7a73f4b6fcc0c09c25b08ca", "8");
427 functionsIndex_[26] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_88134b978f9acb2aecdadf54aeab3c64", "16");
428 functionsIndex_[27] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_152cb1b704c053d24b0dab7461ba6ea3", "8");
429 functionsIndex_[28] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_eee03f337ec81d9f1783cd41e5238757", "8");
430 functionsIndex_[29] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_006f08237bd7611636fc721baebfb4c5", "8");
431 functionsIndex_[30] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b794f5cd3dad7d7b575dd1fd902afdd0", "8");
432 functionsIndex_[31] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_8ee2e50dd9df8f66a3c1766090dd03ab", "8");
433 functionsIndex_[32] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_046aed35bbe4751691f4c34cc249a61d", "8");
434 functionsIndex_[33] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2be452e7af5bf7dfd8c5021842674497", "8");
435 functionsIndex_[34] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_4dcc7a0fd025efba251ac6e9b701c2c5", "28");
436 functionsIndex_[35] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b2601a161c24ad0a1d3586246f87452c", "32");
437 functionsIndex_[19] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_193599b9e345384fcdfcd47c29c55342", "12");
438 functionsIndex_[20] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_7c97f17063a357d38c5fab1136ad12a0", "4");
439 functionsIndex_[38] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_e65b20b7e0170b67544cd6664a4639b7", "4");
440 functionsIndex_[39] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_470e981b0e41f17231ba0ae6f3033321", "8");
441 functionsIndex_[40] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_04cefd138b6ea15ad909858f2a0a8f05", "12");
442 functionsIndex_[41] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_aee5b1f6f0c082f2c3b0986f9f6a18c7", "8");
443 functionsIndex_[42] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_93965682bace75491413e1f0b8d5a654", "16");
444 functionsIndex_[36] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b01c6003238eb46c8db5dc823d7ca678", "12");
445 functionsIndex_[37] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_0147007fb99bad8cd95a139ec8795376", "4");
446 functionsIndex_[45] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_236ee8b403bc99535a8a4695c0cd45cb", "8");
447 functionsIndex_[46] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2a437b7aba6bb01e81113835be8f0146", "8");
448 functionsIndex_[47] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2bcbcb850934ae0bb4c6f0cc940e6cda", "8");
449 functionsIndex_[48] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_8d415c3a78a48e7e61d9fd24e7c79484", "12");
450 functionsIndex_[49] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_70d2f8398bbc63b5f792b69b4ad5fecb", "12");
451 functionsIndex_[50] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1729a067d902771517388eedd7346b23", "12");
452 functionsIndex_[51] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_72e2aeee66cd3abd8ab7e987321c3745", "8");
453 functionsIndex_[52] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1ea3df5a1ac1a1a687fe7325adddb6f0", "8");
454 functionsIndex_[53] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_99b4f370e4f532d8b763e2cb49db92f8", "8");
455 functionsIndex_[54] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_c41c742b68617f1c0590577a0a5ebc0c", "8");
456 functionsIndex_[55] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_142dd2feba0fc1d262bbd0baeb441a8b", "8");
457 functionsIndex_[56] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_5f5c9f81a4dff8daa6c359f1d0488fef", "12");
458 functionsIndex_[57] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_9ca979fffd08fa256306d4e68d8b0e91", "8");
459 functionsIndex_[58] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_6f2d77a26edc91c28d89408dbc3c271e", "8");
460 functionsIndex_[59] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_c0f494b80d4ff8b232df7a75baa0700a", "4");
461 functionsIndex_[60] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_d604f44bd5195e082e745e9cbc164f4c", "4");
462 functionsIndex_[61] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1710299d1c5f3b1f2b7cf3962deebbfd", "8");
463 functionsIndex_[62] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_bb55aaf772ddceaadee36f4e54136bcb", "8");
464 functionsIndex_[43] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_6c5ad02f91b583e29cebd0bd319ce21d", "12");
465 functionsIndex_[44] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_4068241c44a9c1367fe0e57be523f207", "4");
466
467 /* Check whether the functions were properly loaded */
468 for (unsigned int i = 0; i <= 63; i++)
469 {
470 if (functionsIndex_[i] == (LAAW_ORTHANC_CLIENT_FUNCTION_TYPE) NULL)
471 {
472 throw ::OrthancClient::OrthancClientException("Unable to load the functions of the shared library");
473 }
474 }
475 }
476 }}
477 namespace OrthancClient
478 {
479 class OrthancConnection;
480 }
481
482 namespace OrthancClient
483 {
484 class Patient;
485 }
486
487 namespace OrthancClient
488 {
489 class Series;
490 }
491
492 namespace OrthancClient
493 {
494 class Study;
495 }
496
497 namespace OrthancClient
498 {
499 class Instance;
500 }
501
502 namespace Orthanc
503 {
504 /**
505 * @brief The memory layout of the pixels (resp. voxels) of a 2D (resp. 3D) image.
506 *
507 * The memory layout of the pixels (resp. voxels) of a 2D (resp. 3D) image.
508 *
509 * @ingroup Global
510 **/
511 enum PixelFormat
512 {
513 /**
514 * @brief Graylevel, signed 16bpp image.
515 *
516 * The image is graylevel. Each pixel is signed and stored in two bytes.
517 *
518 **/
519 PixelFormat_SignedGrayscale16 = 5,
520 /**
521 * @brief Color image in RGB24 format.
522 *
523 * This format describes a color image. The pixels are stored in 3 consecutive bytes. The memory layout is RGB.
524 *
525 **/
526 PixelFormat_RGB24 = 1,
527 /**
528 * @brief Color image in RGBA32 format.
529 *
530 * This format describes a color image. The pixels are stored in 4 consecutive bytes. The memory layout is RGBA.
531 *
532 **/
533 PixelFormat_RGBA32 = 2,
534 /**
535 * @brief Graylevel 8bpp image.
536 *
537 * The image is graylevel. Each pixel is unsigned and stored in one byte.
538 *
539 **/
540 PixelFormat_Grayscale8 = 3,
541 /**
542 * @brief Graylevel, unsigned 16bpp image.
543 *
544 * The image is graylevel. Each pixel is unsigned and stored in two bytes.
545 *
546 **/
547 PixelFormat_Grayscale16 = 4
548 };
549 }
550
551 namespace Orthanc
552 {
553 /**
554 * @brief The extraction mode specifies the way the values of the pixels are scaled when downloading a 2D image.
555 *
556 * The extraction mode specifies the way the values of the pixels are scaled when downloading a 2D image.
557 *
558 * @ingroup Global
559 **/
560 enum ImageExtractionMode
561 {
562 /**
563 * @brief Truncation to the [-32768, 32767] range.
564 *
565 * Truncation to the [-32768, 32767] range.
566 *
567 **/
568 ImageExtractionMode_Int16 = 4,
569 /**
570 * @brief Rescaled to 8bpp.
571 *
572 * The minimum value of the image is set to 0, and its maximum value is set to 255.
573 *
574 **/
575 ImageExtractionMode_Preview = 1,
576 /**
577 * @brief Truncation to the [0, 255] range.
578 *
579 * Truncation to the [0, 255] range.
580 *
581 **/
582 ImageExtractionMode_UInt8 = 2,
583 /**
584 * @brief Truncation to the [0, 65535] range.
585 *
586 * Truncation to the [0, 65535] range.
587 *
588 **/
589 ImageExtractionMode_UInt16 = 3
590 };
591 }
592
593 namespace OrthancClient
594 {
595 /**
596 * @brief Connection to an instance of %Orthanc.
597 *
598 * This class encapsulates a connection to a remote instance of %Orthanc through its REST API.
599 *
600 **/
601 class OrthancConnection
602 {
603 friend class ::OrthancClient::Patient;
604 friend class ::OrthancClient::Series;
605 friend class ::OrthancClient::Study;
606 friend class ::OrthancClient::Instance;
607 private:
608 bool isReference_;
609 OrthancConnection& operator= (const OrthancConnection&); // Assignment is forbidden
610 void* pimpl_;
611 OrthancConnection(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
612 public:
613 /**
614 * @brief Construct a new reference to this object.
615 *
616 * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid.
617 *
618 * @param other The original object.
619 **/
620 OrthancConnection(const OrthancConnection& other) : isReference_(true), pimpl_(other.pimpl_) { }
621 inline OrthancConnection(const ::std::string& orthancUrl);
622 inline OrthancConnection(const ::std::string& orthancUrl, const ::std::string& username, const ::std::string& password);
623 inline ~OrthancConnection();
624 inline LAAW_UINT32 GetThreadCount() const;
625 inline void SetThreadCount(LAAW_UINT32 threadCount);
626 inline void Reload();
627 inline ::std::string GetOrthancUrl() const;
628 inline LAAW_UINT32 GetPatientCount();
629 inline ::OrthancClient::Patient GetPatient(LAAW_UINT32 index);
630 inline void DeletePatient(LAAW_UINT32 index);
631 inline void StoreFile(const ::std::string& filename);
632 inline void Store(const void* dicom, LAAW_UINT64 size);
633 };
634 }
635
636 namespace OrthancClient
637 {
638 /**
639 * @brief Connection to a patient stored in %Orthanc.
640 *
641 * This class encapsulates a connection to a patient from a remote instance of %Orthanc.
642 *
643 **/
644 class Patient
645 {
646 friend class ::OrthancClient::OrthancConnection;
647 friend class ::OrthancClient::Series;
648 friend class ::OrthancClient::Study;
649 friend class ::OrthancClient::Instance;
650 private:
651 bool isReference_;
652 Patient& operator= (const Patient&); // Assignment is forbidden
653 void* pimpl_;
654 Patient(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
655 public:
656 /**
657 * @brief Construct a new reference to this object.
658 *
659 * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid.
660 *
661 * @param other The original object.
662 **/
663 Patient(const Patient& other) : isReference_(true), pimpl_(other.pimpl_) { }
664 inline Patient(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
665 inline ~Patient();
666 inline void Reload();
667 inline LAAW_UINT32 GetStudyCount();
668 inline ::OrthancClient::Study GetStudy(LAAW_UINT32 index);
669 inline ::std::string GetId() const;
670 inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const;
671 };
672 }
673
674 namespace OrthancClient
675 {
676 /**
677 * @brief Connection to a series stored in %Orthanc.
678 *
679 * This class encapsulates a connection to a series from a remote instance of %Orthanc.
680 *
681 **/
682 class Series
683 {
684 friend class ::OrthancClient::OrthancConnection;
685 friend class ::OrthancClient::Patient;
686 friend class ::OrthancClient::Study;
687 friend class ::OrthancClient::Instance;
688 private:
689 bool isReference_;
690 Series& operator= (const Series&); // Assignment is forbidden
691 void* pimpl_;
692 Series(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
693 public:
694 /**
695 * @brief Construct a new reference to this object.
696 *
697 * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid.
698 *
699 * @param other The original object.
700 **/
701 Series(const Series& other) : isReference_(true), pimpl_(other.pimpl_) { }
702 inline Series(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
703 inline ~Series();
704 inline void Reload();
705 inline LAAW_UINT32 GetInstanceCount();
706 inline ::OrthancClient::Instance GetInstance(LAAW_UINT32 index);
707 inline ::std::string GetId() const;
708 inline ::std::string GetUrl() const;
709 inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const;
710 inline bool Is3DImage();
711 inline LAAW_UINT32 GetWidth();
712 inline LAAW_UINT32 GetHeight();
713 inline float GetVoxelSizeX();
714 inline float GetVoxelSizeY();
715 inline float GetVoxelSizeZ();
716 inline float GetSliceThickness();
717 inline void Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride);
718 inline void Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride, float progress[]);
719 };
720 }
721
722 namespace OrthancClient
723 {
724 /**
725 * @brief Connection to a study stored in %Orthanc.
726 *
727 * This class encapsulates a connection to a study from a remote instance of %Orthanc.
728 *
729 **/
730 class Study
731 {
732 friend class ::OrthancClient::OrthancConnection;
733 friend class ::OrthancClient::Patient;
734 friend class ::OrthancClient::Series;
735 friend class ::OrthancClient::Instance;
736 private:
737 bool isReference_;
738 Study& operator= (const Study&); // Assignment is forbidden
739 void* pimpl_;
740 Study(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
741 public:
742 /**
743 * @brief Construct a new reference to this object.
744 *
745 * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid.
746 *
747 * @param other The original object.
748 **/
749 Study(const Study& other) : isReference_(true), pimpl_(other.pimpl_) { }
750 inline Study(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
751 inline ~Study();
752 inline void Reload();
753 inline LAAW_UINT32 GetSeriesCount();
754 inline ::OrthancClient::Series GetSeries(LAAW_UINT32 index);
755 inline ::std::string GetId() const;
756 inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const;
757 };
758 }
759
760 namespace OrthancClient
761 {
762 /**
763 * @brief Connection to an instance stored in %Orthanc.
764 *
765 * This class encapsulates a connection to an image instance from a remote instance of %Orthanc.
766 *
767 **/
768 class Instance
769 {
770 friend class ::OrthancClient::OrthancConnection;
771 friend class ::OrthancClient::Patient;
772 friend class ::OrthancClient::Series;
773 friend class ::OrthancClient::Study;
774 private:
775 bool isReference_;
776 Instance& operator= (const Instance&); // Assignment is forbidden
777 void* pimpl_;
778 Instance(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
779 public:
780 /**
781 * @brief Construct a new reference to this object.
782 *
783 * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid.
784 *
785 * @param other The original object.
786 **/
787 Instance(const Instance& other) : isReference_(true), pimpl_(other.pimpl_) { }
788 inline Instance(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
789 inline ~Instance();
790 inline ::std::string GetId() const;
791 inline void SetImageExtractionMode(::Orthanc::ImageExtractionMode mode);
792 inline ::Orthanc::ImageExtractionMode GetImageExtractionMode() const;
793 inline ::std::string GetTagAsString(const ::std::string& tag) const;
794 inline float GetTagAsFloat(const ::std::string& tag) const;
795 inline LAAW_INT32 GetTagAsInt(const ::std::string& tag) const;
796 inline LAAW_UINT32 GetWidth();
797 inline LAAW_UINT32 GetHeight();
798 inline LAAW_UINT32 GetPitch();
799 inline ::Orthanc::PixelFormat GetPixelFormat();
800 inline const void* GetBuffer();
801 inline const void* GetBuffer(LAAW_UINT32 y);
802 inline LAAW_UINT64 GetDicomSize();
803 inline const void* GetDicom();
804 inline void DiscardImage();
805 inline void DiscardDicom();
806 inline void LoadTagContent(const ::std::string& path);
807 inline ::std::string GetLoadedTagContent() const;
808 };
809 }
810
811 namespace OrthancClient
812 {
813 /**
814 * @brief Create a connection to an instance of %Orthanc.
815 *
816 * Create a connection to an instance of %Orthanc.
817 *
818 * @param orthancUrl URL to which the REST API of %Orthanc is listening.
819 **/
820 inline OrthancConnection::OrthancConnection(const ::std::string& orthancUrl)
821 {
822 isReference_ = false;
823 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, const char*);
824 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(0);
825 char* error = function(&pimpl_, orthancUrl.c_str());
826 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
827 }
828 /**
829 * @brief Create a connection to an instance of %Orthanc, with authentication.
830 *
831 * Create a connection to an instance of %Orthanc, with authentication.
832 *
833 * @param orthancUrl URL to which the REST API of %Orthanc is listening.
834 * @param username The username.
835 * @param password The password.
836 **/
837 inline OrthancConnection::OrthancConnection(const ::std::string& orthancUrl, const ::std::string& username, const ::std::string& password)
838 {
839 isReference_ = false;
840 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, const char*, const char*, const char*);
841 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(1);
842 char* error = function(&pimpl_, orthancUrl.c_str(), username.c_str(), password.c_str());
843 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
844 }
845 /**
846 * @brief Destructs the object.
847 *
848 * Destructs the object.
849 *
850 **/
851 inline OrthancConnection::~OrthancConnection()
852 {
853 if (isReference_) return;
854 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
855 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(2);
856 char* error = function(pimpl_);
857 error = error; // Remove warning about unused variable
858 }
859 /**
860 * @brief Returns the number of threads for this connection.
861 *
862 * Returns the number of simultaneous connections that are used when downloading information from this instance of %Orthanc.
863 *
864 * @return The number of threads.
865 **/
866 inline LAAW_UINT32 OrthancConnection::GetThreadCount() const
867 {
868 LAAW_UINT32 result_;
869 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_UINT32*);
870 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(3);
871 char* error = function(pimpl_, &result_);
872 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
873 return result_;
874 }
875 /**
876 * @brief Sets the number of threads for this connection.
877 *
878 * Sets the number of simultaneous connections that are used when downloading information from this instance of %Orthanc.
879 *
880 * @param threadCount The number of threads.
881 **/
882 inline void OrthancConnection::SetThreadCount(LAAW_UINT32 threadCount)
883 {
884 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32);
885 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(4);
886 char* error = function(pimpl_, threadCount);
887 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
888 }
889 /**
890 * @brief Reload the list of the patients.
891 *
892 * This method will reload the list of the patients from the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated.
893 *
894 **/
895 inline void OrthancConnection::Reload()
896 {
897 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
898 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(5);
899 char* error = function(pimpl_);
900 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
901 }
902 /**
903 * @brief Returns the URL of this instance of %Orthanc.
904 *
905 * Returns the URL of the remote %Orthanc instance to which this object is connected.
906 *
907 * @return The URL.
908 **/
909 inline ::std::string OrthancConnection::GetOrthancUrl() const
910 {
911 const char* result_;
912 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
913 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(6);
914 char* error = function(pimpl_, &result_);
915 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
916 return std::string(result_);
917 }
918 /**
919 * @brief Returns the number of patients.
920 *
921 * Returns the number of patients that are stored in the remote instance of %Orthanc.
922 *
923 * @return The number of patients.
924 **/
925 inline LAAW_UINT32 OrthancConnection::GetPatientCount()
926 {
927 LAAW_UINT32 result_;
928 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
929 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(7);
930 char* error = function(pimpl_, &result_);
931 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
932 return result_;
933 }
934 /**
935 * @brief Get some patient.
936 *
937 * This method will return an object that contains information about some patient. The patients are indexed by a number between 0 (inclusive) and the result of GetPatientCount() (exclusive).
938 *
939 * @param index The index of the patient of interest.
940 * @return The patient.
941 **/
942 inline ::OrthancClient::Patient OrthancConnection::GetPatient(LAAW_UINT32 index)
943 {
944 void* result_;
945 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
946 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(8);
947 char* error = function(pimpl_, &result_, index);
948 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
949 return ::OrthancClient::Patient(result_);
950 }
951 /**
952 * @brief Delete some patient.
953 *
954 * Delete some patient from the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated.
955 *
956 * @param index The index of the patient of interest.
957 * @return The patient.
958 **/
959 inline void OrthancConnection::DeletePatient(LAAW_UINT32 index)
960 {
961 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32);
962 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(9);
963 char* error = function(pimpl_, index);
964 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
965 }
966 /**
967 * @brief Send a DICOM file.
968 *
969 * This method will store a DICOM file in the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated.
970 *
971 * @param filename Path to the DICOM file
972 **/
973 inline void OrthancConnection::StoreFile(const ::std::string& filename)
974 {
975 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const char*);
976 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(10);
977 char* error = function(pimpl_, filename.c_str());
978 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
979 }
980 /**
981 * @brief Send a DICOM file that is contained inside a memory buffer.
982 *
983 * This method will store a DICOM file in the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated.
984 *
985 * @param dicom The memory buffer containing the DICOM file.
986 * @param size The size of the DICOM file.
987 **/
988 inline void OrthancConnection::Store(const void* dicom, LAAW_UINT64 size)
989 {
990 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void*, LAAW_UINT64);
991 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(11);
992 char* error = function(pimpl_, dicom, size);
993 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
994 }
995 }
996
997 namespace OrthancClient
998 {
999 /**
1000 * @brief Create a connection to some patient.
1001 *
1002 * Create a connection to some patient.
1003 *
1004 * @param connection The remote instance of %Orthanc.
1005 * @param id The %Orthanc identifier of the patient.
1006 **/
1007 inline Patient::Patient(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
1008 {
1009 isReference_ = false;
1010 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
1011 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(12);
1012 char* error = function(&pimpl_, connection.pimpl_, id.c_str());
1013 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1014 }
1015 /**
1016 * @brief Destructs the object.
1017 *
1018 * Destructs the object.
1019 *
1020 **/
1021 inline Patient::~Patient()
1022 {
1023 if (isReference_) return;
1024 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1025 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(13);
1026 char* error = function(pimpl_);
1027 error = error; // Remove warning about unused variable
1028 }
1029 /**
1030 * @brief Reload the studies of this patient.
1031 *
1032 * This method will reload the list of the studies of this patient. Pay attention to the fact that the studies that have been previously returned by GetStudy() will be invalidated.
1033 *
1034 **/
1035 inline void Patient::Reload()
1036 {
1037 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1038 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(14);
1039 char* error = function(pimpl_);
1040 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1041 }
1042 /**
1043 * @brief Return the number of studies for this patient.
1044 *
1045 * Return the number of studies for this patient.
1046 *
1047 * @return The number of studies.
1048 **/
1049 inline LAAW_UINT32 Patient::GetStudyCount()
1050 {
1051 LAAW_UINT32 result_;
1052 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1053 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(15);
1054 char* error = function(pimpl_, &result_);
1055 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1056 return result_;
1057 }
1058 /**
1059 * @brief Get some study of this patient.
1060 *
1061 * This method will return an object that contains information about some study. The studies are indexed by a number between 0 (inclusive) and the result of GetStudyCount() (exclusive).
1062 *
1063 * @param index The index of the study of interest.
1064 * @return The study.
1065 **/
1066 inline ::OrthancClient::Study Patient::GetStudy(LAAW_UINT32 index)
1067 {
1068 void* result_;
1069 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
1070 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(16);
1071 char* error = function(pimpl_, &result_, index);
1072 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1073 return ::OrthancClient::Study(result_);
1074 }
1075 /**
1076 * @brief Get the %Orthanc identifier of this patient.
1077 *
1078 * Get the %Orthanc identifier of this patient.
1079 *
1080 * @return The identifier.
1081 **/
1082 inline ::std::string Patient::GetId() const
1083 {
1084 const char* result_;
1085 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1086 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(17);
1087 char* error = function(pimpl_, &result_);
1088 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1089 return std::string(result_);
1090 }
1091 /**
1092 * @brief Get the value of one of the main DICOM tags for this patient.
1093 *
1094 * Get the value of one of the main DICOM tags for this patient.
1095 *
1096 * @param tag The name of the tag of interest ("PatientName", "PatientID", "PatientSex" or "PatientBirthDate").
1097 * @param defaultValue The default value to be returned if this tag does not exist.
1098 * @return The value of the tag.
1099 **/
1100 inline ::std::string Patient::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const
1101 {
1102 const char* result_;
1103 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*);
1104 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(18);
1105 char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str());
1106 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1107 return std::string(result_);
1108 }
1109 }
1110
1111 namespace OrthancClient
1112 {
1113 /**
1114 * @brief Create a connection to some series.
1115 *
1116 * Create a connection to some series.
1117 *
1118 * @param connection The remote instance of %Orthanc.
1119 * @param id The %Orthanc identifier of the series.
1120 **/
1121 inline Series::Series(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
1122 {
1123 isReference_ = false;
1124 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
1125 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(19);
1126 char* error = function(&pimpl_, connection.pimpl_, id.c_str());
1127 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1128 }
1129 /**
1130 * @brief Destructs the object.
1131 *
1132 * Destructs the object.
1133 *
1134 **/
1135 inline Series::~Series()
1136 {
1137 if (isReference_) return;
1138 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1139 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(20);
1140 char* error = function(pimpl_);
1141 error = error; // Remove warning about unused variable
1142 }
1143 /**
1144 * @brief Reload the instances of this series.
1145 *
1146 * This method will reload the list of the instances of this series. Pay attention to the fact that the instances that have been previously returned by GetInstance() will be invalidated.
1147 *
1148 **/
1149 inline void Series::Reload()
1150 {
1151 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1152 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(21);
1153 char* error = function(pimpl_);
1154 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1155 }
1156 /**
1157 * @brief Return the number of instances for this series.
1158 *
1159 * Return the number of instances for this series.
1160 *
1161 * @return The number of instances.
1162 **/
1163 inline LAAW_UINT32 Series::GetInstanceCount()
1164 {
1165 LAAW_UINT32 result_;
1166 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1167 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(22);
1168 char* error = function(pimpl_, &result_);
1169 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1170 return result_;
1171 }
1172 /**
1173 * @brief Get some instance of this series.
1174 *
1175 * This method will return an object that contains information about some instance. The instances are indexed by a number between 0 (inclusive) and the result of GetInstanceCount() (exclusive).
1176 *
1177 * @param index The index of the instance of interest.
1178 * @return The instance.
1179 **/
1180 inline ::OrthancClient::Instance Series::GetInstance(LAAW_UINT32 index)
1181 {
1182 void* result_;
1183 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
1184 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(23);
1185 char* error = function(pimpl_, &result_, index);
1186 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1187 return ::OrthancClient::Instance(result_);
1188 }
1189 /**
1190 * @brief Get the %Orthanc identifier of this series.
1191 *
1192 * Get the %Orthanc identifier of this series.
1193 *
1194 * @return The identifier.
1195 **/
1196 inline ::std::string Series::GetId() const
1197 {
1198 const char* result_;
1199 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1200 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(24);
1201 char* error = function(pimpl_, &result_);
1202 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1203 return std::string(result_);
1204 }
1205 /**
1206 * @brief Returns the URL to this series.
1207 *
1208 * Returns the URL to this series.
1209 *
1210 * @return The URL.
1211 **/
1212 inline ::std::string Series::GetUrl() const
1213 {
1214 const char* result_;
1215 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1216 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(25);
1217 char* error = function(pimpl_, &result_);
1218 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1219 return std::string(result_);
1220 }
1221 /**
1222 * @brief Get the value of one of the main DICOM tags for this series.
1223 *
1224 * Get the value of one of the main DICOM tags for this series.
1225 *
1226 * @param tag The name of the tag of interest ("Modality", "Manufacturer", "SeriesDate", "SeriesDescription", "SeriesInstanceUID"...).
1227 * @param defaultValue The default value to be returned if this tag does not exist.
1228 * @return The value of the tag.
1229 **/
1230 inline ::std::string Series::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const
1231 {
1232 const char* result_;
1233 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*);
1234 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(26);
1235 char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str());
1236 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1237 return std::string(result_);
1238 }
1239 /**
1240 * @brief Test whether this series encodes a 3D image that can be downloaded from %Orthanc.
1241 *
1242 * Test whether this series encodes a 3D image that can be downloaded from %Orthanc.
1243 *
1244 * @return "true" if and only if this is a 3D image.
1245 **/
1246 inline bool Series::Is3DImage()
1247 {
1248 LAAW_INT32 result_;
1249 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32*);
1250 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(27);
1251 char* error = function(pimpl_, &result_);
1252 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1253 return result_ != 0;
1254 }
1255 /**
1256 * @brief Get the width of the 3D image.
1257 *
1258 * Get the width of the 3D image (i.e. along the X-axis). This call is only valid if this series corresponds to a 3D image.
1259 *
1260 * @return The width.
1261 **/
1262 inline LAAW_UINT32 Series::GetWidth()
1263 {
1264 LAAW_UINT32 result_;
1265 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1266 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(28);
1267 char* error = function(pimpl_, &result_);
1268 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1269 return result_;
1270 }
1271 /**
1272 * @brief Get the height of the 3D image.
1273 *
1274 * Get the height of the 3D image (i.e. along the Y-axis). This call is only valid if this series corresponds to a 3D image.
1275 *
1276 * @return The height.
1277 **/
1278 inline LAAW_UINT32 Series::GetHeight()
1279 {
1280 LAAW_UINT32 result_;
1281 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1282 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(29);
1283 char* error = function(pimpl_, &result_);
1284 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1285 return result_;
1286 }
1287 /**
1288 * @brief Get the physical size of a voxel along the X-axis.
1289 *
1290 * Get the physical size of a voxel along the X-axis. This call is only valid if this series corresponds to a 3D image.
1291 *
1292 * @return The voxel size.
1293 **/
1294 inline float Series::GetVoxelSizeX()
1295 {
1296 float result_;
1297 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*);
1298 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(30);
1299 char* error = function(pimpl_, &result_);
1300 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1301 return result_;
1302 }
1303 /**
1304 * @brief Get the physical size of a voxel along the Y-axis.
1305 *
1306 * Get the physical size of a voxel along the Y-axis. This call is only valid if this series corresponds to a 3D image.
1307 *
1308 * @return The voxel size.
1309 **/
1310 inline float Series::GetVoxelSizeY()
1311 {
1312 float result_;
1313 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*);
1314 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(31);
1315 char* error = function(pimpl_, &result_);
1316 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1317 return result_;
1318 }
1319 /**
1320 * @brief Get the physical size of a voxel along the Z-axis.
1321 *
1322 * Get the physical size of a voxel along the Z-axis. This call is only valid if this series corresponds to a 3D image.
1323 *
1324 * @return The voxel size.
1325 **/
1326 inline float Series::GetVoxelSizeZ()
1327 {
1328 float result_;
1329 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*);
1330 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(32);
1331 char* error = function(pimpl_, &result_);
1332 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1333 return result_;
1334 }
1335 /**
1336 * @brief Get the slice thickness.
1337 *
1338 * Get the slice thickness. This call is only valid if this series corresponds to a 3D image.
1339 *
1340 * @return The slice thickness.
1341 **/
1342 inline float Series::GetSliceThickness()
1343 {
1344 float result_;
1345 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*);
1346 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(33);
1347 char* error = function(pimpl_, &result_);
1348 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1349 return result_;
1350 }
1351 /**
1352 * @brief Load the 3D image into a memory buffer.
1353 *
1354 * Load the 3D image into a memory buffer. This call is only valid if this series corresponds to a 3D image. The "target" buffer must be wide enough to store all the voxels of the image.
1355 *
1356 * @param target The target memory buffer.
1357 * @param format The memory layout of the voxels.
1358 * @param lineStride The number of bytes between two lines in the target memory buffer.
1359 * @param stackStride The number of bytes between two 2D slices in the target memory buffer.
1360 **/
1361 inline void Series::Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride)
1362 {
1363 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void*, LAAW_INT32, LAAW_INT64, LAAW_INT64);
1364 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(34);
1365 char* error = function(pimpl_, target, format, lineStride, stackStride);
1366 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1367 }
1368 /**
1369 * @brief Load the 3D image into a memory buffer.
1370 *
1371 * Load the 3D image into a memory buffer. This call is only valid if this series corresponds to a 3D image. The "target" buffer must be wide enough to store all the voxels of the image. This method will also update a progress indicator to monitor the loading of the image.
1372 *
1373 * @param target The target memory buffer.
1374 * @param format The memory layout of the voxels.
1375 * @param lineStride The number of bytes between two lines in the target memory buffer.
1376 * @param stackStride The number of bytes between two 2D slices in the target memory buffer.
1377 * @param progress A pointer to a floating-point number that is continuously updated by the download threads to reflect the percentage of completion (between 0 and 1). This value can be read from a separate thread.
1378 **/
1379 inline void Series::Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride, float progress[])
1380 {
1381 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void*, LAAW_INT32, LAAW_INT64, LAAW_INT64, float*);
1382 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(35);
1383 char* error = function(pimpl_, target, format, lineStride, stackStride, progress);
1384 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1385 }
1386 }
1387
1388 namespace OrthancClient
1389 {
1390 /**
1391 * @brief Create a connection to some study.
1392 *
1393 * Create a connection to some study.
1394 *
1395 * @param connection The remote instance of %Orthanc.
1396 * @param id The %Orthanc identifier of the study.
1397 **/
1398 inline Study::Study(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
1399 {
1400 isReference_ = false;
1401 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
1402 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(36);
1403 char* error = function(&pimpl_, connection.pimpl_, id.c_str());
1404 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1405 }
1406 /**
1407 * @brief Destructs the object.
1408 *
1409 * Destructs the object.
1410 *
1411 **/
1412 inline Study::~Study()
1413 {
1414 if (isReference_) return;
1415 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1416 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(37);
1417 char* error = function(pimpl_);
1418 error = error; // Remove warning about unused variable
1419 }
1420 /**
1421 * @brief Reload the series of this study.
1422 *
1423 * This method will reload the list of the series of this study. Pay attention to the fact that the series that have been previously returned by GetSeries() will be invalidated.
1424 *
1425 **/
1426 inline void Study::Reload()
1427 {
1428 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1429 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(38);
1430 char* error = function(pimpl_);
1431 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1432 }
1433 /**
1434 * @brief Return the number of series for this study.
1435 *
1436 * Return the number of series for this study.
1437 *
1438 * @return The number of series.
1439 **/
1440 inline LAAW_UINT32 Study::GetSeriesCount()
1441 {
1442 LAAW_UINT32 result_;
1443 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1444 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(39);
1445 char* error = function(pimpl_, &result_);
1446 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1447 return result_;
1448 }
1449 /**
1450 * @brief Get some series of this study.
1451 *
1452 * This method will return an object that contains information about some series. The series are indexed by a number between 0 (inclusive) and the result of GetSeriesCount() (exclusive).
1453 *
1454 * @param index The index of the series of interest.
1455 * @return The series.
1456 **/
1457 inline ::OrthancClient::Series Study::GetSeries(LAAW_UINT32 index)
1458 {
1459 void* result_;
1460 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
1461 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(40);
1462 char* error = function(pimpl_, &result_, index);
1463 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1464 return ::OrthancClient::Series(result_);
1465 }
1466 /**
1467 * @brief Get the %Orthanc identifier of this study.
1468 *
1469 * Get the %Orthanc identifier of this study.
1470 *
1471 * @return The identifier.
1472 **/
1473 inline ::std::string Study::GetId() const
1474 {
1475 const char* result_;
1476 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1477 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(41);
1478 char* error = function(pimpl_, &result_);
1479 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1480 return std::string(result_);
1481 }
1482 /**
1483 * @brief Get the value of one of the main DICOM tags for this study.
1484 *
1485 * Get the value of one of the main DICOM tags for this study.
1486 *
1487 * @param tag The name of the tag of interest ("StudyDate", "StudyDescription", "StudyInstanceUID" or "StudyTime").
1488 * @param defaultValue The default value to be returned if this tag does not exist.
1489 * @return The value of the tag.
1490 **/
1491 inline ::std::string Study::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const
1492 {
1493 const char* result_;
1494 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*);
1495 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(42);
1496 char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str());
1497 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1498 return std::string(result_);
1499 }
1500 }
1501
1502 namespace OrthancClient
1503 {
1504 /**
1505 * @brief Create a connection to some image instance.
1506 *
1507 * Create a connection to some image instance.
1508 *
1509 * @param connection The remote instance of %Orthanc.
1510 * @param id The %Orthanc identifier of the image instance.
1511 **/
1512 inline Instance::Instance(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
1513 {
1514 isReference_ = false;
1515 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
1516 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(43);
1517 char* error = function(&pimpl_, connection.pimpl_, id.c_str());
1518 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1519 }
1520 /**
1521 * @brief Destructs the object.
1522 *
1523 * Destructs the object.
1524 *
1525 **/
1526 inline Instance::~Instance()
1527 {
1528 if (isReference_) return;
1529 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1530 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(44);
1531 char* error = function(pimpl_);
1532 error = error; // Remove warning about unused variable
1533 }
1534 /**
1535 * @brief Get the %Orthanc identifier of this identifier.
1536 *
1537 * Get the %Orthanc identifier of this identifier.
1538 *
1539 * @return The identifier.
1540 **/
1541 inline ::std::string Instance::GetId() const
1542 {
1543 const char* result_;
1544 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1545 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(45);
1546 char* error = function(pimpl_, &result_);
1547 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1548 return std::string(result_);
1549 }
1550 /**
1551 * @brief Set the extraction mode for the 2D image corresponding to this instance.
1552 *
1553 * Set the extraction mode for the 2D image corresponding to this instance.
1554 *
1555 * @param mode The extraction mode.
1556 **/
1557 inline void Instance::SetImageExtractionMode(::Orthanc::ImageExtractionMode mode)
1558 {
1559 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32);
1560 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(46);
1561 char* error = function(pimpl_, mode);
1562 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1563 }
1564 /**
1565 * @brief Get the extraction mode for the 2D image corresponding to this instance.
1566 *
1567 * Get the extraction mode for the 2D image corresponding to this instance.
1568 *
1569 * @return The extraction mode.
1570 **/
1571 inline ::Orthanc::ImageExtractionMode Instance::GetImageExtractionMode() const
1572 {
1573 LAAW_INT32 result_;
1574 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_INT32*);
1575 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(47);
1576 char* error = function(pimpl_, &result_);
1577 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1578 return static_cast< ::Orthanc::ImageExtractionMode >(result_);
1579 }
1580 /**
1581 * @brief Get the string value of some DICOM tag of this instance.
1582 *
1583 * Get the string value of some DICOM tag of this instance.
1584 *
1585 * @param tag The name of the tag of interest.
1586 * @return The value of the tag.
1587 **/
1588 inline ::std::string Instance::GetTagAsString(const ::std::string& tag) const
1589 {
1590 const char* result_;
1591 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*);
1592 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(48);
1593 char* error = function(pimpl_, &result_, tag.c_str());
1594 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1595 return std::string(result_);
1596 }
1597 /**
1598 * @brief Get the floating point value that is stored in some DICOM tag of this instance.
1599 *
1600 * Get the floating point value that is stored in some DICOM tag of this instance.
1601 *
1602 * @param tag The name of the tag of interest.
1603 * @return The value of the tag.
1604 **/
1605 inline float Instance::GetTagAsFloat(const ::std::string& tag) const
1606 {
1607 float result_;
1608 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, float*, const char*);
1609 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(49);
1610 char* error = function(pimpl_, &result_, tag.c_str());
1611 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1612 return result_;
1613 }
1614 /**
1615 * @brief Get the integer value that is stored in some DICOM tag of this instance.
1616 *
1617 * Get the integer value that is stored in some DICOM tag of this instance.
1618 *
1619 * @param tag The name of the tag of interest.
1620 * @return The value of the tag.
1621 **/
1622 inline LAAW_INT32 Instance::GetTagAsInt(const ::std::string& tag) const
1623 {
1624 LAAW_INT32 result_;
1625 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_INT32*, const char*);
1626 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(50);
1627 char* error = function(pimpl_, &result_, tag.c_str());
1628 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1629 return result_;
1630 }
1631 /**
1632 * @brief Get the width of the 2D image.
1633 *
1634 * Get the width of the 2D image that is encoded by this DICOM instance.
1635 *
1636 * @return The width.
1637 **/
1638 inline LAAW_UINT32 Instance::GetWidth()
1639 {
1640 LAAW_UINT32 result_;
1641 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1642 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(51);
1643 char* error = function(pimpl_, &result_);
1644 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1645 return result_;
1646 }
1647 /**
1648 * @brief Get the height of the 2D image.
1649 *
1650 * Get the height of the 2D image that is encoded by this DICOM instance.
1651 *
1652 * @return The height.
1653 **/
1654 inline LAAW_UINT32 Instance::GetHeight()
1655 {
1656 LAAW_UINT32 result_;
1657 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1658 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(52);
1659 char* error = function(pimpl_, &result_);
1660 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1661 return result_;
1662 }
1663 /**
1664 * @brief Get the number of bytes between two lines of the image (pitch).
1665 *
1666 * Get the number of bytes between two lines of the image in the memory buffer returned by GetBuffer(). This value depends on the extraction mode for the image.
1667 *
1668 * @return The pitch.
1669 **/
1670 inline LAAW_UINT32 Instance::GetPitch()
1671 {
1672 LAAW_UINT32 result_;
1673 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1674 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(53);
1675 char* error = function(pimpl_, &result_);
1676 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1677 return result_;
1678 }
1679 /**
1680 * @brief Get the format of the pixels of the 2D image.
1681 *
1682 * Return the memory layout that is used for the 2D image that is encoded by this DICOM instance. This value depends on the extraction mode for the image.
1683 *
1684 * @return The pixel format.
1685 **/
1686 inline ::Orthanc::PixelFormat Instance::GetPixelFormat()
1687 {
1688 LAAW_INT32 result_;
1689 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32*);
1690 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(54);
1691 char* error = function(pimpl_, &result_);
1692 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1693 return static_cast< ::Orthanc::PixelFormat >(result_);
1694 }
1695 /**
1696 * @brief Access the memory buffer in which the raw pixels of the 2D image are stored.
1697 *
1698 * Access the memory buffer in which the raw pixels of the 2D image are stored.
1699 *
1700 * @return A pointer to the memory buffer.
1701 **/
1702 inline const void* Instance::GetBuffer()
1703 {
1704 const void* result_;
1705 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**);
1706 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(55);
1707 char* error = function(pimpl_, &result_);
1708 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1709 return reinterpret_cast< const void* >(result_);
1710 }
1711 /**
1712 * @brief Access the memory buffer in which the raw pixels of some line of the 2D image are stored.
1713 *
1714 * Access the memory buffer in which the raw pixels of some line of the 2D image are stored.
1715 *
1716 * @param y The line of interest.
1717 * @return A pointer to the memory buffer.
1718 **/
1719 inline const void* Instance::GetBuffer(LAAW_UINT32 y)
1720 {
1721 const void* result_;
1722 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**, LAAW_UINT32);
1723 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(56);
1724 char* error = function(pimpl_, &result_, y);
1725 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1726 return reinterpret_cast< const void* >(result_);
1727 }
1728 /**
1729 * @brief Get the size of the DICOM file corresponding to this instance.
1730 *
1731 * Get the size of the DICOM file corresponding to this instance.
1732 *
1733 * @return The file size.
1734 **/
1735 inline LAAW_UINT64 Instance::GetDicomSize()
1736 {
1737 LAAW_UINT64 result_;
1738 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT64*);
1739 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(57);
1740 char* error = function(pimpl_, &result_);
1741 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1742 return result_;
1743 }
1744 /**
1745 * @brief Get a pointer to the content of the DICOM file corresponding to this instance.
1746 *
1747 * Get a pointer to the content of the DICOM file corresponding to this instance.
1748 *
1749 * @return The DICOM file.
1750 **/
1751 inline const void* Instance::GetDicom()
1752 {
1753 const void* result_;
1754 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**);
1755 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(58);
1756 char* error = function(pimpl_, &result_);
1757 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1758 return reinterpret_cast< const void* >(result_);
1759 }
1760 /**
1761 * @brief Discard the downloaded 2D image, so as to make room in memory.
1762 *
1763 * Discard the downloaded 2D image, so as to make room in memory.
1764 *
1765 **/
1766 inline void Instance::DiscardImage()
1767 {
1768 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1769 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(59);
1770 char* error = function(pimpl_);
1771 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1772 }
1773 /**
1774 * @brief Discard the downloaded DICOM file, so as to make room in memory.
1775 *
1776 * Discard the downloaded DICOM file, so as to make room in memory.
1777 *
1778 **/
1779 inline void Instance::DiscardDicom()
1780 {
1781 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1782 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(60);
1783 char* error = function(pimpl_);
1784 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1785 }
1786 /**
1787 * @brief Load a raw tag from the DICOM file.
1788 *
1789 * Load a raw tag from the DICOM file.
1790 *
1791 * @param path The path to the tag of interest (e.g. "0020-000d").
1792 **/
1793 inline void Instance::LoadTagContent(const ::std::string& path)
1794 {
1795 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const char*);
1796 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(61);
1797 char* error = function(pimpl_, path.c_str());
1798 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1799 }
1800 /**
1801 * @brief Return the value of the raw tag that was loaded by LoadContent.
1802 *
1803 * Return the value of the raw tag that was loaded by LoadContent.
1804 *
1805 * @return The tag value.
1806 **/
1807 inline ::std::string Instance::GetLoadedTagContent() const
1808 {
1809 const char* result_;
1810 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1811 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(62);
1812 char* error = function(pimpl_, &result_);
1813 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1814 return std::string(result_);
1815 }
1816 }
1817