Orthanc Plugin SDK  1.9.7
Documentation of the plugin interface of Orthanc
OrthancCPlugin.h
1 
104 #pragma once
105 
106 
107 #include <stdio.h>
108 #include <string.h>
109 
110 #ifdef WIN32
111 # define ORTHANC_PLUGINS_API __declspec(dllexport)
112 #elif __GNUC__ >= 4
113 # define ORTHANC_PLUGINS_API __attribute__ ((visibility ("default")))
114 #else
115 # define ORTHANC_PLUGINS_API
116 #endif
117 
118 #define ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER 1
119 #define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER 9
120 #define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 2
121 
122 
123 #if !defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)
124 #define ORTHANC_PLUGINS_VERSION_IS_ABOVE(major, minor, revision) \
125  (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER > major || \
126  (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER == major && \
127  (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER > minor || \
128  (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER == minor && \
129  ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER >= revision))))
130 #endif
131 
132 
133 
134 /********************************************************************
135  ** Check that function inlining is properly supported. The use of
136  ** inlining is required, to avoid the duplication of object code
137  ** between two compilation modules that would use the Orthanc Plugin
138  ** API.
139  ********************************************************************/
140 
141 /* If the auto-detection of the "inline" keyword below does not work
142  automatically and that your compiler is known to properly support
143  inlining, uncomment the following #define and adapt the definition
144  of "static inline". */
145 
146 /* #define ORTHANC_PLUGIN_INLINE static inline */
147 
148 #ifndef ORTHANC_PLUGIN_INLINE
149 # if __STDC_VERSION__ >= 199901L
150 /* This is C99 or above: http://predef.sourceforge.net/prestd.html */
151 # define ORTHANC_PLUGIN_INLINE static inline
152 # elif defined(__cplusplus)
153 /* This is C++ */
154 # define ORTHANC_PLUGIN_INLINE static inline
155 # elif defined(__GNUC__)
156 /* This is GCC running in C89 mode */
157 # define ORTHANC_PLUGIN_INLINE static __inline
158 # elif defined(_MSC_VER)
159 /* This is Visual Studio running in C89 mode */
160 # define ORTHANC_PLUGIN_INLINE static __inline
161 # else
162 # error Your compiler is not known to support the "inline" keyword
163 # endif
164 #endif
165 
166 
167 
168 /********************************************************************
169  ** Inclusion of standard libraries.
170  ********************************************************************/
171 
177 #include <stdint.h>
178 
179 #include <stdlib.h>
180 
181 
182 
183 /********************************************************************
184  ** Definition of the Orthanc Plugin API.
185  ********************************************************************/
186 
189 #ifdef __cplusplus
190 extern "C"
191 {
192 #endif
193 
197  typedef enum
198  {
306 
307  _OrthancPluginErrorCode_INTERNAL = 0x7fffffff
309 
310 
315  ORTHANC_PLUGINS_API const char* OrthancPluginGetName();
316 
317 
321  typedef enum
322  {
328  _OrthancPluginHttpMethod_INTERNAL = 0x7fffffff
330 
331 
336  typedef struct
337  {
342 
346  uint32_t groupsCount;
347 
351  const char* const* groups;
352 
356  uint32_t getCount;
357 
361  const char* const* getKeys;
362 
366  const char* const* getValues;
367 
371  const void* body;
372 
376  uint32_t bodySize;
377 
378 
379  /* --------------------------------------------------
380  New in version 0.8.1
381  -------------------------------------------------- */
382 
386  uint32_t headersCount;
387 
391  const char* const* headersKeys;
392 
396  const char* const* headersValues;
397 
399 
400 
401  typedef enum
402  {
403  /* Generic services */
404  _OrthancPluginService_LogInfo = 1,
405  _OrthancPluginService_LogWarning = 2,
406  _OrthancPluginService_LogError = 3,
407  _OrthancPluginService_GetOrthancPath = 4,
408  _OrthancPluginService_GetOrthancDirectory = 5,
409  _OrthancPluginService_GetConfigurationPath = 6,
410  _OrthancPluginService_SetPluginProperty = 7,
411  _OrthancPluginService_GetGlobalProperty = 8,
412  _OrthancPluginService_SetGlobalProperty = 9,
413  _OrthancPluginService_GetCommandLineArgumentsCount = 10,
414  _OrthancPluginService_GetCommandLineArgument = 11,
415  _OrthancPluginService_GetExpectedDatabaseVersion = 12,
416  _OrthancPluginService_GetConfiguration = 13,
417  _OrthancPluginService_BufferCompression = 14,
418  _OrthancPluginService_ReadFile = 15,
419  _OrthancPluginService_WriteFile = 16,
420  _OrthancPluginService_GetErrorDescription = 17,
421  _OrthancPluginService_CallHttpClient = 18,
422  _OrthancPluginService_RegisterErrorCode = 19,
423  _OrthancPluginService_RegisterDictionaryTag = 20,
424  _OrthancPluginService_DicomBufferToJson = 21,
425  _OrthancPluginService_DicomInstanceToJson = 22,
426  _OrthancPluginService_CreateDicom = 23,
427  _OrthancPluginService_ComputeMd5 = 24,
428  _OrthancPluginService_ComputeSha1 = 25,
429  _OrthancPluginService_LookupDictionary = 26,
430  _OrthancPluginService_CallHttpClient2 = 27,
431  _OrthancPluginService_GenerateUuid = 28,
432  _OrthancPluginService_RegisterPrivateDictionaryTag = 29,
433  _OrthancPluginService_AutodetectMimeType = 30,
434  _OrthancPluginService_SetMetricsValue = 31,
435  _OrthancPluginService_EncodeDicomWebJson = 32,
436  _OrthancPluginService_EncodeDicomWebXml = 33,
437  _OrthancPluginService_ChunkedHttpClient = 34, /* New in Orthanc 1.5.7 */
438  _OrthancPluginService_GetTagName = 35, /* New in Orthanc 1.5.7 */
439  _OrthancPluginService_EncodeDicomWebJson2 = 36, /* New in Orthanc 1.7.0 */
440  _OrthancPluginService_EncodeDicomWebXml2 = 37, /* New in Orthanc 1.7.0 */
441  _OrthancPluginService_CreateMemoryBuffer = 38, /* New in Orthanc 1.7.0 */
442  _OrthancPluginService_GenerateRestApiAuthorizationToken = 39, /* New in Orthanc 1.8.1 */
443  _OrthancPluginService_CreateMemoryBuffer64 = 40, /* New in Orthanc 1.9.0 */
444  _OrthancPluginService_CreateDicom2 = 41, /* New in Orthanc 1.9.0 */
445 
446  /* Registration of callbacks */
447  _OrthancPluginService_RegisterRestCallback = 1000,
448  _OrthancPluginService_RegisterOnStoredInstanceCallback = 1001,
449  _OrthancPluginService_RegisterStorageArea = 1002,
450  _OrthancPluginService_RegisterOnChangeCallback = 1003,
451  _OrthancPluginService_RegisterRestCallbackNoLock = 1004,
452  _OrthancPluginService_RegisterWorklistCallback = 1005,
453  _OrthancPluginService_RegisterDecodeImageCallback = 1006,
454  _OrthancPluginService_RegisterIncomingHttpRequestFilter = 1007,
455  _OrthancPluginService_RegisterFindCallback = 1008,
456  _OrthancPluginService_RegisterMoveCallback = 1009,
457  _OrthancPluginService_RegisterIncomingHttpRequestFilter2 = 1010,
458  _OrthancPluginService_RegisterRefreshMetricsCallback = 1011,
459  _OrthancPluginService_RegisterChunkedRestCallback = 1012, /* New in Orthanc 1.5.7 */
460  _OrthancPluginService_RegisterStorageCommitmentScpCallback = 1013,
461  _OrthancPluginService_RegisterIncomingDicomInstanceFilter = 1014,
462  _OrthancPluginService_RegisterTranscoderCallback = 1015, /* New in Orthanc 1.7.0 */
463  _OrthancPluginService_RegisterStorageArea2 = 1016, /* New in Orthanc 1.9.0 */
464 
465  /* Sending answers to REST calls */
466  _OrthancPluginService_AnswerBuffer = 2000,
467  _OrthancPluginService_CompressAndAnswerPngImage = 2001, /* Unused as of Orthanc 0.9.4 */
468  _OrthancPluginService_Redirect = 2002,
469  _OrthancPluginService_SendHttpStatusCode = 2003,
470  _OrthancPluginService_SendUnauthorized = 2004,
471  _OrthancPluginService_SendMethodNotAllowed = 2005,
472  _OrthancPluginService_SetCookie = 2006,
473  _OrthancPluginService_SetHttpHeader = 2007,
474  _OrthancPluginService_StartMultipartAnswer = 2008,
475  _OrthancPluginService_SendMultipartItem = 2009,
476  _OrthancPluginService_SendHttpStatus = 2010,
477  _OrthancPluginService_CompressAndAnswerImage = 2011,
478  _OrthancPluginService_SendMultipartItem2 = 2012,
479  _OrthancPluginService_SetHttpErrorDetails = 2013,
480 
481  /* Access to the Orthanc database and API */
482  _OrthancPluginService_GetDicomForInstance = 3000,
483  _OrthancPluginService_RestApiGet = 3001,
484  _OrthancPluginService_RestApiPost = 3002,
485  _OrthancPluginService_RestApiDelete = 3003,
486  _OrthancPluginService_RestApiPut = 3004,
487  _OrthancPluginService_LookupPatient = 3005,
488  _OrthancPluginService_LookupStudy = 3006,
489  _OrthancPluginService_LookupSeries = 3007,
490  _OrthancPluginService_LookupInstance = 3008,
491  _OrthancPluginService_LookupStudyWithAccessionNumber = 3009,
492  _OrthancPluginService_RestApiGetAfterPlugins = 3010,
493  _OrthancPluginService_RestApiPostAfterPlugins = 3011,
494  _OrthancPluginService_RestApiDeleteAfterPlugins = 3012,
495  _OrthancPluginService_RestApiPutAfterPlugins = 3013,
496  _OrthancPluginService_ReconstructMainDicomTags = 3014,
497  _OrthancPluginService_RestApiGet2 = 3015,
498  _OrthancPluginService_CallRestApi = 3016, /* New in Orthanc 1.9.2 */
499 
500  /* Access to DICOM instances */
501  _OrthancPluginService_GetInstanceRemoteAet = 4000,
502  _OrthancPluginService_GetInstanceSize = 4001,
503  _OrthancPluginService_GetInstanceData = 4002,
504  _OrthancPluginService_GetInstanceJson = 4003,
505  _OrthancPluginService_GetInstanceSimplifiedJson = 4004,
506  _OrthancPluginService_HasInstanceMetadata = 4005,
507  _OrthancPluginService_GetInstanceMetadata = 4006,
508  _OrthancPluginService_GetInstanceOrigin = 4007,
509  _OrthancPluginService_GetInstanceTransferSyntaxUid = 4008,
510  _OrthancPluginService_HasInstancePixelData = 4009,
511  _OrthancPluginService_CreateDicomInstance = 4010, /* New in Orthanc 1.7.0 */
512  _OrthancPluginService_FreeDicomInstance = 4011, /* New in Orthanc 1.7.0 */
513  _OrthancPluginService_GetInstanceFramesCount = 4012, /* New in Orthanc 1.7.0 */
514  _OrthancPluginService_GetInstanceRawFrame = 4013, /* New in Orthanc 1.7.0 */
515  _OrthancPluginService_GetInstanceDecodedFrame = 4014, /* New in Orthanc 1.7.0 */
516  _OrthancPluginService_TranscodeDicomInstance = 4015, /* New in Orthanc 1.7.0 */
517  _OrthancPluginService_SerializeDicomInstance = 4016, /* New in Orthanc 1.7.0 */
518  _OrthancPluginService_GetInstanceAdvancedJson = 4017, /* New in Orthanc 1.7.0 */
519  _OrthancPluginService_GetInstanceDicomWebJson = 4018, /* New in Orthanc 1.7.0 */
520  _OrthancPluginService_GetInstanceDicomWebXml = 4019, /* New in Orthanc 1.7.0 */
521 
522  /* Services for plugins implementing a database back-end */
523  _OrthancPluginService_RegisterDatabaseBackend = 5000, /* New in Orthanc 0.8.6 */
524  _OrthancPluginService_DatabaseAnswer = 5001,
525  _OrthancPluginService_RegisterDatabaseBackendV2 = 5002, /* New in Orthanc 0.9.4 */
526  _OrthancPluginService_StorageAreaCreate = 5003,
527  _OrthancPluginService_StorageAreaRead = 5004,
528  _OrthancPluginService_StorageAreaRemove = 5005,
529  _OrthancPluginService_RegisterDatabaseBackendV3 = 5006, /* New in Orthanc 1.9.2 */
530 
531  /* Primitives for handling images */
532  _OrthancPluginService_GetImagePixelFormat = 6000,
533  _OrthancPluginService_GetImageWidth = 6001,
534  _OrthancPluginService_GetImageHeight = 6002,
535  _OrthancPluginService_GetImagePitch = 6003,
536  _OrthancPluginService_GetImageBuffer = 6004,
537  _OrthancPluginService_UncompressImage = 6005,
538  _OrthancPluginService_FreeImage = 6006,
539  _OrthancPluginService_CompressImage = 6007,
540  _OrthancPluginService_ConvertPixelFormat = 6008,
541  _OrthancPluginService_GetFontsCount = 6009,
542  _OrthancPluginService_GetFontInfo = 6010,
543  _OrthancPluginService_DrawText = 6011,
544  _OrthancPluginService_CreateImage = 6012,
545  _OrthancPluginService_CreateImageAccessor = 6013,
546  _OrthancPluginService_DecodeDicomImage = 6014,
547 
548  /* Primitives for handling C-Find, C-Move and worklists */
549  _OrthancPluginService_WorklistAddAnswer = 7000,
550  _OrthancPluginService_WorklistMarkIncomplete = 7001,
551  _OrthancPluginService_WorklistIsMatch = 7002,
552  _OrthancPluginService_WorklistGetDicomQuery = 7003,
553  _OrthancPluginService_FindAddAnswer = 7004,
554  _OrthancPluginService_FindMarkIncomplete = 7005,
555  _OrthancPluginService_GetFindQuerySize = 7006,
556  _OrthancPluginService_GetFindQueryTag = 7007,
557  _OrthancPluginService_GetFindQueryTagName = 7008,
558  _OrthancPluginService_GetFindQueryValue = 7009,
559  _OrthancPluginService_CreateFindMatcher = 7010,
560  _OrthancPluginService_FreeFindMatcher = 7011,
561  _OrthancPluginService_FindMatcherIsMatch = 7012,
562 
563  /* Primitives for accessing Orthanc Peers (new in 1.4.2) */
564  _OrthancPluginService_GetPeers = 8000,
565  _OrthancPluginService_FreePeers = 8001,
566  _OrthancPluginService_GetPeersCount = 8003,
567  _OrthancPluginService_GetPeerName = 8004,
568  _OrthancPluginService_GetPeerUrl = 8005,
569  _OrthancPluginService_CallPeerApi = 8006,
570  _OrthancPluginService_GetPeerUserProperty = 8007,
571 
572  /* Primitives for handling jobs (new in 1.4.2) */
573  _OrthancPluginService_CreateJob = 9000,
574  _OrthancPluginService_FreeJob = 9001,
575  _OrthancPluginService_SubmitJob = 9002,
576  _OrthancPluginService_RegisterJobsUnserializer = 9003,
577 
578  _OrthancPluginService_INTERNAL = 0x7fffffff
579  } _OrthancPluginService;
580 
581 
582  typedef enum
583  {
584  _OrthancPluginProperty_Description = 1,
585  _OrthancPluginProperty_RootUri = 2,
586  _OrthancPluginProperty_OrthancExplorer = 3,
587 
588  _OrthancPluginProperty_INTERNAL = 0x7fffffff
589  } _OrthancPluginProperty;
590 
591 
592 
597  typedef enum
598  {
606 
614 
622 
630 
638 
648 
656 
664 
672 
680 
681  _OrthancPluginPixelFormat_INTERNAL = 0x7fffffff
683 
684 
685 
689  typedef enum
690  {
696  _OrthancPluginContentType_INTERNAL = 0x7fffffff
698 
699 
700 
704  typedef enum
705  {
712  _OrthancPluginResourceType_INTERNAL = 0x7fffffff
714 
715 
716 
721  typedef enum
722  {
743  _OrthancPluginChangeType_INTERNAL = 0x7fffffff
745 
746 
751  typedef enum
752  {
758  _OrthancPluginCompressionType_INTERNAL = 0x7fffffff
760 
761 
766  typedef enum
767  {
772  _OrthancPluginImageFormat_INTERNAL = 0x7fffffff
774 
775 
780  typedef enum
781  {
810  _OrthancPluginValueRepresentation_INTERNAL = 0x7fffffff
812 
813 
819  typedef enum
820  {
825  _OrthancPluginDicomToJsonFormat_INTERNAL = 0x7fffffff
827 
828 
834  typedef enum
835  {
836  OrthancPluginDicomToJsonFlags_None = 0,
846  _OrthancPluginDicomToJsonFlags_INTERNAL = 0x7fffffff
848 
849 
855  typedef enum
856  {
857  OrthancPluginCreateDicomFlags_None = 0,
861  _OrthancPluginCreateDicomFlags_INTERNAL = 0x7fffffff
863 
864 
870  typedef enum
871  {
877  _OrthancPluginIdentifierConstraint_INTERNAL = 0x7fffffff
879 
880 
885  typedef enum
886  {
893  _OrthancPluginConstraintType_INTERNAL = 0x7fffffff
895 
896 
900  typedef enum
901  {
909  _OrthancPluginInstanceOrigin_INTERNAL = 0x7fffffff
911 
912 
916  typedef enum
917  {
922 
923 
930  typedef enum
931  {
937 
938 
942  typedef enum
943  {
953 
954 
959  typedef enum
960  {
965 
966 
972  typedef enum
973  {
1001 
1002 
1003 
1011  typedef struct
1012  {
1016  void* data;
1017 
1021  uint32_t size;
1023 
1024 
1025 
1033  typedef struct
1034  {
1038  void* data;
1039 
1043  uint64_t size;
1045 
1046 
1047 
1048 
1053  typedef struct _OrthancPluginRestOutput_t OrthancPluginRestOutput;
1054 
1055 
1056 
1061  typedef struct _OrthancPluginDicomInstance_t OrthancPluginDicomInstance;
1062 
1063 
1064 
1069  typedef struct _OrthancPluginImage_t OrthancPluginImage;
1070 
1071 
1072 
1077  typedef struct _OrthancPluginStorageArea_t OrthancPluginStorageArea;
1078 
1079 
1080 
1085  typedef struct _OrthancPluginWorklistQuery_t OrthancPluginWorklistQuery;
1086 
1087 
1088 
1093  typedef struct _OrthancPluginWorklistAnswers_t OrthancPluginWorklistAnswers;
1094 
1095 
1096 
1101  typedef struct _OrthancPluginFindQuery_t OrthancPluginFindQuery;
1102 
1103 
1104 
1109  typedef struct _OrthancPluginFindAnswers_t OrthancPluginFindAnswers;
1110 
1111 
1112 
1117  typedef struct _OrthancPluginFindMatcher_t OrthancPluginFindMatcher;
1118 
1119 
1120 
1125  typedef struct _OrthancPluginPeers_t OrthancPluginPeers;
1126 
1127 
1128 
1133  typedef struct _OrthancPluginJob_t OrthancPluginJob;
1134 
1135 
1136 
1142  typedef struct _OrthancPluginDicomWebNode_t OrthancPluginDicomWebNode;
1143 
1144 
1145 
1151  OrthancPluginRestOutput* output,
1152  const char* url,
1153  const OrthancPluginHttpRequest* request);
1154 
1155 
1156 
1162  const OrthancPluginDicomInstance* instance,
1163  const char* instanceId);
1164 
1165 
1166 
1172  OrthancPluginChangeType changeType,
1173  OrthancPluginResourceType resourceType,
1174  const char* resourceId);
1175 
1176 
1177 
1183  OrthancPluginImage** target,
1184  const void* dicom,
1185  const uint32_t size,
1186  uint32_t frameIndex);
1187 
1188 
1189 
1194  typedef void (*OrthancPluginFree) (void* buffer);
1195 
1196 
1197 
1207  const char* bulkDataUri);
1208 
1209 
1210 
1224  const char* uuid,
1225  const void* content,
1226  int64_t size,
1228 
1229 
1230 
1251  void** content,
1252  int64_t* size,
1253  const char* uuid,
1255 
1256 
1257 
1272  const char* uuid,
1274 
1275 
1276 
1295  const char* uuid,
1297  uint64_t rangeStart);
1298 
1299 
1300 
1312  const char* uuid,
1314 
1315 
1316 
1332  const OrthancPluginWorklistQuery* query,
1333  const char* issuerAet,
1334  const char* calledAet);
1335 
1336 
1337 
1362  OrthancPluginHttpMethod method,
1363  const char* uri,
1364  const char* ip,
1365  uint32_t headersCount,
1366  const char* const* headersKeys,
1367  const char* const* headersValues);
1368 
1369 
1370 
1397  OrthancPluginHttpMethod method,
1398  const char* uri,
1399  const char* ip,
1400  uint32_t headersCount,
1401  const char* const* headersKeys,
1402  const char* const* headersValues,
1403  uint32_t getArgumentsCount,
1404  const char* const* getArgumentsKeys,
1405  const char* const* getArgumentsValues);
1406 
1407 
1408 
1424  OrthancPluginFindAnswers* answers,
1425  const OrthancPluginFindQuery* query,
1426  const char* issuerAet,
1427  const char* calledAet);
1428 
1429 
1430 
1466  typedef void* (*OrthancPluginMoveCallback) (
1467  OrthancPluginResourceType resourceType,
1468  const char* patientId,
1469  const char* accessionNumber,
1470  const char* studyInstanceUid,
1471  const char* seriesInstanceUid,
1472  const char* sopInstanceUid,
1473  const char* originatorAet,
1474  const char* sourceAet,
1475  const char* targetAet,
1476  uint16_t originatorId);
1477 
1478 
1491  typedef uint32_t (*OrthancPluginGetMoveSize) (void* moveDriver);
1492 
1493 
1506  typedef OrthancPluginErrorCode (*OrthancPluginApplyMove) (void* moveDriver);
1507 
1508 
1520  typedef void (*OrthancPluginFreeMove) (void* moveDriver);
1521 
1522 
1533  typedef void (*OrthancPluginJobFinalize) (void* job);
1534 
1535 
1546  typedef float (*OrthancPluginJobGetProgress) (void* job);
1547 
1548 
1561  typedef const char* (*OrthancPluginJobGetContent) (void* job);
1562 
1563 
1579  typedef const char* (*OrthancPluginJobGetSerialized) (void* job);
1580 
1581 
1595 
1596 
1620 
1621 
1636 
1637 
1651  typedef OrthancPluginJob* (*OrthancPluginJobsUnserializer) (const char* jobType,
1652  const char* serialized);
1653 
1654 
1655 
1670 
1671 
1672 
1700  uint32_t levelDepth,
1701  const uint16_t* levelTagGroup,
1702  const uint16_t* levelTagElement,
1703  const uint32_t* levelIndex,
1704  uint16_t tagGroup,
1705  uint16_t tagElement,
1707 
1708 
1709 
1738  uint32_t levelDepth,
1739  const uint16_t* levelTagGroup,
1740  const uint16_t* levelTagElement,
1741  const uint32_t* levelIndex,
1742  uint16_t tagGroup,
1743  uint16_t tagElement,
1745  void* payload);
1746 
1747 
1748 
1752  typedef struct _OrthancPluginContext_t
1753  {
1754  void* pluginsManager;
1755  const char* orthancVersion;
1756  OrthancPluginFree Free;
1757  OrthancPluginErrorCode (*InvokeService) (struct _OrthancPluginContext_t* context,
1758  _OrthancPluginService service,
1759  const void* params);
1761 
1762 
1763 
1767  typedef struct
1768  {
1769  uint16_t group;
1770  uint16_t element;
1772  uint32_t minMultiplicity;
1773  uint32_t maxMultiplicity;
1775 
1776 
1777 
1786  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeString(
1787  OrthancPluginContext* context,
1788  char* str)
1789  {
1790  if (str != NULL)
1791  {
1792  context->Free(str);
1793  }
1794  }
1795 
1796 
1816  ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersionAdvanced(
1817  OrthancPluginContext* context,
1818  int expectedMajor,
1819  int expectedMinor,
1820  int expectedRevision)
1821  {
1822  int major, minor, revision;
1823 
1824  if (sizeof(int32_t) != sizeof(OrthancPluginErrorCode) ||
1825  sizeof(int32_t) != sizeof(OrthancPluginHttpMethod) ||
1826  sizeof(int32_t) != sizeof(_OrthancPluginService) ||
1827  sizeof(int32_t) != sizeof(_OrthancPluginProperty) ||
1828  sizeof(int32_t) != sizeof(OrthancPluginPixelFormat) ||
1829  sizeof(int32_t) != sizeof(OrthancPluginContentType) ||
1830  sizeof(int32_t) != sizeof(OrthancPluginResourceType) ||
1831  sizeof(int32_t) != sizeof(OrthancPluginChangeType) ||
1832  sizeof(int32_t) != sizeof(OrthancPluginCompressionType) ||
1833  sizeof(int32_t) != sizeof(OrthancPluginImageFormat) ||
1834  sizeof(int32_t) != sizeof(OrthancPluginValueRepresentation) ||
1835  sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFormat) ||
1836  sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFlags) ||
1837  sizeof(int32_t) != sizeof(OrthancPluginCreateDicomFlags) ||
1838  sizeof(int32_t) != sizeof(OrthancPluginIdentifierConstraint) ||
1839  sizeof(int32_t) != sizeof(OrthancPluginInstanceOrigin) ||
1840  sizeof(int32_t) != sizeof(OrthancPluginJobStepStatus) ||
1841  sizeof(int32_t) != sizeof(OrthancPluginConstraintType) ||
1842  sizeof(int32_t) != sizeof(OrthancPluginMetricsType) ||
1843  sizeof(int32_t) != sizeof(OrthancPluginDicomWebBinaryMode) ||
1844  sizeof(int32_t) != sizeof(OrthancPluginStorageCommitmentFailureReason))
1845  {
1846  /* Mismatch in the size of the enumerations */
1847  return 0;
1848  }
1849 
1850  /* Assume compatibility with the mainline */
1851  if (!strcmp(context->orthancVersion, "mainline"))
1852  {
1853  return 1;
1854  }
1855 
1856  /* Parse the version of the Orthanc core */
1857  if (
1858 #ifdef _MSC_VER
1859  sscanf_s
1860 #else
1861  sscanf
1862 #endif
1863  (context->orthancVersion, "%4d.%4d.%4d", &major, &minor, &revision) != 3)
1864  {
1865  return 0;
1866  }
1867 
1868  /* Check the major number of the version */
1869 
1870  if (major > expectedMajor)
1871  {
1872  return 1;
1873  }
1874 
1875  if (major < expectedMajor)
1876  {
1877  return 0;
1878  }
1879 
1880  /* Check the minor number of the version */
1881 
1882  if (minor > expectedMinor)
1883  {
1884  return 1;
1885  }
1886 
1887  if (minor < expectedMinor)
1888  {
1889  return 0;
1890  }
1891 
1892  /* Check the revision number of the version */
1893 
1894  if (revision >= expectedRevision)
1895  {
1896  return 1;
1897  }
1898  else
1899  {
1900  return 0;
1901  }
1902  }
1903 
1904 
1921  ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersion(
1922  OrthancPluginContext* context)
1923  {
1925  context,
1926  ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
1927  ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
1928  ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
1929  }
1930 
1931 
1940  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeMemoryBuffer(
1941  OrthancPluginContext* context,
1942  OrthancPluginMemoryBuffer* buffer)
1943  {
1944  context->Free(buffer->data);
1945  }
1946 
1947 
1956  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeMemoryBuffer64(
1957  OrthancPluginContext* context,
1959  {
1960  context->Free(buffer->data);
1961  }
1962 
1963 
1972  ORTHANC_PLUGIN_INLINE void OrthancPluginLogError(
1973  OrthancPluginContext* context,
1974  const char* message)
1975  {
1976  context->InvokeService(context, _OrthancPluginService_LogError, message);
1977  }
1978 
1979 
1988  ORTHANC_PLUGIN_INLINE void OrthancPluginLogWarning(
1989  OrthancPluginContext* context,
1990  const char* message)
1991  {
1992  context->InvokeService(context, _OrthancPluginService_LogWarning, message);
1993  }
1994 
1995 
2004  ORTHANC_PLUGIN_INLINE void OrthancPluginLogInfo(
2005  OrthancPluginContext* context,
2006  const char* message)
2007  {
2008  context->InvokeService(context, _OrthancPluginService_LogInfo, message);
2009  }
2010 
2011 
2012 
2013  typedef struct
2014  {
2015  const char* pathRegularExpression;
2016  OrthancPluginRestCallback callback;
2017  } _OrthancPluginRestCallback;
2018 
2040  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallback(
2041  OrthancPluginContext* context,
2042  const char* pathRegularExpression,
2043  OrthancPluginRestCallback callback)
2044  {
2045  _OrthancPluginRestCallback params;
2046  params.pathRegularExpression = pathRegularExpression;
2047  params.callback = callback;
2048  context->InvokeService(context, _OrthancPluginService_RegisterRestCallback, &params);
2049  }
2050 
2051 
2052 
2080  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallbackNoLock(
2081  OrthancPluginContext* context,
2082  const char* pathRegularExpression,
2083  OrthancPluginRestCallback callback)
2084  {
2085  _OrthancPluginRestCallback params;
2086  params.pathRegularExpression = pathRegularExpression;
2087  params.callback = callback;
2088  context->InvokeService(context, _OrthancPluginService_RegisterRestCallbackNoLock, &params);
2089  }
2090 
2091 
2092 
2093  typedef struct
2094  {
2096  } _OrthancPluginOnStoredInstanceCallback;
2097 
2119  OrthancPluginContext* context,
2121  {
2122  _OrthancPluginOnStoredInstanceCallback params;
2123  params.callback = callback;
2124 
2125  context->InvokeService(context, _OrthancPluginService_RegisterOnStoredInstanceCallback, &params);
2126  }
2127 
2128 
2129 
2130  typedef struct
2131  {
2132  OrthancPluginRestOutput* output;
2133  const void* answer;
2134  uint32_t answerSize;
2135  const char* mimeType;
2136  } _OrthancPluginAnswerBuffer;
2137 
2150  ORTHANC_PLUGIN_INLINE void OrthancPluginAnswerBuffer(
2151  OrthancPluginContext* context,
2152  OrthancPluginRestOutput* output,
2153  const void* answer,
2154  uint32_t answerSize,
2155  const char* mimeType)
2156  {
2157  _OrthancPluginAnswerBuffer params;
2158  params.output = output;
2159  params.answer = answer;
2160  params.answerSize = answerSize;
2161  params.mimeType = mimeType;
2162  context->InvokeService(context, _OrthancPluginService_AnswerBuffer, &params);
2163  }
2164 
2165 
2166  typedef struct
2167  {
2168  OrthancPluginRestOutput* output;
2169  OrthancPluginPixelFormat format;
2170  uint32_t width;
2171  uint32_t height;
2172  uint32_t pitch;
2173  const void* buffer;
2174  } _OrthancPluginCompressAndAnswerPngImage;
2175 
2176  typedef struct
2177  {
2178  OrthancPluginRestOutput* output;
2179  OrthancPluginImageFormat imageFormat;
2180  OrthancPluginPixelFormat pixelFormat;
2181  uint32_t width;
2182  uint32_t height;
2183  uint32_t pitch;
2184  const void* buffer;
2185  uint8_t quality;
2186  } _OrthancPluginCompressAndAnswerImage;
2187 
2188 
2207  ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerPngImage(
2208  OrthancPluginContext* context,
2209  OrthancPluginRestOutput* output,
2210  OrthancPluginPixelFormat format,
2211  uint32_t width,
2212  uint32_t height,
2213  uint32_t pitch,
2214  const void* buffer)
2215  {
2216  _OrthancPluginCompressAndAnswerImage params;
2217  params.output = output;
2218  params.imageFormat = OrthancPluginImageFormat_Png;
2219  params.pixelFormat = format;
2220  params.width = width;
2221  params.height = height;
2222  params.pitch = pitch;
2223  params.buffer = buffer;
2224  params.quality = 0; /* No quality for PNG */
2225  context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
2226  }
2227 
2228 
2229 
2230  typedef struct
2231  {
2232  OrthancPluginMemoryBuffer* target;
2233  const char* instanceId;
2234  } _OrthancPluginGetDicomForInstance;
2235 
2249  OrthancPluginContext* context,
2250  OrthancPluginMemoryBuffer* target,
2251  const char* instanceId)
2252  {
2253  _OrthancPluginGetDicomForInstance params;
2254  params.target = target;
2255  params.instanceId = instanceId;
2256  return context->InvokeService(context, _OrthancPluginService_GetDicomForInstance, &params);
2257  }
2258 
2259 
2260 
2261  typedef struct
2262  {
2263  OrthancPluginMemoryBuffer* target;
2264  const char* uri;
2265  } _OrthancPluginRestApiGet;
2266 
2282  OrthancPluginContext* context,
2283  OrthancPluginMemoryBuffer* target,
2284  const char* uri)
2285  {
2286  _OrthancPluginRestApiGet params;
2287  params.target = target;
2288  params.uri = uri;
2289  return context->InvokeService(context, _OrthancPluginService_RestApiGet, &params);
2290  }
2291 
2292 
2293 
2312  OrthancPluginContext* context,
2313  OrthancPluginMemoryBuffer* target,
2314  const char* uri)
2315  {
2316  _OrthancPluginRestApiGet params;
2317  params.target = target;
2318  params.uri = uri;
2319  return context->InvokeService(context, _OrthancPluginService_RestApiGetAfterPlugins, &params);
2320  }
2321 
2322 
2323 
2324  typedef struct
2325  {
2326  OrthancPluginMemoryBuffer* target;
2327  const char* uri;
2328  const void* body;
2329  uint32_t bodySize;
2330  } _OrthancPluginRestApiPostPut;
2331 
2349  OrthancPluginContext* context,
2350  OrthancPluginMemoryBuffer* target,
2351  const char* uri,
2352  const void* body,
2353  uint32_t bodySize)
2354  {
2355  _OrthancPluginRestApiPostPut params;
2356  params.target = target;
2357  params.uri = uri;
2358  params.body = body;
2359  params.bodySize = bodySize;
2360  return context->InvokeService(context, _OrthancPluginService_RestApiPost, &params);
2361  }
2362 
2363 
2384  OrthancPluginContext* context,
2385  OrthancPluginMemoryBuffer* target,
2386  const char* uri,
2387  const void* body,
2388  uint32_t bodySize)
2389  {
2390  _OrthancPluginRestApiPostPut params;
2391  params.target = target;
2392  params.uri = uri;
2393  params.body = body;
2394  params.bodySize = bodySize;
2395  return context->InvokeService(context, _OrthancPluginService_RestApiPostAfterPlugins, &params);
2396  }
2397 
2398 
2399 
2413  OrthancPluginContext* context,
2414  const char* uri)
2415  {
2416  return context->InvokeService(context, _OrthancPluginService_RestApiDelete, uri);
2417  }
2418 
2419 
2436  OrthancPluginContext* context,
2437  const char* uri)
2438  {
2439  return context->InvokeService(context, _OrthancPluginService_RestApiDeleteAfterPlugins, uri);
2440  }
2441 
2442 
2443 
2461  OrthancPluginContext* context,
2462  OrthancPluginMemoryBuffer* target,
2463  const char* uri,
2464  const void* body,
2465  uint32_t bodySize)
2466  {
2467  _OrthancPluginRestApiPostPut params;
2468  params.target = target;
2469  params.uri = uri;
2470  params.body = body;
2471  params.bodySize = bodySize;
2472  return context->InvokeService(context, _OrthancPluginService_RestApiPut, &params);
2473  }
2474 
2475 
2476 
2497  OrthancPluginContext* context,
2498  OrthancPluginMemoryBuffer* target,
2499  const char* uri,
2500  const void* body,
2501  uint32_t bodySize)
2502  {
2503  _OrthancPluginRestApiPostPut params;
2504  params.target = target;
2505  params.uri = uri;
2506  params.body = body;
2507  params.bodySize = bodySize;
2508  return context->InvokeService(context, _OrthancPluginService_RestApiPutAfterPlugins, &params);
2509  }
2510 
2511 
2512 
2513  typedef struct
2514  {
2515  OrthancPluginRestOutput* output;
2516  const char* argument;
2517  } _OrthancPluginOutputPlusArgument;
2518 
2530  ORTHANC_PLUGIN_INLINE void OrthancPluginRedirect(
2531  OrthancPluginContext* context,
2532  OrthancPluginRestOutput* output,
2533  const char* redirection)
2534  {
2535  _OrthancPluginOutputPlusArgument params;
2536  params.output = output;
2537  params.argument = redirection;
2538  context->InvokeService(context, _OrthancPluginService_Redirect, &params);
2539  }
2540 
2541 
2542 
2543  typedef struct
2544  {
2545  char** result;
2546  const char* argument;
2547  } _OrthancPluginRetrieveDynamicString;
2548 
2562  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupPatient(
2563  OrthancPluginContext* context,
2564  const char* patientID)
2565  {
2566  char* result;
2567 
2568  _OrthancPluginRetrieveDynamicString params;
2569  params.result = &result;
2570  params.argument = patientID;
2571 
2572  if (context->InvokeService(context, _OrthancPluginService_LookupPatient, &params) != OrthancPluginErrorCode_Success)
2573  {
2574  /* Error */
2575  return NULL;
2576  }
2577  else
2578  {
2579  return result;
2580  }
2581  }
2582 
2583 
2597  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudy(
2598  OrthancPluginContext* context,
2599  const char* studyUID)
2600  {
2601  char* result;
2602 
2603  _OrthancPluginRetrieveDynamicString params;
2604  params.result = &result;
2605  params.argument = studyUID;
2606 
2607  if (context->InvokeService(context, _OrthancPluginService_LookupStudy, &params) != OrthancPluginErrorCode_Success)
2608  {
2609  /* Error */
2610  return NULL;
2611  }
2612  else
2613  {
2614  return result;
2615  }
2616  }
2617 
2618 
2632  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudyWithAccessionNumber(
2633  OrthancPluginContext* context,
2634  const char* accessionNumber)
2635  {
2636  char* result;
2637 
2638  _OrthancPluginRetrieveDynamicString params;
2639  params.result = &result;
2640  params.argument = accessionNumber;
2641 
2642  if (context->InvokeService(context, _OrthancPluginService_LookupStudyWithAccessionNumber, &params) != OrthancPluginErrorCode_Success)
2643  {
2644  /* Error */
2645  return NULL;
2646  }
2647  else
2648  {
2649  return result;
2650  }
2651  }
2652 
2653 
2667  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupSeries(
2668  OrthancPluginContext* context,
2669  const char* seriesUID)
2670  {
2671  char* result;
2672 
2673  _OrthancPluginRetrieveDynamicString params;
2674  params.result = &result;
2675  params.argument = seriesUID;
2676 
2677  if (context->InvokeService(context, _OrthancPluginService_LookupSeries, &params) != OrthancPluginErrorCode_Success)
2678  {
2679  /* Error */
2680  return NULL;
2681  }
2682  else
2683  {
2684  return result;
2685  }
2686  }
2687 
2688 
2702  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupInstance(
2703  OrthancPluginContext* context,
2704  const char* sopInstanceUID)
2705  {
2706  char* result;
2707 
2708  _OrthancPluginRetrieveDynamicString params;
2709  params.result = &result;
2710  params.argument = sopInstanceUID;
2711 
2712  if (context->InvokeService(context, _OrthancPluginService_LookupInstance, &params) != OrthancPluginErrorCode_Success)
2713  {
2714  /* Error */
2715  return NULL;
2716  }
2717  else
2718  {
2719  return result;
2720  }
2721  }
2722 
2723 
2724 
2725  typedef struct
2726  {
2727  OrthancPluginRestOutput* output;
2728  uint16_t status;
2729  } _OrthancPluginSendHttpStatusCode;
2730 
2747  ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatusCode(
2748  OrthancPluginContext* context,
2749  OrthancPluginRestOutput* output,
2750  uint16_t status)
2751  {
2752  _OrthancPluginSendHttpStatusCode params;
2753  params.output = output;
2754  params.status = status;
2755  context->InvokeService(context, _OrthancPluginService_SendHttpStatusCode, &params);
2756  }
2757 
2758 
2770  ORTHANC_PLUGIN_INLINE void OrthancPluginSendUnauthorized(
2771  OrthancPluginContext* context,
2772  OrthancPluginRestOutput* output,
2773  const char* realm)
2774  {
2775  _OrthancPluginOutputPlusArgument params;
2776  params.output = output;
2777  params.argument = realm;
2778  context->InvokeService(context, _OrthancPluginService_SendUnauthorized, &params);
2779  }
2780 
2781 
2793  ORTHANC_PLUGIN_INLINE void OrthancPluginSendMethodNotAllowed(
2794  OrthancPluginContext* context,
2795  OrthancPluginRestOutput* output,
2796  const char* allowedMethods)
2797  {
2798  _OrthancPluginOutputPlusArgument params;
2799  params.output = output;
2800  params.argument = allowedMethods;
2801  context->InvokeService(context, _OrthancPluginService_SendMethodNotAllowed, &params);
2802  }
2803 
2804 
2805  typedef struct
2806  {
2807  OrthancPluginRestOutput* output;
2808  const char* key;
2809  const char* value;
2810  } _OrthancPluginSetHttpHeader;
2811 
2823  ORTHANC_PLUGIN_INLINE void OrthancPluginSetCookie(
2824  OrthancPluginContext* context,
2825  OrthancPluginRestOutput* output,
2826  const char* cookie,
2827  const char* value)
2828  {
2829  _OrthancPluginSetHttpHeader params;
2830  params.output = output;
2831  params.key = cookie;
2832  params.value = value;
2833  context->InvokeService(context, _OrthancPluginService_SetCookie, &params);
2834  }
2835 
2836 
2848  ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpHeader(
2849  OrthancPluginContext* context,
2850  OrthancPluginRestOutput* output,
2851  const char* key,
2852  const char* value)
2853  {
2854  _OrthancPluginSetHttpHeader params;
2855  params.output = output;
2856  params.key = key;
2857  params.value = value;
2858  context->InvokeService(context, _OrthancPluginService_SetHttpHeader, &params);
2859  }
2860 
2861 
2862  typedef struct
2863  {
2864  char** resultStringToFree;
2865  const char** resultString;
2866  int64_t* resultInt64;
2867  const char* key;
2868  const OrthancPluginDicomInstance* instance;
2869  OrthancPluginInstanceOrigin* resultOrigin; /* New in Orthanc 0.9.5 SDK */
2870  } _OrthancPluginAccessDicomInstance;
2871 
2872 
2884  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceRemoteAet(
2885  OrthancPluginContext* context,
2886  const OrthancPluginDicomInstance* instance)
2887  {
2888  const char* result;
2889 
2890  _OrthancPluginAccessDicomInstance params;
2891  memset(&params, 0, sizeof(params));
2892  params.resultString = &result;
2893  params.instance = instance;
2894 
2895  if (context->InvokeService(context, _OrthancPluginService_GetInstanceRemoteAet, &params) != OrthancPluginErrorCode_Success)
2896  {
2897  /* Error */
2898  return NULL;
2899  }
2900  else
2901  {
2902  return result;
2903  }
2904  }
2905 
2906 
2917  ORTHANC_PLUGIN_INLINE int64_t OrthancPluginGetInstanceSize(
2918  OrthancPluginContext* context,
2919  const OrthancPluginDicomInstance* instance)
2920  {
2921  int64_t size;
2922 
2923  _OrthancPluginAccessDicomInstance params;
2924  memset(&params, 0, sizeof(params));
2925  params.resultInt64 = &size;
2926  params.instance = instance;
2927 
2928  if (context->InvokeService(context, _OrthancPluginService_GetInstanceSize, &params) != OrthancPluginErrorCode_Success)
2929  {
2930  /* Error */
2931  return -1;
2932  }
2933  else
2934  {
2935  return size;
2936  }
2937  }
2938 
2939 
2950  ORTHANC_PLUGIN_INLINE const void* OrthancPluginGetInstanceData(
2951  OrthancPluginContext* context,
2952  const OrthancPluginDicomInstance* instance)
2953  {
2954  const char* result;
2955 
2956  _OrthancPluginAccessDicomInstance params;
2957  memset(&params, 0, sizeof(params));
2958  params.resultString = &result;
2959  params.instance = instance;
2960 
2961  if (context->InvokeService(context, _OrthancPluginService_GetInstanceData, &params) != OrthancPluginErrorCode_Success)
2962  {
2963  /* Error */
2964  return NULL;
2965  }
2966  else
2967  {
2968  return result;
2969  }
2970  }
2971 
2972 
2986  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceJson(
2987  OrthancPluginContext* context,
2988  const OrthancPluginDicomInstance* instance)
2989  {
2990  char* result;
2991 
2992  _OrthancPluginAccessDicomInstance params;
2993  memset(&params, 0, sizeof(params));
2994  params.resultStringToFree = &result;
2995  params.instance = instance;
2996 
2997  if (context->InvokeService(context, _OrthancPluginService_GetInstanceJson, &params) != OrthancPluginErrorCode_Success)
2998  {
2999  /* Error */
3000  return NULL;
3001  }
3002  else
3003  {
3004  return result;
3005  }
3006  }
3007 
3008 
3024  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceSimplifiedJson(
3025  OrthancPluginContext* context,
3026  const OrthancPluginDicomInstance* instance)
3027  {
3028  char* result;
3029 
3030  _OrthancPluginAccessDicomInstance params;
3031  memset(&params, 0, sizeof(params));
3032  params.resultStringToFree = &result;
3033  params.instance = instance;
3034 
3035  if (context->InvokeService(context, _OrthancPluginService_GetInstanceSimplifiedJson, &params) != OrthancPluginErrorCode_Success)
3036  {
3037  /* Error */
3038  return NULL;
3039  }
3040  else
3041  {
3042  return result;
3043  }
3044  }
3045 
3046 
3063  ORTHANC_PLUGIN_INLINE int OrthancPluginHasInstanceMetadata(
3064  OrthancPluginContext* context,
3065  const OrthancPluginDicomInstance* instance,
3066  const char* metadata)
3067  {
3068  int64_t result;
3069 
3070  _OrthancPluginAccessDicomInstance params;
3071  memset(&params, 0, sizeof(params));
3072  params.resultInt64 = &result;
3073  params.instance = instance;
3074  params.key = metadata;
3075 
3076  if (context->InvokeService(context, _OrthancPluginService_HasInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
3077  {
3078  /* Error */
3079  return -1;
3080  }
3081  else
3082  {
3083  return (result != 0);
3084  }
3085  }
3086 
3087 
3104  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceMetadata(
3105  OrthancPluginContext* context,
3106  const OrthancPluginDicomInstance* instance,
3107  const char* metadata)
3108  {
3109  const char* result;
3110 
3111  _OrthancPluginAccessDicomInstance params;
3112  memset(&params, 0, sizeof(params));
3113  params.resultString = &result;
3114  params.instance = instance;
3115  params.key = metadata;
3116 
3117  if (context->InvokeService(context, _OrthancPluginService_GetInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
3118  {
3119  /* Error */
3120  return NULL;
3121  }
3122  else
3123  {
3124  return result;
3125  }
3126  }
3127 
3128 
3129 
3130  typedef struct
3131  {
3135  OrthancPluginFree free;
3136  } _OrthancPluginRegisterStorageArea;
3137 
3153  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterStorageArea(
3154  OrthancPluginContext* context,
3158  {
3159  _OrthancPluginRegisterStorageArea params;
3160  params.create = create;
3161  params.read = read;
3162  params.remove = remove;
3163 
3164 #ifdef __cplusplus
3165  params.free = ::free;
3166 #else
3167  params.free = free;
3168 #endif
3169 
3170  context->InvokeService(context, _OrthancPluginService_RegisterStorageArea, &params);
3171  }
3172 
3173 
3174 
3185  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancPath(OrthancPluginContext* context)
3186  {
3187  char* result;
3188 
3189  _OrthancPluginRetrieveDynamicString params;
3190  params.result = &result;
3191  params.argument = NULL;
3192 
3193  if (context->InvokeService(context, _OrthancPluginService_GetOrthancPath, &params) != OrthancPluginErrorCode_Success)
3194  {
3195  /* Error */
3196  return NULL;
3197  }
3198  else
3199  {
3200  return result;
3201  }
3202  }
3203 
3204 
3215  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancDirectory(OrthancPluginContext* context)
3216  {
3217  char* result;
3218 
3219  _OrthancPluginRetrieveDynamicString params;
3220  params.result = &result;
3221  params.argument = NULL;
3222 
3223  if (context->InvokeService(context, _OrthancPluginService_GetOrthancDirectory, &params) != OrthancPluginErrorCode_Success)
3224  {
3225  /* Error */
3226  return NULL;
3227  }
3228  else
3229  {
3230  return result;
3231  }
3232  }
3233 
3234 
3250  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfigurationPath(OrthancPluginContext* context)
3251  {
3252  char* result;
3253 
3254  _OrthancPluginRetrieveDynamicString params;
3255  params.result = &result;
3256  params.argument = NULL;
3257 
3258  if (context->InvokeService(context, _OrthancPluginService_GetConfigurationPath, &params) != OrthancPluginErrorCode_Success)
3259  {
3260  /* Error */
3261  return NULL;
3262  }
3263  else
3264  {
3265  return result;
3266  }
3267  }
3268 
3269 
3270 
3271  typedef struct
3272  {
3274  } _OrthancPluginOnChangeCallback;
3275 
3296  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnChangeCallback(
3297  OrthancPluginContext* context,
3299  {
3300  _OrthancPluginOnChangeCallback params;
3301  params.callback = callback;
3302 
3303  context->InvokeService(context, _OrthancPluginService_RegisterOnChangeCallback, &params);
3304  }
3305 
3306 
3307 
3308  typedef struct
3309  {
3310  const char* plugin;
3311  _OrthancPluginProperty property;
3312  const char* value;
3313  } _OrthancPluginSetPluginProperty;
3314 
3315 
3327  ORTHANC_PLUGIN_INLINE void OrthancPluginSetRootUri(
3328  OrthancPluginContext* context,
3329  const char* uri)
3330  {
3331  _OrthancPluginSetPluginProperty params;
3332  params.plugin = OrthancPluginGetName();
3333  params.property = _OrthancPluginProperty_RootUri;
3334  params.value = uri;
3335 
3336  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
3337  }
3338 
3339 
3349  ORTHANC_PLUGIN_INLINE void OrthancPluginSetDescription(
3350  OrthancPluginContext* context,
3351  const char* description)
3352  {
3353  _OrthancPluginSetPluginProperty params;
3354  params.plugin = OrthancPluginGetName();
3355  params.property = _OrthancPluginProperty_Description;
3356  params.value = description;
3357 
3358  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
3359  }
3360 
3361 
3371  ORTHANC_PLUGIN_INLINE void OrthancPluginExtendOrthancExplorer(
3372  OrthancPluginContext* context,
3373  const char* javascript)
3374  {
3375  _OrthancPluginSetPluginProperty params;
3376  params.plugin = OrthancPluginGetName();
3377  params.property = _OrthancPluginProperty_OrthancExplorer;
3378  params.value = javascript;
3379 
3380  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
3381  }
3382 
3383 
3384  typedef struct
3385  {
3386  char** result;
3387  int32_t property;
3388  const char* value;
3389  } _OrthancPluginGlobalProperty;
3390 
3391 
3405  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetGlobalProperty(
3406  OrthancPluginContext* context,
3407  int32_t property,
3408  const char* defaultValue)
3409  {
3410  char* result;
3411 
3412  _OrthancPluginGlobalProperty params;
3413  params.result = &result;
3414  params.property = property;
3415  params.value = defaultValue;
3416 
3417  if (context->InvokeService(context, _OrthancPluginService_GetGlobalProperty, &params) != OrthancPluginErrorCode_Success)
3418  {
3419  /* Error */
3420  return NULL;
3421  }
3422  else
3423  {
3424  return result;
3425  }
3426  }
3427 
3428 
3445  OrthancPluginContext* context,
3446  int32_t property,
3447  const char* value)
3448  {
3449  _OrthancPluginGlobalProperty params;
3450  params.result = NULL;
3451  params.property = property;
3452  params.value = value;
3453 
3454  return context->InvokeService(context, _OrthancPluginService_SetGlobalProperty, &params);
3455  }
3456 
3457 
3458 
3459  typedef struct
3460  {
3461  int32_t *resultInt32;
3462  uint32_t *resultUint32;
3463  int64_t *resultInt64;
3464  uint64_t *resultUint64;
3465  } _OrthancPluginReturnSingleValue;
3466 
3475  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetCommandLineArgumentsCount(
3476  OrthancPluginContext* context)
3477  {
3478  uint32_t count = 0;
3479 
3480  _OrthancPluginReturnSingleValue params;
3481  memset(&params, 0, sizeof(params));
3482  params.resultUint32 = &count;
3483 
3484  if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgumentsCount, &params) != OrthancPluginErrorCode_Success)
3485  {
3486  /* Error */
3487  return 0;
3488  }
3489  else
3490  {
3491  return count;
3492  }
3493  }
3494 
3495 
3496 
3509  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetCommandLineArgument(
3510  OrthancPluginContext* context,
3511  uint32_t argument)
3512  {
3513  char* result;
3514 
3515  _OrthancPluginGlobalProperty params;
3516  params.result = &result;
3517  params.property = (int32_t) argument;
3518  params.value = NULL;
3519 
3520  if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgument, &params) != OrthancPluginErrorCode_Success)
3521  {
3522  /* Error */
3523  return NULL;
3524  }
3525  else
3526  {
3527  return result;
3528  }
3529  }
3530 
3531 
3541  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetExpectedDatabaseVersion(
3542  OrthancPluginContext* context)
3543  {
3544  uint32_t count = 0;
3545 
3546  _OrthancPluginReturnSingleValue params;
3547  memset(&params, 0, sizeof(params));
3548  params.resultUint32 = &count;
3549 
3550  if (context->InvokeService(context, _OrthancPluginService_GetExpectedDatabaseVersion, &params) != OrthancPluginErrorCode_Success)
3551  {
3552  /* Error */
3553  return 0;
3554  }
3555  else
3556  {
3557  return count;
3558  }
3559  }
3560 
3561 
3562 
3574  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfiguration(OrthancPluginContext* context)
3575  {
3576  char* result;
3577 
3578  _OrthancPluginRetrieveDynamicString params;
3579  params.result = &result;
3580  params.argument = NULL;
3581 
3582  if (context->InvokeService(context, _OrthancPluginService_GetConfiguration, &params) != OrthancPluginErrorCode_Success)
3583  {
3584  /* Error */
3585  return NULL;
3586  }
3587  else
3588  {
3589  return result;
3590  }
3591  }
3592 
3593 
3594 
3595  typedef struct
3596  {
3597  OrthancPluginRestOutput* output;
3598  const char* subType;
3599  const char* contentType;
3600  } _OrthancPluginStartMultipartAnswer;
3601 
3616  OrthancPluginContext* context,
3617  OrthancPluginRestOutput* output,
3618  const char* subType,
3619  const char* contentType)
3620  {
3621  _OrthancPluginStartMultipartAnswer params;
3622  params.output = output;
3623  params.subType = subType;
3624  params.contentType = contentType;
3625  return context->InvokeService(context, _OrthancPluginService_StartMultipartAnswer, &params);
3626  }
3627 
3628 
3645  OrthancPluginContext* context,
3646  OrthancPluginRestOutput* output,
3647  const void* answer,
3648  uint32_t answerSize)
3649  {
3650  _OrthancPluginAnswerBuffer params;
3651  params.output = output;
3652  params.answer = answer;
3653  params.answerSize = answerSize;
3654  params.mimeType = NULL;
3655  return context->InvokeService(context, _OrthancPluginService_SendMultipartItem, &params);
3656  }
3657 
3658 
3659 
3660  typedef struct
3661  {
3662  OrthancPluginMemoryBuffer* target;
3663  const void* source;
3664  uint32_t size;
3665  OrthancPluginCompressionType compression;
3666  uint8_t uncompress;
3667  } _OrthancPluginBufferCompression;
3668 
3669 
3687  OrthancPluginContext* context,
3688  OrthancPluginMemoryBuffer* target,
3689  const void* source,
3690  uint32_t size,
3691  OrthancPluginCompressionType compression,
3692  uint8_t uncompress)
3693  {
3694  _OrthancPluginBufferCompression params;
3695  params.target = target;
3696  params.source = source;
3697  params.size = size;
3698  params.compression = compression;
3699  params.uncompress = uncompress;
3700 
3701  return context->InvokeService(context, _OrthancPluginService_BufferCompression, &params);
3702  }
3703 
3704 
3705 
3706  typedef struct
3707  {
3708  OrthancPluginMemoryBuffer* target;
3709  const char* path;
3710  } _OrthancPluginReadFile;
3711 
3724  OrthancPluginContext* context,
3725  OrthancPluginMemoryBuffer* target,
3726  const char* path)
3727  {
3728  _OrthancPluginReadFile params;
3729  params.target = target;
3730  params.path = path;
3731  return context->InvokeService(context, _OrthancPluginService_ReadFile, &params);
3732  }
3733 
3734 
3735 
3736  typedef struct
3737  {
3738  const char* path;
3739  const void* data;
3740  uint32_t size;
3741  } _OrthancPluginWriteFile;
3742 
3755  OrthancPluginContext* context,
3756  const char* path,
3757  const void* data,
3758  uint32_t size)
3759  {
3760  _OrthancPluginWriteFile params;
3761  params.path = path;
3762  params.data = data;
3763  params.size = size;
3764  return context->InvokeService(context, _OrthancPluginService_WriteFile, &params);
3765  }
3766 
3767 
3768 
3769  typedef struct
3770  {
3771  const char** target;
3772  OrthancPluginErrorCode error;
3773  } _OrthancPluginGetErrorDescription;
3774 
3785  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetErrorDescription(
3786  OrthancPluginContext* context,
3787  OrthancPluginErrorCode error)
3788  {
3789  const char* result = NULL;
3790 
3791  _OrthancPluginGetErrorDescription params;
3792  params.target = &result;
3793  params.error = error;
3794 
3795  if (context->InvokeService(context, _OrthancPluginService_GetErrorDescription, &params) != OrthancPluginErrorCode_Success ||
3796  result == NULL)
3797  {
3798  return "Unknown error code";
3799  }
3800  else
3801  {
3802  return result;
3803  }
3804  }
3805 
3806 
3807 
3808  typedef struct
3809  {
3810  OrthancPluginRestOutput* output;
3811  uint16_t status;
3812  const char* body;
3813  uint32_t bodySize;
3814  } _OrthancPluginSendHttpStatus;
3815 
3838  ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatus(
3839  OrthancPluginContext* context,
3840  OrthancPluginRestOutput* output,
3841  uint16_t status,
3842  const char* body,
3843  uint32_t bodySize)
3844  {
3845  _OrthancPluginSendHttpStatus params;
3846  params.output = output;
3847  params.status = status;
3848  params.body = body;
3849  params.bodySize = bodySize;
3850  context->InvokeService(context, _OrthancPluginService_SendHttpStatus, &params);
3851  }
3852 
3853 
3854 
3855  typedef struct
3856  {
3857  const OrthancPluginImage* image;
3858  uint32_t* resultUint32;
3859  OrthancPluginPixelFormat* resultPixelFormat;
3860  void** resultBuffer;
3861  } _OrthancPluginGetImageInfo;
3862 
3863 
3875  OrthancPluginContext* context,
3876  const OrthancPluginImage* image)
3877  {
3878  OrthancPluginPixelFormat target;
3879 
3880  _OrthancPluginGetImageInfo params;
3881  memset(&params, 0, sizeof(params));
3882  params.image = image;
3883  params.resultPixelFormat = &target;
3884 
3885  if (context->InvokeService(context, _OrthancPluginService_GetImagePixelFormat, &params) != OrthancPluginErrorCode_Success)
3886  {
3888  }
3889  else
3890  {
3891  return (OrthancPluginPixelFormat) target;
3892  }
3893  }
3894 
3895 
3896 
3907  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageWidth(
3908  OrthancPluginContext* context,
3909  const OrthancPluginImage* image)
3910  {
3911  uint32_t width;
3912 
3913  _OrthancPluginGetImageInfo params;
3914  memset(&params, 0, sizeof(params));
3915  params.image = image;
3916  params.resultUint32 = &width;
3917 
3918  if (context->InvokeService(context, _OrthancPluginService_GetImageWidth, &params) != OrthancPluginErrorCode_Success)
3919  {
3920  return 0;
3921  }
3922  else
3923  {
3924  return width;
3925  }
3926  }
3927 
3928 
3929 
3940  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageHeight(
3941  OrthancPluginContext* context,
3942  const OrthancPluginImage* image)
3943  {
3944  uint32_t height;
3945 
3946  _OrthancPluginGetImageInfo params;
3947  memset(&params, 0, sizeof(params));
3948  params.image = image;
3949  params.resultUint32 = &height;
3950 
3951  if (context->InvokeService(context, _OrthancPluginService_GetImageHeight, &params) != OrthancPluginErrorCode_Success)
3952  {
3953  return 0;
3954  }
3955  else
3956  {
3957  return height;
3958  }
3959  }
3960 
3961 
3962 
3975  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImagePitch(
3976  OrthancPluginContext* context,
3977  const OrthancPluginImage* image)
3978  {
3979  uint32_t pitch;
3980 
3981  _OrthancPluginGetImageInfo params;
3982  memset(&params, 0, sizeof(params));
3983  params.image = image;
3984  params.resultUint32 = &pitch;
3985 
3986  if (context->InvokeService(context, _OrthancPluginService_GetImagePitch, &params) != OrthancPluginErrorCode_Success)
3987  {
3988  return 0;
3989  }
3990  else
3991  {
3992  return pitch;
3993  }
3994  }
3995 
3996 
3997 
4009  ORTHANC_PLUGIN_INLINE void* OrthancPluginGetImageBuffer(
4010  OrthancPluginContext* context,
4011  const OrthancPluginImage* image)
4012  {
4013  void* target = NULL;
4014 
4015  _OrthancPluginGetImageInfo params;
4016  memset(&params, 0, sizeof(params));
4017  params.resultBuffer = &target;
4018  params.image = image;
4019 
4020  if (context->InvokeService(context, _OrthancPluginService_GetImageBuffer, &params) != OrthancPluginErrorCode_Success)
4021  {
4022  return NULL;
4023  }
4024  else
4025  {
4026  return target;
4027  }
4028  }
4029 
4030 
4031  typedef struct
4032  {
4033  OrthancPluginImage** target;
4034  const void* data;
4035  uint32_t size;
4036  OrthancPluginImageFormat format;
4037  } _OrthancPluginUncompressImage;
4038 
4039 
4053  OrthancPluginContext* context,
4054  const void* data,
4055  uint32_t size,
4056  OrthancPluginImageFormat format)
4057  {
4058  OrthancPluginImage* target = NULL;
4059 
4060  _OrthancPluginUncompressImage params;
4061  memset(&params, 0, sizeof(params));
4062  params.target = &target;
4063  params.data = data;
4064  params.size = size;
4065  params.format = format;
4066 
4067  if (context->InvokeService(context, _OrthancPluginService_UncompressImage, &params) != OrthancPluginErrorCode_Success)
4068  {
4069  return NULL;
4070  }
4071  else
4072  {
4073  return target;
4074  }
4075  }
4076 
4077 
4078 
4079 
4080  typedef struct
4081  {
4082  OrthancPluginImage* image;
4083  } _OrthancPluginFreeImage;
4084 
4094  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeImage(
4095  OrthancPluginContext* context,
4096  OrthancPluginImage* image)
4097  {
4098  _OrthancPluginFreeImage params;
4099  params.image = image;
4100 
4101  context->InvokeService(context, _OrthancPluginService_FreeImage, &params);
4102  }
4103 
4104 
4105 
4106 
4107  typedef struct
4108  {
4109  OrthancPluginMemoryBuffer* target;
4110  OrthancPluginImageFormat imageFormat;
4111  OrthancPluginPixelFormat pixelFormat;
4112  uint32_t width;
4113  uint32_t height;
4114  uint32_t pitch;
4115  const void* buffer;
4116  uint8_t quality;
4117  } _OrthancPluginCompressImage;
4118 
4119 
4140  OrthancPluginContext* context,
4141  OrthancPluginMemoryBuffer* target,
4142  OrthancPluginPixelFormat format,
4143  uint32_t width,
4144  uint32_t height,
4145  uint32_t pitch,
4146  const void* buffer)
4147  {
4148  _OrthancPluginCompressImage params;
4149  memset(&params, 0, sizeof(params));
4150  params.target = target;
4151  params.imageFormat = OrthancPluginImageFormat_Png;
4152  params.pixelFormat = format;
4153  params.width = width;
4154  params.height = height;
4155  params.pitch = pitch;
4156  params.buffer = buffer;
4157  params.quality = 0; /* Unused for PNG */
4158 
4159  return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
4160  }
4161 
4162 
4185  OrthancPluginContext* context,
4186  OrthancPluginMemoryBuffer* target,
4187  OrthancPluginPixelFormat format,
4188  uint32_t width,
4189  uint32_t height,
4190  uint32_t pitch,
4191  const void* buffer,
4192  uint8_t quality)
4193  {
4194  _OrthancPluginCompressImage params;
4195  memset(&params, 0, sizeof(params));
4196  params.target = target;
4197  params.imageFormat = OrthancPluginImageFormat_Jpeg;
4198  params.pixelFormat = format;
4199  params.width = width;
4200  params.height = height;
4201  params.pitch = pitch;
4202  params.buffer = buffer;
4203  params.quality = quality;
4204 
4205  return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
4206  }
4207 
4208 
4209 
4231  ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerJpegImage(
4232  OrthancPluginContext* context,
4233  OrthancPluginRestOutput* output,
4234  OrthancPluginPixelFormat format,
4235  uint32_t width,
4236  uint32_t height,
4237  uint32_t pitch,
4238  const void* buffer,
4239  uint8_t quality)
4240  {
4241  _OrthancPluginCompressAndAnswerImage params;
4242  params.output = output;
4243  params.imageFormat = OrthancPluginImageFormat_Jpeg;
4244  params.pixelFormat = format;
4245  params.width = width;
4246  params.height = height;
4247  params.pitch = pitch;
4248  params.buffer = buffer;
4249  params.quality = quality;
4250  context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
4251  }
4252 
4253 
4254 
4255 
4256  typedef struct
4257  {
4258  OrthancPluginMemoryBuffer* target;
4259  OrthancPluginHttpMethod method;
4260  const char* url;
4261  const char* username;
4262  const char* password;
4263  const void* body;
4264  uint32_t bodySize;
4265  } _OrthancPluginCallHttpClient;
4266 
4267 
4285  OrthancPluginContext* context,
4286  OrthancPluginMemoryBuffer* target,
4287  const char* url,
4288  const char* username,
4289  const char* password)
4290  {
4291  _OrthancPluginCallHttpClient params;
4292  memset(&params, 0, sizeof(params));
4293 
4294  params.target = target;
4295  params.method = OrthancPluginHttpMethod_Get;
4296  params.url = url;
4297  params.username = username;
4298  params.password = password;
4299 
4300  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
4301  }
4302 
4303 
4323  OrthancPluginContext* context,
4324  OrthancPluginMemoryBuffer* target,
4325  const char* url,
4326  const void* body,
4327  uint32_t bodySize,
4328  const char* username,
4329  const char* password)
4330  {
4331  _OrthancPluginCallHttpClient params;
4332  memset(&params, 0, sizeof(params));
4333 
4334  params.target = target;
4335  params.method = OrthancPluginHttpMethod_Post;
4336  params.url = url;
4337  params.body = body;
4338  params.bodySize = bodySize;
4339  params.username = username;
4340  params.password = password;
4341 
4342  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
4343  }
4344 
4345 
4365  OrthancPluginContext* context,
4366  OrthancPluginMemoryBuffer* target,
4367  const char* url,
4368  const void* body,
4369  uint32_t bodySize,
4370  const char* username,
4371  const char* password)
4372  {
4373  _OrthancPluginCallHttpClient params;
4374  memset(&params, 0, sizeof(params));
4375 
4376  params.target = target;
4377  params.method = OrthancPluginHttpMethod_Put;
4378  params.url = url;
4379  params.body = body;
4380  params.bodySize = bodySize;
4381  params.username = username;
4382  params.password = password;
4383 
4384  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
4385  }
4386 
4387 
4403  OrthancPluginContext* context,
4404  const char* url,
4405  const char* username,
4406  const char* password)
4407  {
4408  _OrthancPluginCallHttpClient params;
4409  memset(&params, 0, sizeof(params));
4410 
4411  params.method = OrthancPluginHttpMethod_Delete;
4412  params.url = url;
4413  params.username = username;
4414  params.password = password;
4415 
4416  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
4417  }
4418 
4419 
4420 
4421  typedef struct
4422  {
4423  OrthancPluginImage** target;
4424  const OrthancPluginImage* source;
4425  OrthancPluginPixelFormat targetFormat;
4426  } _OrthancPluginConvertPixelFormat;
4427 
4428 
4441  OrthancPluginContext* context,
4442  const OrthancPluginImage* source,
4443  OrthancPluginPixelFormat targetFormat)
4444  {
4445  OrthancPluginImage* target = NULL;
4446 
4447  _OrthancPluginConvertPixelFormat params;
4448  params.target = &target;
4449  params.source = source;
4450  params.targetFormat = targetFormat;
4451 
4452  if (context->InvokeService(context, _OrthancPluginService_ConvertPixelFormat, &params) != OrthancPluginErrorCode_Success)
4453  {
4454  return NULL;
4455  }
4456  else
4457  {
4458  return target;
4459  }
4460  }
4461 
4462 
4463 
4475  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontsCount(
4476  OrthancPluginContext* context)
4477  {
4478  uint32_t count = 0;
4479 
4480  _OrthancPluginReturnSingleValue params;
4481  memset(&params, 0, sizeof(params));
4482  params.resultUint32 = &count;
4483 
4484  if (context->InvokeService(context, _OrthancPluginService_GetFontsCount, &params) != OrthancPluginErrorCode_Success)
4485  {
4486  /* Error */
4487  return 0;
4488  }
4489  else
4490  {
4491  return count;
4492  }
4493  }
4494 
4495 
4496 
4497 
4498  typedef struct
4499  {
4500  uint32_t fontIndex; /* in */
4501  const char** name; /* out */
4502  uint32_t* size; /* out */
4503  } _OrthancPluginGetFontInfo;
4504 
4515  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetFontName(
4516  OrthancPluginContext* context,
4517  uint32_t fontIndex)
4518  {
4519  const char* result = NULL;
4520 
4521  _OrthancPluginGetFontInfo params;
4522  memset(&params, 0, sizeof(params));
4523  params.name = &result;
4524  params.fontIndex = fontIndex;
4525 
4526  if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
4527  {
4528  return NULL;
4529  }
4530  else
4531  {
4532  return result;
4533  }
4534  }
4535 
4536 
4547  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontSize(
4548  OrthancPluginContext* context,
4549  uint32_t fontIndex)
4550  {
4551  uint32_t result;
4552 
4553  _OrthancPluginGetFontInfo params;
4554  memset(&params, 0, sizeof(params));
4555  params.size = &result;
4556  params.fontIndex = fontIndex;
4557 
4558  if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
4559  {
4560  return 0;
4561  }
4562  else
4563  {
4564  return result;
4565  }
4566  }
4567 
4568 
4569 
4570  typedef struct
4571  {
4572  OrthancPluginImage* image;
4573  uint32_t fontIndex;
4574  const char* utf8Text;
4575  int32_t x;
4576  int32_t y;
4577  uint8_t r;
4578  uint8_t g;
4579  uint8_t b;
4580  } _OrthancPluginDrawText;
4581 
4582 
4601  OrthancPluginContext* context,
4602  OrthancPluginImage* image,
4603  uint32_t fontIndex,
4604  const char* utf8Text,
4605  int32_t x,
4606  int32_t y,
4607  uint8_t r,
4608  uint8_t g,
4609  uint8_t b)
4610  {
4611  _OrthancPluginDrawText params;
4612  memset(&params, 0, sizeof(params));
4613  params.image = image;
4614  params.fontIndex = fontIndex;
4615  params.utf8Text = utf8Text;
4616  params.x = x;
4617  params.y = y;
4618  params.r = r;
4619  params.g = g;
4620  params.b = b;
4621 
4622  return context->InvokeService(context, _OrthancPluginService_DrawText, &params);
4623  }
4624 
4625 
4626 
4627  typedef struct
4628  {
4629  OrthancPluginStorageArea* storageArea;
4630  const char* uuid;
4631  const void* content;
4632  uint64_t size;
4634  } _OrthancPluginStorageAreaCreate;
4635 
4636 
4655  OrthancPluginContext* context,
4656  OrthancPluginStorageArea* storageArea,
4657  const char* uuid,
4658  const void* content,
4659  uint64_t size,
4661  {
4662  _OrthancPluginStorageAreaCreate params;
4663  params.storageArea = storageArea;
4664  params.uuid = uuid;
4665  params.content = content;
4666  params.size = size;
4667  params.type = type;
4668 
4669  return context->InvokeService(context, _OrthancPluginService_StorageAreaCreate, &params);
4670  }
4671 
4672 
4673  typedef struct
4674  {
4675  OrthancPluginMemoryBuffer* target;
4676  OrthancPluginStorageArea* storageArea;
4677  const char* uuid;
4679  } _OrthancPluginStorageAreaRead;
4680 
4681 
4699  OrthancPluginContext* context,
4700  OrthancPluginMemoryBuffer* target,
4701  OrthancPluginStorageArea* storageArea,
4702  const char* uuid,
4704  {
4705  _OrthancPluginStorageAreaRead params;
4706  params.target = target;
4707  params.storageArea = storageArea;
4708  params.uuid = uuid;
4709  params.type = type;
4710 
4711  return context->InvokeService(context, _OrthancPluginService_StorageAreaRead, &params);
4712  }
4713 
4714 
4715  typedef struct
4716  {
4717  OrthancPluginStorageArea* storageArea;
4718  const char* uuid;
4720  } _OrthancPluginStorageAreaRemove;
4721 
4738  OrthancPluginContext* context,
4739  OrthancPluginStorageArea* storageArea,
4740  const char* uuid,
4742  {
4743  _OrthancPluginStorageAreaRemove params;
4744  params.storageArea = storageArea;
4745  params.uuid = uuid;
4746  params.type = type;
4747 
4748  return context->InvokeService(context, _OrthancPluginService_StorageAreaRemove, &params);
4749  }
4750 
4751 
4752 
4753  typedef struct
4754  {
4755  OrthancPluginErrorCode* target;
4756  int32_t code;
4757  uint16_t httpStatus;
4758  const char* message;
4759  } _OrthancPluginRegisterErrorCode;
4760 
4777  OrthancPluginContext* context,
4778  int32_t code,
4779  uint16_t httpStatus,
4780  const char* message)
4781  {
4782  OrthancPluginErrorCode target;
4783 
4784  _OrthancPluginRegisterErrorCode params;
4785  params.target = &target;
4786  params.code = code;
4787  params.httpStatus = httpStatus;
4788  params.message = message;
4789 
4790  if (context->InvokeService(context, _OrthancPluginService_RegisterErrorCode, &params) == OrthancPluginErrorCode_Success)
4791  {
4792  return target;
4793  }
4794  else
4795  {
4796  /* There was an error while assigned the error. Use a generic code. */
4798  }
4799  }
4800 
4801 
4802 
4803  typedef struct
4804  {
4805  uint16_t group;
4806  uint16_t element;
4808  const char* name;
4809  uint32_t minMultiplicity;
4810  uint32_t maxMultiplicity;
4811  } _OrthancPluginRegisterDictionaryTag;
4812 
4833  OrthancPluginContext* context,
4834  uint16_t group,
4835  uint16_t element,
4837  const char* name,
4838  uint32_t minMultiplicity,
4839  uint32_t maxMultiplicity)
4840  {
4841  _OrthancPluginRegisterDictionaryTag params;
4842  params.group = group;
4843  params.element = element;
4844  params.vr = vr;
4845  params.name = name;
4846  params.minMultiplicity = minMultiplicity;
4847  params.maxMultiplicity = maxMultiplicity;
4848 
4849  return context->InvokeService(context, _OrthancPluginService_RegisterDictionaryTag, &params);
4850  }
4851 
4852 
4853 
4854  typedef struct
4855  {
4856  uint16_t group;
4857  uint16_t element;
4859  const char* name;
4860  uint32_t minMultiplicity;
4861  uint32_t maxMultiplicity;
4862  const char* privateCreator;
4863  } _OrthancPluginRegisterPrivateDictionaryTag;
4864 
4886  OrthancPluginContext* context,
4887  uint16_t group,
4888  uint16_t element,
4890  const char* name,
4891  uint32_t minMultiplicity,
4892  uint32_t maxMultiplicity,
4893  const char* privateCreator)
4894  {
4895  _OrthancPluginRegisterPrivateDictionaryTag params;
4896  params.group = group;
4897  params.element = element;
4898  params.vr = vr;
4899  params.name = name;
4900  params.minMultiplicity = minMultiplicity;
4901  params.maxMultiplicity = maxMultiplicity;
4902  params.privateCreator = privateCreator;
4903 
4904  return context->InvokeService(context, _OrthancPluginService_RegisterPrivateDictionaryTag, &params);
4905  }
4906 
4907 
4908 
4909  typedef struct
4910  {
4911  OrthancPluginStorageArea* storageArea;
4913  } _OrthancPluginReconstructMainDicomTags;
4914 
4930  OrthancPluginContext* context,
4931  OrthancPluginStorageArea* storageArea,
4933  {
4934  _OrthancPluginReconstructMainDicomTags params;
4935  params.level = level;
4936  params.storageArea = storageArea;
4937 
4938  return context->InvokeService(context, _OrthancPluginService_ReconstructMainDicomTags, &params);
4939  }
4940 
4941 
4942  typedef struct
4943  {
4944  char** result;
4945  const char* instanceId;
4946  const void* buffer;
4947  uint32_t size;
4950  uint32_t maxStringLength;
4951  } _OrthancPluginDicomToJson;
4952 
4953 
4973  ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomBufferToJson(
4974  OrthancPluginContext* context,
4975  const void* buffer,
4976  uint32_t size,
4979  uint32_t maxStringLength)
4980  {
4981  char* result;
4982 
4983  _OrthancPluginDicomToJson params;
4984  memset(&params, 0, sizeof(params));
4985  params.result = &result;
4986  params.buffer = buffer;
4987  params.size = size;
4988  params.format = format;
4989  params.flags = flags;
4990  params.maxStringLength = maxStringLength;
4991 
4992  if (context->InvokeService(context, _OrthancPluginService_DicomBufferToJson, &params) != OrthancPluginErrorCode_Success)
4993  {
4994  /* Error */
4995  return NULL;
4996  }
4997  else
4998  {
4999  return result;
5000  }
5001  }
5002 
5003 
5022  ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomInstanceToJson(
5023  OrthancPluginContext* context,
5024  const char* instanceId,
5027  uint32_t maxStringLength)
5028  {
5029  char* result;
5030 
5031  _OrthancPluginDicomToJson params;
5032  memset(&params, 0, sizeof(params));
5033  params.result = &result;
5034  params.instanceId = instanceId;
5035  params.format = format;
5036  params.flags = flags;
5037  params.maxStringLength = maxStringLength;
5038 
5039  if (context->InvokeService(context, _OrthancPluginService_DicomInstanceToJson, &params) != OrthancPluginErrorCode_Success)
5040  {
5041  /* Error */
5042  return NULL;
5043  }
5044  else
5045  {
5046  return result;
5047  }
5048  }
5049 
5050 
5051  typedef struct
5052  {
5053  OrthancPluginMemoryBuffer* target;
5054  const char* uri;
5055  uint32_t headersCount;
5056  const char* const* headersKeys;
5057  const char* const* headersValues;
5058  int32_t afterPlugins;
5059  } _OrthancPluginRestApiGet2;
5060 
5081  OrthancPluginContext* context,
5082  OrthancPluginMemoryBuffer* target,
5083  const char* uri,
5084  uint32_t headersCount,
5085  const char* const* headersKeys,
5086  const char* const* headersValues,
5087  int32_t afterPlugins)
5088  {
5089  _OrthancPluginRestApiGet2 params;
5090  params.target = target;
5091  params.uri = uri;
5092  params.headersCount = headersCount;
5093  params.headersKeys = headersKeys;
5094  params.headersValues = headersValues;
5095  params.afterPlugins = afterPlugins;
5096 
5097  return context->InvokeService(context, _OrthancPluginService_RestApiGet2, &params);
5098  }
5099 
5100 
5101 
5102  typedef struct
5103  {
5105  } _OrthancPluginWorklistCallback;
5106 
5119  OrthancPluginContext* context,
5121  {
5122  _OrthancPluginWorklistCallback params;
5123  params.callback = callback;
5124 
5125  return context->InvokeService(context, _OrthancPluginService_RegisterWorklistCallback, &params);
5126  }
5127 
5128 
5129 
5130  typedef struct
5131  {
5133  const OrthancPluginWorklistQuery* query;
5134  const void* dicom;
5135  uint32_t size;
5136  } _OrthancPluginWorklistAnswersOperation;
5137 
5155  OrthancPluginContext* context,
5157  const OrthancPluginWorklistQuery* query,
5158  const void* dicom,
5159  uint32_t size)
5160  {
5161  _OrthancPluginWorklistAnswersOperation params;
5162  params.answers = answers;
5163  params.query = query;
5164  params.dicom = dicom;
5165  params.size = size;
5166 
5167  return context->InvokeService(context, _OrthancPluginService_WorklistAddAnswer, &params);
5168  }
5169 
5170 
5185  OrthancPluginContext* context,
5187  {
5188  _OrthancPluginWorklistAnswersOperation params;
5189  params.answers = answers;
5190  params.query = NULL;
5191  params.dicom = NULL;
5192  params.size = 0;
5193 
5194  return context->InvokeService(context, _OrthancPluginService_WorklistMarkIncomplete, &params);
5195  }
5196 
5197 
5198  typedef struct
5199  {
5200  const OrthancPluginWorklistQuery* query;
5201  const void* dicom;
5202  uint32_t size;
5203  int32_t* isMatch;
5204  OrthancPluginMemoryBuffer* target;
5205  } _OrthancPluginWorklistQueryOperation;
5206 
5222  ORTHANC_PLUGIN_INLINE int32_t OrthancPluginWorklistIsMatch(
5223  OrthancPluginContext* context,
5224  const OrthancPluginWorklistQuery* query,
5225  const void* dicom,
5226  uint32_t size)
5227  {
5228  int32_t isMatch = 0;
5229 
5230  _OrthancPluginWorklistQueryOperation params;
5231  params.query = query;
5232  params.dicom = dicom;
5233  params.size = size;
5234  params.isMatch = &isMatch;
5235  params.target = NULL;
5236 
5237  if (context->InvokeService(context, _OrthancPluginService_WorklistIsMatch, &params) == OrthancPluginErrorCode_Success)
5238  {
5239  return isMatch;
5240  }
5241  else
5242  {
5243  /* Error: Assume non-match */
5244  return 0;
5245  }
5246  }
5247 
5248 
5262  OrthancPluginContext* context,
5263  OrthancPluginMemoryBuffer* target,
5264  const OrthancPluginWorklistQuery* query)
5265  {
5266  _OrthancPluginWorklistQueryOperation params;
5267  params.query = query;
5268  params.dicom = NULL;
5269  params.size = 0;
5270  params.isMatch = NULL;
5271  params.target = target;
5272 
5273  return context->InvokeService(context, _OrthancPluginService_WorklistGetDicomQuery, &params);
5274  }
5275 
5276 
5288  OrthancPluginContext* context,
5289  const OrthancPluginDicomInstance* instance)
5290  {
5292 
5293  _OrthancPluginAccessDicomInstance params;
5294  memset(&params, 0, sizeof(params));
5295  params.resultOrigin = &origin;
5296  params.instance = instance;
5297 
5298  if (context->InvokeService(context, _OrthancPluginService_GetInstanceOrigin, &params) != OrthancPluginErrorCode_Success)
5299  {
5300  /* Error */
5302  }
5303  else
5304  {
5305  return origin;
5306  }
5307  }
5308 
5309 
5310  typedef struct
5311  {
5312  OrthancPluginMemoryBuffer* target;
5313  const char* json;
5314  const OrthancPluginImage* pixelData;
5316  } _OrthancPluginCreateDicom;
5317 
5344  OrthancPluginContext* context,
5345  OrthancPluginMemoryBuffer* target,
5346  const char* json,
5347  const OrthancPluginImage* pixelData,
5349  {
5350  _OrthancPluginCreateDicom params;
5351  params.target = target;
5352  params.json = json;
5353  params.pixelData = pixelData;
5354  params.flags = flags;
5355 
5356  return context->InvokeService(context, _OrthancPluginService_CreateDicom, &params);
5357  }
5358 
5359 
5360  typedef struct
5361  {
5363  } _OrthancPluginDecodeImageCallback;
5364 
5380  OrthancPluginContext* context,
5382  {
5383  _OrthancPluginDecodeImageCallback params;
5384  params.callback = callback;
5385 
5386  return context->InvokeService(context, _OrthancPluginService_RegisterDecodeImageCallback, &params);
5387  }
5388 
5389 
5390 
5391  typedef struct
5392  {
5393  OrthancPluginImage** target;
5394  OrthancPluginPixelFormat format;
5395  uint32_t width;
5396  uint32_t height;
5397  uint32_t pitch;
5398  void* buffer;
5399  const void* constBuffer;
5400  uint32_t bufferSize;
5401  uint32_t frameIndex;
5402  } _OrthancPluginCreateImage;
5403 
5404 
5418  OrthancPluginContext* context,
5419  OrthancPluginPixelFormat format,
5420  uint32_t width,
5421  uint32_t height)
5422  {
5423  OrthancPluginImage* target = NULL;
5424 
5425  _OrthancPluginCreateImage params;
5426  memset(&params, 0, sizeof(params));
5427  params.target = &target;
5428  params.format = format;
5429  params.width = width;
5430  params.height = height;
5431 
5432  if (context->InvokeService(context, _OrthancPluginService_CreateImage, &params) != OrthancPluginErrorCode_Success)
5433  {
5434  return NULL;
5435  }
5436  else
5437  {
5438  return target;
5439  }
5440  }
5441 
5442 
5461  OrthancPluginContext* context,
5462  OrthancPluginPixelFormat format,
5463  uint32_t width,
5464  uint32_t height,
5465  uint32_t pitch,
5466  void* buffer)
5467  {
5468  OrthancPluginImage* target = NULL;
5469 
5470  _OrthancPluginCreateImage params;
5471  memset(&params, 0, sizeof(params));
5472  params.target = &target;
5473  params.format = format;
5474  params.width = width;
5475  params.height = height;
5476  params.pitch = pitch;
5477  params.buffer = buffer;
5478 
5479  if (context->InvokeService(context, _OrthancPluginService_CreateImageAccessor, &params) != OrthancPluginErrorCode_Success)
5480  {
5481  return NULL;
5482  }
5483  else
5484  {
5485  return target;
5486  }
5487  }
5488 
5489 
5490 
5507  OrthancPluginContext* context,
5508  const void* buffer,
5509  uint32_t bufferSize,
5510  uint32_t frameIndex)
5511  {
5512  OrthancPluginImage* target = NULL;
5513 
5514  _OrthancPluginCreateImage params;
5515  memset(&params, 0, sizeof(params));
5516  params.target = &target;
5517  params.constBuffer = buffer;
5518  params.bufferSize = bufferSize;
5519  params.frameIndex = frameIndex;
5520 
5521  if (context->InvokeService(context, _OrthancPluginService_DecodeDicomImage, &params) != OrthancPluginErrorCode_Success)
5522  {
5523  return NULL;
5524  }
5525  else
5526  {
5527  return target;
5528  }
5529  }
5530 
5531 
5532 
5533  typedef struct
5534  {
5535  char** result;
5536  const void* buffer;
5537  uint32_t size;
5538  } _OrthancPluginComputeHash;
5539 
5552  ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeMd5(
5553  OrthancPluginContext* context,
5554  const void* buffer,
5555  uint32_t size)
5556  {
5557  char* result;
5558 
5559  _OrthancPluginComputeHash params;
5560  params.result = &result;
5561  params.buffer = buffer;
5562  params.size = size;
5563 
5564  if (context->InvokeService(context, _OrthancPluginService_ComputeMd5, &params) != OrthancPluginErrorCode_Success)
5565  {
5566  /* Error */
5567  return NULL;
5568  }
5569  else
5570  {
5571  return result;
5572  }
5573  }
5574 
5575 
5588  ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeSha1(
5589  OrthancPluginContext* context,
5590  const void* buffer,
5591  uint32_t size)
5592  {
5593  char* result;
5594 
5595  _OrthancPluginComputeHash params;
5596  params.result = &result;
5597  params.buffer = buffer;
5598  params.size = size;
5599 
5600  if (context->InvokeService(context, _OrthancPluginService_ComputeSha1, &params) != OrthancPluginErrorCode_Success)
5601  {
5602  /* Error */
5603  return NULL;
5604  }
5605  else
5606  {
5607  return result;
5608  }
5609  }
5610 
5611 
5612 
5613  typedef struct
5614  {
5616  const char* name;
5617  } _OrthancPluginLookupDictionary;
5618 
5635  OrthancPluginContext* context,
5637  const char* name)
5638  {
5639  _OrthancPluginLookupDictionary params;
5640  params.target = target;
5641  params.name = name;
5642  return context->InvokeService(context, _OrthancPluginService_LookupDictionary, &params);
5643  }
5644 
5645 
5646 
5647  typedef struct
5648  {
5649  OrthancPluginRestOutput* output;
5650  const void* answer;
5651  uint32_t answerSize;
5652  uint32_t headersCount;
5653  const char* const* headersKeys;
5654  const char* const* headersValues;
5655  } _OrthancPluginSendMultipartItem2;
5656 
5678  OrthancPluginContext* context,
5679  OrthancPluginRestOutput* output,
5680  const void* answer,
5681  uint32_t answerSize,
5682  uint32_t headersCount,
5683  const char* const* headersKeys,
5684  const char* const* headersValues)
5685  {
5686  _OrthancPluginSendMultipartItem2 params;
5687  params.output = output;
5688  params.answer = answer;
5689  params.answerSize = answerSize;
5690  params.headersCount = headersCount;
5691  params.headersKeys = headersKeys;
5692  params.headersValues = headersValues;
5693 
5694  return context->InvokeService(context, _OrthancPluginService_SendMultipartItem2, &params);
5695  }
5696 
5697 
5698  typedef struct
5699  {
5701  } _OrthancPluginIncomingHttpRequestFilter;
5702 
5716  OrthancPluginContext* context,
5718  {
5719  _OrthancPluginIncomingHttpRequestFilter params;
5720  params.callback = callback;
5721 
5722  return context->InvokeService(context, _OrthancPluginService_RegisterIncomingHttpRequestFilter, &params);
5723  }
5724 
5725 
5726 
5727  typedef struct
5728  {
5729  OrthancPluginMemoryBuffer* answerBody;
5730  OrthancPluginMemoryBuffer* answerHeaders;
5731  uint16_t* httpStatus;
5732  OrthancPluginHttpMethod method;
5733  const char* url;
5734  uint32_t headersCount;
5735  const char* const* headersKeys;
5736  const char* const* headersValues;
5737  const void* body;
5738  uint32_t bodySize;
5739  const char* username;
5740  const char* password;
5741  uint32_t timeout;
5742  const char* certificateFile;
5743  const char* certificateKeyFile;
5744  const char* certificateKeyPassword;
5745  uint8_t pkcs11;
5746  } _OrthancPluginCallHttpClient2;
5747 
5748 
5749 
5791  OrthancPluginContext* context,
5792  OrthancPluginMemoryBuffer* answerBody,
5793  OrthancPluginMemoryBuffer* answerHeaders,
5794  uint16_t* httpStatus,
5795  OrthancPluginHttpMethod method,
5796  const char* url,
5797  uint32_t headersCount,
5798  const char* const* headersKeys,
5799  const char* const* headersValues,
5800  const void* body,
5801  uint32_t bodySize,
5802  const char* username,
5803  const char* password,
5804  uint32_t timeout,
5805  const char* certificateFile,
5806  const char* certificateKeyFile,
5807  const char* certificateKeyPassword,
5808  uint8_t pkcs11)
5809  {
5810  _OrthancPluginCallHttpClient2 params;
5811  memset(&params, 0, sizeof(params));
5812 
5813  params.answerBody = answerBody;
5814  params.answerHeaders = answerHeaders;
5815  params.httpStatus = httpStatus;
5816  params.method = method;
5817  params.url = url;
5818  params.headersCount = headersCount;
5819  params.headersKeys = headersKeys;
5820  params.headersValues = headersValues;
5821  params.body = body;
5822  params.bodySize = bodySize;
5823  params.username = username;
5824  params.password = password;
5825  params.timeout = timeout;
5826  params.certificateFile = certificateFile;
5827  params.certificateKeyFile = certificateKeyFile;
5828  params.certificateKeyPassword = certificateKeyPassword;
5829  params.pkcs11 = pkcs11;
5830 
5831  return context->InvokeService(context, _OrthancPluginService_CallHttpClient2, &params);
5832  }
5833 
5834 
5845  ORTHANC_PLUGIN_INLINE char* OrthancPluginGenerateUuid(
5846  OrthancPluginContext* context)
5847  {
5848  char* result;
5849 
5850  _OrthancPluginRetrieveDynamicString params;
5851  params.result = &result;
5852  params.argument = NULL;
5853 
5854  if (context->InvokeService(context, _OrthancPluginService_GenerateUuid, &params) != OrthancPluginErrorCode_Success)
5855  {
5856  /* Error */
5857  return NULL;
5858  }
5859  else
5860  {
5861  return result;
5862  }
5863  }
5864 
5865 
5866 
5867 
5868  typedef struct
5869  {
5870  OrthancPluginFindCallback callback;
5871  } _OrthancPluginFindCallback;
5872 
5885  OrthancPluginContext* context,
5886  OrthancPluginFindCallback callback)
5887  {
5888  _OrthancPluginFindCallback params;
5889  params.callback = callback;
5890 
5891  return context->InvokeService(context, _OrthancPluginService_RegisterFindCallback, &params);
5892  }
5893 
5894 
5895  typedef struct
5896  {
5897  OrthancPluginFindAnswers *answers;
5898  const OrthancPluginFindQuery *query;
5899  const void *dicom;
5900  uint32_t size;
5901  uint32_t index;
5902  uint32_t *resultUint32;
5903  uint16_t *resultGroup;
5904  uint16_t *resultElement;
5905  char **resultString;
5906  } _OrthancPluginFindOperation;
5907 
5924  OrthancPluginContext* context,
5925  OrthancPluginFindAnswers* answers,
5926  const void* dicom,
5927  uint32_t size)
5928  {
5929  _OrthancPluginFindOperation params;
5930  memset(&params, 0, sizeof(params));
5931  params.answers = answers;
5932  params.dicom = dicom;
5933  params.size = size;
5934 
5935  return context->InvokeService(context, _OrthancPluginService_FindAddAnswer, &params);
5936  }
5937 
5938 
5953  OrthancPluginContext* context,
5954  OrthancPluginFindAnswers* answers)
5955  {
5956  _OrthancPluginFindOperation params;
5957  memset(&params, 0, sizeof(params));
5958  params.answers = answers;
5959 
5960  return context->InvokeService(context, _OrthancPluginService_FindMarkIncomplete, &params);
5961  }
5962 
5963 
5964 
5976  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFindQuerySize(
5977  OrthancPluginContext* context,
5978  const OrthancPluginFindQuery* query)
5979  {
5980  uint32_t count = 0;
5981 
5982  _OrthancPluginFindOperation params;
5983  memset(&params, 0, sizeof(params));
5984  params.query = query;
5985  params.resultUint32 = &count;
5986 
5987  if (context->InvokeService(context, _OrthancPluginService_GetFindQuerySize, &params) != OrthancPluginErrorCode_Success)
5988  {
5989  /* Error */
5990  return 0;
5991  }
5992  else
5993  {
5994  return count;
5995  }
5996  }
5997 
5998 
6014  OrthancPluginContext* context,
6015  uint16_t* group,
6016  uint16_t* element,
6017  const OrthancPluginFindQuery* query,
6018  uint32_t index)
6019  {
6020  _OrthancPluginFindOperation params;
6021  memset(&params, 0, sizeof(params));
6022  params.query = query;
6023  params.index = index;
6024  params.resultGroup = group;
6025  params.resultElement = element;
6026 
6027  return context->InvokeService(context, _OrthancPluginService_GetFindQueryTag, &params);
6028  }
6029 
6030 
6044  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetFindQueryTagName(
6045  OrthancPluginContext* context,
6046  const OrthancPluginFindQuery* query,
6047  uint32_t index)
6048  {
6049  char* result;
6050 
6051  _OrthancPluginFindOperation params;
6052  memset(&params, 0, sizeof(params));
6053  params.query = query;
6054  params.index = index;
6055  params.resultString = &result;
6056 
6057  if (context->InvokeService(context, _OrthancPluginService_GetFindQueryTagName, &params) != OrthancPluginErrorCode_Success)
6058  {
6059  /* Error */
6060  return NULL;
6061  }
6062  else
6063  {
6064  return result;
6065  }
6066  }
6067 
6068 
6082  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetFindQueryValue(
6083  OrthancPluginContext* context,
6084  const OrthancPluginFindQuery* query,
6085  uint32_t index)
6086  {
6087  char* result;
6088 
6089  _OrthancPluginFindOperation params;
6090  memset(&params, 0, sizeof(params));
6091  params.query = query;
6092  params.index = index;
6093  params.resultString = &result;
6094 
6095  if (context->InvokeService(context, _OrthancPluginService_GetFindQueryValue, &params) != OrthancPluginErrorCode_Success)
6096  {
6097  /* Error */
6098  return NULL;
6099  }
6100  else
6101  {
6102  return result;
6103  }
6104  }
6105 
6106 
6107 
6108 
6109  typedef struct
6110  {
6111  OrthancPluginMoveCallback callback;
6112  OrthancPluginGetMoveSize getMoveSize;
6113  OrthancPluginApplyMove applyMove;
6114  OrthancPluginFreeMove freeMove;
6115  } _OrthancPluginMoveCallback;
6116 
6131  OrthancPluginContext* context,
6132  OrthancPluginMoveCallback callback,
6133  OrthancPluginGetMoveSize getMoveSize,
6134  OrthancPluginApplyMove applyMove,
6135  OrthancPluginFreeMove freeMove)
6136  {
6137  _OrthancPluginMoveCallback params;
6138  params.callback = callback;
6139  params.getMoveSize = getMoveSize;
6140  params.applyMove = applyMove;
6141  params.freeMove = freeMove;
6142 
6143  return context->InvokeService(context, _OrthancPluginService_RegisterMoveCallback, &params);
6144  }
6145 
6146 
6147 
6148  typedef struct
6149  {
6150  OrthancPluginFindMatcher** target;
6151  const void* query;
6152  uint32_t size;
6153  } _OrthancPluginCreateFindMatcher;
6154 
6155 
6170  OrthancPluginContext* context,
6171  const void* query,
6172  uint32_t size)
6173  {
6174  OrthancPluginFindMatcher* target = NULL;
6175 
6176  _OrthancPluginCreateFindMatcher params;
6177  memset(&params, 0, sizeof(params));
6178  params.target = &target;
6179  params.query = query;
6180  params.size = size;
6181 
6182  if (context->InvokeService(context, _OrthancPluginService_CreateFindMatcher, &params) != OrthancPluginErrorCode_Success)
6183  {
6184  return NULL;
6185  }
6186  else
6187  {
6188  return target;
6189  }
6190  }
6191 
6192 
6193  typedef struct
6194  {
6195  OrthancPluginFindMatcher* matcher;
6196  } _OrthancPluginFreeFindMatcher;
6197 
6207  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeFindMatcher(
6208  OrthancPluginContext* context,
6209  OrthancPluginFindMatcher* matcher)
6210  {
6211  _OrthancPluginFreeFindMatcher params;
6212  params.matcher = matcher;
6213 
6214  context->InvokeService(context, _OrthancPluginService_FreeFindMatcher, &params);
6215  }
6216 
6217 
6218  typedef struct
6219  {
6220  const OrthancPluginFindMatcher* matcher;
6221  const void* dicom;
6222  uint32_t size;
6223  int32_t* isMatch;
6224  } _OrthancPluginFindMatcherIsMatch;
6225 
6240  ORTHANC_PLUGIN_INLINE int32_t OrthancPluginFindMatcherIsMatch(
6241  OrthancPluginContext* context,
6242  const OrthancPluginFindMatcher* matcher,
6243  const void* dicom,
6244  uint32_t size)
6245  {
6246  int32_t isMatch = 0;
6247 
6248  _OrthancPluginFindMatcherIsMatch params;
6249  params.matcher = matcher;
6250  params.dicom = dicom;
6251  params.size = size;
6252  params.isMatch = &isMatch;
6253 
6254  if (context->InvokeService(context, _OrthancPluginService_FindMatcherIsMatch, &params) == OrthancPluginErrorCode_Success)
6255  {
6256  return isMatch;
6257  }
6258  else
6259  {
6260  /* Error: Assume non-match */
6261  return 0;
6262  }
6263  }
6264 
6265 
6266  typedef struct
6267  {
6269  } _OrthancPluginIncomingHttpRequestFilter2;
6270 
6283  OrthancPluginContext* context,
6285  {
6286  _OrthancPluginIncomingHttpRequestFilter2 params;
6287  params.callback = callback;
6288 
6289  return context->InvokeService(context, _OrthancPluginService_RegisterIncomingHttpRequestFilter2, &params);
6290  }
6291 
6292 
6293 
6294  typedef struct
6295  {
6296  OrthancPluginPeers** peers;
6297  } _OrthancPluginGetPeers;
6298 
6311  OrthancPluginContext* context)
6312  {
6313  OrthancPluginPeers* peers = NULL;
6314 
6315  _OrthancPluginGetPeers params;
6316  memset(&params, 0, sizeof(params));
6317  params.peers = &peers;
6318 
6319  if (context->InvokeService(context, _OrthancPluginService_GetPeers, &params) != OrthancPluginErrorCode_Success)
6320  {
6321  return NULL;
6322  }
6323  else
6324  {
6325  return peers;
6326  }
6327  }
6328 
6329 
6330  typedef struct
6331  {
6332  OrthancPluginPeers* peers;
6333  } _OrthancPluginFreePeers;
6334 
6344  ORTHANC_PLUGIN_INLINE void OrthancPluginFreePeers(
6345  OrthancPluginContext* context,
6346  OrthancPluginPeers* peers)
6347  {
6348  _OrthancPluginFreePeers params;
6349  params.peers = peers;
6350 
6351  context->InvokeService(context, _OrthancPluginService_FreePeers, &params);
6352  }
6353 
6354 
6355  typedef struct
6356  {
6357  uint32_t* target;
6358  const OrthancPluginPeers* peers;
6359  } _OrthancPluginGetPeersCount;
6360 
6374  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetPeersCount(
6375  OrthancPluginContext* context,
6376  const OrthancPluginPeers* peers)
6377  {
6378  uint32_t target = 0;
6379 
6380  _OrthancPluginGetPeersCount params;
6381  memset(&params, 0, sizeof(params));
6382  params.target = &target;
6383  params.peers = peers;
6384 
6385  if (context->InvokeService(context, _OrthancPluginService_GetPeersCount, &params) != OrthancPluginErrorCode_Success)
6386  {
6387  /* Error */
6388  return 0;
6389  }
6390  else
6391  {
6392  return target;
6393  }
6394  }
6395 
6396 
6397  typedef struct
6398  {
6399  const char** target;
6400  const OrthancPluginPeers* peers;
6401  uint32_t peerIndex;
6402  const char* userProperty;
6403  } _OrthancPluginGetPeerProperty;
6404 
6422  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetPeerName(
6423  OrthancPluginContext* context,
6424  const OrthancPluginPeers* peers,
6425  uint32_t peerIndex)
6426  {
6427  const char* target = NULL;
6428 
6429  _OrthancPluginGetPeerProperty params;
6430  memset(&params, 0, sizeof(params));
6431  params.target = &target;
6432  params.peers = peers;
6433  params.peerIndex = peerIndex;
6434  params.userProperty = NULL;
6435 
6436  if (context->InvokeService(context, _OrthancPluginService_GetPeerName, &params) != OrthancPluginErrorCode_Success)
6437  {
6438  /* Error */
6439  return NULL;
6440  }
6441  else
6442  {
6443  return target;
6444  }
6445  }
6446 
6447 
6463  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetPeerUrl(
6464  OrthancPluginContext* context,
6465  const OrthancPluginPeers* peers,
6466  uint32_t peerIndex)
6467  {
6468  const char* target = NULL;
6469 
6470  _OrthancPluginGetPeerProperty params;
6471  memset(&params, 0, sizeof(params));
6472  params.target = &target;
6473  params.peers = peers;
6474  params.peerIndex = peerIndex;
6475  params.userProperty = NULL;
6476 
6477  if (context->InvokeService(context, _OrthancPluginService_GetPeerUrl, &params) != OrthancPluginErrorCode_Success)
6478  {
6479  /* Error */
6480  return NULL;
6481  }
6482  else
6483  {
6484  return target;
6485  }
6486  }
6487 
6488 
6489 
6509  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetPeerUserProperty(
6510  OrthancPluginContext* context,
6511  const OrthancPluginPeers* peers,
6512  uint32_t peerIndex,
6513  const char* userProperty)
6514  {
6515  const char* target = NULL;
6516 
6517  _OrthancPluginGetPeerProperty params;
6518  memset(&params, 0, sizeof(params));
6519  params.target = &target;
6520  params.peers = peers;
6521  params.peerIndex = peerIndex;
6522  params.userProperty = userProperty;
6523 
6524  if (context->InvokeService(context, _OrthancPluginService_GetPeerUserProperty, &params) != OrthancPluginErrorCode_Success)
6525  {
6526  /* No such user property */
6527  return NULL;
6528  }
6529  else
6530  {
6531  return target;
6532  }
6533  }
6534 
6535 
6536 
6537  typedef struct
6538  {
6539  OrthancPluginMemoryBuffer* answerBody;
6540  OrthancPluginMemoryBuffer* answerHeaders;
6541  uint16_t* httpStatus;
6542  const OrthancPluginPeers* peers;
6543  uint32_t peerIndex;
6544  OrthancPluginHttpMethod method;
6545  const char* uri;
6546  uint32_t additionalHeadersCount;
6547  const char* const* additionalHeadersKeys;
6548  const char* const* additionalHeadersValues;
6549  const void* body;
6550  uint32_t bodySize;
6551  uint32_t timeout;
6552  } _OrthancPluginCallPeerApi;
6553 
6591  OrthancPluginContext* context,
6592  OrthancPluginMemoryBuffer* answerBody,
6593  OrthancPluginMemoryBuffer* answerHeaders,
6594  uint16_t* httpStatus,
6595  const OrthancPluginPeers* peers,
6596  uint32_t peerIndex,
6597  OrthancPluginHttpMethod method,
6598  const char* uri,
6599  uint32_t additionalHeadersCount,
6600  const char* const* additionalHeadersKeys,
6601  const char* const* additionalHeadersValues,
6602  const void* body,
6603  uint32_t bodySize,
6604  uint32_t timeout)
6605  {
6606  _OrthancPluginCallPeerApi params;
6607  memset(&params, 0, sizeof(params));
6608 
6609  params.answerBody = answerBody;
6610  params.answerHeaders = answerHeaders;
6611  params.httpStatus = httpStatus;
6612  params.peers = peers;
6613  params.peerIndex = peerIndex;
6614  params.method = method;
6615  params.uri = uri;
6616  params.additionalHeadersCount = additionalHeadersCount;
6617  params.additionalHeadersKeys = additionalHeadersKeys;
6618  params.additionalHeadersValues = additionalHeadersValues;
6619  params.body = body;
6620  params.bodySize = bodySize;
6621  params.timeout = timeout;
6622 
6623  return context->InvokeService(context, _OrthancPluginService_CallPeerApi, &params);
6624  }
6625 
6626 
6627 
6628 
6629 
6630  typedef struct
6631  {
6632  OrthancPluginJob** target;
6633  void *job;
6634  OrthancPluginJobFinalize finalize;
6635  const char *type;
6636  OrthancPluginJobGetProgress getProgress;
6637  OrthancPluginJobGetContent getContent;
6638  OrthancPluginJobGetSerialized getSerialized;
6639  OrthancPluginJobStep step;
6640  OrthancPluginJobStop stop;
6641  OrthancPluginJobReset reset;
6642  } _OrthancPluginCreateJob;
6643 
6676  OrthancPluginContext *context,
6677  void *job,
6678  OrthancPluginJobFinalize finalize,
6679  const char *type,
6680  OrthancPluginJobGetProgress getProgress,
6681  OrthancPluginJobGetContent getContent,
6682  OrthancPluginJobGetSerialized getSerialized,
6683  OrthancPluginJobStep step,
6684  OrthancPluginJobStop stop,
6685  OrthancPluginJobReset reset)
6686  {
6687  OrthancPluginJob* target = NULL;
6688 
6689  _OrthancPluginCreateJob params;
6690  memset(&params, 0, sizeof(params));
6691 
6692  params.target = &target;
6693  params.job = job;
6694  params.finalize = finalize;
6695  params.type = type;
6696  params.getProgress = getProgress;
6697  params.getContent = getContent;
6698  params.getSerialized = getSerialized;
6699  params.step = step;
6700  params.stop = stop;
6701  params.reset = reset;
6702 
6703  if (context->InvokeService(context, _OrthancPluginService_CreateJob, &params) != OrthancPluginErrorCode_Success ||
6704  target == NULL)
6705  {
6706  /* Error */
6707  return NULL;
6708  }
6709  else
6710  {
6711  return target;
6712  }
6713  }
6714 
6715 
6716  typedef struct
6717  {
6718  OrthancPluginJob* job;
6719  } _OrthancPluginFreeJob;
6720 
6730  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeJob(
6731  OrthancPluginContext* context,
6732  OrthancPluginJob* job)
6733  {
6734  _OrthancPluginFreeJob params;
6735  params.job = job;
6736 
6737  context->InvokeService(context, _OrthancPluginService_FreeJob, &params);
6738  }
6739 
6740 
6741 
6742  typedef struct
6743  {
6744  char** resultId;
6745  OrthancPluginJob *job;
6746  int priority;
6747  } _OrthancPluginSubmitJob;
6748 
6762  ORTHANC_PLUGIN_INLINE char *OrthancPluginSubmitJob(
6763  OrthancPluginContext *context,
6764  OrthancPluginJob *job,
6765  int priority)
6766  {
6767  char* resultId = NULL;
6768 
6769  _OrthancPluginSubmitJob params;
6770  memset(&params, 0, sizeof(params));
6771 
6772  params.resultId = &resultId;
6773  params.job = job;
6774  params.priority = priority;
6775 
6776  if (context->InvokeService(context, _OrthancPluginService_SubmitJob, &params) != OrthancPluginErrorCode_Success ||
6777  resultId == NULL)
6778  {
6779  /* Error */
6780  return NULL;
6781  }
6782  else
6783  {
6784  return resultId;
6785  }
6786  }
6787 
6788 
6789 
6790  typedef struct
6791  {
6792  OrthancPluginJobsUnserializer unserializer;
6793  } _OrthancPluginJobsUnserializer;
6794 
6807  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterJobsUnserializer(
6808  OrthancPluginContext* context,
6809  OrthancPluginJobsUnserializer unserializer)
6810  {
6811  _OrthancPluginJobsUnserializer params;
6812  params.unserializer = unserializer;
6813 
6814  context->InvokeService(context, _OrthancPluginService_RegisterJobsUnserializer, &params);
6815  }
6816 
6817 
6818 
6819  typedef struct
6820  {
6821  OrthancPluginRestOutput* output;
6822  const char* details;
6823  uint8_t log;
6824  } _OrthancPluginSetHttpErrorDetails;
6825 
6843  ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpErrorDetails(
6844  OrthancPluginContext* context,
6845  OrthancPluginRestOutput* output,
6846  const char* details,
6847  uint8_t log)
6848  {
6849  _OrthancPluginSetHttpErrorDetails params;
6850  params.output = output;
6851  params.details = details;
6852  params.log = log;
6853  context->InvokeService(context, _OrthancPluginService_SetHttpErrorDetails, &params);
6854  }
6855 
6856 
6857 
6858  typedef struct
6859  {
6860  const char** result;
6861  const char* argument;
6862  } _OrthancPluginRetrieveStaticString;
6863 
6875  ORTHANC_PLUGIN_INLINE const char* OrthancPluginAutodetectMimeType(
6876  OrthancPluginContext* context,
6877  const char* path)
6878  {
6879  const char* result = NULL;
6880 
6881  _OrthancPluginRetrieveStaticString params;
6882  params.result = &result;
6883  params.argument = path;
6884 
6885  if (context->InvokeService(context, _OrthancPluginService_AutodetectMimeType, &params) != OrthancPluginErrorCode_Success)
6886  {
6887  /* Error */
6888  return NULL;
6889  }
6890  else
6891  {
6892  return result;
6893  }
6894  }
6895 
6896 
6897 
6898  typedef struct
6899  {
6900  const char* name;
6901  float value;
6903  } _OrthancPluginSetMetricsValue;
6904 
6919  ORTHANC_PLUGIN_INLINE void OrthancPluginSetMetricsValue(
6920  OrthancPluginContext* context,
6921  const char* name,
6922  float value,
6924  {
6925  _OrthancPluginSetMetricsValue params;
6926  params.name = name;
6927  params.value = value;
6928  params.type = type;
6929  context->InvokeService(context, _OrthancPluginService_SetMetricsValue, &params);
6930  }
6931 
6932 
6933 
6934  typedef struct
6935  {
6937  } _OrthancPluginRegisterRefreshMetricsCallback;
6938 
6950  OrthancPluginContext* context,
6952  {
6953  _OrthancPluginRegisterRefreshMetricsCallback params;
6954  params.callback = callback;
6955  context->InvokeService(context, _OrthancPluginService_RegisterRefreshMetricsCallback, &params);
6956  }
6957 
6958 
6959 
6960 
6961  typedef struct
6962  {
6963  char** target;
6964  const void* dicom;
6965  uint32_t dicomSize;
6967  } _OrthancPluginEncodeDicomWeb;
6968 
6985  ORTHANC_PLUGIN_INLINE char* OrthancPluginEncodeDicomWebJson(
6986  OrthancPluginContext* context,
6987  const void* dicom,
6988  uint32_t dicomSize,
6990  {
6991  char* target = NULL;
6992 
6993  _OrthancPluginEncodeDicomWeb params;
6994  params.target = &target;
6995  params.dicom = dicom;
6996  params.dicomSize = dicomSize;
6997  params.callback = callback;
6998 
6999  if (context->InvokeService(context, _OrthancPluginService_EncodeDicomWebJson, &params) != OrthancPluginErrorCode_Success)
7000  {
7001  /* Error */
7002  return NULL;
7003  }
7004  else
7005  {
7006  return target;
7007  }
7008  }
7009 
7010 
7027  ORTHANC_PLUGIN_INLINE char* OrthancPluginEncodeDicomWebXml(
7028  OrthancPluginContext* context,
7029  const void* dicom,
7030  uint32_t dicomSize,
7032  {
7033  char* target = NULL;
7034 
7035  _OrthancPluginEncodeDicomWeb params;
7036  params.target = &target;
7037  params.dicom = dicom;
7038  params.dicomSize = dicomSize;
7039  params.callback = callback;
7040 
7041  if (context->InvokeService(context, _OrthancPluginService_EncodeDicomWebXml, &params) != OrthancPluginErrorCode_Success)
7042  {
7043  /* Error */
7044  return NULL;
7045  }
7046  else
7047  {
7048  return target;
7049  }
7050  }
7051 
7052 
7053 
7054  typedef struct
7055  {
7056  char** target;
7057  const void* dicom;
7058  uint32_t dicomSize;
7060  void* payload;
7061  } _OrthancPluginEncodeDicomWeb2;
7062 
7079  ORTHANC_PLUGIN_INLINE char* OrthancPluginEncodeDicomWebJson2(
7080  OrthancPluginContext* context,
7081  const void* dicom,
7082  uint32_t dicomSize,
7084  void* payload)
7085  {
7086  char* target = NULL;
7087 
7088  _OrthancPluginEncodeDicomWeb2 params;
7089  params.target = &target;
7090  params.dicom = dicom;
7091  params.dicomSize = dicomSize;
7092  params.callback = callback;
7093  params.payload = payload;
7094 
7095  if (context->InvokeService(context, _OrthancPluginService_EncodeDicomWebJson2, &params) != OrthancPluginErrorCode_Success)
7096  {
7097  /* Error */
7098  return NULL;
7099  }
7100  else
7101  {
7102  return target;
7103  }
7104  }
7105 
7106 
7123  ORTHANC_PLUGIN_INLINE char* OrthancPluginEncodeDicomWebXml2(
7124  OrthancPluginContext* context,
7125  const void* dicom,
7126  uint32_t dicomSize,
7128  void* payload)
7129  {
7130  char* target = NULL;
7131 
7132  _OrthancPluginEncodeDicomWeb2 params;
7133  params.target = &target;
7134  params.dicom = dicom;
7135  params.dicomSize = dicomSize;
7136  params.callback = callback;
7137  params.payload = payload;
7138 
7139  if (context->InvokeService(context, _OrthancPluginService_EncodeDicomWebXml2, &params) != OrthancPluginErrorCode_Success)
7140  {
7141  /* Error */
7142  return NULL;
7143  }
7144  else
7145  {
7146  return target;
7147  }
7148  }
7149 
7150 
7151 
7168  void* answer,
7169  const char* key,
7170  const char* value);
7171 
7172 
7189  void* answer,
7190  const void* data,
7191  uint32_t size);
7192 
7193 
7208  typedef uint8_t (*OrthancPluginChunkedClientRequestIsDone) (void* request);
7209 
7210 
7226 
7227 
7241  typedef const void* (*OrthancPluginChunkedClientRequestGetChunkData) (void* request);
7242 
7243 
7257  typedef uint32_t (*OrthancPluginChunkedClientRequestGetChunkSize) (void* request);
7258 
7259 
7260  typedef struct
7261  {
7262  void* answer;
7265  uint16_t* httpStatus;
7266  OrthancPluginHttpMethod method;
7267  const char* url;
7268  uint32_t headersCount;
7269  const char* const* headersKeys;
7270  const char* const* headersValues;
7271  void* request;
7276  const char* username;
7277  const char* password;
7278  uint32_t timeout;
7279  const char* certificateFile;
7280  const char* certificateKeyFile;
7281  const char* certificateKeyPassword;
7282  uint8_t pkcs11;
7283  } _OrthancPluginChunkedHttpClient;
7284 
7285 
7337  OrthancPluginContext* context,
7338  void* answer,
7341  uint16_t* httpStatus,
7342  OrthancPluginHttpMethod method,
7343  const char* url,
7344  uint32_t headersCount,
7345  const char* const* headersKeys,
7346  const char* const* headersValues,
7347  void* request,
7352  const char* username,
7353  const char* password,
7354  uint32_t timeout,
7355  const char* certificateFile,
7356  const char* certificateKeyFile,
7357  const char* certificateKeyPassword,
7358  uint8_t pkcs11)
7359  {
7360  _OrthancPluginChunkedHttpClient params;
7361  memset(&params, 0, sizeof(params));
7362 
7363  /* In common with OrthancPluginHttpClient() */
7364  params.httpStatus = httpStatus;
7365  params.method = method;
7366  params.url = url;
7367  params.headersCount = headersCount;
7368  params.headersKeys = headersKeys;
7369  params.headersValues = headersValues;
7370  params.username = username;
7371  params.password = password;
7372  params.timeout = timeout;
7373  params.certificateFile = certificateFile;
7374  params.certificateKeyFile = certificateKeyFile;
7375  params.certificateKeyPassword = certificateKeyPassword;
7376  params.pkcs11 = pkcs11;
7377 
7378  /* For chunked body/answer */
7379  params.answer = answer;
7380  params.answerAddChunk = answerAddChunk;
7381  params.answerAddHeader = answerAddHeader;
7382  params.request = request;
7383  params.requestIsDone = requestIsDone;
7384  params.requestChunkData = requestChunkData;
7385  params.requestChunkSize = requestChunkSize;
7386  params.requestNext = requestNext;
7387 
7388  return context->InvokeService(context, _OrthancPluginService_ChunkedHttpClient, &params);
7389  }
7390 
7391 
7392 
7397  typedef struct _OrthancPluginServerChunkedRequestReader_t OrthancPluginServerChunkedRequestReader;
7398 
7399 
7400 
7418  const char* url,
7419  const OrthancPluginHttpRequest* request);
7420 
7421 
7437  const void* data,
7438  uint32_t size);
7439 
7440 
7457  OrthancPluginRestOutput* output);
7458 
7459 
7475 
7476  typedef struct
7477  {
7478  const char* pathRegularExpression;
7479  OrthancPluginRestCallback getHandler;
7481  OrthancPluginRestCallback deleteHandler;
7486  } _OrthancPluginChunkedRestCallback;
7487 
7488 
7518  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterChunkedRestCallback(
7519  OrthancPluginContext* context,
7520  const char* pathRegularExpression,
7521  OrthancPluginRestCallback getHandler,
7523  OrthancPluginRestCallback deleteHandler,
7528  {
7529  _OrthancPluginChunkedRestCallback params;
7530  params.pathRegularExpression = pathRegularExpression;
7531  params.getHandler = getHandler;
7532  params.postHandler = postHandler;
7533  params.deleteHandler = deleteHandler;
7534  params.putHandler = putHandler;
7535  params.addChunk = addChunk;
7536  params.execute = execute;
7537  params.finalize = finalize;
7538 
7539  context->InvokeService(context, _OrthancPluginService_RegisterChunkedRestCallback, &params);
7540  }
7541 
7542 
7543 
7544 
7545 
7546  typedef struct
7547  {
7548  char** result;
7549  uint16_t group;
7550  uint16_t element;
7551  const char* privateCreator;
7552  } _OrthancPluginGetTagName;
7553 
7569  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetTagName(
7570  OrthancPluginContext* context,
7571  uint16_t group,
7572  uint16_t element,
7573  const char* privateCreator)
7574  {
7575  char* result;
7576 
7577  _OrthancPluginGetTagName params;
7578  params.result = &result;
7579  params.group = group;
7580  params.element = element;
7581  params.privateCreator = privateCreator;
7582 
7583  if (context->InvokeService(context, _OrthancPluginService_GetTagName, &params) != OrthancPluginErrorCode_Success)
7584  {
7585  /* Error */
7586  return NULL;
7587  }
7588  else
7589  {
7590  return result;
7591  }
7592  }
7593 
7594 
7595 
7625  void** handler /* out */,
7626  const char* jobId,
7627  const char* transactionUid,
7628  const char* const* sopClassUids,
7629  const char* const* sopInstanceUids,
7630  uint32_t countInstances,
7631  const char* remoteAet,
7632  const char* calledAet);
7633 
7634 
7646  typedef void (*OrthancPluginStorageCommitmentDestructor) (void* handler);
7647 
7648 
7669  void* handler,
7670  const char* sopClassUid,
7671  const char* sopInstanceUid);
7672 
7673 
7674  typedef struct
7675  {
7679  } _OrthancPluginRegisterStorageCommitmentScpCallback;
7680 
7695  OrthancPluginContext* context,
7699  {
7700  _OrthancPluginRegisterStorageCommitmentScpCallback params;
7701  params.factory = factory;
7702  params.destructor = destructor;
7703  params.lookup = lookup;
7704  return context->InvokeService(context, _OrthancPluginService_RegisterStorageCommitmentScpCallback, &params);
7705  }
7706 
7707 
7708 
7725  const OrthancPluginDicomInstance* instance);
7726 
7727 
7728  typedef struct
7729  {
7731  } _OrthancPluginIncomingDicomInstanceFilter;
7732 
7756  OrthancPluginContext* context,
7758  {
7759  _OrthancPluginIncomingDicomInstanceFilter params;
7760  params.callback = callback;
7761 
7762  return context->InvokeService(context, _OrthancPluginService_RegisterIncomingDicomInstanceFilter, &params);
7763  }
7764 
7765 
7779  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceTransferSyntaxUid(
7780  OrthancPluginContext* context,
7781  const OrthancPluginDicomInstance* instance)
7782  {
7783  char* result;
7784 
7785  _OrthancPluginAccessDicomInstance params;
7786  memset(&params, 0, sizeof(params));
7787  params.resultStringToFree = &result;
7788  params.instance = instance;
7789 
7790  if (context->InvokeService(context, _OrthancPluginService_GetInstanceTransferSyntaxUid, &params) != OrthancPluginErrorCode_Success)
7791  {
7792  /* Error */
7793  return NULL;
7794  }
7795  else
7796  {
7797  return result;
7798  }
7799  }
7800 
7801 
7814  ORTHANC_PLUGIN_INLINE int32_t OrthancPluginHasInstancePixelData(
7815  OrthancPluginContext* context,
7816  const OrthancPluginDicomInstance* instance)
7817  {
7818  int64_t hasPixelData;
7819 
7820  _OrthancPluginAccessDicomInstance params;
7821  memset(&params, 0, sizeof(params));
7822  params.resultInt64 = &hasPixelData;
7823  params.instance = instance;
7824 
7825  if (context->InvokeService(context, _OrthancPluginService_HasInstancePixelData, &params) != OrthancPluginErrorCode_Success ||
7826  hasPixelData < 0 ||
7827  hasPixelData > 1)
7828  {
7829  /* Error */
7830  return -1;
7831  }
7832  else
7833  {
7834  return (hasPixelData != 0);
7835  }
7836  }
7837 
7838 
7839 
7840 
7841 
7842 
7843  typedef struct
7844  {
7845  OrthancPluginDicomInstance** target;
7846  const void* buffer;
7847  uint32_t size;
7848  const char* transferSyntax;
7849  } _OrthancPluginCreateDicomInstance;
7850 
7865  OrthancPluginContext* context,
7866  const void* buffer,
7867  uint32_t size)
7868  {
7869  OrthancPluginDicomInstance* target = NULL;
7870 
7871  _OrthancPluginCreateDicomInstance params;
7872  params.target = &target;
7873  params.buffer = buffer;
7874  params.size = size;
7875 
7876  if (context->InvokeService(context, _OrthancPluginService_CreateDicomInstance, &params) != OrthancPluginErrorCode_Success)
7877  {
7878  /* Error */
7879  return NULL;
7880  }
7881  else
7882  {
7883  return target;
7884  }
7885  }
7886 
7887  typedef struct
7888  {
7890  } _OrthancPluginFreeDicomInstance;
7891 
7902  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeDicomInstance(
7903  OrthancPluginContext* context,
7905  {
7906  _OrthancPluginFreeDicomInstance params;
7907  params.dicom = dicom;
7908 
7909  context->InvokeService(context, _OrthancPluginService_FreeDicomInstance, &params);
7910  }
7911 
7912 
7913  typedef struct
7914  {
7915  uint32_t* targetUint32;
7916  OrthancPluginMemoryBuffer* targetBuffer;
7917  OrthancPluginImage** targetImage;
7918  char** targetStringToFree;
7919  const OrthancPluginDicomInstance* instance;
7920  uint32_t frameIndex;
7923  uint32_t maxStringLength;
7924  OrthancPluginDicomWebBinaryCallback2 dicomWebCallback;
7925  void* dicomWebPayload;
7926  } _OrthancPluginAccessDicomInstance2;
7927 
7939  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetInstanceFramesCount(
7940  OrthancPluginContext* context,
7941  const OrthancPluginDicomInstance* instance)
7942  {
7943  uint32_t count;
7944 
7945  _OrthancPluginAccessDicomInstance2 params;
7946  memset(&params, 0, sizeof(params));
7947  params.targetUint32 = &count;
7948  params.instance = instance;
7949 
7950  if (context->InvokeService(context, _OrthancPluginService_GetInstanceFramesCount, &params) != OrthancPluginErrorCode_Success)
7951  {
7952  /* Error */
7953  return 0;
7954  }
7955  else
7956  {
7957  return count;
7958  }
7959  }
7960 
7961 
7980  OrthancPluginContext* context,
7981  OrthancPluginMemoryBuffer* target,
7982  const OrthancPluginDicomInstance* instance,
7983  uint32_t frameIndex)
7984  {
7985  _OrthancPluginAccessDicomInstance2 params;
7986  memset(&params, 0, sizeof(params));
7987  params.targetBuffer = target;
7988  params.instance = instance;
7989  params.frameIndex = frameIndex;
7990 
7991  return context->InvokeService(context, _OrthancPluginService_GetInstanceRawFrame, &params);
7992  }
7993 
7994 
8008  OrthancPluginContext* context,
8009  const OrthancPluginDicomInstance* instance,
8010  uint32_t frameIndex)
8011  {
8012  OrthancPluginImage* target = NULL;
8013 
8014  _OrthancPluginAccessDicomInstance2 params;
8015  memset(&params, 0, sizeof(params));
8016  params.targetImage = &target;
8017  params.instance = instance;
8018  params.frameIndex = frameIndex;
8019 
8020  if (context->InvokeService(context, _OrthancPluginService_GetInstanceDecodedFrame, &params) != OrthancPluginErrorCode_Success)
8021  {
8022  return NULL;
8023  }
8024  else
8025  {
8026  return target;
8027  }
8028  }
8029 
8030 
8047  OrthancPluginContext* context,
8048  const void* buffer,
8049  uint32_t size,
8050  const char* transferSyntax)
8051  {
8052  OrthancPluginDicomInstance* target = NULL;
8053 
8054  _OrthancPluginCreateDicomInstance params;
8055  params.target = &target;
8056  params.buffer = buffer;
8057  params.size = size;
8058  params.transferSyntax = transferSyntax;
8059 
8060  if (context->InvokeService(context, _OrthancPluginService_TranscodeDicomInstance, &params) != OrthancPluginErrorCode_Success)
8061  {
8062  /* Error */
8063  return NULL;
8064  }
8065  else
8066  {
8067  return target;
8068  }
8069  }
8070 
8085  OrthancPluginContext* context,
8086  OrthancPluginMemoryBuffer* target,
8087  const OrthancPluginDicomInstance* instance)
8088  {
8089  _OrthancPluginAccessDicomInstance2 params;
8090  memset(&params, 0, sizeof(params));
8091  params.targetBuffer = target;
8092  params.instance = instance;
8093 
8094  return context->InvokeService(context, _OrthancPluginService_SerializeDicomInstance, &params);
8095  }
8096 
8097 
8116  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceAdvancedJson(
8117  OrthancPluginContext* context,
8118  const OrthancPluginDicomInstance* instance,
8121  uint32_t maxStringLength)
8122  {
8123  char* result = NULL;
8124 
8125  _OrthancPluginAccessDicomInstance2 params;
8126  memset(&params, 0, sizeof(params));
8127  params.targetStringToFree = &result;
8128  params.instance = instance;
8129  params.format = format;
8130  params.flags = flags;
8131  params.maxStringLength = maxStringLength;
8132 
8133  if (context->InvokeService(context, _OrthancPluginService_GetInstanceAdvancedJson, &params) != OrthancPluginErrorCode_Success)
8134  {
8135  /* Error */
8136  return NULL;
8137  }
8138  else
8139  {
8140  return result;
8141  }
8142  }
8143 
8144 
8159  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceDicomWebJson(
8160  OrthancPluginContext* context,
8161  const OrthancPluginDicomInstance* instance,
8163  void* payload)
8164  {
8165  char* target = NULL;
8166 
8167  _OrthancPluginAccessDicomInstance2 params;
8168  params.targetStringToFree = &target;
8169  params.instance = instance;
8170  params.dicomWebCallback = callback;
8171  params.dicomWebPayload = payload;
8172 
8173  if (context->InvokeService(context, _OrthancPluginService_GetInstanceDicomWebJson, &params) != OrthancPluginErrorCode_Success)
8174  {
8175  /* Error */
8176  return NULL;
8177  }
8178  else
8179  {
8180  return target;
8181  }
8182  }
8183 
8184 
8199  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceDicomWebXml(
8200  OrthancPluginContext* context,
8201  const OrthancPluginDicomInstance* instance,
8203  void* payload)
8204  {
8205  char* target = NULL;
8206 
8207  _OrthancPluginAccessDicomInstance2 params;
8208  params.targetStringToFree = &target;
8209  params.instance = instance;
8210  params.dicomWebCallback = callback;
8211  params.dicomWebPayload = payload;
8212 
8213  if (context->InvokeService(context, _OrthancPluginService_GetInstanceDicomWebXml, &params) != OrthancPluginErrorCode_Success)
8214  {
8215  /* Error */
8216  return NULL;
8217  }
8218  else
8219  {
8220  return target;
8221  }
8222  }
8223 
8224 
8225 
8245  OrthancPluginMemoryBuffer* transcoded /* out */,
8246  const void* buffer,
8247  uint64_t size,
8248  const char* const* allowedSyntaxes,
8249  uint32_t countSyntaxes,
8250  uint8_t allowNewSopInstanceUid);
8251 
8252 
8253  typedef struct
8254  {
8256  } _OrthancPluginTranscoderCallback;
8257 
8272  OrthancPluginContext* context,
8274  {
8275  _OrthancPluginTranscoderCallback params;
8276  params.callback = callback;
8277 
8278  return context->InvokeService(context, _OrthancPluginService_RegisterTranscoderCallback, &params);
8279  }
8280 
8281 
8282 
8283  typedef struct
8284  {
8285  OrthancPluginMemoryBuffer* target;
8286  uint32_t size;
8287  } _OrthancPluginCreateMemoryBuffer;
8288 
8307  OrthancPluginContext* context,
8308  OrthancPluginMemoryBuffer* target,
8309  uint32_t size)
8310  {
8311  _OrthancPluginCreateMemoryBuffer params;
8312  params.target = target;
8313  params.size = size;
8314 
8315  return context->InvokeService(context, _OrthancPluginService_CreateMemoryBuffer, &params);
8316  }
8317 
8318 
8345  OrthancPluginContext* context)
8346  {
8347  char* result;
8348 
8349  _OrthancPluginRetrieveDynamicString params;
8350  params.result = &result;
8351  params.argument = NULL;
8352 
8353  if (context->InvokeService(context, _OrthancPluginService_GenerateRestApiAuthorizationToken,
8354  &params) != OrthancPluginErrorCode_Success)
8355  {
8356  /* Error */
8357  return NULL;
8358  }
8359  else
8360  {
8361  return result;
8362  }
8363  }
8364 
8365 
8366 
8367  typedef struct
8368  {
8370  uint64_t size;
8371  } _OrthancPluginCreateMemoryBuffer64;
8372 
8391  OrthancPluginContext* context,
8393  uint64_t size)
8394  {
8395  _OrthancPluginCreateMemoryBuffer64 params;
8396  params.target = target;
8397  params.size = size;
8398 
8399  return context->InvokeService(context, _OrthancPluginService_CreateMemoryBuffer64, &params);
8400  }
8401 
8402 
8403  typedef struct
8404  {
8409  } _OrthancPluginRegisterStorageArea2;
8410 
8427  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterStorageArea2(
8428  OrthancPluginContext* context,
8433  {
8434  _OrthancPluginRegisterStorageArea2 params;
8435  params.create = create;
8436  params.readWhole = readWhole;
8437  params.readRange = readRange;
8438  params.remove = remove;
8439  context->InvokeService(context, _OrthancPluginService_RegisterStorageArea2, &params);
8440  }
8441 
8442 
8443 
8444  typedef struct
8445  {
8446  _OrthancPluginCreateDicom createDicom;
8447  const char* privateCreator;
8448  } _OrthancPluginCreateDicom2;
8449 
8475  OrthancPluginContext* context,
8476  OrthancPluginMemoryBuffer* target,
8477  const char* json,
8478  const OrthancPluginImage* pixelData,
8480  const char* privateCreator)
8481  {
8482  _OrthancPluginCreateDicom2 params;
8483  params.createDicom.target = target;
8484  params.createDicom.json = json;
8485  params.createDicom.pixelData = pixelData;
8486  params.createDicom.flags = flags;
8487  params.privateCreator = privateCreator;
8488 
8489  return context->InvokeService(context, _OrthancPluginService_CreateDicom2, &params);
8490  }
8491 
8492 
8493 
8494 
8495 
8496 
8497  typedef struct
8498  {
8499  OrthancPluginMemoryBuffer* answerBody;
8500  OrthancPluginMemoryBuffer* answerHeaders;
8501  uint16_t* httpStatus;
8502  OrthancPluginHttpMethod method;
8503  const char* uri;
8504  uint32_t headersCount;
8505  const char* const* headersKeys;
8506  const char* const* headersValues;
8507  const void* body;
8508  uint32_t bodySize;
8509  uint8_t afterPlugins;
8510  } _OrthancPluginCallRestApi;
8511 
8543  OrthancPluginContext* context,
8544  OrthancPluginMemoryBuffer* answerBody,
8545  OrthancPluginMemoryBuffer* answerHeaders,
8546  uint16_t* httpStatus,
8547  OrthancPluginHttpMethod method,
8548  const char* uri,
8549  uint32_t headersCount,
8550  const char* const* headersKeys,
8551  const char* const* headersValues,
8552  const void* body,
8553  uint32_t bodySize,
8554  uint8_t afterPlugins)
8555  {
8556  _OrthancPluginCallRestApi params;
8557  memset(&params, 0, sizeof(params));
8558 
8559  params.answerBody = answerBody;
8560  params.answerHeaders = answerHeaders;
8561  params.httpStatus = httpStatus;
8562  params.method = method;
8563  params.uri = uri;
8564  params.headersCount = headersCount;
8565  params.headersKeys = headersKeys;
8566  params.headersValues = headersValues;
8567  params.body = body;
8568  params.bodySize = bodySize;
8569  params.afterPlugins = afterPlugins;
8570 
8571  return context->InvokeService(context, _OrthancPluginService_CallRestApi, &params);
8572  }
8573 
8574 
8575 #ifdef __cplusplus
8576 }
8577 #endif
8578 
8579 
char * OrthancPluginGetInstanceTransferSyntaxUid(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance)
Get the transfer syntax of a DICOM file.
Definition: OrthancCPlugin.h:7779
Definition: OrthancCPlugin.h:769
Definition: OrthancCPlugin.h:873
OrthancPluginChangeType
Definition: OrthancCPlugin.h:721
Definition: OrthancCPlugin.h:233
void OrthancPluginSendHttpStatusCode(OrthancPluginContext *context, OrthancPluginRestOutput *output, uint16_t status)
Send a HTTP status code.
Definition: OrthancCPlugin.h:2747
void OrthancPluginFreePeers(OrthancPluginContext *context, OrthancPluginPeers *peers)
Free the list of available Orthanc peers.
Definition: OrthancCPlugin.h:6344
struct _OrthancPluginRestOutput_t OrthancPluginRestOutput
Opaque structure that represents the HTTP connection to the client application.
Definition: OrthancCPlugin.h:1053
OrthancPluginErrorCode OrthancPluginFindAddAnswer(OrthancPluginContext *context, OrthancPluginFindAnswers *answers, const void *dicom, uint32_t size)
Add one answer to some C-Find request.
Definition: OrthancCPlugin.h:5923
void OrthancPluginSetHttpHeader(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *key, const char *value)
Set some HTTP header.
Definition: OrthancCPlugin.h:2848
Definition: OrthancCPlugin.h:792
Definition: OrthancCPlugin.h:963
OrthancPluginImage * OrthancPluginGetInstanceDecodedFrame(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance, uint32_t frameIndex)
Decode one frame from a DICOM instance.
Definition: OrthancCPlugin.h:8007
Definition: OrthancCPlugin.h:274
void OrthancPluginLogInfo(OrthancPluginContext *context, const char *message)
Log an information.
Definition: OrthancCPlugin.h:2004
OrthancPluginErrorCode OrthancPluginRegisterDecodeImageCallback(OrthancPluginContext *context, OrthancPluginDecodeImageCallback callback)
Register a callback to handle the decoding of DICOM images.
Definition: OrthancCPlugin.h:5379
OrthancPluginErrorCode OrthancPluginHttpClient(OrthancPluginContext *context, OrthancPluginMemoryBuffer *answerBody, OrthancPluginMemoryBuffer *answerHeaders, uint16_t *httpStatus, OrthancPluginHttpMethod method, const char *url, uint32_t headersCount, const char *const *headersKeys, const char *const *headersValues, const void *body, uint32_t bodySize, const char *username, const char *password, uint32_t timeout, const char *certificateFile, const char *certificateKeyFile, const char *certificateKeyPassword, uint8_t pkcs11)
Issue a HTTP call with full flexibility.
Definition: OrthancCPlugin.h:5790
Definition: OrthancCPlugin.h:874
The parameters of a REST request.
Definition: OrthancCPlugin.h:336
void OrthancPluginRedirect(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *redirection)
Redirect a REST request.
Definition: OrthancCPlugin.h:2530
OrthancPluginContentType
Definition: OrthancCPlugin.h:689
OrthancPluginErrorCode OrthancPluginRestApiDeleteAfterPlugins(OrthancPluginContext *context, const char *uri)
Make a DELETE call to the REST API, as tainted by the plugins.
Definition: OrthancCPlugin.h:2435
Definition: OrthancCPlugin.h:707
char * OrthancPluginGetInstanceDicomWebXml(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance, OrthancPluginDicomWebBinaryCallback2 callback, void *payload)
Convert a DICOM instance to DICOMweb XML.
Definition: OrthancCPlugin.h:8199
A 64-bit memory buffer allocated by the core system of Orthanc.
Definition: OrthancCPlugin.h:1033
OrthancPluginErrorCode(* OrthancPluginChunkedClientRequestNext)(void *request)
Callback to advance in the request body during a chunked transfer.
Definition: OrthancCPlugin.h:7225
Definition: OrthancCPlugin.h:791
struct _OrthancPluginDicomWebNode_t OrthancPluginDicomWebNode
Opaque structure that represents a node in a JSON or XML document used in DICOMweb.
Definition: OrthancCPlugin.h:1142
Definition: OrthancCPlugin.h:905
OrthancPluginErrorCode OrthancPluginCompressPngImage(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, OrthancPluginPixelFormat format, uint32_t width, uint32_t height, uint32_t pitch, const void *buffer)
Encode a PNG image.
Definition: OrthancCPlugin.h:4139
void OrthancPluginCompressAndAnswerJpegImage(OrthancPluginContext *context, OrthancPluginRestOutput *output, OrthancPluginPixelFormat format, uint32_t width, uint32_t height, uint32_t pitch, const void *buffer, uint8_t quality)
Answer to a REST request with a JPEG image.
Definition: OrthancCPlugin.h:4231
OrthancPluginJobStepStatus
Definition: OrthancCPlugin.h:916
int OrthancPluginCheckVersion(OrthancPluginContext *context)
Check the compatibility of the plugin wrt. the version of its hosting Orthanc.
Definition: OrthancCPlugin.h:1921
void OrthancPluginSetHttpErrorDetails(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *details, uint8_t log)
Provide a detailed description for an HTTP error.
Definition: OrthancCPlugin.h:6843
OrthancPluginErrorCode OrthancPluginSerializeDicomInstance(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const OrthancPluginDicomInstance *instance)
Writes a DICOM instance to a memory buffer.
Definition: OrthancCPlugin.h:8084
Definition: OrthancCPlugin.h:266
Definition: OrthancCPlugin.h:203
Definition: OrthancCPlugin.h:264
OrthancPluginInstanceOrigin
Definition: OrthancCPlugin.h:900
const char *(* OrthancPluginJobGetContent)(void *job)
Callback to retrieve the content of one custom job.
Definition: OrthancCPlugin.h:1561
OrthancPluginDicomInstance * OrthancPluginTranscodeDicomInstance(OrthancPluginContext *context, const void *buffer, uint32_t size, const char *transferSyntax)
Parse and transcode a DICOM instance.
Definition: OrthancCPlugin.h:8046
Definition: OrthancCPlugin.h:789
Definition: OrthancCPlugin.h:934
Definition: OrthancCPlugin.h:241
char * OrthancPluginGetInstanceAdvancedJson(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance, OrthancPluginDicomToJsonFormat format, OrthancPluginDicomToJsonFlags flags, uint32_t maxStringLength)
Format a DICOM memory buffer as a JSON string.
Definition: OrthancCPlugin.h:8116
OrthancPluginErrorCode OrthancPluginRegisterPrivateDictionaryTag(OrthancPluginContext *context, uint16_t group, uint16_t element, OrthancPluginValueRepresentation vr, const char *name, uint32_t minMultiplicity, uint32_t maxMultiplicity, const char *privateCreator)
Register a new private tag into the DICOM dictionary.
Definition: OrthancCPlugin.h:4885
char * OrthancPluginGetInstanceSimplifiedJson(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance)
Get the DICOM tag hierarchy as a JSON file (with simplification).
Definition: OrthancCPlugin.h:3024
OrthancPluginErrorCode OrthancPluginRestApiPostAfterPlugins(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const void *body, uint32_t bodySize)
Make a POST call to the REST API, as tainted by the plugins.
Definition: OrthancCPlugin.h:2383
Definition: OrthancCPlugin.h:289
Graylevel, unsigned 16bpp image.
Definition: OrthancCPlugin.h:613
Definition: OrthancCPlugin.h:736
Definition: OrthancCPlugin.h:225
const char *const * headersValues
The values of the HTTP headers.
Definition: OrthancCPlugin.h:396
Definition: OrthancCPlugin.h:276
Definition: OrthancCPlugin.h:278
const char *const * headersKeys
The keys of the HTTP headers (always converted to low-case).
Definition: OrthancCPlugin.h:391
Definition: OrthancCPlugin.h:262
OrthancPluginCreateDicomFlags
Definition: OrthancCPlugin.h:855
char * OrthancPluginComputeSha1(OrthancPluginContext *context, const void *buffer, uint32_t size)
Compute a SHA-1 hash.
Definition: OrthancCPlugin.h:5588
OrthancPluginJob * OrthancPluginCreateJob(OrthancPluginContext *context, void *job, OrthancPluginJobFinalize finalize, const char *type, OrthancPluginJobGetProgress getProgress, OrthancPluginJobGetContent getContent, OrthancPluginJobGetSerialized getSerialized, OrthancPluginJobStep step, OrthancPluginJobStop stop, OrthancPluginJobReset reset)
Create a custom job.
Definition: OrthancCPlugin.h:6675
Definition: OrthancCPlugin.h:280
OrthancPluginPixelFormat
Definition: OrthancCPlugin.h:597
Definition: OrthancCPlugin.h:906
uint32_t getCount
For a GET request, the number of GET parameters.
Definition: OrthancCPlugin.h:356
char * OrthancPluginSubmitJob(OrthancPluginContext *context, OrthancPluginJob *job, int priority)
Submit a new job to the jobs engine of Orthanc.
Definition: OrthancCPlugin.h:6762
Definition: OrthancCPlugin.h:639
void OrthancPluginRegisterStorageArea(OrthancPluginContext *context, OrthancPluginStorageCreate create, OrthancPluginStorageRead read, OrthancPluginStorageRemove remove)
Register a custom storage area.
Definition: OrthancCPlugin.h:3153
const char * OrthancPluginAutodetectMimeType(OrthancPluginContext *context, const char *path)
Detect the MIME type of a file.
Definition: OrthancCPlugin.h:6875
Definition: OrthancCPlugin.h:889
OrthancPluginErrorCode OrthancPluginGetDicomForInstance(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *instanceId)
Retrieve a DICOM instance using its Orthanc identifier.
Definition: OrthancCPlugin.h:2248
struct _OrthancPluginServerChunkedRequestReader_t OrthancPluginServerChunkedRequestReader
Opaque structure that reads the content of a HTTP request body during a chunked HTTP transfer...
Definition: OrthancCPlugin.h:7397
OrthancPluginImageFormat
Definition: OrthancCPlugin.h:766
Definition: OrthancCPlugin.h:211
Definition: OrthancCPlugin.h:302
void OrthancPluginFreeString(OrthancPluginContext *context, char *str)
Free a string.
Definition: OrthancCPlugin.h:1786
Definition: OrthancCPlugin.h:286
OrthancPluginErrorCode OrthancPluginRegisterStorageCommitmentScpCallback(OrthancPluginContext *context, OrthancPluginStorageCommitmentFactory factory, OrthancPluginStorageCommitmentDestructor destructor, OrthancPluginStorageCommitmentLookup lookup)
Register a callback to handle incoming requests to the storage commitment SCP.
Definition: OrthancCPlugin.h:7694
const char * OrthancPluginGetFontName(OrthancPluginContext *context, uint32_t fontIndex)
Return the name of a font.
Definition: OrthancCPlugin.h:4515
Definition: OrthancCPlugin.h:231
Definition: OrthancCPlugin.h:292
Definition: OrthancCPlugin.h:284
OrthancPluginErrorCode OrthancPluginSendMultipartItem2(OrthancPluginContext *context, OrthancPluginRestOutput *output, const void *answer, uint32_t answerSize, uint32_t headersCount, const char *const *headersKeys, const char *const *headersValues)
Send an item as a part of some HTTP multipart answer, with custom headers.
Definition: OrthancCPlugin.h:5677
Definition: OrthancCPlugin.h:324
Definition: OrthancCPlugin.h:222
char * OrthancPluginComputeMd5(OrthancPluginContext *context, const void *buffer, uint32_t size)
Compute an MD5 hash.
Definition: OrthancCPlugin.h:5552
Definition: OrthancCPlugin.h:918
Definition: OrthancCPlugin.h:224
OrthancPluginErrorCode
Definition: OrthancCPlugin.h:197
struct _OrthancPluginJob_t OrthancPluginJob
Opaque structure to a job to be executed by Orthanc.
Definition: OrthancCPlugin.h:1133
void OrthancPluginFreeMemoryBuffer64(OrthancPluginContext *context, OrthancPluginMemoryBuffer64 *buffer)
Free a memory buffer.
Definition: OrthancCPlugin.h:1956
OrthancPluginImage * OrthancPluginConvertPixelFormat(OrthancPluginContext *context, const OrthancPluginImage *source, OrthancPluginPixelFormat targetFormat)
Change the pixel format of an image.
Definition: OrthancCPlugin.h:4440
Definition: OrthancCPlugin.h:287
OrthancPluginErrorCode(* OrthancPluginWorklistCallback)(OrthancPluginWorklistAnswers *answers, const OrthancPluginWorklistQuery *query, const char *issuerAet, const char *calledAet)
Callback to handle the C-Find SCP requests for worklists.
Definition: OrthancCPlugin.h:1330
OrthancPluginErrorCode OrthancPluginCreateMemoryBuffer(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, uint32_t size)
Create a 32-bit memory buffer.
Definition: OrthancCPlugin.h:8306
Definition: OrthancCPlugin.h:730
OrthancPluginErrorCode OrthancPluginStorageAreaRead(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, OrthancPluginStorageArea *storageArea, const char *uuid, OrthancPluginContentType type)
Read a file from the storage area.
Definition: OrthancCPlugin.h:4698
OrthancPluginErrorCode OrthancPluginRegisterIncomingDicomInstanceFilter(OrthancPluginContext *context, OrthancPluginIncomingDicomInstanceFilter callback)
Register a callback to filter incoming DICOM instances.
Definition: OrthancCPlugin.h:7755
uint32_t OrthancPluginGetFontsCount(OrthancPluginContext *context)
Return the number of available fonts.
Definition: OrthancCPlugin.h:4475
char * OrthancPluginGetConfigurationPath(OrthancPluginContext *context)
Return the path to the configuration file(s).
Definition: OrthancCPlugin.h:3250
Definition: OrthancCPlugin.h:220
OrthancPluginErrorCode OrthancPluginGetFindQueryTag(OrthancPluginContext *context, uint16_t *group, uint16_t *element, const OrthancPluginFindQuery *query, uint32_t index)
Get one tag in a C-Find query.
Definition: OrthancCPlugin.h:6013
void OrthancPluginRegisterOnChangeCallback(OrthancPluginContext *context, OrthancPluginOnChangeCallback callback)
Register a callback to monitor changes.
Definition: OrthancCPlugin.h:3296
Color image in RGBA32 format.
Definition: OrthancCPlugin.h:637
Definition: OrthancCPlugin.h:837
OrthancPluginDicomToJsonFlags
Definition: OrthancCPlugin.h:834
Definition: OrthancCPlugin.h:935
Definition: OrthancCPlugin.h:213
void OrthancPluginSendMethodNotAllowed(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *allowedMethods)
Signal that this URI does not support this HTTP method.
Definition: OrthancCPlugin.h:2793
Definition: OrthancCPlugin.h:753
OrthancPluginErrorCode OrthancPluginRestApiPut(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const void *body, uint32_t bodySize)
Make a PUT call to the built-in Orthanc REST API.
Definition: OrthancCPlugin.h:2460
char * OrthancPluginGenerateUuid(OrthancPluginContext *context)
Generate an UUID.
Definition: OrthancCPlugin.h:5845
void(* OrthancPluginDicomWebBinaryCallback2)(OrthancPluginDicomWebNode *node, OrthancPluginDicomWebSetBinaryNode setter, uint32_t levelDepth, const uint16_t *levelTagGroup, const uint16_t *levelTagElement, const uint32_t *levelIndex, uint16_t tagGroup, uint16_t tagElement, OrthancPluginValueRepresentation vr, void *payload)
Callback executed to encode a binary tag in DICOMweb.
Definition: OrthancCPlugin.h:1735
float(* OrthancPluginJobGetProgress)(void *job)
Callback to check the progress of one custom job.
Definition: OrthancCPlugin.h:1546
Definition: OrthancCPlugin.h:738
uint8_t(* OrthancPluginChunkedClientRequestIsDone)(void *request)
Callback to know whether the request body is entirely read during a chunked transfer.
Definition: OrthancCPlugin.h:7208
Definition: OrthancCPlugin.h:933
Definition: OrthancCPlugin.h:724
struct _OrthancPluginContext_t OrthancPluginContext
Data structure that contains information about the Orthanc core.
OrthancPluginImage * OrthancPluginDecodeDicomImage(OrthancPluginContext *context, const void *buffer, uint32_t bufferSize, uint32_t frameIndex)
Decode one frame from a DICOM instance.
Definition: OrthancCPlugin.h:5506
Definition: OrthancCPlugin.h:263
OrthancPluginDicomToJsonFormat
Definition: OrthancCPlugin.h:819
OrthancPluginErrorCode OrthancPluginLookupDictionary(OrthancPluginContext *context, OrthancPluginDictionaryEntry *target, const char *name)
Get information about the given DICOM tag.
Definition: OrthancCPlugin.h:5634
OrthancPluginErrorCode(* OrthancPluginJobStop)(void *job, OrthancPluginJobStopReason reason)
Callback executed once one custom job leaves the "running" state.
Definition: OrthancCPlugin.h:1618
Definition: OrthancCPlugin.h:821
const void *(* OrthancPluginChunkedClientRequestGetChunkData)(void *request)
Callback to read the current chunk of the request body during a chunked transfer. ...
Definition: OrthancCPlugin.h:7241
OrthancPluginErrorCode OrthancPluginRegisterErrorCode(OrthancPluginContext *context, int32_t code, uint16_t httpStatus, const char *message)
Declare a custom error code for this plugin.
Definition: OrthancCPlugin.h:4776
Definition: OrthancCPlugin.h:244
uint16_t group
Definition: OrthancCPlugin.h:1769
void * OrthancPluginGetImageBuffer(OrthancPluginContext *context, const OrthancPluginImage *image)
Return a pointer to the content of an image.
Definition: OrthancCPlugin.h:4009
int32_t(* OrthancPluginIncomingHttpRequestFilter)(OrthancPluginHttpMethod method, const char *uri, const char *ip, uint32_t headersCount, const char *const *headersKeys, const char *const *headersValues)
Callback to filter incoming HTTP requests received by Orthanc.
Definition: OrthancCPlugin.h:1361
Definition: OrthancCPlugin.h:782
uint32_t minMultiplicity
Definition: OrthancCPlugin.h:1772
Definition: OrthancCPlugin.h:823
OrthancPluginErrorCode(* OrthancPluginTranscoderCallback)(OrthancPluginMemoryBuffer *transcoded, const void *buffer, uint64_t size, const char *const *allowedSyntaxes, uint32_t countSyntaxes, uint8_t allowNewSopInstanceUid)
Signature of a callback function to transcode a DICOM instance.
Definition: OrthancCPlugin.h:8244
Definition: OrthancCPlugin.h:794
OrthancPluginErrorCode OrthancPluginWorklistAddAnswer(OrthancPluginContext *context, OrthancPluginWorklistAnswers *answers, const OrthancPluginWorklistQuery *query, const void *dicom, uint32_t size)
Add one answer to some modality worklist request.
Definition: OrthancCPlugin.h:5154
OrthancPluginErrorCode OrthancPluginHttpPut(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *url, const void *body, uint32_t bodySize, const char *username, const char *password)
Issue a HTTP PUT call.
Definition: OrthancCPlugin.h:4364
Definition: OrthancCPlugin.h:932
OrthancPluginJobStopReason
Definition: OrthancCPlugin.h:930
struct _OrthancPluginWorklistQuery_t OrthancPluginWorklistQuery
Opaque structure to an object that represents a C-Find query for worklists.
Definition: OrthancCPlugin.h:1085
Definition: OrthancCPlugin.h:768
Definition: OrthancCPlugin.h:256
struct _OrthancPluginStorageArea_t OrthancPluginStorageArea
Opaque structure that represents the storage area that is actually used by Orthanc.
Definition: OrthancCPlugin.h:1077
Definition: OrthancCPlugin.h:248
Definition: OrthancCPlugin.h:691
char * OrthancPluginGetInstanceJson(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance)
Get the DICOM tag hierarchy as a JSON file.
Definition: OrthancCPlugin.h:2986
Definition: OrthancCPlugin.h:728
Color image in RGB48 format.
Definition: OrthancCPlugin.h:647
uint32_t OrthancPluginGetExpectedDatabaseVersion(OrthancPluginContext *context)
Get the expected version of the database schema.
Definition: OrthancCPlugin.h:3541
Definition: OrthancCPlugin.h:279
Graylevel 8bpp image.
Definition: OrthancCPlugin.h:605
Definition: OrthancCPlugin.h:277
Definition: OrthancCPlugin.h:214
OrthancPluginConstraintType
Definition: OrthancCPlugin.h:885
Definition: OrthancCPlugin.h:740
OrthancPluginResourceType
Definition: OrthancCPlugin.h:704
OrthancPluginHttpMethod
Definition: OrthancCPlugin.h:321
void(* OrthancPluginDicomWebSetBinaryNode)(OrthancPluginDicomWebNode *node, OrthancPluginDicomWebBinaryMode mode, const char *bulkDataUri)
Signature of a function to set the content of a node encoding a binary DICOM tag, into a JSON or XML ...
Definition: OrthancCPlugin.h:1204
OrthancPluginDicomInstance * OrthancPluginCreateDicomInstance(OrthancPluginContext *context, const void *buffer, uint32_t size)
Parse a DICOM instance.
Definition: OrthancCPlugin.h:7864
Definition: OrthancCPlugin.h:230
uint32_t OrthancPluginGetImageHeight(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the height of an image.
Definition: OrthancCPlugin.h:3940
OrthancPluginValueRepresentation
Definition: OrthancCPlugin.h:780
char * OrthancPluginGetConfiguration(OrthancPluginContext *context)
Return the content of the configuration file(s).
Definition: OrthancCPlugin.h:3574
Definition: OrthancCPlugin.h:201
void OrthancPluginSendHttpStatus(OrthancPluginContext *context, OrthancPluginRestOutput *output, uint16_t status, const char *body, uint32_t bodySize)
Send a HTTP status, with a custom body.
Definition: OrthancCPlugin.h:3838
OrthancPluginImage * OrthancPluginUncompressImage(OrthancPluginContext *context, const void *data, uint32_t size, OrthancPluginImageFormat format)
Decode a compressed image.
Definition: OrthancCPlugin.h:4052
Definition: OrthancCPlugin.h:282
Definition: OrthancCPlugin.h:784
void OrthancPluginRegisterStorageArea2(OrthancPluginContext *context, OrthancPluginStorageCreate create, OrthancPluginStorageReadWhole readWhole, OrthancPluginStorageReadRange readRange, OrthancPluginStorageRemove remove)
Register a custom storage area, with support for range request.
Definition: OrthancCPlugin.h:8427
Definition: OrthancCPlugin.h:217
char * OrthancPluginEncodeDicomWebXml(OrthancPluginContext *context, const void *dicom, uint32_t dicomSize, OrthancPluginDicomWebBinaryCallback callback)
Convert a DICOM instance to DICOMweb XML.
Definition: OrthancCPlugin.h:7027
Definition: OrthancCPlugin.h:709
OrthancPluginErrorCode(* OrthancPluginRestCallback)(OrthancPluginRestOutput *output, const char *url, const OrthancPluginHttpRequest *request)
Signature of a callback function that answers to a REST request.
Definition: OrthancCPlugin.h:1150
Definition: OrthancCPlugin.h:273
Definition: OrthancCPlugin.h:754
int32_t(* OrthancPluginIncomingHttpRequestFilter2)(OrthancPluginHttpMethod method, const char *uri, const char *ip, uint32_t headersCount, const char *const *headersKeys, const char *const *headersValues, uint32_t getArgumentsCount, const char *const *getArgumentsKeys, const char *const *getArgumentsValues)
Callback to filter incoming HTTP requests received by Orthanc.
Definition: OrthancCPlugin.h:1396
OrthancPluginErrorCode OrthancPluginGetInstanceRawFrame(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const OrthancPluginDicomInstance *instance, uint32_t frameIndex)
Get the raw content of a frame in a DICOM instance.
Definition: OrthancCPlugin.h:7979
Definition: OrthancCPlugin.h:787
Definition: OrthancCPlugin.h:290
Definition: OrthancCPlugin.h:920
void OrthancPluginSetMetricsValue(OrthancPluginContext *context, const char *name, float value, OrthancPluginMetricsType type)
Set the value of a metrics.
Definition: OrthancCPlugin.h:6919
char * OrthancPluginGetOrthancDirectory(OrthancPluginContext *context)
Return the directory containing the Orthanc.
Definition: OrthancCPlugin.h:3215
Definition: OrthancCPlugin.h:235
OrthancPluginErrorCode OrthancPluginRestApiPost(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const void *body, uint32_t bodySize)
Make a POST call to the built-in Orthanc REST API.
Definition: OrthancCPlugin.h:2348
Definition: OrthancCPlugin.h:756
Definition: OrthancCPlugin.h:806
Definition: OrthancCPlugin.h:265
Color image in RGB24 format.
Definition: OrthancCPlugin.h:629
OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter2(OrthancPluginContext *context, OrthancPluginIncomingHttpRequestFilter2 callback)
Register a callback to filter incoming HTTP requests.
Definition: OrthancCPlugin.h:6282
char * OrthancPluginGenerateRestApiAuthorizationToken(OrthancPluginContext *context)
Generate a token to grant full access to the REST API of Orthanc.
Definition: OrthancCPlugin.h:8344
Graylevel, signed 16bpp image.
Definition: OrthancCPlugin.h:621
Definition: OrthancCPlugin.h:944
An entry in the dictionary of DICOM tags.
Definition: OrthancCPlugin.h:1767
Definition: OrthancCPlugin.h:275
Definition: OrthancCPlugin.h:207
struct _OrthancPluginFindMatcher_t OrthancPluginFindMatcher
Opaque structure to an object that can be used to check whether a DICOM instance matches a C-Find que...
Definition: OrthancCPlugin.h:1117
Definition: OrthancCPlugin.h:723
OrthancPluginCompressionType
Definition: OrthancCPlugin.h:751
Definition: OrthancCPlugin.h:199
OrthancPluginErrorCode OrthancPluginRestApiGet2(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, uint32_t headersCount, const char *const *headersKeys, const char *const *headersValues, int32_t afterPlugins)
Make a GET call to the Orthanc REST API, with custom HTTP headers.
Definition: OrthancCPlugin.h:5080
Definition: OrthancCPlugin.h:840
struct _OrthancPluginPeers_t OrthancPluginPeers
Opaque structure to the set of remote Orthanc Peers that are known to the local Orthanc server...
Definition: OrthancCPlugin.h:1125
OrthancPluginPixelFormat OrthancPluginGetImagePixelFormat(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the pixel format of an image.
Definition: OrthancCPlugin.h:3874
OrthancPluginErrorCode OrthancPluginDrawText(OrthancPluginContext *context, OrthancPluginImage *image, uint32_t fontIndex, const char *utf8Text, int32_t x, int32_t y, uint8_t r, uint8_t g, uint8_t b)
Draw text on an image.
Definition: OrthancCPlugin.h:4600
OrthancPluginErrorCode OrthancPluginCreateMemoryBuffer64(OrthancPluginContext *context, OrthancPluginMemoryBuffer64 *target, uint64_t size)
Create a 64-bit memory buffer.
Definition: OrthancCPlugin.h:8390
uint32_t OrthancPluginGetImagePitch(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the pitch of an image.
Definition: OrthancCPlugin.h:3975
Definition: OrthancCPlugin.h:692
void OrthancPluginCompressAndAnswerPngImage(OrthancPluginContext *context, OrthancPluginRestOutput *output, OrthancPluginPixelFormat format, uint32_t width, uint32_t height, uint32_t pitch, const void *buffer)
Answer to a REST request with a PNG image.
Definition: OrthancCPlugin.h:2207
Definition: OrthancCPlugin.h:295
Definition: OrthancCPlugin.h:301
OrthancPluginJobStepStatus(* OrthancPluginJobStep)(void *job)
Callback to execute one step of a custom job.
Definition: OrthancCPlugin.h:1594
void * data
The content of the buffer.
Definition: OrthancCPlugin.h:1038
uint32_t maxMultiplicity
Definition: OrthancCPlugin.h:1773
Definition: OrthancCPlugin.h:962
OrthancPluginErrorCode OrthancPluginCallRestApi(OrthancPluginContext *context, OrthancPluginMemoryBuffer *answerBody, OrthancPluginMemoryBuffer *answerHeaders, uint16_t *httpStatus, OrthancPluginHttpMethod method, const char *uri, uint32_t headersCount, const char *const *headersKeys, const char *const *headersValues, const void *body, uint32_t bodySize, uint8_t afterPlugins)
Call the REST API of Orthanc with full flexibility.
Definition: OrthancCPlugin.h:8542
Definition: OrthancCPlugin.h:294
OrthancPluginErrorCode(* OrthancPluginDecodeImageCallback)(OrthancPluginImage **target, const void *dicom, const uint32_t size, uint32_t frameIndex)
Signature of a callback function to decode a DICOM instance as an image.
Definition: OrthancCPlugin.h:1182
char * OrthancPluginDicomBufferToJson(OrthancPluginContext *context, const void *buffer, uint32_t size, OrthancPluginDicomToJsonFormat format, OrthancPluginDicomToJsonFlags flags, uint32_t maxStringLength)
Format a DICOM memory buffer as a JSON string.
Definition: OrthancCPlugin.h:4973
void(* OrthancPluginFree)(void *buffer)
Signature of a function to free dynamic memory.
Definition: OrthancCPlugin.h:1194
Definition: OrthancCPlugin.h:890
uint32_t OrthancPluginGetCommandLineArgumentsCount(OrthancPluginContext *context)
Get the number of command-line arguments.
Definition: OrthancCPlugin.h:3475
Definition: OrthancCPlugin.h:246
void OrthancPluginSendUnauthorized(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *realm)
Signal that a REST request is not authorized.
Definition: OrthancCPlugin.h:2770
OrthancPluginErrorCode OrthancPluginCallPeerApi(OrthancPluginContext *context, OrthancPluginMemoryBuffer *answerBody, OrthancPluginMemoryBuffer *answerHeaders, uint16_t *httpStatus, const OrthancPluginPeers *peers, uint32_t peerIndex, OrthancPluginHttpMethod method, const char *uri, uint32_t additionalHeadersCount, const char *const *additionalHeadersKeys, const char *const *additionalHeadersValues, const void *body, uint32_t bodySize, uint32_t timeout)
Call the REST API of an Orthanc peer.
Definition: OrthancCPlugin.h:6590
Definition: OrthancCPlugin.h:209
Graylevel, unsigned 64bpp image.
Definition: OrthancCPlugin.h:679
Definition: OrthancCPlugin.h:271
Definition: OrthancCPlugin.h:259
void OrthancPluginFreeFindMatcher(OrthancPluginContext *context, OrthancPluginFindMatcher *matcher)
Free a C-Find matcher.
Definition: OrthancCPlugin.h:6207
OrthancPluginErrorCode OrthancPluginCreateDicom2(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *json, const OrthancPluginImage *pixelData, OrthancPluginCreateDicomFlags flags, const char *privateCreator)
Create a DICOM instance from a JSON string and an image, with a private creator.
Definition: OrthancCPlugin.h:8474
Definition: OrthancCPlugin.h:291
void OrthancPluginLogError(OrthancPluginContext *context, const char *message)
Log an error.
Definition: OrthancCPlugin.h:1972
Definition: OrthancCPlugin.h:228
OrthancPluginFindMatcher * OrthancPluginCreateFindMatcher(OrthancPluginContext *context, const void *query, uint32_t size)
Create a C-Find matcher.
Definition: OrthancCPlugin.h:6169
void * data
The content of the buffer.
Definition: OrthancCPlugin.h:1016
uint32_t OrthancPluginGetFontSize(OrthancPluginContext *context, uint32_t fontIndex)
Return the size of a font.
Definition: OrthancCPlugin.h:4547
void OrthancPluginExtendOrthancExplorer(OrthancPluginContext *context, const char *javascript)
Extend the JavaScript code of Orthanc Explorer.
Definition: OrthancCPlugin.h:3371
Definition: OrthancCPlugin.h:904
void(* OrthancPluginRefreshMetricsCallback)()
Callback executed to update the metrics of the plugin.
Definition: OrthancCPlugin.h:1669
OrthancPluginErrorCode OrthancPluginRestApiGet(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri)
Make a GET call to the built-in Orthanc REST API.
Definition: OrthancCPlugin.h:2281
const char * OrthancPluginGetErrorDescription(OrthancPluginContext *context, OrthancPluginErrorCode error)
Get the description of a given error code.
Definition: OrthancCPlugin.h:3785
uint32_t headersCount
The number of HTTP headers.
Definition: OrthancCPlugin.h:386
Definition: OrthancCPlugin.h:739
const void * OrthancPluginGetInstanceData(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance)
Get the data of a DICOM file.
Definition: OrthancCPlugin.h:2950
Definition: OrthancCPlugin.h:729
Definition: OrthancCPlugin.h:839
void OrthancPluginFreeMemoryBuffer(OrthancPluginContext *context, OrthancPluginMemoryBuffer *buffer)
Free a memory buffer.
Definition: OrthancCPlugin.h:1940
OrthancPluginErrorCode OrthancPluginRegisterWorklistCallback(OrthancPluginContext *context, OrthancPluginWorklistCallback callback)
Register a callback to handle modality worklists requests.
Definition: OrthancCPlugin.h:5118
OrthancPluginErrorCode(* OrthancPluginStorageCreate)(const char *uuid, const void *content, int64_t size, OrthancPluginContentType type)
Callback for writing to the storage area.
Definition: OrthancCPlugin.h:1223
int OrthancPluginHasInstanceMetadata(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance, const char *metadata)
Check whether a DICOM instance is associated with some metadata.
Definition: OrthancCPlugin.h:3063
void *(* OrthancPluginMoveCallback)(OrthancPluginResourceType resourceType, const char *patientId, const char *accessionNumber, const char *studyInstanceUid, const char *seriesInstanceUid, const char *sopInstanceUid, const char *originatorAet, const char *sourceAet, const char *targetAet, uint16_t originatorId)
Callback to handle incoming C-Move SCP requests.
Definition: OrthancCPlugin.h:1466
Definition: OrthancCPlugin.h:800
Definition: OrthancCPlugin.h:240
OrthancPluginErrorCode OrthancPluginRestApiDelete(OrthancPluginContext *context, const char *uri)
Make a DELETE call to the built-in Orthanc REST API.
Definition: OrthancCPlugin.h:2412
Definition: OrthancCPlugin.h:804
OrthancPluginErrorCode(* OrthancPluginStorageCommitmentLookup)(OrthancPluginStorageCommitmentFailureReason *target, void *handler, const char *sopClassUid, const char *sopInstanceUid)
Callback to get the status of one DICOM instance in the storage commitment SCP.
Definition: OrthancCPlugin.h:7667
Definition: OrthancCPlugin.h:708
OrthancPluginErrorCode OrthancPluginReadFile(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *path)
Read a file.
Definition: OrthancCPlugin.h:3723
Definition: OrthancCPlugin.h:793
Definition: OrthancCPlugin.h:875
struct _OrthancPluginFindAnswers_t OrthancPluginFindAnswers
Opaque structure to an object that represents the answers to a C-Find query for worklists.
Definition: OrthancCPlugin.h:1109
OrthancPluginErrorCode OrthancPluginRegisterMoveCallback(OrthancPluginContext *context, OrthancPluginMoveCallback callback, OrthancPluginGetMoveSize getMoveSize, OrthancPluginApplyMove applyMove, OrthancPluginFreeMove freeMove)
Register a callback to handle C-Move requests.
Definition: OrthancCPlugin.h:6130
Definition: OrthancCPlugin.h:325
Definition: OrthancCPlugin.h:737
OrthancPluginImage * OrthancPluginCreateImage(OrthancPluginContext *context, OrthancPluginPixelFormat format, uint32_t width, uint32_t height)
Create an image.
Definition: OrthancCPlugin.h:5417
Definition: OrthancCPlugin.h:795
Definition: OrthancCPlugin.h:251
char * OrthancPluginGetOrthancPath(OrthancPluginContext *context)
Return the path to the Orthanc executable.
Definition: OrthancCPlugin.h:3185
char * OrthancPluginGetGlobalProperty(OrthancPluginContext *context, int32_t property, const char *defaultValue)
Get the value of a global property.
Definition: OrthancCPlugin.h:3405
Definition: OrthancCPlugin.h:891
OrthancPluginErrorCode(* OrthancPluginStorageRemove)(const char *uuid, OrthancPluginContentType type)
Callback for removing a file from the storage area.
Definition: OrthancCPlugin.h:1311
const char * OrthancPluginGetInstanceMetadata(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance, const char *metadata)
Get the value of some metadata associated with a given DICOM instance.
Definition: OrthancCPlugin.h:3104
Definition: OrthancCPlugin.h:822
Definition: OrthancCPlugin.h:260
Definition: OrthancCPlugin.h:844
Definition: OrthancCPlugin.h:298
Definition: OrthancCPlugin.h:323
Definition: OrthancCPlugin.h:951
Definition: OrthancCPlugin.h:731
Definition: OrthancCPlugin.h:305
OrthancPluginErrorCode OrthancPluginReconstructMainDicomTags(OrthancPluginContext *context, OrthancPluginStorageArea *storageArea, OrthancPluginResourceType level)
Reconstruct the main DICOM tags.
Definition: OrthancCPlugin.h:4929
char * OrthancPluginGetFindQueryTagName(OrthancPluginContext *context, const OrthancPluginFindQuery *query, uint32_t index)
Get the symbolic name of one tag in a C-Find query.
Definition: OrthancCPlugin.h:6044
void OrthancPluginRegisterJobsUnserializer(OrthancPluginContext *context, OrthancPluginJobsUnserializer unserializer)
Register an unserializer for custom jobs.
Definition: OrthancCPlugin.h:6807
void OrthancPluginFreeDicomInstance(OrthancPluginContext *context, OrthancPluginDicomInstance *dicom)
Free a DICOM instance.
Definition: OrthancCPlugin.h:7902
char * OrthancPluginEncodeDicomWebJson2(OrthancPluginContext *context, const void *dicom, uint32_t dicomSize, OrthancPluginDicomWebBinaryCallback2 callback, void *payload)
Convert a DICOM instance to DICOMweb JSON.
Definition: OrthancCPlugin.h:7079
char * OrthancPluginGetCommandLineArgument(OrthancPluginContext *context, uint32_t argument)
Get the value of a command-line argument.
Definition: OrthancCPlugin.h:3509
OrthancPluginErrorCode OrthancPluginHttpGet(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *url, const char *username, const char *password)
Issue a HTTP GET call.
Definition: OrthancCPlugin.h:4284
int64_t OrthancPluginGetInstanceSize(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance)
Get the size of a DICOM file.
Definition: OrthancCPlugin.h:2917
OrthancPluginImage * OrthancPluginCreateImageAccessor(OrthancPluginContext *context, OrthancPluginPixelFormat format, uint32_t width, uint32_t height, uint32_t pitch, void *buffer)
Create an image pointing to a memory buffer.
Definition: OrthancCPlugin.h:5460
Definition: OrthancCPlugin.h:268
char * OrthancPluginGetInstanceDicomWebJson(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance, OrthancPluginDicomWebBinaryCallback2 callback, void *payload)
Convert a DICOM instance to DICOMweb JSON.
Definition: OrthancCPlugin.h:8159
OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter(OrthancPluginContext *context, OrthancPluginIncomingHttpRequestFilter callback)
Register a callback to filter incoming HTTP requests.
Definition: OrthancCPlugin.h:5715
Definition: OrthancCPlugin.h:907
Definition: OrthancCPlugin.h:221
char * OrthancPluginDicomInstanceToJson(OrthancPluginContext *context, const char *instanceId, OrthancPluginDicomToJsonFormat format, OrthancPluginDicomToJsonFlags flags, uint32_t maxStringLength)
Format a DICOM instance as a JSON string.
Definition: OrthancCPlugin.h:5022
const char *const * getValues
For a GET request, the values of the GET parameters.
Definition: OrthancCPlugin.h:366
const char * OrthancPluginGetPeerUserProperty(OrthancPluginContext *context, const OrthancPluginPeers *peers, uint32_t peerIndex, const char *userProperty)
Get some user-defined property of an Orthanc peer.
Definition: OrthancCPlugin.h:6509
Definition: OrthancCPlugin.h:807
OrthancPluginErrorCode(* OrthancPluginOnChangeCallback)(OrthancPluginChangeType changeType, OrthancPluginResourceType resourceType, const char *resourceId)
Signature of a callback function that is triggered when a change happens to some DICOM resource...
Definition: OrthancCPlugin.h:1171
OrthancPluginPeers * OrthancPluginGetPeers(OrthancPluginContext *context)
Return the list of available Orthanc peers.
Definition: OrthancCPlugin.h:6310
OrthancPluginErrorCode OrthancPluginBufferCompression(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const void *source, uint32_t size, OrthancPluginCompressionType compression, uint8_t uncompress)
Compress or decompress a buffer.
Definition: OrthancCPlugin.h:3686
Definition: OrthancCPlugin.h:261
OrthancPluginErrorCode(* OrthancPluginChunkedClientAnswerAddChunk)(void *answer, const void *data, uint32_t size)
Callback executed when an answer chunk is received during a chunked transfer.
Definition: OrthancCPlugin.h:7188
OrthancPluginErrorCode OrthancPluginWorklistMarkIncomplete(OrthancPluginContext *context, OrthancPluginWorklistAnswers *answers)
Mark the set of worklist answers as incomplete.
Definition: OrthancCPlugin.h:5184
OrthancPluginErrorCode OrthancPluginCreateDicom(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *json, const OrthancPluginImage *pixelData, OrthancPluginCreateDicomFlags flags)
Create a DICOM instance from a JSON string and an image.
Definition: OrthancCPlugin.h:5343
Definition: OrthancCPlugin.h:254
Definition: OrthancCPlugin.h:770
Definition: OrthancCPlugin.h:208
Definition: OrthancCPlugin.h:267
Definition: OrthancCPlugin.h:215
void OrthancPluginRegisterRestCallbackNoLock(OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback callback)
Register a REST callback, without locking.
Definition: OrthancCPlugin.h:2080
OrthancPluginErrorCode OrthancPluginHttpPost(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *url, const void *body, uint32_t bodySize, const char *username, const char *password)
Issue a HTTP POST call.
Definition: OrthancCPlugin.h:4322
OrthancPluginErrorCode(* OrthancPluginFindCallback)(OrthancPluginFindAnswers *answers, const OrthancPluginFindQuery *query, const char *issuerAet, const char *calledAet)
Callback to handle incoming C-Find SCP requests.
Definition: OrthancCPlugin.h:1423
Definition: OrthancCPlugin.h:734
OrthancPluginErrorCode OrthancPluginRegisterFindCallback(OrthancPluginContext *context, OrthancPluginFindCallback callback)
Register a callback to handle C-Find requests.
Definition: OrthancCPlugin.h:5884
struct _OrthancPluginImage_t OrthancPluginImage
Opaque structure that represents an image that is uncompressed in memory.
Definition: OrthancCPlugin.h:1069
OrthancPluginErrorCode OrthancPluginStartMultipartAnswer(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *subType, const char *contentType)
Start an HTTP multipart answer.
Definition: OrthancCPlugin.h:3615
struct _OrthancPluginWorklistAnswers_t OrthancPluginWorklistAnswers
Opaque structure to an object that represents the answers to a C-Find query for worklists.
Definition: OrthancCPlugin.h:1093
Definition: OrthancCPlugin.h:200
Definition: OrthancCPlugin.h:243
Definition: OrthancCPlugin.h:226
Definition: OrthancCPlugin.h:219
OrthancPluginInstanceOrigin OrthancPluginGetInstanceOrigin(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance)
Get the origin of a DICOM file.
Definition: OrthancCPlugin.h:5287
Definition: OrthancCPlugin.h:741
Definition: OrthancCPlugin.h:872
Definition: OrthancCPlugin.h:299
Definition: OrthancCPlugin.h:270
void(* OrthancPluginFreeMove)(void *moveDriver)
Callback to free one C-Move driver.
Definition: OrthancCPlugin.h:1520
char * OrthancPluginEncodeDicomWebXml2(OrthancPluginContext *context, const void *dicom, uint32_t dicomSize, OrthancPluginDicomWebBinaryCallback2 callback, void *payload)
Convert a DICOM instance to DICOMweb XML.
Definition: OrthancCPlugin.h:7123
void OrthancPluginSetRootUri(OrthancPluginContext *context, const char *uri)
Set the URI where the plugin provides its Web interface.
Definition: OrthancCPlugin.h:3327
int32_t OrthancPluginHasInstancePixelData(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance)
Check whether the DICOM file has pixel data.
Definition: OrthancCPlugin.h:7814
const char *(* OrthancPluginJobGetSerialized)(void *job)
Callback to serialize one custom job.
Definition: OrthancCPlugin.h:1579
OrthancPluginErrorCode OrthancPluginStorageAreaRemove(OrthancPluginContext *context, OrthancPluginStorageArea *storageArea, const char *uuid, OrthancPluginContentType type)
Remove a file from the storage area.
Definition: OrthancCPlugin.h:4737
Definition: OrthancCPlugin.h:919
Definition: OrthancCPlugin.h:694
OrthancPluginErrorCode(* OrthancPluginOnStoredInstanceCallback)(const OrthancPluginDicomInstance *instance, const char *instanceId)
Signature of a callback function that is triggered when Orthanc stores a new DICOM instance...
Definition: OrthancCPlugin.h:1161
void OrthancPluginFreeJob(OrthancPluginContext *context, OrthancPluginJob *job)
Free a custom job.
Definition: OrthancCPlugin.h:6730
Definition: OrthancCPlugin.h:799
Definition: OrthancCPlugin.h:735
const char *const * getKeys
For a GET request, the keys of the GET parameters.
Definition: OrthancCPlugin.h:361
Definition: OrthancCPlugin.h:802
Definition: OrthancCPlugin.h:726
char * OrthancPluginLookupPatient(OrthancPluginContext *context, const char *patientID)
Look for a patient.
Definition: OrthancCPlugin.h:2562
OrthancPluginErrorCode(* OrthancPluginStorageCommitmentFactory)(void **handler, const char *jobId, const char *transactionUid, const char *const *sopClassUids, const char *const *sopInstanceUids, uint32_t countInstances, const char *remoteAet, const char *calledAet)
Callback executed by the storage commitment SCP.
Definition: OrthancCPlugin.h:7624
OrthancPluginErrorCode(* OrthancPluginStorageReadRange)(OrthancPluginMemoryBuffer64 *target, const char *uuid, OrthancPluginContentType type, uint64_t rangeStart)
Callback for reading a range of a file from the storage area.
Definition: OrthancCPlugin.h:1293
struct _OrthancPluginDicomInstance_t OrthancPluginDicomInstance
Opaque structure that represents a DICOM instance that is managed by the Orthanc core.
Definition: OrthancCPlugin.h:1061
Definition: OrthancCPlugin.h:242
Definition: OrthancCPlugin.h:888
Definition: OrthancCPlugin.h:803
void OrthancPluginFreeImage(OrthancPluginContext *context, OrthancPluginImage *image)
Free an image.
Definition: OrthancCPlugin.h:4094
OrthancPluginValueRepresentation vr
Definition: OrthancCPlugin.h:1771
OrthancPluginErrorCode OrthancPluginChunkedHttpClient(OrthancPluginContext *context, void *answer, OrthancPluginChunkedClientAnswerAddChunk answerAddChunk, OrthancPluginChunkedClientAnswerAddHeader answerAddHeader, uint16_t *httpStatus, OrthancPluginHttpMethod method, const char *url, uint32_t headersCount, const char *const *headersKeys, const char *const *headersValues, void *request, OrthancPluginChunkedClientRequestIsDone requestIsDone, OrthancPluginChunkedClientRequestGetChunkData requestChunkData, OrthancPluginChunkedClientRequestGetChunkSize requestChunkSize, OrthancPluginChunkedClientRequestNext requestNext, const char *username, const char *password, uint32_t timeout, const char *certificateFile, const char *certificateKeyFile, const char *certificateKeyPassword, uint8_t pkcs11)
Issue a HTTP call, using chunked HTTP transfers.
Definition: OrthancCPlugin.h:7336
uint16_t element
Definition: OrthancCPlugin.h:1770
char * OrthancPluginLookupInstance(OrthancPluginContext *context, const char *sopInstanceUID)
Look for an instance.
Definition: OrthancCPlugin.h:2702
Definition: OrthancCPlugin.h:733
OrthancPluginErrorCode OrthancPluginSetGlobalProperty(OrthancPluginContext *context, int32_t property, const char *value)
Set the value of a global property.
Definition: OrthancCPlugin.h:3444
OrthancPluginErrorCode(* OrthancPluginApplyMove)(void *moveDriver)
Callback to apply one C-Move suboperation.
Definition: OrthancCPlugin.h:1506
Definition: OrthancCPlugin.h:232
Definition: OrthancCPlugin.h:693
Definition: OrthancCPlugin.h:239
const char *const * groups
The matched values for the groups of the regular expression.
Definition: OrthancCPlugin.h:351
OrthancPluginErrorCode OrthancPluginWriteFile(OrthancPluginContext *context, const char *path, const void *data, uint32_t size)
Write a file.
Definition: OrthancCPlugin.h:3754
Definition: OrthancCPlugin.h:269
OrthancPluginErrorCode(* OrthancPluginStorageRead)(void **content, int64_t *size, const char *uuid, OrthancPluginContentType type)
Callback for reading from the storage area.
Definition: OrthancCPlugin.h:1250
Definition: OrthancCPlugin.h:272
char * OrthancPluginLookupStudy(OrthancPluginContext *context, const char *studyUID)
Look for a study.
Definition: OrthancCPlugin.h:2597
uint32_t size
The number of bytes in the buffer.
Definition: OrthancCPlugin.h:1021
Graylevel, floating-point 32bpp image.
Definition: OrthancCPlugin.h:663
const char * OrthancPluginGetInstanceRemoteAet(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance)
Get the AET of a DICOM instance.
Definition: OrthancCPlugin.h:2884
Definition: OrthancCPlugin.h:902
Definition: OrthancCPlugin.h:252
OrthancPluginErrorCode(* OrthancPluginJobReset)(void *job)
Callback executed once one stopped custom job is started again.
Definition: OrthancCPlugin.h:1635
char * OrthancPluginEncodeDicomWebJson(OrthancPluginContext *context, const void *dicom, uint32_t dicomSize, OrthancPluginDicomWebBinaryCallback callback)
Convert a DICOM instance to DICOMweb JSON.
Definition: OrthancCPlugin.h:6985
uint32_t groupsCount
The number of groups of the regular expression.
Definition: OrthancCPlugin.h:346
Definition: OrthancCPlugin.h:253
OrthancPluginErrorCode(* OrthancPluginServerChunkedRequestReaderFactory)(OrthancPluginServerChunkedRequestReader **reader, const char *url, const OrthancPluginHttpRequest *request)
Callback to create a reader to handle incoming chunked HTTP transfers.
Definition: OrthancCPlugin.h:7416
Definition: OrthancCPlugin.h:710
void OrthancPluginLogWarning(OrthancPluginContext *context, const char *message)
Log a warning.
Definition: OrthancCPlugin.h:1988
Definition: OrthancCPlugin.h:961
Definition: OrthancCPlugin.h:788
Definition: OrthancCPlugin.h:258
int32_t OrthancPluginWorklistIsMatch(OrthancPluginContext *context, const OrthancPluginWorklistQuery *query, const void *dicom, uint32_t size)
Test whether a worklist matches the query.
Definition: OrthancCPlugin.h:5222
int OrthancPluginCheckVersionAdvanced(OrthancPluginContext *context, int expectedMajor, int expectedMinor, int expectedRevision)
Check that the version of the hosting Orthanc is above a given version.
Definition: OrthancCPlugin.h:1816
Definition: OrthancCPlugin.h:808
const void * body
For a PUT or POST request, the content of the body.
Definition: OrthancCPlugin.h:371
OrthancPluginErrorCode(* OrthancPluginServerChunkedRequestReaderExecute)(OrthancPluginServerChunkedRequestReader *reader, OrthancPluginRestOutput *output)
Callback invoked whenever the request body is entirely received.
Definition: OrthancCPlugin.h:7455
OrthancPluginIdentifierConstraint
Definition: OrthancCPlugin.h:870
uint32_t bodySize
For a PUT or POST request, the number of bytes of the body.
Definition: OrthancCPlugin.h:376
OrthancPluginErrorCode OrthancPluginFindMarkIncomplete(OrthancPluginContext *context, OrthancPluginFindAnswers *answers)
Mark the set of C-Find answers as incomplete.
Definition: OrthancCPlugin.h:5952
Definition: OrthancCPlugin.h:326
OrthancPluginJob *(* OrthancPluginJobsUnserializer)(const char *jobType, const char *serialized)
Callback executed to unserialize a custom job.
Definition: OrthancCPlugin.h:1651
OrthancPluginMetricsType
Definition: OrthancCPlugin.h:942
OrthancPluginErrorCode OrthancPluginRestApiPutAfterPlugins(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const void *body, uint32_t bodySize)
Make a PUT call to the REST API, as tainted by the plugins.
Definition: OrthancCPlugin.h:2496
OrthancPluginErrorCode OrthancPluginSendMultipartItem(OrthancPluginContext *context, OrthancPluginRestOutput *output, const void *answer, uint32_t answerSize)
Send an item as a part of some HTTP multipart answer.
Definition: OrthancCPlugin.h:3644
OrthancPluginDicomWebBinaryMode
Definition: OrthancCPlugin.h:959
Definition: OrthancCPlugin.h:237
Definition: OrthancCPlugin.h:304
void OrthancPluginSetCookie(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *cookie, const char *value)
Set a cookie.
Definition: OrthancCPlugin.h:2823
Definition: OrthancCPlugin.h:725
char * OrthancPluginGetTagName(OrthancPluginContext *context, uint16_t group, uint16_t element, const char *privateCreator)
Returns the symbolic name of a DICOM tag.
Definition: OrthancCPlugin.h:7569
uint32_t OrthancPluginGetPeersCount(OrthancPluginContext *context, const OrthancPluginPeers *peers)
Get the number of Orthanc peers.
Definition: OrthancCPlugin.h:6374
Definition: OrthancCPlugin.h:798
const char * OrthancPluginGetPeerUrl(OrthancPluginContext *context, const OrthancPluginPeers *peers, uint32_t peerIndex)
Get the base URL of an Orthanc peer.
Definition: OrthancCPlugin.h:6463
uint32_t OrthancPluginGetFindQuerySize(OrthancPluginContext *context, const OrthancPluginFindQuery *query)
Get the number of tags in a C-Find query.
Definition: OrthancCPlugin.h:5976
void OrthancPluginSetDescription(OrthancPluginContext *context, const char *description)
Set a description for this plugin.
Definition: OrthancCPlugin.h:3349
Definition: OrthancCPlugin.h:300
Definition: OrthancCPlugin.h:234
void OrthancPluginRegisterOnStoredInstanceCallback(OrthancPluginContext *context, OrthancPluginOnStoredInstanceCallback callback)
Register a callback for received instances.
Definition: OrthancCPlugin.h:2118
Definition: OrthancCPlugin.h:727
Definition: OrthancCPlugin.h:801
OrthancPluginErrorCode OrthancPluginRegisterDictionaryTag(OrthancPluginContext *context, uint16_t group, uint16_t element, OrthancPluginValueRepresentation vr, const char *name, uint32_t minMultiplicity, uint32_t maxMultiplicity)
Register a new tag into the DICOM dictionary.
Definition: OrthancCPlugin.h:4832
Definition: OrthancCPlugin.h:255
Definition: OrthancCPlugin.h:212
int32_t(* OrthancPluginIncomingDicomInstanceFilter)(const OrthancPluginDicomInstance *instance)
Callback to filter incoming DICOM instances received by Orthanc.
Definition: OrthancCPlugin.h:7724
Definition: OrthancCPlugin.h:805
Definition: OrthancCPlugin.h:785
Graylevel, unsigned 32bpp image.
Definition: OrthancCPlugin.h:655
Definition: OrthancCPlugin.h:887
void OrthancPluginRegisterRestCallback(OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback callback)
Register a REST callback.
Definition: OrthancCPlugin.h:2040
uint32_t(* OrthancPluginChunkedClientRequestGetChunkSize)(void *request)
Callback to read the size of the current request chunk during a chunked transfer. ...
Definition: OrthancCPlugin.h:7257
char * OrthancPluginLookupStudyWithAccessionNumber(OrthancPluginContext *context, const char *accessionNumber)
Look for a study, using the accession number.
Definition: OrthancCPlugin.h:2632
Definition: OrthancCPlugin.h:797
Definition: OrthancCPlugin.h:783
Definition: OrthancCPlugin.h:204
Definition: OrthancCPlugin.h:706
void OrthancPluginRegisterChunkedRestCallback(OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback getHandler, OrthancPluginServerChunkedRequestReaderFactory postHandler, OrthancPluginRestCallback deleteHandler, OrthancPluginServerChunkedRequestReaderFactory putHandler, OrthancPluginServerChunkedRequestReaderAddChunk addChunk, OrthancPluginServerChunkedRequestReaderExecute execute, OrthancPluginServerChunkedRequestReaderFinalize finalize)
Register a REST callback to handle chunked HTTP transfers.
Definition: OrthancCPlugin.h:7518
OrthancPluginErrorCode OrthancPluginWorklistGetDicomQuery(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const OrthancPluginWorklistQuery *query)
Retrieve the worklist query as a DICOM file.
Definition: OrthancCPlugin.h:5261
OrthancPluginErrorCode OrthancPluginRestApiGetAfterPlugins(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri)
Make a GET call to the REST API, as tainted by the plugins.
Definition: OrthancCPlugin.h:2311
OrthancPluginErrorCode(* OrthancPluginChunkedClientAnswerAddHeader)(void *answer, const char *key, const char *value)
Callback executed when a HTTP header is received during a chunked transfer.
Definition: OrthancCPlugin.h:7167
Definition: OrthancCPlugin.h:903
Definition: OrthancCPlugin.h:223
Definition: OrthancCPlugin.h:293
Definition: OrthancCPlugin.h:205
Definition: OrthancCPlugin.h:210
struct _OrthancPluginFindQuery_t OrthancPluginFindQuery
Opaque structure to an object that represents a C-Find query.
Definition: OrthancCPlugin.h:1101
Definition: OrthancCPlugin.h:202
Definition: OrthancCPlugin.h:227
Definition: OrthancCPlugin.h:732
Definition: OrthancCPlugin.h:755
void OrthancPluginRegisterRefreshMetricsCallback(OrthancPluginContext *context, OrthancPluginRefreshMetricsCallback callback)
Register a callback to refresh the metrics.
Definition: OrthancCPlugin.h:6949
Definition: OrthancCPlugin.h:245
Definition: OrthancCPlugin.h:238
OrthancPluginHttpMethod method
The HTTP method.
Definition: OrthancCPlugin.h:341
Definition: OrthancCPlugin.h:288
OrthancPluginErrorCode OrthancPluginStorageAreaCreate(OrthancPluginContext *context, OrthancPluginStorageArea *storageArea, const char *uuid, const void *content, uint64_t size, OrthancPluginContentType type)
Create a file inside the storage area.
Definition: OrthancCPlugin.h:4654
void OrthancPluginAnswerBuffer(OrthancPluginContext *context, OrthancPluginRestOutput *output, const void *answer, uint32_t answerSize, const char *mimeType)
Answer to a REST request.
Definition: OrthancCPlugin.h:2150
OrthancPluginErrorCode OrthancPluginHttpDelete(OrthancPluginContext *context, const char *url, const char *username, const char *password)
Issue a HTTP DELETE call.
Definition: OrthancCPlugin.h:4402
A 32-bit memory buffer allocated by the core system of Orthanc.
Definition: OrthancCPlugin.h:1011
uint64_t size
The number of bytes in the buffer.
Definition: OrthancCPlugin.h:1043
void(* OrthancPluginServerChunkedRequestReaderFinalize)(OrthancPluginServerChunkedRequestReader *reader)
Callback invoked to release the resources associated with an incoming HTTP chunked transfer...
Definition: OrthancCPlugin.h:7473
const char * OrthancPluginGetPeerName(OrthancPluginContext *context, const OrthancPluginPeers *peers, uint32_t peerIndex)
Get the symbolic name of an Orthanc peer.
Definition: OrthancCPlugin.h:6422
OrthancPluginErrorCode(* OrthancPluginStorageReadWhole)(OrthancPluginMemoryBuffer64 *target, const char *uuid, OrthancPluginContentType type)
Callback for reading a whole file from the storage area.
Definition: OrthancCPlugin.h:1270
Color image in BGRA32 format.
Definition: OrthancCPlugin.h:671
OrthancPluginStorageCommitmentFailureReason
Definition: OrthancCPlugin.h:972
Definition: OrthancCPlugin.h:790
Definition: OrthancCPlugin.h:838
uint32_t OrthancPluginGetInstanceFramesCount(OrthancPluginContext *context, const OrthancPluginDicomInstance *instance)
Get the number of frames in a DICOM instance.
Definition: OrthancCPlugin.h:7939
OrthancPluginErrorCode OrthancPluginRegisterTranscoderCallback(OrthancPluginContext *context, OrthancPluginTranscoderCallback callback)
Register a callback to handle the transcoding of DICOM images.
Definition: OrthancCPlugin.h:8271
Definition: OrthancCPlugin.h:216
void(* OrthancPluginStorageCommitmentDestructor)(void *handler)
Callback to free one storage commitment SCP handler.
Definition: OrthancCPlugin.h:7646
Definition: OrthancCPlugin.h:843
int32_t OrthancPluginFindMatcherIsMatch(OrthancPluginContext *context, const OrthancPluginFindMatcher *matcher, const void *dicom, uint32_t size)
Test whether a DICOM instance matches a C-Find query.
Definition: OrthancCPlugin.h:6240
Definition: OrthancCPlugin.h:796
void(* OrthancPluginJobFinalize)(void *job)
Callback to finalize one custom job.
Definition: OrthancCPlugin.h:1533
char * OrthancPluginLookupSeries(OrthancPluginContext *context, const char *seriesUID)
Look for a series.
Definition: OrthancCPlugin.h:2667
Definition: OrthancCPlugin.h:206
uint32_t(* OrthancPluginGetMoveSize)(void *moveDriver)
Callback to read the size of a C-Move driver.
Definition: OrthancCPlugin.h:1491
Definition: OrthancCPlugin.h:786
void(* OrthancPluginDicomWebBinaryCallback)(OrthancPluginDicomWebNode *node, OrthancPluginDicomWebSetBinaryNode setter, uint32_t levelDepth, const uint16_t *levelTagGroup, const uint16_t *levelTagElement, const uint32_t *levelIndex, uint16_t tagGroup, uint16_t tagElement, OrthancPluginValueRepresentation vr)
Callback executed to encode a binary tag in DICOMweb.
Definition: OrthancCPlugin.h:1697
Definition: OrthancCPlugin.h:281
uint32_t OrthancPluginGetImageWidth(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the width of an image.
Definition: OrthancCPlugin.h:3907
OrthancPluginErrorCode(* OrthancPluginServerChunkedRequestReaderAddChunk)(OrthancPluginServerChunkedRequestReader *reader, const void *data, uint32_t size)
Callback invoked whenever a new data chunk is available during a chunked transfer.
Definition: OrthancCPlugin.h:7435
OrthancPluginErrorCode OrthancPluginCompressJpegImage(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, OrthancPluginPixelFormat format, uint32_t width, uint32_t height, uint32_t pitch, const void *buffer, uint8_t quality)
Encode a JPEG image.
Definition: OrthancCPlugin.h:4184
char * OrthancPluginGetFindQueryValue(OrthancPluginContext *context, const OrthancPluginFindQuery *query, uint32_t index)
Get the value associated with one tag in a C-Find query.
Definition: OrthancCPlugin.h:6082
Definition: OrthancCPlugin.h:236
Definition: OrthancCPlugin.h:229