Orthanc Client
Documentation of the client library of Orthanc
OrthancCppClient.h
Go to the documentation of this file.
1 
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.7"
85 #else
86 #define LAAW_ORTHANC_CLIENT_DEFAULT_PATH "libOrthancClient.so.0.7"
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 {
166 class OrthancClientException : public std::exception
167  {
168  private:
169  std::string message_;
170 
171  public:
176  OrthancClientException(std::string message) : message_(message)
177  {
178  }
179 
180  ~OrthancClientException() throw()
181  {
182  }
183 
188  const std::string& What() const throw()
189  {
190  return message_;
191  }
192 };
193 }
194 
195 
196 namespace OrthancClient { namespace Internals {
202 class Library
203  {
204  private:
205  LAAW_ORTHANC_CLIENT_HANDLE_TYPE handle_;
206  LAAW_ORTHANC_CLIENT_FUNCTION_TYPE functionsIndex_[60 + 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(60);
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  {
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  {
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  LAAW_ORTHANC_CLIENT_CLOSER(handle_);
306  handle_ = LAAW_ORTHANC_CLIENT_HANDLE_NULL;
307  }
308  }
309 };
310 }}
311 
312 
320 namespace OrthancClient {
334 inline void Initialize()
335 {
337 }
338 
350 inline void Initialize(const std::string& sharedLibraryPath)
351 {
352  ::OrthancClient::Internals::Library::Initialize(sharedLibraryPath.c_str());
353 }
354 
363 inline void Finalize()
364 {
365  ::OrthancClient::Internals::Library::GetInstance().Finalize();
366 }
367 
368 
372 }
373 
374 
375 namespace OrthancClient { namespace Internals {
376 inline void Library::LoadFunctions()
377 {
378  typedef const char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) ();
379  Function getVersion = (Function) LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_GetVersion", "0");
380  if (getVersion == NULL)
381  {
382  throw ::OrthancClient::OrthancClientException("Unable to get the library version");
383  }
384 
389  if (strcmp(getVersion(), "0.7"))
390  {
391  throw ::OrthancClient::OrthancClientException("Mismatch between the C++ header and the library version");
392  }
393 
394  functionsIndex_[60] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_FreeString", "4");
395  functionsIndex_[3] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_557aee7b61817292a0f31269d3c35db7", "8");
396  functionsIndex_[4] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_0b8dff0ce67f10954a49b059e348837e", "8");
397  functionsIndex_[5] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_e05097c153f676e5a5ee54dcfc78256f", "4");
398  functionsIndex_[6] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_e840242bf58d17d3c1d722da09ce88e0", "8");
399  functionsIndex_[7] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_c9af31433001b5dfc012a552dc6d0050", "8");
400  functionsIndex_[8] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_3fba4d6b818180a44cd1cae6046334dc", "12");
401  functionsIndex_[9] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_aeb20dc75b9246188db857317e5e0ce7", "8");
402  functionsIndex_[10] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_62689803d9871e4d9c51a648640b320b", "8");
403  functionsIndex_[11] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2fb64c9e5a67eccd413b0e913469a421", "16");
404  functionsIndex_[0] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1f1acb322ea4d0aad65172824607673c", "8");
405  functionsIndex_[1] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_f3fd272e4636f6a531aabb72ee01cd5b", "16");
406  functionsIndex_[2] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_12d3de0a96e9efb11136a9811bb9ed38", "4");
407  functionsIndex_[14] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_f756172daf04516eec3a566adabb4335", "4");
408  functionsIndex_[15] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_ddb68763ec902a97d579666a73a20118", "8");
409  functionsIndex_[16] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_fba3c68b4be7558dbc65f7ce1ab57d63", "12");
410  functionsIndex_[17] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b4ca99d958f843493e58d1ef967340e1", "8");
411  functionsIndex_[18] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_78d5cc76d282437b6f93ec3b82c35701", "16");
412  functionsIndex_[12] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_6cf0d7268667f9b0aa4511bacf184919", "12");
413  functionsIndex_[13] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_7d81cd502ee27e859735d0ea7112b5a1", "4");
414  functionsIndex_[21] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_48a2a1a9d68c047e22bfba23014643d2", "4");
415  functionsIndex_[22] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_852bf8296ca21c5fde5ec565cc10721d", "8");
416  functionsIndex_[23] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_efd04574e0779faa83df1f2d8f9888db", "12");
417  functionsIndex_[24] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_736247ff5e8036dac38163da6f666ed5", "8");
418  functionsIndex_[25] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_d82d2598a7a73f4b6fcc0c09c25b08ca", "8");
419  functionsIndex_[26] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_88134b978f9acb2aecdadf54aeab3c64", "16");
420  functionsIndex_[27] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_152cb1b704c053d24b0dab7461ba6ea3", "8");
421  functionsIndex_[28] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_eee03f337ec81d9f1783cd41e5238757", "8");
422  functionsIndex_[29] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_006f08237bd7611636fc721baebfb4c5", "8");
423  functionsIndex_[30] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b794f5cd3dad7d7b575dd1fd902afdd0", "8");
424  functionsIndex_[31] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_8ee2e50dd9df8f66a3c1766090dd03ab", "8");
425  functionsIndex_[32] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_046aed35bbe4751691f4c34cc249a61d", "8");
426  functionsIndex_[33] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_4dcc7a0fd025efba251ac6e9b701c2c5", "28");
427  functionsIndex_[34] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b2601a161c24ad0a1d3586246f87452c", "32");
428  functionsIndex_[19] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_193599b9e345384fcdfcd47c29c55342", "12");
429  functionsIndex_[20] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_7c97f17063a357d38c5fab1136ad12a0", "4");
430  functionsIndex_[37] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_e65b20b7e0170b67544cd6664a4639b7", "4");
431  functionsIndex_[38] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_470e981b0e41f17231ba0ae6f3033321", "8");
432  functionsIndex_[39] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_04cefd138b6ea15ad909858f2a0a8f05", "12");
433  functionsIndex_[40] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_aee5b1f6f0c082f2c3b0986f9f6a18c7", "8");
434  functionsIndex_[41] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_93965682bace75491413e1f0b8d5a654", "16");
435  functionsIndex_[35] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b01c6003238eb46c8db5dc823d7ca678", "12");
436  functionsIndex_[36] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_0147007fb99bad8cd95a139ec8795376", "4");
437  functionsIndex_[44] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_236ee8b403bc99535a8a4695c0cd45cb", "8");
438  functionsIndex_[45] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2a437b7aba6bb01e81113835be8f0146", "8");
439  functionsIndex_[46] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2bcbcb850934ae0bb4c6f0cc940e6cda", "8");
440  functionsIndex_[47] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_8d415c3a78a48e7e61d9fd24e7c79484", "12");
441  functionsIndex_[48] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_70d2f8398bbc63b5f792b69b4ad5fecb", "12");
442  functionsIndex_[49] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1729a067d902771517388eedd7346b23", "12");
443  functionsIndex_[50] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_72e2aeee66cd3abd8ab7e987321c3745", "8");
444  functionsIndex_[51] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1ea3df5a1ac1a1a687fe7325adddb6f0", "8");
445  functionsIndex_[52] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_99b4f370e4f532d8b763e2cb49db92f8", "8");
446  functionsIndex_[53] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_c41c742b68617f1c0590577a0a5ebc0c", "8");
447  functionsIndex_[54] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_142dd2feba0fc1d262bbd0baeb441a8b", "8");
448  functionsIndex_[55] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_5f5c9f81a4dff8daa6c359f1d0488fef", "12");
449  functionsIndex_[56] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_9ca979fffd08fa256306d4e68d8b0e91", "8");
450  functionsIndex_[57] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_6f2d77a26edc91c28d89408dbc3c271e", "8");
451  functionsIndex_[58] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_c0f494b80d4ff8b232df7a75baa0700a", "4");
452  functionsIndex_[59] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_d604f44bd5195e082e745e9cbc164f4c", "4");
453  functionsIndex_[42] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_6c5ad02f91b583e29cebd0bd319ce21d", "12");
454  functionsIndex_[43] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_4068241c44a9c1367fe0e57be523f207", "4");
455 
456  /* Check whether the functions were properly loaded */
457  for (unsigned int i = 0; i <= 60; i++)
458  {
459  if (functionsIndex_[i] == (LAAW_ORTHANC_CLIENT_FUNCTION_TYPE) NULL)
460  {
461  throw ::OrthancClient::OrthancClientException("Unable to load the functions of the shared library");
462  }
463  }
464 }
465 }}
466 namespace OrthancClient
467 {
468  class OrthancConnection;
469 }
470 
471 namespace OrthancClient
472 {
473  class Patient;
474 }
475 
476 namespace OrthancClient
477 {
478  class Series;
479 }
480 
481 namespace OrthancClient
482 {
483  class Study;
484 }
485 
486 namespace OrthancClient
487 {
488  class Instance;
489 }
490 
491 namespace Orthanc
492 {
501  {
530  };
531 }
532 
533 namespace Orthanc
534 {
543  {
572  };
573 }
574 
575 namespace OrthancClient
576 {
584  {
585  friend class ::OrthancClient::Patient;
586  friend class ::OrthancClient::Series;
587  friend class ::OrthancClient::Study;
588  friend class ::OrthancClient::Instance;
589  private:
590  bool isReference_;
591  OrthancConnection& operator= (const OrthancConnection&); // Assignment is forbidden
592  void* pimpl_;
593  OrthancConnection(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
594  public:
602  OrthancConnection(const OrthancConnection& other) : isReference_(true), pimpl_(other.pimpl_) { }
603  inline OrthancConnection(const ::std::string& orthancUrl);
604  inline OrthancConnection(const ::std::string& orthancUrl, const ::std::string& username, const ::std::string& password);
605  inline ~OrthancConnection();
606  inline LAAW_UINT32 GetThreadCount() const;
607  inline void SetThreadCount(LAAW_UINT32 threadCount);
608  inline void Reload();
609  inline ::std::string GetOrthancUrl() const;
610  inline LAAW_UINT32 GetPatientCount();
611  inline ::OrthancClient::Patient GetPatient(LAAW_UINT32 index);
612  inline void DeletePatient(LAAW_UINT32 index);
613  inline void StoreFile(const ::std::string& filename);
614  inline void Store(const void* dicom, LAAW_UINT64 size);
615  };
616 }
617 
618 namespace OrthancClient
619 {
626  class Patient
627  {
628  friend class ::OrthancClient::OrthancConnection;
629  friend class ::OrthancClient::Series;
630  friend class ::OrthancClient::Study;
631  friend class ::OrthancClient::Instance;
632  private:
633  bool isReference_;
634  Patient& operator= (const Patient&); // Assignment is forbidden
635  void* pimpl_;
636  Patient(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
637  public:
645  Patient(const Patient& other) : isReference_(true), pimpl_(other.pimpl_) { }
646  inline Patient(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
647  inline ~Patient();
648  inline void Reload();
649  inline LAAW_UINT32 GetStudyCount();
650  inline ::OrthancClient::Study GetStudy(LAAW_UINT32 index);
651  inline ::std::string GetId() const;
652  inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const;
653  };
654 }
655 
656 namespace OrthancClient
657 {
664  class Series
665  {
666  friend class ::OrthancClient::OrthancConnection;
667  friend class ::OrthancClient::Patient;
668  friend class ::OrthancClient::Study;
669  friend class ::OrthancClient::Instance;
670  private:
671  bool isReference_;
672  Series& operator= (const Series&); // Assignment is forbidden
673  void* pimpl_;
674  Series(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
675  public:
683  Series(const Series& other) : isReference_(true), pimpl_(other.pimpl_) { }
684  inline Series(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
685  inline ~Series();
686  inline void Reload();
687  inline LAAW_UINT32 GetInstanceCount();
688  inline ::OrthancClient::Instance GetInstance(LAAW_UINT32 index);
689  inline ::std::string GetId() const;
690  inline ::std::string GetUrl() const;
691  inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const;
692  inline bool Is3DImage();
693  inline LAAW_UINT32 GetWidth();
694  inline LAAW_UINT32 GetHeight();
695  inline float GetVoxelSizeX();
696  inline float GetVoxelSizeY();
697  inline float GetVoxelSizeZ();
698  inline void Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride);
699  inline void Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride, float progress[]);
700  };
701 }
702 
703 namespace OrthancClient
704 {
711  class Study
712  {
713  friend class ::OrthancClient::OrthancConnection;
714  friend class ::OrthancClient::Patient;
715  friend class ::OrthancClient::Series;
716  friend class ::OrthancClient::Instance;
717  private:
718  bool isReference_;
719  Study& operator= (const Study&); // Assignment is forbidden
720  void* pimpl_;
721  Study(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
722  public:
730  Study(const Study& other) : isReference_(true), pimpl_(other.pimpl_) { }
731  inline Study(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
732  inline ~Study();
733  inline void Reload();
734  inline LAAW_UINT32 GetSeriesCount();
735  inline ::OrthancClient::Series GetSeries(LAAW_UINT32 index);
736  inline ::std::string GetId() const;
737  inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const;
738  };
739 }
740 
741 namespace OrthancClient
742 {
749  class Instance
750  {
751  friend class ::OrthancClient::OrthancConnection;
752  friend class ::OrthancClient::Patient;
753  friend class ::OrthancClient::Series;
754  friend class ::OrthancClient::Study;
755  private:
756  bool isReference_;
757  Instance& operator= (const Instance&); // Assignment is forbidden
758  void* pimpl_;
759  Instance(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
760  public:
768  Instance(const Instance& other) : isReference_(true), pimpl_(other.pimpl_) { }
769  inline Instance(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
770  inline ~Instance();
771  inline ::std::string GetId() const;
774  inline ::std::string GetTagAsString(const ::std::string& tag) const;
775  inline float GetTagAsFloat(const ::std::string& tag) const;
776  inline LAAW_INT32 GetTagAsInt(const ::std::string& tag) const;
777  inline LAAW_UINT32 GetWidth();
778  inline LAAW_UINT32 GetHeight();
779  inline LAAW_UINT32 GetPitch();
781  inline const void* GetBuffer();
782  inline const void* GetBuffer(LAAW_UINT32 y);
783  inline LAAW_UINT64 GetDicomSize();
784  inline const void* GetDicom();
785  inline void DiscardImage();
786  inline void DiscardDicom();
787  };
788 }
789 
790 namespace OrthancClient
791 {
799  inline OrthancConnection::OrthancConnection(const ::std::string& orthancUrl)
800  {
801  isReference_ = false;
802  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, const char*);
803  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(0);
804  char* error = function(&pimpl_, orthancUrl.c_str());
805  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
806  }
816  inline OrthancConnection::OrthancConnection(const ::std::string& orthancUrl, const ::std::string& username, const ::std::string& password)
817  {
818  isReference_ = false;
819  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, const char*, const char*, const char*);
820  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(1);
821  char* error = function(&pimpl_, orthancUrl.c_str(), username.c_str(), password.c_str());
822  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
823  }
831  {
832  if (isReference_) return;
833  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
834  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(2);
835  char* error = function(pimpl_);
836  error = error; // Remove warning about unused variable
837  }
845  inline LAAW_UINT32 OrthancConnection::GetThreadCount() const
846  {
847  LAAW_UINT32 result_;
848  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_UINT32*);
849  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(3);
850  char* error = function(pimpl_, &result_);
851  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
852  return result_;
853  }
861  inline void OrthancConnection::SetThreadCount(LAAW_UINT32 threadCount)
862  {
863  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32);
864  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(4);
865  char* error = function(pimpl_, threadCount);
866  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
867  }
875  {
876  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
877  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(5);
878  char* error = function(pimpl_);
879  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
880  }
888  inline ::std::string OrthancConnection::GetOrthancUrl() const
889  {
890  const char* result_;
891  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
892  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(6);
893  char* error = function(pimpl_, &result_);
894  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
895  return std::string(result_);
896  }
905  {
906  LAAW_UINT32 result_;
907  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
908  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(7);
909  char* error = function(pimpl_, &result_);
910  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
911  return result_;
912  }
921  inline ::OrthancClient::Patient OrthancConnection::GetPatient(LAAW_UINT32 index)
922  {
923  void* result_;
924  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
925  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(8);
926  char* error = function(pimpl_, &result_, index);
927  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
928  return ::OrthancClient::Patient(result_);
929  }
938  inline void OrthancConnection::DeletePatient(LAAW_UINT32 index)
939  {
940  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32);
941  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(9);
942  char* error = function(pimpl_, index);
943  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
944  }
952  inline void OrthancConnection::StoreFile(const ::std::string& filename)
953  {
954  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const char*);
955  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(10);
956  char* error = function(pimpl_, filename.c_str());
957  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
958  }
967  inline void OrthancConnection::Store(const void* dicom, LAAW_UINT64 size)
968  {
969  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void*, LAAW_UINT64);
970  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(11);
971  char* error = function(pimpl_, dicom, size);
972  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
973  }
974 }
975 
976 namespace OrthancClient
977 {
986  inline Patient::Patient(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
987  {
988  isReference_ = false;
989  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
990  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(12);
991  char* error = function(&pimpl_, connection.pimpl_, id.c_str());
992  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
993  }
1001  {
1002  if (isReference_) return;
1003  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1004  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(13);
1005  char* error = function(pimpl_);
1006  error = error; // Remove warning about unused variable
1007  }
1014  inline void Patient::Reload()
1015  {
1016  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1017  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(14);
1018  char* error = function(pimpl_);
1019  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1020  }
1028  inline LAAW_UINT32 Patient::GetStudyCount()
1029  {
1030  LAAW_UINT32 result_;
1031  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1032  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(15);
1033  char* error = function(pimpl_, &result_);
1034  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1035  return result_;
1036  }
1045  inline ::OrthancClient::Study Patient::GetStudy(LAAW_UINT32 index)
1046  {
1047  void* result_;
1048  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
1049  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(16);
1050  char* error = function(pimpl_, &result_, index);
1051  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1052  return ::OrthancClient::Study(result_);
1053  }
1061  inline ::std::string Patient::GetId() const
1062  {
1063  const char* result_;
1064  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1065  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(17);
1066  char* error = function(pimpl_, &result_);
1067  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1068  return std::string(result_);
1069  }
1079  inline ::std::string Patient::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const
1080  {
1081  const char* result_;
1082  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*);
1083  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(18);
1084  char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str());
1085  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1086  return std::string(result_);
1087  }
1088 }
1089 
1090 namespace OrthancClient
1091 {
1100  inline Series::Series(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
1101  {
1102  isReference_ = false;
1103  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
1104  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(19);
1105  char* error = function(&pimpl_, connection.pimpl_, id.c_str());
1106  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1107  }
1115  {
1116  if (isReference_) return;
1117  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1118  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(20);
1119  char* error = function(pimpl_);
1120  error = error; // Remove warning about unused variable
1121  }
1128  inline void Series::Reload()
1129  {
1130  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1131  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(21);
1132  char* error = function(pimpl_);
1133  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1134  }
1142  inline LAAW_UINT32 Series::GetInstanceCount()
1143  {
1144  LAAW_UINT32 result_;
1145  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1146  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(22);
1147  char* error = function(pimpl_, &result_);
1148  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1149  return result_;
1150  }
1159  inline ::OrthancClient::Instance Series::GetInstance(LAAW_UINT32 index)
1160  {
1161  void* result_;
1162  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
1163  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(23);
1164  char* error = function(pimpl_, &result_, index);
1165  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1166  return ::OrthancClient::Instance(result_);
1167  }
1175  inline ::std::string Series::GetId() const
1176  {
1177  const char* result_;
1178  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1179  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(24);
1180  char* error = function(pimpl_, &result_);
1181  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1182  return std::string(result_);
1183  }
1191  inline ::std::string Series::GetUrl() const
1192  {
1193  const char* result_;
1194  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1195  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(25);
1196  char* error = function(pimpl_, &result_);
1197  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1198  return std::string(result_);
1199  }
1209  inline ::std::string Series::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const
1210  {
1211  const char* result_;
1212  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*);
1213  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(26);
1214  char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str());
1215  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1216  return std::string(result_);
1217  }
1225  inline bool Series::Is3DImage()
1226  {
1227  LAAW_INT32 result_;
1228  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32*);
1229  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(27);
1230  char* error = function(pimpl_, &result_);
1231  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1232  return result_ != 0;
1233  }
1241  inline LAAW_UINT32 Series::GetWidth()
1242  {
1243  LAAW_UINT32 result_;
1244  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1245  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(28);
1246  char* error = function(pimpl_, &result_);
1247  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1248  return result_;
1249  }
1257  inline LAAW_UINT32 Series::GetHeight()
1258  {
1259  LAAW_UINT32 result_;
1260  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1261  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(29);
1262  char* error = function(pimpl_, &result_);
1263  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1264  return result_;
1265  }
1273  inline float Series::GetVoxelSizeX()
1274  {
1275  float result_;
1276  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*);
1277  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(30);
1278  char* error = function(pimpl_, &result_);
1279  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1280  return result_;
1281  }
1289  inline float Series::GetVoxelSizeY()
1290  {
1291  float result_;
1292  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*);
1293  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(31);
1294  char* error = function(pimpl_, &result_);
1295  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1296  return result_;
1297  }
1305  inline float Series::GetVoxelSizeZ()
1306  {
1307  float result_;
1308  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*);
1309  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(32);
1310  char* error = function(pimpl_, &result_);
1311  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1312  return result_;
1313  }
1324  inline void Series::Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride)
1325  {
1326  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void*, LAAW_INT32, LAAW_INT64, LAAW_INT64);
1327  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(33);
1328  char* error = function(pimpl_, target, format, lineStride, stackStride);
1329  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1330  }
1342  inline void Series::Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride, float progress[])
1343  {
1344  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void*, LAAW_INT32, LAAW_INT64, LAAW_INT64, float*);
1345  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(34);
1346  char* error = function(pimpl_, target, format, lineStride, stackStride, progress);
1347  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1348  }
1349 }
1350 
1351 namespace OrthancClient
1352 {
1361  inline Study::Study(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
1362  {
1363  isReference_ = false;
1364  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
1365  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(35);
1366  char* error = function(&pimpl_, connection.pimpl_, id.c_str());
1367  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1368  }
1375  inline Study::~Study()
1376  {
1377  if (isReference_) return;
1378  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1379  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(36);
1380  char* error = function(pimpl_);
1381  error = error; // Remove warning about unused variable
1382  }
1389  inline void Study::Reload()
1390  {
1391  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1392  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(37);
1393  char* error = function(pimpl_);
1394  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1395  }
1403  inline LAAW_UINT32 Study::GetSeriesCount()
1404  {
1405  LAAW_UINT32 result_;
1406  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1407  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(38);
1408  char* error = function(pimpl_, &result_);
1409  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1410  return result_;
1411  }
1420  inline ::OrthancClient::Series Study::GetSeries(LAAW_UINT32 index)
1421  {
1422  void* result_;
1423  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
1424  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(39);
1425  char* error = function(pimpl_, &result_, index);
1426  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1427  return ::OrthancClient::Series(result_);
1428  }
1436  inline ::std::string Study::GetId() const
1437  {
1438  const char* result_;
1439  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1440  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(40);
1441  char* error = function(pimpl_, &result_);
1442  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1443  return std::string(result_);
1444  }
1454  inline ::std::string Study::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const
1455  {
1456  const char* result_;
1457  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*);
1458  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(41);
1459  char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str());
1460  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1461  return std::string(result_);
1462  }
1463 }
1464 
1465 namespace OrthancClient
1466 {
1475  inline Instance::Instance(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
1476  {
1477  isReference_ = false;
1478  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
1479  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(42);
1480  char* error = function(&pimpl_, connection.pimpl_, id.c_str());
1481  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1482  }
1490  {
1491  if (isReference_) return;
1492  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1493  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(43);
1494  char* error = function(pimpl_);
1495  error = error; // Remove warning about unused variable
1496  }
1504  inline ::std::string Instance::GetId() const
1505  {
1506  const char* result_;
1507  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1508  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(44);
1509  char* error = function(pimpl_, &result_);
1510  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1511  return std::string(result_);
1512  }
1521  {
1522  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32);
1523  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(45);
1524  char* error = function(pimpl_, mode);
1525  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1526  }
1535  {
1536  LAAW_INT32 result_;
1537  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_INT32*);
1538  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(46);
1539  char* error = function(pimpl_, &result_);
1540  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1541  return static_cast< ::Orthanc::ImageExtractionMode >(result_);
1542  }
1551  inline ::std::string Instance::GetTagAsString(const ::std::string& tag) const
1552  {
1553  const char* result_;
1554  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*);
1555  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(47);
1556  char* error = function(pimpl_, &result_, tag.c_str());
1557  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1558  return std::string(result_);
1559  }
1568  inline float Instance::GetTagAsFloat(const ::std::string& tag) const
1569  {
1570  float result_;
1571  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, float*, const char*);
1572  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(48);
1573  char* error = function(pimpl_, &result_, tag.c_str());
1574  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1575  return result_;
1576  }
1585  inline LAAW_INT32 Instance::GetTagAsInt(const ::std::string& tag) const
1586  {
1587  LAAW_INT32 result_;
1588  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_INT32*, const char*);
1589  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(49);
1590  char* error = function(pimpl_, &result_, tag.c_str());
1591  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1592  return result_;
1593  }
1601  inline LAAW_UINT32 Instance::GetWidth()
1602  {
1603  LAAW_UINT32 result_;
1604  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1605  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(50);
1606  char* error = function(pimpl_, &result_);
1607  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1608  return result_;
1609  }
1617  inline LAAW_UINT32 Instance::GetHeight()
1618  {
1619  LAAW_UINT32 result_;
1620  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1621  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(51);
1622  char* error = function(pimpl_, &result_);
1623  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1624  return result_;
1625  }
1633  inline LAAW_UINT32 Instance::GetPitch()
1634  {
1635  LAAW_UINT32 result_;
1636  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1637  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(52);
1638  char* error = function(pimpl_, &result_);
1639  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1640  return result_;
1641  }
1650  {
1651  LAAW_INT32 result_;
1652  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32*);
1653  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(53);
1654  char* error = function(pimpl_, &result_);
1655  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1656  return static_cast< ::Orthanc::PixelFormat >(result_);
1657  }
1665  inline const void* Instance::GetBuffer()
1666  {
1667  const void* result_;
1668  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**);
1669  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(54);
1670  char* error = function(pimpl_, &result_);
1671  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1672  return reinterpret_cast< const void* >(result_);
1673  }
1682  inline const void* Instance::GetBuffer(LAAW_UINT32 y)
1683  {
1684  const void* result_;
1685  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**, LAAW_UINT32);
1686  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(55);
1687  char* error = function(pimpl_, &result_, y);
1688  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1689  return reinterpret_cast< const void* >(result_);
1690  }
1698  inline LAAW_UINT64 Instance::GetDicomSize()
1699  {
1700  LAAW_UINT64 result_;
1701  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT64*);
1702  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(56);
1703  char* error = function(pimpl_, &result_);
1704  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1705  return result_;
1706  }
1714  inline const void* Instance::GetDicom()
1715  {
1716  const void* result_;
1717  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**);
1718  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(57);
1719  char* error = function(pimpl_, &result_);
1720  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1721  return reinterpret_cast< const void* >(result_);
1722  }
1730  {
1731  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1732  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(58);
1733  char* error = function(pimpl_);
1734  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1735  }
1743  {
1744  typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1745  Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(59);
1746  char* error = function(pimpl_);
1747  ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1748  }
1749 }
1750