Orthanc Plugin SDK  1.5.8
Documentation of the plugin interface of Orthanc
OrthancCPlugin.h
1 
110 #pragma once
111 
112 
113 #include <stdio.h>
114 #include <string.h>
115 
116 #ifdef WIN32
117 # define ORTHANC_PLUGINS_API __declspec(dllexport)
118 #elif __GNUC__ >= 4
119 # define ORTHANC_PLUGINS_API __attribute__ ((visibility ("default")))
120 #else
121 # define ORTHANC_PLUGINS_API
122 #endif
123 
124 #define ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER 1
125 #define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER 5
126 #define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 7
127 
128 
129 #if !defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)
130 #define ORTHANC_PLUGINS_VERSION_IS_ABOVE(major, minor, revision) \
131  (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER > major || \
132  (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER == major && \
133  (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER > minor || \
134  (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER == minor && \
135  ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER >= revision))))
136 #endif
137 
138 
139 
140 /********************************************************************
141  ** Check that function inlining is properly supported. The use of
142  ** inlining is required, to avoid the duplication of object code
143  ** between two compilation modules that would use the Orthanc Plugin
144  ** API.
145  ********************************************************************/
146 
147 /* If the auto-detection of the "inline" keyword below does not work
148  automatically and that your compiler is known to properly support
149  inlining, uncomment the following #define and adapt the definition
150  of "static inline". */
151 
152 /* #define ORTHANC_PLUGIN_INLINE static inline */
153 
154 #ifndef ORTHANC_PLUGIN_INLINE
155 # if __STDC_VERSION__ >= 199901L
156 /* This is C99 or above: http://predef.sourceforge.net/prestd.html */
157 # define ORTHANC_PLUGIN_INLINE static inline
158 # elif defined(__cplusplus)
159 /* This is C++ */
160 # define ORTHANC_PLUGIN_INLINE static inline
161 # elif defined(__GNUC__)
162 /* This is GCC running in C89 mode */
163 # define ORTHANC_PLUGIN_INLINE static __inline
164 # elif defined(_MSC_VER)
165 /* This is Visual Studio running in C89 mode */
166 # define ORTHANC_PLUGIN_INLINE static __inline
167 # else
168 # error Your compiler is not known to support the "inline" keyword
169 # endif
170 #endif
171 
172 
173 
174 /********************************************************************
175  ** Inclusion of standard libraries.
176  ********************************************************************/
177 
183 #include <stdint.h>
184 
185 #include <stdlib.h>
186 
187 
188 
189 /********************************************************************
190  ** Definition of the Orthanc Plugin API.
191  ********************************************************************/
192 
195 #ifdef __cplusplus
196 extern "C"
197 {
198 #endif
199 
203  typedef enum
204  {
305 
306  _OrthancPluginErrorCode_INTERNAL = 0x7fffffff
308 
309 
314  ORTHANC_PLUGINS_API const char* OrthancPluginGetName();
315 
316 
320  typedef enum
321  {
327  _OrthancPluginHttpMethod_INTERNAL = 0x7fffffff
329 
330 
335  typedef struct
336  {
341 
345  uint32_t groupsCount;
346 
350  const char* const* groups;
351 
355  uint32_t getCount;
356 
360  const char* const* getKeys;
361 
365  const char* const* getValues;
366 
370  const void* body;
371 
375  uint32_t bodySize;
376 
377 
378  /* --------------------------------------------------
379  New in version 0.8.1
380  -------------------------------------------------- */
381 
385  uint32_t headersCount;
386 
390  const char* const* headersKeys;
391 
395  const char* const* headersValues;
396 
398 
399 
400  typedef enum
401  {
402  /* Generic services */
403  _OrthancPluginService_LogInfo = 1,
404  _OrthancPluginService_LogWarning = 2,
405  _OrthancPluginService_LogError = 3,
406  _OrthancPluginService_GetOrthancPath = 4,
407  _OrthancPluginService_GetOrthancDirectory = 5,
408  _OrthancPluginService_GetConfigurationPath = 6,
409  _OrthancPluginService_SetPluginProperty = 7,
410  _OrthancPluginService_GetGlobalProperty = 8,
411  _OrthancPluginService_SetGlobalProperty = 9,
412  _OrthancPluginService_GetCommandLineArgumentsCount = 10,
413  _OrthancPluginService_GetCommandLineArgument = 11,
414  _OrthancPluginService_GetExpectedDatabaseVersion = 12,
415  _OrthancPluginService_GetConfiguration = 13,
416  _OrthancPluginService_BufferCompression = 14,
417  _OrthancPluginService_ReadFile = 15,
418  _OrthancPluginService_WriteFile = 16,
419  _OrthancPluginService_GetErrorDescription = 17,
420  _OrthancPluginService_CallHttpClient = 18,
421  _OrthancPluginService_RegisterErrorCode = 19,
422  _OrthancPluginService_RegisterDictionaryTag = 20,
423  _OrthancPluginService_DicomBufferToJson = 21,
424  _OrthancPluginService_DicomInstanceToJson = 22,
425  _OrthancPluginService_CreateDicom = 23,
426  _OrthancPluginService_ComputeMd5 = 24,
427  _OrthancPluginService_ComputeSha1 = 25,
428  _OrthancPluginService_LookupDictionary = 26,
429  _OrthancPluginService_CallHttpClient2 = 27,
430  _OrthancPluginService_GenerateUuid = 28,
431  _OrthancPluginService_RegisterPrivateDictionaryTag = 29,
432  _OrthancPluginService_AutodetectMimeType = 30,
433  _OrthancPluginService_SetMetricsValue = 31,
434  _OrthancPluginService_EncodeDicomWebJson = 32,
435  _OrthancPluginService_EncodeDicomWebXml = 33,
436  _OrthancPluginService_ChunkedHttpClient = 34, /* New in Orthanc 1.5.7 */
437  _OrthancPluginService_GetTagName = 35, /* New in Orthanc 1.5.7 */
438 
439  /* Registration of callbacks */
440  _OrthancPluginService_RegisterRestCallback = 1000,
441  _OrthancPluginService_RegisterOnStoredInstanceCallback = 1001,
442  _OrthancPluginService_RegisterStorageArea = 1002,
443  _OrthancPluginService_RegisterOnChangeCallback = 1003,
444  _OrthancPluginService_RegisterRestCallbackNoLock = 1004,
445  _OrthancPluginService_RegisterWorklistCallback = 1005,
446  _OrthancPluginService_RegisterDecodeImageCallback = 1006,
447  _OrthancPluginService_RegisterIncomingHttpRequestFilter = 1007,
448  _OrthancPluginService_RegisterFindCallback = 1008,
449  _OrthancPluginService_RegisterMoveCallback = 1009,
450  _OrthancPluginService_RegisterIncomingHttpRequestFilter2 = 1010,
451  _OrthancPluginService_RegisterRefreshMetricsCallback = 1011,
452  _OrthancPluginService_RegisterChunkedRestCallback = 1012, /* New in Orthanc 1.5.7 */
453 
454  /* Sending answers to REST calls */
455  _OrthancPluginService_AnswerBuffer = 2000,
456  _OrthancPluginService_CompressAndAnswerPngImage = 2001, /* Unused as of Orthanc 0.9.4 */
457  _OrthancPluginService_Redirect = 2002,
458  _OrthancPluginService_SendHttpStatusCode = 2003,
459  _OrthancPluginService_SendUnauthorized = 2004,
460  _OrthancPluginService_SendMethodNotAllowed = 2005,
461  _OrthancPluginService_SetCookie = 2006,
462  _OrthancPluginService_SetHttpHeader = 2007,
463  _OrthancPluginService_StartMultipartAnswer = 2008,
464  _OrthancPluginService_SendMultipartItem = 2009,
465  _OrthancPluginService_SendHttpStatus = 2010,
466  _OrthancPluginService_CompressAndAnswerImage = 2011,
467  _OrthancPluginService_SendMultipartItem2 = 2012,
468  _OrthancPluginService_SetHttpErrorDetails = 2013,
469 
470  /* Access to the Orthanc database and API */
471  _OrthancPluginService_GetDicomForInstance = 3000,
472  _OrthancPluginService_RestApiGet = 3001,
473  _OrthancPluginService_RestApiPost = 3002,
474  _OrthancPluginService_RestApiDelete = 3003,
475  _OrthancPluginService_RestApiPut = 3004,
476  _OrthancPluginService_LookupPatient = 3005,
477  _OrthancPluginService_LookupStudy = 3006,
478  _OrthancPluginService_LookupSeries = 3007,
479  _OrthancPluginService_LookupInstance = 3008,
480  _OrthancPluginService_LookupStudyWithAccessionNumber = 3009,
481  _OrthancPluginService_RestApiGetAfterPlugins = 3010,
482  _OrthancPluginService_RestApiPostAfterPlugins = 3011,
483  _OrthancPluginService_RestApiDeleteAfterPlugins = 3012,
484  _OrthancPluginService_RestApiPutAfterPlugins = 3013,
485  _OrthancPluginService_ReconstructMainDicomTags = 3014,
486  _OrthancPluginService_RestApiGet2 = 3015,
487 
488  /* Access to DICOM instances */
489  _OrthancPluginService_GetInstanceRemoteAet = 4000,
490  _OrthancPluginService_GetInstanceSize = 4001,
491  _OrthancPluginService_GetInstanceData = 4002,
492  _OrthancPluginService_GetInstanceJson = 4003,
493  _OrthancPluginService_GetInstanceSimplifiedJson = 4004,
494  _OrthancPluginService_HasInstanceMetadata = 4005,
495  _OrthancPluginService_GetInstanceMetadata = 4006,
496  _OrthancPluginService_GetInstanceOrigin = 4007,
497 
498  /* Services for plugins implementing a database back-end */
499  _OrthancPluginService_RegisterDatabaseBackend = 5000,
500  _OrthancPluginService_DatabaseAnswer = 5001,
501  _OrthancPluginService_RegisterDatabaseBackendV2 = 5002,
502  _OrthancPluginService_StorageAreaCreate = 5003,
503  _OrthancPluginService_StorageAreaRead = 5004,
504  _OrthancPluginService_StorageAreaRemove = 5005,
505 
506  /* Primitives for handling images */
507  _OrthancPluginService_GetImagePixelFormat = 6000,
508  _OrthancPluginService_GetImageWidth = 6001,
509  _OrthancPluginService_GetImageHeight = 6002,
510  _OrthancPluginService_GetImagePitch = 6003,
511  _OrthancPluginService_GetImageBuffer = 6004,
512  _OrthancPluginService_UncompressImage = 6005,
513  _OrthancPluginService_FreeImage = 6006,
514  _OrthancPluginService_CompressImage = 6007,
515  _OrthancPluginService_ConvertPixelFormat = 6008,
516  _OrthancPluginService_GetFontsCount = 6009,
517  _OrthancPluginService_GetFontInfo = 6010,
518  _OrthancPluginService_DrawText = 6011,
519  _OrthancPluginService_CreateImage = 6012,
520  _OrthancPluginService_CreateImageAccessor = 6013,
521  _OrthancPluginService_DecodeDicomImage = 6014,
522 
523  /* Primitives for handling C-Find, C-Move and worklists */
524  _OrthancPluginService_WorklistAddAnswer = 7000,
525  _OrthancPluginService_WorklistMarkIncomplete = 7001,
526  _OrthancPluginService_WorklistIsMatch = 7002,
527  _OrthancPluginService_WorklistGetDicomQuery = 7003,
528  _OrthancPluginService_FindAddAnswer = 7004,
529  _OrthancPluginService_FindMarkIncomplete = 7005,
530  _OrthancPluginService_GetFindQuerySize = 7006,
531  _OrthancPluginService_GetFindQueryTag = 7007,
532  _OrthancPluginService_GetFindQueryTagName = 7008,
533  _OrthancPluginService_GetFindQueryValue = 7009,
534  _OrthancPluginService_CreateFindMatcher = 7010,
535  _OrthancPluginService_FreeFindMatcher = 7011,
536  _OrthancPluginService_FindMatcherIsMatch = 7012,
537 
538  /* Primitives for accessing Orthanc Peers (new in 1.4.2) */
539  _OrthancPluginService_GetPeers = 8000,
540  _OrthancPluginService_FreePeers = 8001,
541  _OrthancPluginService_GetPeersCount = 8003,
542  _OrthancPluginService_GetPeerName = 8004,
543  _OrthancPluginService_GetPeerUrl = 8005,
544  _OrthancPluginService_CallPeerApi = 8006,
545  _OrthancPluginService_GetPeerUserProperty = 8007,
546 
547  /* Primitives for handling jobs (new in 1.4.2) */
548  _OrthancPluginService_CreateJob = 9000,
549  _OrthancPluginService_FreeJob = 9001,
550  _OrthancPluginService_SubmitJob = 9002,
551  _OrthancPluginService_RegisterJobsUnserializer = 9003,
552 
553  _OrthancPluginService_INTERNAL = 0x7fffffff
554  } _OrthancPluginService;
555 
556 
557  typedef enum
558  {
559  _OrthancPluginProperty_Description = 1,
560  _OrthancPluginProperty_RootUri = 2,
561  _OrthancPluginProperty_OrthancExplorer = 3,
562 
563  _OrthancPluginProperty_INTERNAL = 0x7fffffff
564  } _OrthancPluginProperty;
565 
566 
567 
572  typedef enum
573  {
581 
589 
597 
605 
613 
623 
631 
639 
647 
655 
656  _OrthancPluginPixelFormat_INTERNAL = 0x7fffffff
658 
659 
660 
664  typedef enum
665  {
670  _OrthancPluginContentType_INTERNAL = 0x7fffffff
672 
673 
674 
678  typedef enum
679  {
686  _OrthancPluginResourceType_INTERNAL = 0x7fffffff
688 
689 
690 
695  typedef enum
696  {
714  _OrthancPluginChangeType_INTERNAL = 0x7fffffff
716 
717 
722  typedef enum
723  {
729  _OrthancPluginCompressionType_INTERNAL = 0x7fffffff
731 
732 
737  typedef enum
738  {
743  _OrthancPluginImageFormat_INTERNAL = 0x7fffffff
745 
746 
751  typedef enum
752  {
781  _OrthancPluginValueRepresentation_INTERNAL = 0x7fffffff
783 
784 
790  typedef enum
791  {
796  _OrthancPluginDicomToJsonFormat_INTERNAL = 0x7fffffff
798 
799 
805  typedef enum
806  {
807  OrthancPluginDicomToJsonFlags_None = 0,
815  _OrthancPluginDicomToJsonFlags_INTERNAL = 0x7fffffff
817 
818 
824  typedef enum
825  {
826  OrthancPluginCreateDicomFlags_None = 0,
830  _OrthancPluginCreateDicomFlags_INTERNAL = 0x7fffffff
832 
833 
839  typedef enum
840  {
846  _OrthancPluginIdentifierConstraint_INTERNAL = 0x7fffffff
848 
849 
854  typedef enum
855  {
862  _OrthancPluginConstraintType_INTERNAL = 0x7fffffff
864 
865 
869  typedef enum
870  {
877  _OrthancPluginInstanceOrigin_INTERNAL = 0x7fffffff
879 
880 
884  typedef enum
885  {
890 
891 
898  typedef enum
899  {
905 
906 
910  typedef enum
911  {
921 
922 
927  typedef enum
928  {
933 
934 
935 
943  typedef struct
944  {
948  void* data;
949 
953  uint32_t size;
955 
956 
957 
958 
963  typedef struct _OrthancPluginRestOutput_t OrthancPluginRestOutput;
964 
965 
966 
970  typedef struct _OrthancPluginDicomInstance_t OrthancPluginDicomInstance;
971 
972 
973 
978  typedef struct _OrthancPluginImage_t OrthancPluginImage;
979 
980 
981 
986  typedef struct _OrthancPluginStorageArea_t OrthancPluginStorageArea;
987 
988 
989 
994  typedef struct _OrthancPluginWorklistQuery_t OrthancPluginWorklistQuery;
995 
996 
997 
1002  typedef struct _OrthancPluginWorklistAnswers_t OrthancPluginWorklistAnswers;
1003 
1004 
1005 
1010  typedef struct _OrthancPluginFindQuery_t OrthancPluginFindQuery;
1011 
1012 
1013 
1018  typedef struct _OrthancPluginFindAnswers_t OrthancPluginFindAnswers;
1019 
1020 
1021 
1026  typedef struct _OrthancPluginFindAnswers_t OrthancPluginFindMatcher;
1027 
1028 
1029 
1034  typedef struct _OrthancPluginPeers_t OrthancPluginPeers;
1035 
1036 
1037 
1042  typedef struct _OrthancPluginJob_t OrthancPluginJob;
1043 
1044 
1045 
1051  typedef struct _OrthancPluginDicomWebNode_t OrthancPluginDicomWebNode;
1052 
1053 
1054 
1060  OrthancPluginRestOutput* output,
1061  const char* url,
1062  const OrthancPluginHttpRequest* request);
1063 
1064 
1065 
1071  OrthancPluginDicomInstance* instance,
1072  const char* instanceId);
1073 
1074 
1075 
1081  OrthancPluginChangeType changeType,
1082  OrthancPluginResourceType resourceType,
1083  const char* resourceId);
1084 
1085 
1086 
1092  OrthancPluginImage** target,
1093  const void* dicom,
1094  const uint32_t size,
1095  uint32_t frameIndex);
1096 
1097 
1098 
1103  typedef void (*OrthancPluginFree) (void* buffer);
1104 
1105 
1106 
1115  OrthancPluginDicomWebBinaryMode mode,
1116  const char* bulkDataUri);
1117 
1118 
1119 
1133  const char* uuid,
1134  const void* content,
1135  int64_t size,
1137 
1138 
1139 
1153  void** content,
1154  int64_t* size,
1155  const char* uuid,
1157 
1158 
1159 
1171  const char* uuid,
1173 
1174 
1175 
1191  const OrthancPluginWorklistQuery* query,
1192  const char* issuerAet,
1193  const char* calledAet);
1194 
1195 
1196 
1217  OrthancPluginHttpMethod method,
1218  const char* uri,
1219  const char* ip,
1220  uint32_t headersCount,
1221  const char* const* headersKeys,
1222  const char* const* headersValues);
1223 
1224 
1225 
1248  OrthancPluginHttpMethod method,
1249  const char* uri,
1250  const char* ip,
1251  uint32_t headersCount,
1252  const char* const* headersKeys,
1253  const char* const* headersValues,
1254  uint32_t getArgumentsCount,
1255  const char* const* getArgumentsKeys,
1256  const char* const* getArgumentsValues);
1257 
1258 
1259 
1275  OrthancPluginFindAnswers* answers,
1276  const OrthancPluginFindQuery* query,
1277  const char* issuerAet,
1278  const char* calledAet);
1279 
1280 
1281 
1317  typedef void* (*OrthancPluginMoveCallback) (
1318  OrthancPluginResourceType resourceType,
1319  const char* patientId,
1320  const char* accessionNumber,
1321  const char* studyInstanceUid,
1322  const char* seriesInstanceUid,
1323  const char* sopInstanceUid,
1324  const char* originatorAet,
1325  const char* sourceAet,
1326  const char* targetAet,
1327  uint16_t originatorId);
1328 
1329 
1342  typedef uint32_t (*OrthancPluginGetMoveSize) (void* moveDriver);
1343 
1344 
1357  typedef OrthancPluginErrorCode (*OrthancPluginApplyMove) (void* moveDriver);
1358 
1359 
1371  typedef void (*OrthancPluginFreeMove) (void* moveDriver);
1372 
1373 
1384  typedef void (*OrthancPluginJobFinalize) (void* job);
1385 
1386 
1397  typedef float (*OrthancPluginJobGetProgress) (void* job);
1398 
1399 
1412  typedef const char* (*OrthancPluginJobGetContent) (void* job);
1413 
1414 
1430  typedef const char* (*OrthancPluginJobGetSerialized) (void* job);
1431 
1432 
1446 
1447 
1471 
1472 
1487 
1488 
1502  typedef OrthancPluginJob* (*OrthancPluginJobsUnserializer) (const char* jobType,
1503  const char* serialized);
1504 
1505 
1506 
1521 
1522 
1523 
1551  uint32_t levelDepth,
1552  const uint16_t* levelTagGroup,
1553  const uint16_t* levelTagElement,
1554  const uint32_t* levelIndex,
1555  uint16_t tagGroup,
1556  uint16_t tagElement,
1558 
1559 
1560 
1564  typedef struct _OrthancPluginContext_t
1565  {
1566  void* pluginsManager;
1567  const char* orthancVersion;
1568  OrthancPluginFree Free;
1569  OrthancPluginErrorCode (*InvokeService) (struct _OrthancPluginContext_t* context,
1570  _OrthancPluginService service,
1571  const void* params);
1573 
1574 
1575 
1579  typedef struct
1580  {
1581  uint16_t group;
1582  uint16_t element;
1584  uint32_t minMultiplicity;
1585  uint32_t maxMultiplicity;
1587 
1588 
1589 
1598  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeString(
1599  OrthancPluginContext* context,
1600  char* str)
1601  {
1602  if (str != NULL)
1603  {
1604  context->Free(str);
1605  }
1606  }
1607 
1608 
1628  ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersionAdvanced(
1629  OrthancPluginContext* context,
1630  int expectedMajor,
1631  int expectedMinor,
1632  int expectedRevision)
1633  {
1634  int major, minor, revision;
1635 
1636  if (sizeof(int32_t) != sizeof(OrthancPluginErrorCode) ||
1637  sizeof(int32_t) != sizeof(OrthancPluginHttpMethod) ||
1638  sizeof(int32_t) != sizeof(_OrthancPluginService) ||
1639  sizeof(int32_t) != sizeof(_OrthancPluginProperty) ||
1640  sizeof(int32_t) != sizeof(OrthancPluginPixelFormat) ||
1641  sizeof(int32_t) != sizeof(OrthancPluginContentType) ||
1642  sizeof(int32_t) != sizeof(OrthancPluginResourceType) ||
1643  sizeof(int32_t) != sizeof(OrthancPluginChangeType) ||
1644  sizeof(int32_t) != sizeof(OrthancPluginCompressionType) ||
1645  sizeof(int32_t) != sizeof(OrthancPluginImageFormat) ||
1646  sizeof(int32_t) != sizeof(OrthancPluginValueRepresentation) ||
1647  sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFormat) ||
1648  sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFlags) ||
1649  sizeof(int32_t) != sizeof(OrthancPluginCreateDicomFlags) ||
1650  sizeof(int32_t) != sizeof(OrthancPluginIdentifierConstraint) ||
1651  sizeof(int32_t) != sizeof(OrthancPluginInstanceOrigin) ||
1652  sizeof(int32_t) != sizeof(OrthancPluginJobStepStatus) ||
1653  sizeof(int32_t) != sizeof(OrthancPluginConstraintType) ||
1654  sizeof(int32_t) != sizeof(OrthancPluginMetricsType) ||
1655  sizeof(int32_t) != sizeof(OrthancPluginDicomWebBinaryMode))
1656  {
1657  /* Mismatch in the size of the enumerations */
1658  return 0;
1659  }
1660 
1661  /* Assume compatibility with the mainline */
1662  if (!strcmp(context->orthancVersion, "mainline"))
1663  {
1664  return 1;
1665  }
1666 
1667  /* Parse the version of the Orthanc core */
1668  if (
1669 #ifdef _MSC_VER
1670  sscanf_s
1671 #else
1672  sscanf
1673 #endif
1674  (context->orthancVersion, "%4d.%4d.%4d", &major, &minor, &revision) != 3)
1675  {
1676  return 0;
1677  }
1678 
1679  /* Check the major number of the version */
1680 
1681  if (major > expectedMajor)
1682  {
1683  return 1;
1684  }
1685 
1686  if (major < expectedMajor)
1687  {
1688  return 0;
1689  }
1690 
1691  /* Check the minor number of the version */
1692 
1693  if (minor > expectedMinor)
1694  {
1695  return 1;
1696  }
1697 
1698  if (minor < expectedMinor)
1699  {
1700  return 0;
1701  }
1702 
1703  /* Check the revision number of the version */
1704 
1705  if (revision >= expectedRevision)
1706  {
1707  return 1;
1708  }
1709  else
1710  {
1711  return 0;
1712  }
1713  }
1714 
1715 
1732  ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersion(
1733  OrthancPluginContext* context)
1734  {
1736  context,
1737  ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
1738  ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
1739  ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
1740  }
1741 
1742 
1751  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeMemoryBuffer(
1752  OrthancPluginContext* context,
1753  OrthancPluginMemoryBuffer* buffer)
1754  {
1755  context->Free(buffer->data);
1756  }
1757 
1758 
1767  ORTHANC_PLUGIN_INLINE void OrthancPluginLogError(
1768  OrthancPluginContext* context,
1769  const char* message)
1770  {
1771  context->InvokeService(context, _OrthancPluginService_LogError, message);
1772  }
1773 
1774 
1783  ORTHANC_PLUGIN_INLINE void OrthancPluginLogWarning(
1784  OrthancPluginContext* context,
1785  const char* message)
1786  {
1787  context->InvokeService(context, _OrthancPluginService_LogWarning, message);
1788  }
1789 
1790 
1799  ORTHANC_PLUGIN_INLINE void OrthancPluginLogInfo(
1800  OrthancPluginContext* context,
1801  const char* message)
1802  {
1803  context->InvokeService(context, _OrthancPluginService_LogInfo, message);
1804  }
1805 
1806 
1807 
1808  typedef struct
1809  {
1810  const char* pathRegularExpression;
1811  OrthancPluginRestCallback callback;
1812  } _OrthancPluginRestCallback;
1813 
1835  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallback(
1836  OrthancPluginContext* context,
1837  const char* pathRegularExpression,
1838  OrthancPluginRestCallback callback)
1839  {
1840  _OrthancPluginRestCallback params;
1841  params.pathRegularExpression = pathRegularExpression;
1842  params.callback = callback;
1843  context->InvokeService(context, _OrthancPluginService_RegisterRestCallback, &params);
1844  }
1845 
1846 
1847 
1875  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallbackNoLock(
1876  OrthancPluginContext* context,
1877  const char* pathRegularExpression,
1878  OrthancPluginRestCallback callback)
1879  {
1880  _OrthancPluginRestCallback params;
1881  params.pathRegularExpression = pathRegularExpression;
1882  params.callback = callback;
1883  context->InvokeService(context, _OrthancPluginService_RegisterRestCallbackNoLock, &params);
1884  }
1885 
1886 
1887 
1888  typedef struct
1889  {
1891  } _OrthancPluginOnStoredInstanceCallback;
1892 
1904  OrthancPluginContext* context,
1906  {
1907  _OrthancPluginOnStoredInstanceCallback params;
1908  params.callback = callback;
1909 
1910  context->InvokeService(context, _OrthancPluginService_RegisterOnStoredInstanceCallback, &params);
1911  }
1912 
1913 
1914 
1915  typedef struct
1916  {
1917  OrthancPluginRestOutput* output;
1918  const void* answer;
1919  uint32_t answerSize;
1920  const char* mimeType;
1921  } _OrthancPluginAnswerBuffer;
1922 
1935  ORTHANC_PLUGIN_INLINE void OrthancPluginAnswerBuffer(
1936  OrthancPluginContext* context,
1937  OrthancPluginRestOutput* output,
1938  const void* answer,
1939  uint32_t answerSize,
1940  const char* mimeType)
1941  {
1942  _OrthancPluginAnswerBuffer params;
1943  params.output = output;
1944  params.answer = answer;
1945  params.answerSize = answerSize;
1946  params.mimeType = mimeType;
1947  context->InvokeService(context, _OrthancPluginService_AnswerBuffer, &params);
1948  }
1949 
1950 
1951  typedef struct
1952  {
1953  OrthancPluginRestOutput* output;
1954  OrthancPluginPixelFormat format;
1955  uint32_t width;
1956  uint32_t height;
1957  uint32_t pitch;
1958  const void* buffer;
1959  } _OrthancPluginCompressAndAnswerPngImage;
1960 
1961  typedef struct
1962  {
1963  OrthancPluginRestOutput* output;
1964  OrthancPluginImageFormat imageFormat;
1965  OrthancPluginPixelFormat pixelFormat;
1966  uint32_t width;
1967  uint32_t height;
1968  uint32_t pitch;
1969  const void* buffer;
1970  uint8_t quality;
1971  } _OrthancPluginCompressAndAnswerImage;
1972 
1973 
1992  ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerPngImage(
1993  OrthancPluginContext* context,
1994  OrthancPluginRestOutput* output,
1995  OrthancPluginPixelFormat format,
1996  uint32_t width,
1997  uint32_t height,
1998  uint32_t pitch,
1999  const void* buffer)
2000  {
2001  _OrthancPluginCompressAndAnswerImage params;
2002  params.output = output;
2003  params.imageFormat = OrthancPluginImageFormat_Png;
2004  params.pixelFormat = format;
2005  params.width = width;
2006  params.height = height;
2007  params.pitch = pitch;
2008  params.buffer = buffer;
2009  params.quality = 0; /* No quality for PNG */
2010  context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
2011  }
2012 
2013 
2014 
2015  typedef struct
2016  {
2017  OrthancPluginMemoryBuffer* target;
2018  const char* instanceId;
2019  } _OrthancPluginGetDicomForInstance;
2020 
2034  OrthancPluginContext* context,
2035  OrthancPluginMemoryBuffer* target,
2036  const char* instanceId)
2037  {
2038  _OrthancPluginGetDicomForInstance params;
2039  params.target = target;
2040  params.instanceId = instanceId;
2041  return context->InvokeService(context, _OrthancPluginService_GetDicomForInstance, &params);
2042  }
2043 
2044 
2045 
2046  typedef struct
2047  {
2048  OrthancPluginMemoryBuffer* target;
2049  const char* uri;
2050  } _OrthancPluginRestApiGet;
2051 
2067  OrthancPluginContext* context,
2068  OrthancPluginMemoryBuffer* target,
2069  const char* uri)
2070  {
2071  _OrthancPluginRestApiGet params;
2072  params.target = target;
2073  params.uri = uri;
2074  return context->InvokeService(context, _OrthancPluginService_RestApiGet, &params);
2075  }
2076 
2077 
2078 
2097  OrthancPluginContext* context,
2098  OrthancPluginMemoryBuffer* target,
2099  const char* uri)
2100  {
2101  _OrthancPluginRestApiGet params;
2102  params.target = target;
2103  params.uri = uri;
2104  return context->InvokeService(context, _OrthancPluginService_RestApiGetAfterPlugins, &params);
2105  }
2106 
2107 
2108 
2109  typedef struct
2110  {
2111  OrthancPluginMemoryBuffer* target;
2112  const char* uri;
2113  const void* body;
2114  uint32_t bodySize;
2115  } _OrthancPluginRestApiPostPut;
2116 
2134  OrthancPluginContext* context,
2135  OrthancPluginMemoryBuffer* target,
2136  const char* uri,
2137  const void* body,
2138  uint32_t bodySize)
2139  {
2140  _OrthancPluginRestApiPostPut params;
2141  params.target = target;
2142  params.uri = uri;
2143  params.body = body;
2144  params.bodySize = bodySize;
2145  return context->InvokeService(context, _OrthancPluginService_RestApiPost, &params);
2146  }
2147 
2148 
2169  OrthancPluginContext* context,
2170  OrthancPluginMemoryBuffer* target,
2171  const char* uri,
2172  const void* body,
2173  uint32_t bodySize)
2174  {
2175  _OrthancPluginRestApiPostPut params;
2176  params.target = target;
2177  params.uri = uri;
2178  params.body = body;
2179  params.bodySize = bodySize;
2180  return context->InvokeService(context, _OrthancPluginService_RestApiPostAfterPlugins, &params);
2181  }
2182 
2183 
2184 
2198  OrthancPluginContext* context,
2199  const char* uri)
2200  {
2201  return context->InvokeService(context, _OrthancPluginService_RestApiDelete, uri);
2202  }
2203 
2204 
2221  OrthancPluginContext* context,
2222  const char* uri)
2223  {
2224  return context->InvokeService(context, _OrthancPluginService_RestApiDeleteAfterPlugins, uri);
2225  }
2226 
2227 
2228 
2246  OrthancPluginContext* context,
2247  OrthancPluginMemoryBuffer* target,
2248  const char* uri,
2249  const void* body,
2250  uint32_t bodySize)
2251  {
2252  _OrthancPluginRestApiPostPut params;
2253  params.target = target;
2254  params.uri = uri;
2255  params.body = body;
2256  params.bodySize = bodySize;
2257  return context->InvokeService(context, _OrthancPluginService_RestApiPut, &params);
2258  }
2259 
2260 
2261 
2282  OrthancPluginContext* context,
2283  OrthancPluginMemoryBuffer* target,
2284  const char* uri,
2285  const void* body,
2286  uint32_t bodySize)
2287  {
2288  _OrthancPluginRestApiPostPut params;
2289  params.target = target;
2290  params.uri = uri;
2291  params.body = body;
2292  params.bodySize = bodySize;
2293  return context->InvokeService(context, _OrthancPluginService_RestApiPutAfterPlugins, &params);
2294  }
2295 
2296 
2297 
2298  typedef struct
2299  {
2300  OrthancPluginRestOutput* output;
2301  const char* argument;
2302  } _OrthancPluginOutputPlusArgument;
2303 
2315  ORTHANC_PLUGIN_INLINE void OrthancPluginRedirect(
2316  OrthancPluginContext* context,
2317  OrthancPluginRestOutput* output,
2318  const char* redirection)
2319  {
2320  _OrthancPluginOutputPlusArgument params;
2321  params.output = output;
2322  params.argument = redirection;
2323  context->InvokeService(context, _OrthancPluginService_Redirect, &params);
2324  }
2325 
2326 
2327 
2328  typedef struct
2329  {
2330  char** result;
2331  const char* argument;
2332  } _OrthancPluginRetrieveDynamicString;
2333 
2347  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupPatient(
2348  OrthancPluginContext* context,
2349  const char* patientID)
2350  {
2351  char* result;
2352 
2353  _OrthancPluginRetrieveDynamicString params;
2354  params.result = &result;
2355  params.argument = patientID;
2356 
2357  if (context->InvokeService(context, _OrthancPluginService_LookupPatient, &params) != OrthancPluginErrorCode_Success)
2358  {
2359  /* Error */
2360  return NULL;
2361  }
2362  else
2363  {
2364  return result;
2365  }
2366  }
2367 
2368 
2382  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudy(
2383  OrthancPluginContext* context,
2384  const char* studyUID)
2385  {
2386  char* result;
2387 
2388  _OrthancPluginRetrieveDynamicString params;
2389  params.result = &result;
2390  params.argument = studyUID;
2391 
2392  if (context->InvokeService(context, _OrthancPluginService_LookupStudy, &params) != OrthancPluginErrorCode_Success)
2393  {
2394  /* Error */
2395  return NULL;
2396  }
2397  else
2398  {
2399  return result;
2400  }
2401  }
2402 
2403 
2417  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudyWithAccessionNumber(
2418  OrthancPluginContext* context,
2419  const char* accessionNumber)
2420  {
2421  char* result;
2422 
2423  _OrthancPluginRetrieveDynamicString params;
2424  params.result = &result;
2425  params.argument = accessionNumber;
2426 
2427  if (context->InvokeService(context, _OrthancPluginService_LookupStudyWithAccessionNumber, &params) != OrthancPluginErrorCode_Success)
2428  {
2429  /* Error */
2430  return NULL;
2431  }
2432  else
2433  {
2434  return result;
2435  }
2436  }
2437 
2438 
2452  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupSeries(
2453  OrthancPluginContext* context,
2454  const char* seriesUID)
2455  {
2456  char* result;
2457 
2458  _OrthancPluginRetrieveDynamicString params;
2459  params.result = &result;
2460  params.argument = seriesUID;
2461 
2462  if (context->InvokeService(context, _OrthancPluginService_LookupSeries, &params) != OrthancPluginErrorCode_Success)
2463  {
2464  /* Error */
2465  return NULL;
2466  }
2467  else
2468  {
2469  return result;
2470  }
2471  }
2472 
2473 
2487  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupInstance(
2488  OrthancPluginContext* context,
2489  const char* sopInstanceUID)
2490  {
2491  char* result;
2492 
2493  _OrthancPluginRetrieveDynamicString params;
2494  params.result = &result;
2495  params.argument = sopInstanceUID;
2496 
2497  if (context->InvokeService(context, _OrthancPluginService_LookupInstance, &params) != OrthancPluginErrorCode_Success)
2498  {
2499  /* Error */
2500  return NULL;
2501  }
2502  else
2503  {
2504  return result;
2505  }
2506  }
2507 
2508 
2509 
2510  typedef struct
2511  {
2512  OrthancPluginRestOutput* output;
2513  uint16_t status;
2514  } _OrthancPluginSendHttpStatusCode;
2515 
2532  ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatusCode(
2533  OrthancPluginContext* context,
2534  OrthancPluginRestOutput* output,
2535  uint16_t status)
2536  {
2537  _OrthancPluginSendHttpStatusCode params;
2538  params.output = output;
2539  params.status = status;
2540  context->InvokeService(context, _OrthancPluginService_SendHttpStatusCode, &params);
2541  }
2542 
2543 
2555  ORTHANC_PLUGIN_INLINE void OrthancPluginSendUnauthorized(
2556  OrthancPluginContext* context,
2557  OrthancPluginRestOutput* output,
2558  const char* realm)
2559  {
2560  _OrthancPluginOutputPlusArgument params;
2561  params.output = output;
2562  params.argument = realm;
2563  context->InvokeService(context, _OrthancPluginService_SendUnauthorized, &params);
2564  }
2565 
2566 
2578  ORTHANC_PLUGIN_INLINE void OrthancPluginSendMethodNotAllowed(
2579  OrthancPluginContext* context,
2580  OrthancPluginRestOutput* output,
2581  const char* allowedMethods)
2582  {
2583  _OrthancPluginOutputPlusArgument params;
2584  params.output = output;
2585  params.argument = allowedMethods;
2586  context->InvokeService(context, _OrthancPluginService_SendMethodNotAllowed, &params);
2587  }
2588 
2589 
2590  typedef struct
2591  {
2592  OrthancPluginRestOutput* output;
2593  const char* key;
2594  const char* value;
2595  } _OrthancPluginSetHttpHeader;
2596 
2608  ORTHANC_PLUGIN_INLINE void OrthancPluginSetCookie(
2609  OrthancPluginContext* context,
2610  OrthancPluginRestOutput* output,
2611  const char* cookie,
2612  const char* value)
2613  {
2614  _OrthancPluginSetHttpHeader params;
2615  params.output = output;
2616  params.key = cookie;
2617  params.value = value;
2618  context->InvokeService(context, _OrthancPluginService_SetCookie, &params);
2619  }
2620 
2621 
2633  ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpHeader(
2634  OrthancPluginContext* context,
2635  OrthancPluginRestOutput* output,
2636  const char* key,
2637  const char* value)
2638  {
2639  _OrthancPluginSetHttpHeader params;
2640  params.output = output;
2641  params.key = key;
2642  params.value = value;
2643  context->InvokeService(context, _OrthancPluginService_SetHttpHeader, &params);
2644  }
2645 
2646 
2647  typedef struct
2648  {
2649  char** resultStringToFree;
2650  const char** resultString;
2651  int64_t* resultInt64;
2652  const char* key;
2653  OrthancPluginDicomInstance* instance;
2654  OrthancPluginInstanceOrigin* resultOrigin; /* New in Orthanc 0.9.5 SDK */
2655  } _OrthancPluginAccessDicomInstance;
2656 
2657 
2669  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceRemoteAet(
2670  OrthancPluginContext* context,
2671  OrthancPluginDicomInstance* instance)
2672  {
2673  const char* result;
2674 
2675  _OrthancPluginAccessDicomInstance params;
2676  memset(&params, 0, sizeof(params));
2677  params.resultString = &result;
2678  params.instance = instance;
2679 
2680  if (context->InvokeService(context, _OrthancPluginService_GetInstanceRemoteAet, &params) != OrthancPluginErrorCode_Success)
2681  {
2682  /* Error */
2683  return NULL;
2684  }
2685  else
2686  {
2687  return result;
2688  }
2689  }
2690 
2691 
2702  ORTHANC_PLUGIN_INLINE int64_t OrthancPluginGetInstanceSize(
2703  OrthancPluginContext* context,
2704  OrthancPluginDicomInstance* instance)
2705  {
2706  int64_t size;
2707 
2708  _OrthancPluginAccessDicomInstance params;
2709  memset(&params, 0, sizeof(params));
2710  params.resultInt64 = &size;
2711  params.instance = instance;
2712 
2713  if (context->InvokeService(context, _OrthancPluginService_GetInstanceSize, &params) != OrthancPluginErrorCode_Success)
2714  {
2715  /* Error */
2716  return -1;
2717  }
2718  else
2719  {
2720  return size;
2721  }
2722  }
2723 
2724 
2735  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceData(
2736  OrthancPluginContext* context,
2737  OrthancPluginDicomInstance* instance)
2738  {
2739  const char* result;
2740 
2741  _OrthancPluginAccessDicomInstance params;
2742  memset(&params, 0, sizeof(params));
2743  params.resultString = &result;
2744  params.instance = instance;
2745 
2746  if (context->InvokeService(context, _OrthancPluginService_GetInstanceData, &params) != OrthancPluginErrorCode_Success)
2747  {
2748  /* Error */
2749  return NULL;
2750  }
2751  else
2752  {
2753  return result;
2754  }
2755  }
2756 
2757 
2771  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceJson(
2772  OrthancPluginContext* context,
2773  OrthancPluginDicomInstance* instance)
2774  {
2775  char* result;
2776 
2777  _OrthancPluginAccessDicomInstance params;
2778  memset(&params, 0, sizeof(params));
2779  params.resultStringToFree = &result;
2780  params.instance = instance;
2781 
2782  if (context->InvokeService(context, _OrthancPluginService_GetInstanceJson, &params) != OrthancPluginErrorCode_Success)
2783  {
2784  /* Error */
2785  return NULL;
2786  }
2787  else
2788  {
2789  return result;
2790  }
2791  }
2792 
2793 
2809  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceSimplifiedJson(
2810  OrthancPluginContext* context,
2811  OrthancPluginDicomInstance* instance)
2812  {
2813  char* result;
2814 
2815  _OrthancPluginAccessDicomInstance params;
2816  memset(&params, 0, sizeof(params));
2817  params.resultStringToFree = &result;
2818  params.instance = instance;
2819 
2820  if (context->InvokeService(context, _OrthancPluginService_GetInstanceSimplifiedJson, &params) != OrthancPluginErrorCode_Success)
2821  {
2822  /* Error */
2823  return NULL;
2824  }
2825  else
2826  {
2827  return result;
2828  }
2829  }
2830 
2831 
2848  ORTHANC_PLUGIN_INLINE int OrthancPluginHasInstanceMetadata(
2849  OrthancPluginContext* context,
2850  OrthancPluginDicomInstance* instance,
2851  const char* metadata)
2852  {
2853  int64_t result;
2854 
2855  _OrthancPluginAccessDicomInstance params;
2856  memset(&params, 0, sizeof(params));
2857  params.resultInt64 = &result;
2858  params.instance = instance;
2859  params.key = metadata;
2860 
2861  if (context->InvokeService(context, _OrthancPluginService_HasInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
2862  {
2863  /* Error */
2864  return -1;
2865  }
2866  else
2867  {
2868  return (result != 0);
2869  }
2870  }
2871 
2872 
2886  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceMetadata(
2887  OrthancPluginContext* context,
2888  OrthancPluginDicomInstance* instance,
2889  const char* metadata)
2890  {
2891  const char* result;
2892 
2893  _OrthancPluginAccessDicomInstance params;
2894  memset(&params, 0, sizeof(params));
2895  params.resultString = &result;
2896  params.instance = instance;
2897  params.key = metadata;
2898 
2899  if (context->InvokeService(context, _OrthancPluginService_GetInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
2900  {
2901  /* Error */
2902  return NULL;
2903  }
2904  else
2905  {
2906  return result;
2907  }
2908  }
2909 
2910 
2911 
2912  typedef struct
2913  {
2917  OrthancPluginFree free;
2918  } _OrthancPluginRegisterStorageArea;
2919 
2934  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterStorageArea(
2935  OrthancPluginContext* context,
2939  {
2940  _OrthancPluginRegisterStorageArea params;
2941  params.create = create;
2942  params.read = read;
2943  params.remove = remove;
2944 
2945 #ifdef __cplusplus
2946  params.free = ::free;
2947 #else
2948  params.free = free;
2949 #endif
2950 
2951  context->InvokeService(context, _OrthancPluginService_RegisterStorageArea, &params);
2952  }
2953 
2954 
2955 
2966  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancPath(OrthancPluginContext* context)
2967  {
2968  char* result;
2969 
2970  _OrthancPluginRetrieveDynamicString params;
2971  params.result = &result;
2972  params.argument = NULL;
2973 
2974  if (context->InvokeService(context, _OrthancPluginService_GetOrthancPath, &params) != OrthancPluginErrorCode_Success)
2975  {
2976  /* Error */
2977  return NULL;
2978  }
2979  else
2980  {
2981  return result;
2982  }
2983  }
2984 
2985 
2996  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancDirectory(OrthancPluginContext* context)
2997  {
2998  char* result;
2999 
3000  _OrthancPluginRetrieveDynamicString params;
3001  params.result = &result;
3002  params.argument = NULL;
3003 
3004  if (context->InvokeService(context, _OrthancPluginService_GetOrthancDirectory, &params) != OrthancPluginErrorCode_Success)
3005  {
3006  /* Error */
3007  return NULL;
3008  }
3009  else
3010  {
3011  return result;
3012  }
3013  }
3014 
3015 
3031  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfigurationPath(OrthancPluginContext* context)
3032  {
3033  char* result;
3034 
3035  _OrthancPluginRetrieveDynamicString params;
3036  params.result = &result;
3037  params.argument = NULL;
3038 
3039  if (context->InvokeService(context, _OrthancPluginService_GetConfigurationPath, &params) != OrthancPluginErrorCode_Success)
3040  {
3041  /* Error */
3042  return NULL;
3043  }
3044  else
3045  {
3046  return result;
3047  }
3048  }
3049 
3050 
3051 
3052  typedef struct
3053  {
3055  } _OrthancPluginOnChangeCallback;
3056 
3073  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnChangeCallback(
3074  OrthancPluginContext* context,
3076  {
3077  _OrthancPluginOnChangeCallback params;
3078  params.callback = callback;
3079 
3080  context->InvokeService(context, _OrthancPluginService_RegisterOnChangeCallback, &params);
3081  }
3082 
3083 
3084 
3085  typedef struct
3086  {
3087  const char* plugin;
3088  _OrthancPluginProperty property;
3089  const char* value;
3090  } _OrthancPluginSetPluginProperty;
3091 
3092 
3104  ORTHANC_PLUGIN_INLINE void OrthancPluginSetRootUri(
3105  OrthancPluginContext* context,
3106  const char* uri)
3107  {
3108  _OrthancPluginSetPluginProperty params;
3109  params.plugin = OrthancPluginGetName();
3110  params.property = _OrthancPluginProperty_RootUri;
3111  params.value = uri;
3112 
3113  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
3114  }
3115 
3116 
3126  ORTHANC_PLUGIN_INLINE void OrthancPluginSetDescription(
3127  OrthancPluginContext* context,
3128  const char* description)
3129  {
3130  _OrthancPluginSetPluginProperty params;
3131  params.plugin = OrthancPluginGetName();
3132  params.property = _OrthancPluginProperty_Description;
3133  params.value = description;
3134 
3135  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
3136  }
3137 
3138 
3148  ORTHANC_PLUGIN_INLINE void OrthancPluginExtendOrthancExplorer(
3149  OrthancPluginContext* context,
3150  const char* javascript)
3151  {
3152  _OrthancPluginSetPluginProperty params;
3153  params.plugin = OrthancPluginGetName();
3154  params.property = _OrthancPluginProperty_OrthancExplorer;
3155  params.value = javascript;
3156 
3157  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
3158  }
3159 
3160 
3161  typedef struct
3162  {
3163  char** result;
3164  int32_t property;
3165  const char* value;
3166  } _OrthancPluginGlobalProperty;
3167 
3168 
3182  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetGlobalProperty(
3183  OrthancPluginContext* context,
3184  int32_t property,
3185  const char* defaultValue)
3186  {
3187  char* result;
3188 
3189  _OrthancPluginGlobalProperty params;
3190  params.result = &result;
3191  params.property = property;
3192  params.value = defaultValue;
3193 
3194  if (context->InvokeService(context, _OrthancPluginService_GetGlobalProperty, &params) != OrthancPluginErrorCode_Success)
3195  {
3196  /* Error */
3197  return NULL;
3198  }
3199  else
3200  {
3201  return result;
3202  }
3203  }
3204 
3205 
3222  OrthancPluginContext* context,
3223  int32_t property,
3224  const char* value)
3225  {
3226  _OrthancPluginGlobalProperty params;
3227  params.result = NULL;
3228  params.property = property;
3229  params.value = value;
3230 
3231  return context->InvokeService(context, _OrthancPluginService_SetGlobalProperty, &params);
3232  }
3233 
3234 
3235 
3236  typedef struct
3237  {
3238  int32_t *resultInt32;
3239  uint32_t *resultUint32;
3240  int64_t *resultInt64;
3241  uint64_t *resultUint64;
3242  } _OrthancPluginReturnSingleValue;
3243 
3252  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetCommandLineArgumentsCount(
3253  OrthancPluginContext* context)
3254  {
3255  uint32_t count = 0;
3256 
3257  _OrthancPluginReturnSingleValue params;
3258  memset(&params, 0, sizeof(params));
3259  params.resultUint32 = &count;
3260 
3261  if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgumentsCount, &params) != OrthancPluginErrorCode_Success)
3262  {
3263  /* Error */
3264  return 0;
3265  }
3266  else
3267  {
3268  return count;
3269  }
3270  }
3271 
3272 
3273 
3286  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetCommandLineArgument(
3287  OrthancPluginContext* context,
3288  uint32_t argument)
3289  {
3290  char* result;
3291 
3292  _OrthancPluginGlobalProperty params;
3293  params.result = &result;
3294  params.property = (int32_t) argument;
3295  params.value = NULL;
3296 
3297  if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgument, &params) != OrthancPluginErrorCode_Success)
3298  {
3299  /* Error */
3300  return NULL;
3301  }
3302  else
3303  {
3304  return result;
3305  }
3306  }
3307 
3308 
3318  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetExpectedDatabaseVersion(
3319  OrthancPluginContext* context)
3320  {
3321  uint32_t count = 0;
3322 
3323  _OrthancPluginReturnSingleValue params;
3324  memset(&params, 0, sizeof(params));
3325  params.resultUint32 = &count;
3326 
3327  if (context->InvokeService(context, _OrthancPluginService_GetExpectedDatabaseVersion, &params) != OrthancPluginErrorCode_Success)
3328  {
3329  /* Error */
3330  return 0;
3331  }
3332  else
3333  {
3334  return count;
3335  }
3336  }
3337 
3338 
3339 
3351  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfiguration(OrthancPluginContext* context)
3352  {
3353  char* result;
3354 
3355  _OrthancPluginRetrieveDynamicString params;
3356  params.result = &result;
3357  params.argument = NULL;
3358 
3359  if (context->InvokeService(context, _OrthancPluginService_GetConfiguration, &params) != OrthancPluginErrorCode_Success)
3360  {
3361  /* Error */
3362  return NULL;
3363  }
3364  else
3365  {
3366  return result;
3367  }
3368  }
3369 
3370 
3371 
3372  typedef struct
3373  {
3374  OrthancPluginRestOutput* output;
3375  const char* subType;
3376  const char* contentType;
3377  } _OrthancPluginStartMultipartAnswer;
3378 
3393  OrthancPluginContext* context,
3394  OrthancPluginRestOutput* output,
3395  const char* subType,
3396  const char* contentType)
3397  {
3398  _OrthancPluginStartMultipartAnswer params;
3399  params.output = output;
3400  params.subType = subType;
3401  params.contentType = contentType;
3402  return context->InvokeService(context, _OrthancPluginService_StartMultipartAnswer, &params);
3403  }
3404 
3405 
3422  OrthancPluginContext* context,
3423  OrthancPluginRestOutput* output,
3424  const char* answer,
3425  uint32_t answerSize)
3426  {
3427  _OrthancPluginAnswerBuffer params;
3428  params.output = output;
3429  params.answer = answer;
3430  params.answerSize = answerSize;
3431  params.mimeType = NULL;
3432  return context->InvokeService(context, _OrthancPluginService_SendMultipartItem, &params);
3433  }
3434 
3435 
3436 
3437  typedef struct
3438  {
3439  OrthancPluginMemoryBuffer* target;
3440  const void* source;
3441  uint32_t size;
3442  OrthancPluginCompressionType compression;
3443  uint8_t uncompress;
3444  } _OrthancPluginBufferCompression;
3445 
3446 
3464  OrthancPluginContext* context,
3465  OrthancPluginMemoryBuffer* target,
3466  const void* source,
3467  uint32_t size,
3468  OrthancPluginCompressionType compression,
3469  uint8_t uncompress)
3470  {
3471  _OrthancPluginBufferCompression params;
3472  params.target = target;
3473  params.source = source;
3474  params.size = size;
3475  params.compression = compression;
3476  params.uncompress = uncompress;
3477 
3478  return context->InvokeService(context, _OrthancPluginService_BufferCompression, &params);
3479  }
3480 
3481 
3482 
3483  typedef struct
3484  {
3485  OrthancPluginMemoryBuffer* target;
3486  const char* path;
3487  } _OrthancPluginReadFile;
3488 
3501  OrthancPluginContext* context,
3502  OrthancPluginMemoryBuffer* target,
3503  const char* path)
3504  {
3505  _OrthancPluginReadFile params;
3506  params.target = target;
3507  params.path = path;
3508  return context->InvokeService(context, _OrthancPluginService_ReadFile, &params);
3509  }
3510 
3511 
3512 
3513  typedef struct
3514  {
3515  const char* path;
3516  const void* data;
3517  uint32_t size;
3518  } _OrthancPluginWriteFile;
3519 
3532  OrthancPluginContext* context,
3533  const char* path,
3534  const void* data,
3535  uint32_t size)
3536  {
3537  _OrthancPluginWriteFile params;
3538  params.path = path;
3539  params.data = data;
3540  params.size = size;
3541  return context->InvokeService(context, _OrthancPluginService_WriteFile, &params);
3542  }
3543 
3544 
3545 
3546  typedef struct
3547  {
3548  const char** target;
3549  OrthancPluginErrorCode error;
3550  } _OrthancPluginGetErrorDescription;
3551 
3562  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetErrorDescription(
3563  OrthancPluginContext* context,
3564  OrthancPluginErrorCode error)
3565  {
3566  const char* result = NULL;
3567 
3568  _OrthancPluginGetErrorDescription params;
3569  params.target = &result;
3570  params.error = error;
3571 
3572  if (context->InvokeService(context, _OrthancPluginService_GetErrorDescription, &params) != OrthancPluginErrorCode_Success ||
3573  result == NULL)
3574  {
3575  return "Unknown error code";
3576  }
3577  else
3578  {
3579  return result;
3580  }
3581  }
3582 
3583 
3584 
3585  typedef struct
3586  {
3587  OrthancPluginRestOutput* output;
3588  uint16_t status;
3589  const char* body;
3590  uint32_t bodySize;
3591  } _OrthancPluginSendHttpStatus;
3592 
3615  ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatus(
3616  OrthancPluginContext* context,
3617  OrthancPluginRestOutput* output,
3618  uint16_t status,
3619  const char* body,
3620  uint32_t bodySize)
3621  {
3622  _OrthancPluginSendHttpStatus params;
3623  params.output = output;
3624  params.status = status;
3625  params.body = body;
3626  params.bodySize = bodySize;
3627  context->InvokeService(context, _OrthancPluginService_SendHttpStatus, &params);
3628  }
3629 
3630 
3631 
3632  typedef struct
3633  {
3634  const OrthancPluginImage* image;
3635  uint32_t* resultUint32;
3636  OrthancPluginPixelFormat* resultPixelFormat;
3637  void** resultBuffer;
3638  } _OrthancPluginGetImageInfo;
3639 
3640 
3652  OrthancPluginContext* context,
3653  const OrthancPluginImage* image)
3654  {
3655  OrthancPluginPixelFormat target;
3656 
3657  _OrthancPluginGetImageInfo params;
3658  memset(&params, 0, sizeof(params));
3659  params.image = image;
3660  params.resultPixelFormat = &target;
3661 
3662  if (context->InvokeService(context, _OrthancPluginService_GetImagePixelFormat, &params) != OrthancPluginErrorCode_Success)
3663  {
3665  }
3666  else
3667  {
3668  return (OrthancPluginPixelFormat) target;
3669  }
3670  }
3671 
3672 
3673 
3684  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageWidth(
3685  OrthancPluginContext* context,
3686  const OrthancPluginImage* image)
3687  {
3688  uint32_t width;
3689 
3690  _OrthancPluginGetImageInfo params;
3691  memset(&params, 0, sizeof(params));
3692  params.image = image;
3693  params.resultUint32 = &width;
3694 
3695  if (context->InvokeService(context, _OrthancPluginService_GetImageWidth, &params) != OrthancPluginErrorCode_Success)
3696  {
3697  return 0;
3698  }
3699  else
3700  {
3701  return width;
3702  }
3703  }
3704 
3705 
3706 
3717  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageHeight(
3718  OrthancPluginContext* context,
3719  const OrthancPluginImage* image)
3720  {
3721  uint32_t height;
3722 
3723  _OrthancPluginGetImageInfo params;
3724  memset(&params, 0, sizeof(params));
3725  params.image = image;
3726  params.resultUint32 = &height;
3727 
3728  if (context->InvokeService(context, _OrthancPluginService_GetImageHeight, &params) != OrthancPluginErrorCode_Success)
3729  {
3730  return 0;
3731  }
3732  else
3733  {
3734  return height;
3735  }
3736  }
3737 
3738 
3739 
3752  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImagePitch(
3753  OrthancPluginContext* context,
3754  const OrthancPluginImage* image)
3755  {
3756  uint32_t pitch;
3757 
3758  _OrthancPluginGetImageInfo params;
3759  memset(&params, 0, sizeof(params));
3760  params.image = image;
3761  params.resultUint32 = &pitch;
3762 
3763  if (context->InvokeService(context, _OrthancPluginService_GetImagePitch, &params) != OrthancPluginErrorCode_Success)
3764  {
3765  return 0;
3766  }
3767  else
3768  {
3769  return pitch;
3770  }
3771  }
3772 
3773 
3774 
3786  ORTHANC_PLUGIN_INLINE void* OrthancPluginGetImageBuffer(
3787  OrthancPluginContext* context,
3788  const OrthancPluginImage* image)
3789  {
3790  void* target = NULL;
3791 
3792  _OrthancPluginGetImageInfo params;
3793  memset(&params, 0, sizeof(params));
3794  params.resultBuffer = &target;
3795  params.image = image;
3796 
3797  if (context->InvokeService(context, _OrthancPluginService_GetImageBuffer, &params) != OrthancPluginErrorCode_Success)
3798  {
3799  return NULL;
3800  }
3801  else
3802  {
3803  return target;
3804  }
3805  }
3806 
3807 
3808  typedef struct
3809  {
3810  OrthancPluginImage** target;
3811  const void* data;
3812  uint32_t size;
3813  OrthancPluginImageFormat format;
3814  } _OrthancPluginUncompressImage;
3815 
3816 
3830  OrthancPluginContext* context,
3831  const void* data,
3832  uint32_t size,
3833  OrthancPluginImageFormat format)
3834  {
3835  OrthancPluginImage* target = NULL;
3836 
3837  _OrthancPluginUncompressImage params;
3838  memset(&params, 0, sizeof(params));
3839  params.target = &target;
3840  params.data = data;
3841  params.size = size;
3842  params.format = format;
3843 
3844  if (context->InvokeService(context, _OrthancPluginService_UncompressImage, &params) != OrthancPluginErrorCode_Success)
3845  {
3846  return NULL;
3847  }
3848  else
3849  {
3850  return target;
3851  }
3852  }
3853 
3854 
3855 
3856 
3857  typedef struct
3858  {
3859  OrthancPluginImage* image;
3860  } _OrthancPluginFreeImage;
3861 
3871  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeImage(
3872  OrthancPluginContext* context,
3873  OrthancPluginImage* image)
3874  {
3875  _OrthancPluginFreeImage params;
3876  params.image = image;
3877 
3878  context->InvokeService(context, _OrthancPluginService_FreeImage, &params);
3879  }
3880 
3881 
3882 
3883 
3884  typedef struct
3885  {
3886  OrthancPluginMemoryBuffer* target;
3887  OrthancPluginImageFormat imageFormat;
3888  OrthancPluginPixelFormat pixelFormat;
3889  uint32_t width;
3890  uint32_t height;
3891  uint32_t pitch;
3892  const void* buffer;
3893  uint8_t quality;
3894  } _OrthancPluginCompressImage;
3895 
3896 
3917  OrthancPluginContext* context,
3918  OrthancPluginMemoryBuffer* target,
3919  OrthancPluginPixelFormat format,
3920  uint32_t width,
3921  uint32_t height,
3922  uint32_t pitch,
3923  const void* buffer)
3924  {
3925  _OrthancPluginCompressImage params;
3926  memset(&params, 0, sizeof(params));
3927  params.target = target;
3928  params.imageFormat = OrthancPluginImageFormat_Png;
3929  params.pixelFormat = format;
3930  params.width = width;
3931  params.height = height;
3932  params.pitch = pitch;
3933  params.buffer = buffer;
3934  params.quality = 0; /* Unused for PNG */
3935 
3936  return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
3937  }
3938 
3939 
3962  OrthancPluginContext* context,
3963  OrthancPluginMemoryBuffer* target,
3964  OrthancPluginPixelFormat format,
3965  uint32_t width,
3966  uint32_t height,
3967  uint32_t pitch,
3968  const void* buffer,
3969  uint8_t quality)
3970  {
3971  _OrthancPluginCompressImage params;
3972  memset(&params, 0, sizeof(params));
3973  params.target = target;
3974  params.imageFormat = OrthancPluginImageFormat_Jpeg;
3975  params.pixelFormat = format;
3976  params.width = width;
3977  params.height = height;
3978  params.pitch = pitch;
3979  params.buffer = buffer;
3980  params.quality = quality;
3981 
3982  return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
3983  }
3984 
3985 
3986 
4008  ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerJpegImage(
4009  OrthancPluginContext* context,
4010  OrthancPluginRestOutput* output,
4011  OrthancPluginPixelFormat format,
4012  uint32_t width,
4013  uint32_t height,
4014  uint32_t pitch,
4015  const void* buffer,
4016  uint8_t quality)
4017  {
4018  _OrthancPluginCompressAndAnswerImage params;
4019  params.output = output;
4020  params.imageFormat = OrthancPluginImageFormat_Jpeg;
4021  params.pixelFormat = format;
4022  params.width = width;
4023  params.height = height;
4024  params.pitch = pitch;
4025  params.buffer = buffer;
4026  params.quality = quality;
4027  context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
4028  }
4029 
4030 
4031 
4032 
4033  typedef struct
4034  {
4035  OrthancPluginMemoryBuffer* target;
4036  OrthancPluginHttpMethod method;
4037  const char* url;
4038  const char* username;
4039  const char* password;
4040  const void* body;
4041  uint32_t bodySize;
4042  } _OrthancPluginCallHttpClient;
4043 
4044 
4062  OrthancPluginContext* context,
4063  OrthancPluginMemoryBuffer* target,
4064  const char* url,
4065  const char* username,
4066  const char* password)
4067  {
4068  _OrthancPluginCallHttpClient params;
4069  memset(&params, 0, sizeof(params));
4070 
4071  params.target = target;
4072  params.method = OrthancPluginHttpMethod_Get;
4073  params.url = url;
4074  params.username = username;
4075  params.password = password;
4076 
4077  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
4078  }
4079 
4080 
4100  OrthancPluginContext* context,
4101  OrthancPluginMemoryBuffer* target,
4102  const char* url,
4103  const void* body,
4104  uint32_t bodySize,
4105  const char* username,
4106  const char* password)
4107  {
4108  _OrthancPluginCallHttpClient params;
4109  memset(&params, 0, sizeof(params));
4110 
4111  params.target = target;
4112  params.method = OrthancPluginHttpMethod_Post;
4113  params.url = url;
4114  params.body = body;
4115  params.bodySize = bodySize;
4116  params.username = username;
4117  params.password = password;
4118 
4119  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
4120  }
4121 
4122 
4142  OrthancPluginContext* context,
4143  OrthancPluginMemoryBuffer* target,
4144  const char* url,
4145  const void* body,
4146  uint32_t bodySize,
4147  const char* username,
4148  const char* password)
4149  {
4150  _OrthancPluginCallHttpClient params;
4151  memset(&params, 0, sizeof(params));
4152 
4153  params.target = target;
4154  params.method = OrthancPluginHttpMethod_Put;
4155  params.url = url;
4156  params.body = body;
4157  params.bodySize = bodySize;
4158  params.username = username;
4159  params.password = password;
4160 
4161  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
4162  }
4163 
4164 
4180  OrthancPluginContext* context,
4181  const char* url,
4182  const char* username,
4183  const char* password)
4184  {
4185  _OrthancPluginCallHttpClient params;
4186  memset(&params, 0, sizeof(params));
4187 
4188  params.method = OrthancPluginHttpMethod_Delete;
4189  params.url = url;
4190  params.username = username;
4191  params.password = password;
4192 
4193  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
4194  }
4195 
4196 
4197 
4198  typedef struct
4199  {
4200  OrthancPluginImage** target;
4201  const OrthancPluginImage* source;
4202  OrthancPluginPixelFormat targetFormat;
4203  } _OrthancPluginConvertPixelFormat;
4204 
4205 
4218  OrthancPluginContext* context,
4219  const OrthancPluginImage* source,
4220  OrthancPluginPixelFormat targetFormat)
4221  {
4222  OrthancPluginImage* target = NULL;
4223 
4224  _OrthancPluginConvertPixelFormat params;
4225  params.target = &target;
4226  params.source = source;
4227  params.targetFormat = targetFormat;
4228 
4229  if (context->InvokeService(context, _OrthancPluginService_ConvertPixelFormat, &params) != OrthancPluginErrorCode_Success)
4230  {
4231  return NULL;
4232  }
4233  else
4234  {
4235  return target;
4236  }
4237  }
4238 
4239 
4240 
4252  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontsCount(
4253  OrthancPluginContext* context)
4254  {
4255  uint32_t count = 0;
4256 
4257  _OrthancPluginReturnSingleValue params;
4258  memset(&params, 0, sizeof(params));
4259  params.resultUint32 = &count;
4260 
4261  if (context->InvokeService(context, _OrthancPluginService_GetFontsCount, &params) != OrthancPluginErrorCode_Success)
4262  {
4263  /* Error */
4264  return 0;
4265  }
4266  else
4267  {
4268  return count;
4269  }
4270  }
4271 
4272 
4273 
4274 
4275  typedef struct
4276  {
4277  uint32_t fontIndex; /* in */
4278  const char** name; /* out */
4279  uint32_t* size; /* out */
4280  } _OrthancPluginGetFontInfo;
4281 
4292  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetFontName(
4293  OrthancPluginContext* context,
4294  uint32_t fontIndex)
4295  {
4296  const char* result = NULL;
4297 
4298  _OrthancPluginGetFontInfo params;
4299  memset(&params, 0, sizeof(params));
4300  params.name = &result;
4301  params.fontIndex = fontIndex;
4302 
4303  if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
4304  {
4305  return NULL;
4306  }
4307  else
4308  {
4309  return result;
4310  }
4311  }
4312 
4313 
4324  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontSize(
4325  OrthancPluginContext* context,
4326  uint32_t fontIndex)
4327  {
4328  uint32_t result;
4329 
4330  _OrthancPluginGetFontInfo params;
4331  memset(&params, 0, sizeof(params));
4332  params.size = &result;
4333  params.fontIndex = fontIndex;
4334 
4335  if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
4336  {
4337  return 0;
4338  }
4339  else
4340  {
4341  return result;
4342  }
4343  }
4344 
4345 
4346 
4347  typedef struct
4348  {
4349  OrthancPluginImage* image;
4350  uint32_t fontIndex;
4351  const char* utf8Text;
4352  int32_t x;
4353  int32_t y;
4354  uint8_t r;
4355  uint8_t g;
4356  uint8_t b;
4357  } _OrthancPluginDrawText;
4358 
4359 
4378  OrthancPluginContext* context,
4379  OrthancPluginImage* image,
4380  uint32_t fontIndex,
4381  const char* utf8Text,
4382  int32_t x,
4383  int32_t y,
4384  uint8_t r,
4385  uint8_t g,
4386  uint8_t b)
4387  {
4388  _OrthancPluginDrawText params;
4389  memset(&params, 0, sizeof(params));
4390  params.image = image;
4391  params.fontIndex = fontIndex;
4392  params.utf8Text = utf8Text;
4393  params.x = x;
4394  params.y = y;
4395  params.r = r;
4396  params.g = g;
4397  params.b = b;
4398 
4399  return context->InvokeService(context, _OrthancPluginService_DrawText, &params);
4400  }
4401 
4402 
4403 
4404  typedef struct
4405  {
4406  OrthancPluginStorageArea* storageArea;
4407  const char* uuid;
4408  const void* content;
4409  uint64_t size;
4411  } _OrthancPluginStorageAreaCreate;
4412 
4413 
4430  OrthancPluginContext* context,
4431  OrthancPluginStorageArea* storageArea,
4432  const char* uuid,
4433  const void* content,
4434  uint64_t size,
4436  {
4437  _OrthancPluginStorageAreaCreate params;
4438  params.storageArea = storageArea;
4439  params.uuid = uuid;
4440  params.content = content;
4441  params.size = size;
4442  params.type = type;
4443 
4444  return context->InvokeService(context, _OrthancPluginService_StorageAreaCreate, &params);
4445  }
4446 
4447 
4448  typedef struct
4449  {
4450  OrthancPluginMemoryBuffer* target;
4451  OrthancPluginStorageArea* storageArea;
4452  const char* uuid;
4454  } _OrthancPluginStorageAreaRead;
4455 
4456 
4472  OrthancPluginContext* context,
4473  OrthancPluginMemoryBuffer* target,
4474  OrthancPluginStorageArea* storageArea,
4475  const char* uuid,
4477  {
4478  _OrthancPluginStorageAreaRead params;
4479  params.target = target;
4480  params.storageArea = storageArea;
4481  params.uuid = uuid;
4482  params.type = type;
4483 
4484  return context->InvokeService(context, _OrthancPluginService_StorageAreaRead, &params);
4485  }
4486 
4487 
4488  typedef struct
4489  {
4490  OrthancPluginStorageArea* storageArea;
4491  const char* uuid;
4493  } _OrthancPluginStorageAreaRemove;
4494 
4509  OrthancPluginContext* context,
4510  OrthancPluginStorageArea* storageArea,
4511  const char* uuid,
4513  {
4514  _OrthancPluginStorageAreaRemove params;
4515  params.storageArea = storageArea;
4516  params.uuid = uuid;
4517  params.type = type;
4518 
4519  return context->InvokeService(context, _OrthancPluginService_StorageAreaRemove, &params);
4520  }
4521 
4522 
4523 
4524  typedef struct
4525  {
4526  OrthancPluginErrorCode* target;
4527  int32_t code;
4528  uint16_t httpStatus;
4529  const char* message;
4530  } _OrthancPluginRegisterErrorCode;
4531 
4548  OrthancPluginContext* context,
4549  int32_t code,
4550  uint16_t httpStatus,
4551  const char* message)
4552  {
4553  OrthancPluginErrorCode target;
4554 
4555  _OrthancPluginRegisterErrorCode params;
4556  params.target = &target;
4557  params.code = code;
4558  params.httpStatus = httpStatus;
4559  params.message = message;
4560 
4561  if (context->InvokeService(context, _OrthancPluginService_RegisterErrorCode, &params) == OrthancPluginErrorCode_Success)
4562  {
4563  return target;
4564  }
4565  else
4566  {
4567  /* There was an error while assigned the error. Use a generic code. */
4569  }
4570  }
4571 
4572 
4573 
4574  typedef struct
4575  {
4576  uint16_t group;
4577  uint16_t element;
4579  const char* name;
4580  uint32_t minMultiplicity;
4581  uint32_t maxMultiplicity;
4582  } _OrthancPluginRegisterDictionaryTag;
4583 
4604  OrthancPluginContext* context,
4605  uint16_t group,
4606  uint16_t element,
4608  const char* name,
4609  uint32_t minMultiplicity,
4610  uint32_t maxMultiplicity)
4611  {
4612  _OrthancPluginRegisterDictionaryTag params;
4613  params.group = group;
4614  params.element = element;
4615  params.vr = vr;
4616  params.name = name;
4617  params.minMultiplicity = minMultiplicity;
4618  params.maxMultiplicity = maxMultiplicity;
4619 
4620  return context->InvokeService(context, _OrthancPluginService_RegisterDictionaryTag, &params);
4621  }
4622 
4623 
4624 
4625  typedef struct
4626  {
4627  uint16_t group;
4628  uint16_t element;
4630  const char* name;
4631  uint32_t minMultiplicity;
4632  uint32_t maxMultiplicity;
4633  const char* privateCreator;
4634  } _OrthancPluginRegisterPrivateDictionaryTag;
4635 
4657  OrthancPluginContext* context,
4658  uint16_t group,
4659  uint16_t element,
4661  const char* name,
4662  uint32_t minMultiplicity,
4663  uint32_t maxMultiplicity,
4664  const char* privateCreator)
4665  {
4666  _OrthancPluginRegisterPrivateDictionaryTag params;
4667  params.group = group;
4668  params.element = element;
4669  params.vr = vr;
4670  params.name = name;
4671  params.minMultiplicity = minMultiplicity;
4672  params.maxMultiplicity = maxMultiplicity;
4673  params.privateCreator = privateCreator;
4674 
4675  return context->InvokeService(context, _OrthancPluginService_RegisterPrivateDictionaryTag, &params);
4676  }
4677 
4678 
4679 
4680  typedef struct
4681  {
4682  OrthancPluginStorageArea* storageArea;
4684  } _OrthancPluginReconstructMainDicomTags;
4685 
4701  OrthancPluginContext* context,
4702  OrthancPluginStorageArea* storageArea,
4704  {
4705  _OrthancPluginReconstructMainDicomTags params;
4706  params.level = level;
4707  params.storageArea = storageArea;
4708 
4709  return context->InvokeService(context, _OrthancPluginService_ReconstructMainDicomTags, &params);
4710  }
4711 
4712 
4713  typedef struct
4714  {
4715  char** result;
4716  const char* instanceId;
4717  const void* buffer;
4718  uint32_t size;
4721  uint32_t maxStringLength;
4722  } _OrthancPluginDicomToJson;
4723 
4724 
4744  ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomBufferToJson(
4745  OrthancPluginContext* context,
4746  const void* buffer,
4747  uint32_t size,
4750  uint32_t maxStringLength)
4751  {
4752  char* result;
4753 
4754  _OrthancPluginDicomToJson params;
4755  memset(&params, 0, sizeof(params));
4756  params.result = &result;
4757  params.buffer = buffer;
4758  params.size = size;
4759  params.format = format;
4760  params.flags = flags;
4761  params.maxStringLength = maxStringLength;
4762 
4763  if (context->InvokeService(context, _OrthancPluginService_DicomBufferToJson, &params) != OrthancPluginErrorCode_Success)
4764  {
4765  /* Error */
4766  return NULL;
4767  }
4768  else
4769  {
4770  return result;
4771  }
4772  }
4773 
4774 
4793  ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomInstanceToJson(
4794  OrthancPluginContext* context,
4795  const char* instanceId,
4798  uint32_t maxStringLength)
4799  {
4800  char* result;
4801 
4802  _OrthancPluginDicomToJson params;
4803  memset(&params, 0, sizeof(params));
4804  params.result = &result;
4805  params.instanceId = instanceId;
4806  params.format = format;
4807  params.flags = flags;
4808  params.maxStringLength = maxStringLength;
4809 
4810  if (context->InvokeService(context, _OrthancPluginService_DicomInstanceToJson, &params) != OrthancPluginErrorCode_Success)
4811  {
4812  /* Error */
4813  return NULL;
4814  }
4815  else
4816  {
4817  return result;
4818  }
4819  }
4820 
4821 
4822  typedef struct
4823  {
4824  OrthancPluginMemoryBuffer* target;
4825  const char* uri;
4826  uint32_t headersCount;
4827  const char* const* headersKeys;
4828  const char* const* headersValues;
4829  int32_t afterPlugins;
4830  } _OrthancPluginRestApiGet2;
4831 
4852  OrthancPluginContext* context,
4853  OrthancPluginMemoryBuffer* target,
4854  const char* uri,
4855  uint32_t headersCount,
4856  const char* const* headersKeys,
4857  const char* const* headersValues,
4858  int32_t afterPlugins)
4859  {
4860  _OrthancPluginRestApiGet2 params;
4861  params.target = target;
4862  params.uri = uri;
4863  params.headersCount = headersCount;
4864  params.headersKeys = headersKeys;
4865  params.headersValues = headersValues;
4866  params.afterPlugins = afterPlugins;
4867 
4868  return context->InvokeService(context, _OrthancPluginService_RestApiGet2, &params);
4869  }
4870 
4871 
4872 
4873  typedef struct
4874  {
4876  } _OrthancPluginWorklistCallback;
4877 
4890  OrthancPluginContext* context,
4892  {
4893  _OrthancPluginWorklistCallback params;
4894  params.callback = callback;
4895 
4896  return context->InvokeService(context, _OrthancPluginService_RegisterWorklistCallback, &params);
4897  }
4898 
4899 
4900 
4901  typedef struct
4902  {
4904  const OrthancPluginWorklistQuery* query;
4905  const void* dicom;
4906  uint32_t size;
4907  } _OrthancPluginWorklistAnswersOperation;
4908 
4926  OrthancPluginContext* context,
4928  const OrthancPluginWorklistQuery* query,
4929  const void* dicom,
4930  uint32_t size)
4931  {
4932  _OrthancPluginWorklistAnswersOperation params;
4933  params.answers = answers;
4934  params.query = query;
4935  params.dicom = dicom;
4936  params.size = size;
4937 
4938  return context->InvokeService(context, _OrthancPluginService_WorklistAddAnswer, &params);
4939  }
4940 
4941 
4956  OrthancPluginContext* context,
4958  {
4959  _OrthancPluginWorklistAnswersOperation params;
4960  params.answers = answers;
4961  params.query = NULL;
4962  params.dicom = NULL;
4963  params.size = 0;
4964 
4965  return context->InvokeService(context, _OrthancPluginService_WorklistMarkIncomplete, &params);
4966  }
4967 
4968 
4969  typedef struct
4970  {
4971  const OrthancPluginWorklistQuery* query;
4972  const void* dicom;
4973  uint32_t size;
4974  int32_t* isMatch;
4975  OrthancPluginMemoryBuffer* target;
4976  } _OrthancPluginWorklistQueryOperation;
4977 
4993  ORTHANC_PLUGIN_INLINE int32_t OrthancPluginWorklistIsMatch(
4994  OrthancPluginContext* context,
4995  const OrthancPluginWorklistQuery* query,
4996  const void* dicom,
4997  uint32_t size)
4998  {
4999  int32_t isMatch = 0;
5000 
5001  _OrthancPluginWorklistQueryOperation params;
5002  params.query = query;
5003  params.dicom = dicom;
5004  params.size = size;
5005  params.isMatch = &isMatch;
5006  params.target = NULL;
5007 
5008  if (context->InvokeService(context, _OrthancPluginService_WorklistIsMatch, &params) == OrthancPluginErrorCode_Success)
5009  {
5010  return isMatch;
5011  }
5012  else
5013  {
5014  /* Error: Assume non-match */
5015  return 0;
5016  }
5017  }
5018 
5019 
5033  OrthancPluginContext* context,
5034  OrthancPluginMemoryBuffer* target,
5035  const OrthancPluginWorklistQuery* query)
5036  {
5037  _OrthancPluginWorklistQueryOperation params;
5038  params.query = query;
5039  params.dicom = NULL;
5040  params.size = 0;
5041  params.isMatch = NULL;
5042  params.target = target;
5043 
5044  return context->InvokeService(context, _OrthancPluginService_WorklistGetDicomQuery, &params);
5045  }
5046 
5047 
5059  OrthancPluginContext* context,
5060  OrthancPluginDicomInstance* instance)
5061  {
5063 
5064  _OrthancPluginAccessDicomInstance params;
5065  memset(&params, 0, sizeof(params));
5066  params.resultOrigin = &origin;
5067  params.instance = instance;
5068 
5069  if (context->InvokeService(context, _OrthancPluginService_GetInstanceOrigin, &params) != OrthancPluginErrorCode_Success)
5070  {
5071  /* Error */
5073  }
5074  else
5075  {
5076  return origin;
5077  }
5078  }
5079 
5080 
5081  typedef struct
5082  {
5083  OrthancPluginMemoryBuffer* target;
5084  const char* json;
5085  const OrthancPluginImage* pixelData;
5087  } _OrthancPluginCreateDicom;
5088 
5108  OrthancPluginContext* context,
5109  OrthancPluginMemoryBuffer* target,
5110  const char* json,
5111  const OrthancPluginImage* pixelData,
5113  {
5114  _OrthancPluginCreateDicom params;
5115  params.target = target;
5116  params.json = json;
5117  params.pixelData = pixelData;
5118  params.flags = flags;
5119 
5120  return context->InvokeService(context, _OrthancPluginService_CreateDicom, &params);
5121  }
5122 
5123 
5124  typedef struct
5125  {
5127  } _OrthancPluginDecodeImageCallback;
5128 
5141  OrthancPluginContext* context,
5143  {
5144  _OrthancPluginDecodeImageCallback params;
5145  params.callback = callback;
5146 
5147  return context->InvokeService(context, _OrthancPluginService_RegisterDecodeImageCallback, &params);
5148  }
5149 
5150 
5151 
5152  typedef struct
5153  {
5154  OrthancPluginImage** target;
5155  OrthancPluginPixelFormat format;
5156  uint32_t width;
5157  uint32_t height;
5158  uint32_t pitch;
5159  void* buffer;
5160  const void* constBuffer;
5161  uint32_t bufferSize;
5162  uint32_t frameIndex;
5163  } _OrthancPluginCreateImage;
5164 
5165 
5179  OrthancPluginContext* context,
5180  OrthancPluginPixelFormat format,
5181  uint32_t width,
5182  uint32_t height)
5183  {
5184  OrthancPluginImage* target = NULL;
5185 
5186  _OrthancPluginCreateImage params;
5187  memset(&params, 0, sizeof(params));
5188  params.target = &target;
5189  params.format = format;
5190  params.width = width;
5191  params.height = height;
5192 
5193  if (context->InvokeService(context, _OrthancPluginService_CreateImage, &params) != OrthancPluginErrorCode_Success)
5194  {
5195  return NULL;
5196  }
5197  else
5198  {
5199  return target;
5200  }
5201  }
5202 
5203 
5222  OrthancPluginContext* context,
5223  OrthancPluginPixelFormat format,
5224  uint32_t width,
5225  uint32_t height,
5226  uint32_t pitch,
5227  void* buffer)
5228  {
5229  OrthancPluginImage* target = NULL;
5230 
5231  _OrthancPluginCreateImage params;
5232  memset(&params, 0, sizeof(params));
5233  params.target = &target;
5234  params.format = format;
5235  params.width = width;
5236  params.height = height;
5237  params.pitch = pitch;
5238  params.buffer = buffer;
5239 
5240  if (context->InvokeService(context, _OrthancPluginService_CreateImageAccessor, &params) != OrthancPluginErrorCode_Success)
5241  {
5242  return NULL;
5243  }
5244  else
5245  {
5246  return target;
5247  }
5248  }
5249 
5250 
5251 
5267  OrthancPluginContext* context,
5268  const void* buffer,
5269  uint32_t bufferSize,
5270  uint32_t frameIndex)
5271  {
5272  OrthancPluginImage* target = NULL;
5273 
5274  _OrthancPluginCreateImage params;
5275  memset(&params, 0, sizeof(params));
5276  params.target = &target;
5277  params.constBuffer = buffer;
5278  params.bufferSize = bufferSize;
5279  params.frameIndex = frameIndex;
5280 
5281  if (context->InvokeService(context, _OrthancPluginService_DecodeDicomImage, &params) != OrthancPluginErrorCode_Success)
5282  {
5283  return NULL;
5284  }
5285  else
5286  {
5287  return target;
5288  }
5289  }
5290 
5291 
5292 
5293  typedef struct
5294  {
5295  char** result;
5296  const void* buffer;
5297  uint32_t size;
5298  } _OrthancPluginComputeHash;
5299 
5312  ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeMd5(
5313  OrthancPluginContext* context,
5314  const void* buffer,
5315  uint32_t size)
5316  {
5317  char* result;
5318 
5319  _OrthancPluginComputeHash params;
5320  params.result = &result;
5321  params.buffer = buffer;
5322  params.size = size;
5323 
5324  if (context->InvokeService(context, _OrthancPluginService_ComputeMd5, &params) != OrthancPluginErrorCode_Success)
5325  {
5326  /* Error */
5327  return NULL;
5328  }
5329  else
5330  {
5331  return result;
5332  }
5333  }
5334 
5335 
5348  ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeSha1(
5349  OrthancPluginContext* context,
5350  const void* buffer,
5351  uint32_t size)
5352  {
5353  char* result;
5354 
5355  _OrthancPluginComputeHash params;
5356  params.result = &result;
5357  params.buffer = buffer;
5358  params.size = size;
5359 
5360  if (context->InvokeService(context, _OrthancPluginService_ComputeSha1, &params) != OrthancPluginErrorCode_Success)
5361  {
5362  /* Error */
5363  return NULL;
5364  }
5365  else
5366  {
5367  return result;
5368  }
5369  }
5370 
5371 
5372 
5373  typedef struct
5374  {
5376  const char* name;
5377  } _OrthancPluginLookupDictionary;
5378 
5395  OrthancPluginContext* context,
5397  const char* name)
5398  {
5399  _OrthancPluginLookupDictionary params;
5400  params.target = target;
5401  params.name = name;
5402  return context->InvokeService(context, _OrthancPluginService_LookupDictionary, &params);
5403  }
5404 
5405 
5406 
5407  typedef struct
5408  {
5409  OrthancPluginRestOutput* output;
5410  const char* answer;
5411  uint32_t answerSize;
5412  uint32_t headersCount;
5413  const char* const* headersKeys;
5414  const char* const* headersValues;
5415  } _OrthancPluginSendMultipartItem2;
5416 
5438  OrthancPluginContext* context,
5439  OrthancPluginRestOutput* output,
5440  const char* answer,
5441  uint32_t answerSize,
5442  uint32_t headersCount,
5443  const char* const* headersKeys,
5444  const char* const* headersValues)
5445  {
5446  _OrthancPluginSendMultipartItem2 params;
5447  params.output = output;
5448  params.answer = answer;
5449  params.answerSize = answerSize;
5450  params.headersCount = headersCount;
5451  params.headersKeys = headersKeys;
5452  params.headersValues = headersValues;
5453 
5454  return context->InvokeService(context, _OrthancPluginService_SendMultipartItem2, &params);
5455  }
5456 
5457 
5458  typedef struct
5459  {
5461  } _OrthancPluginIncomingHttpRequestFilter;
5462 
5476  OrthancPluginContext* context,
5478  {
5479  _OrthancPluginIncomingHttpRequestFilter params;
5480  params.callback = callback;
5481 
5482  return context->InvokeService(context, _OrthancPluginService_RegisterIncomingHttpRequestFilter, &params);
5483  }
5484 
5485 
5486 
5487  typedef struct
5488  {
5489  OrthancPluginMemoryBuffer* answerBody;
5490  OrthancPluginMemoryBuffer* answerHeaders;
5491  uint16_t* httpStatus;
5492  OrthancPluginHttpMethod method;
5493  const char* url;
5494  uint32_t headersCount;
5495  const char* const* headersKeys;
5496  const char* const* headersValues;
5497  const void* body;
5498  uint32_t bodySize;
5499  const char* username;
5500  const char* password;
5501  uint32_t timeout;
5502  const char* certificateFile;
5503  const char* certificateKeyFile;
5504  const char* certificateKeyPassword;
5505  uint8_t pkcs11;
5506  } _OrthancPluginCallHttpClient2;
5507 
5508 
5509 
5550  OrthancPluginContext* context,
5551  OrthancPluginMemoryBuffer* answerBody,
5552  OrthancPluginMemoryBuffer* answerHeaders,
5553  uint16_t* httpStatus,
5554  OrthancPluginHttpMethod method,
5555  const char* url,
5556  uint32_t headersCount,
5557  const char* const* headersKeys,
5558  const char* const* headersValues,
5559  const void* body,
5560  uint32_t bodySize,
5561  const char* username,
5562  const char* password,
5563  uint32_t timeout,
5564  const char* certificateFile,
5565  const char* certificateKeyFile,
5566  const char* certificateKeyPassword,
5567  uint8_t pkcs11)
5568  {
5569  _OrthancPluginCallHttpClient2 params;
5570  memset(&params, 0, sizeof(params));
5571 
5572  params.answerBody = answerBody;
5573  params.answerHeaders = answerHeaders;
5574  params.httpStatus = httpStatus;
5575  params.method = method;
5576  params.url = url;
5577  params.headersCount = headersCount;
5578  params.headersKeys = headersKeys;
5579  params.headersValues = headersValues;
5580  params.body = body;
5581  params.bodySize = bodySize;
5582  params.username = username;
5583  params.password = password;
5584  params.timeout = timeout;
5585  params.certificateFile = certificateFile;
5586  params.certificateKeyFile = certificateKeyFile;
5587  params.certificateKeyPassword = certificateKeyPassword;
5588  params.pkcs11 = pkcs11;
5589 
5590  return context->InvokeService(context, _OrthancPluginService_CallHttpClient2, &params);
5591  }
5592 
5593 
5604  ORTHANC_PLUGIN_INLINE char* OrthancPluginGenerateUuid(
5605  OrthancPluginContext* context)
5606  {
5607  char* result;
5608 
5609  _OrthancPluginRetrieveDynamicString params;
5610  params.result = &result;
5611  params.argument = NULL;
5612 
5613  if (context->InvokeService(context, _OrthancPluginService_GenerateUuid, &params) != OrthancPluginErrorCode_Success)
5614  {
5615  /* Error */
5616  return NULL;
5617  }
5618  else
5619  {
5620  return result;
5621  }
5622  }
5623 
5624 
5625 
5626 
5627  typedef struct
5628  {
5629  OrthancPluginFindCallback callback;
5630  } _OrthancPluginFindCallback;
5631 
5644  OrthancPluginContext* context,
5645  OrthancPluginFindCallback callback)
5646  {
5647  _OrthancPluginFindCallback params;
5648  params.callback = callback;
5649 
5650  return context->InvokeService(context, _OrthancPluginService_RegisterFindCallback, &params);
5651  }
5652 
5653 
5654  typedef struct
5655  {
5656  OrthancPluginFindAnswers *answers;
5657  const OrthancPluginFindQuery *query;
5658  const void *dicom;
5659  uint32_t size;
5660  uint32_t index;
5661  uint32_t *resultUint32;
5662  uint16_t *resultGroup;
5663  uint16_t *resultElement;
5664  char **resultString;
5665  } _OrthancPluginFindOperation;
5666 
5683  OrthancPluginContext* context,
5684  OrthancPluginFindAnswers* answers,
5685  const void* dicom,
5686  uint32_t size)
5687  {
5688  _OrthancPluginFindOperation params;
5689  memset(&params, 0, sizeof(params));
5690  params.answers = answers;
5691  params.dicom = dicom;
5692  params.size = size;
5693 
5694  return context->InvokeService(context, _OrthancPluginService_FindAddAnswer, &params);
5695  }
5696 
5697 
5712  OrthancPluginContext* context,
5713  OrthancPluginFindAnswers* answers)
5714  {
5715  _OrthancPluginFindOperation params;
5716  memset(&params, 0, sizeof(params));
5717  params.answers = answers;
5718 
5719  return context->InvokeService(context, _OrthancPluginService_FindMarkIncomplete, &params);
5720  }
5721 
5722 
5723 
5735  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFindQuerySize(
5736  OrthancPluginContext* context,
5737  const OrthancPluginFindQuery* query)
5738  {
5739  uint32_t count = 0;
5740 
5741  _OrthancPluginFindOperation params;
5742  memset(&params, 0, sizeof(params));
5743  params.query = query;
5744  params.resultUint32 = &count;
5745 
5746  if (context->InvokeService(context, _OrthancPluginService_GetFindQuerySize, &params) != OrthancPluginErrorCode_Success)
5747  {
5748  /* Error */
5749  return 0;
5750  }
5751  else
5752  {
5753  return count;
5754  }
5755  }
5756 
5757 
5773  OrthancPluginContext* context,
5774  uint16_t* group,
5775  uint16_t* element,
5776  const OrthancPluginFindQuery* query,
5777  uint32_t index)
5778  {
5779  _OrthancPluginFindOperation params;
5780  memset(&params, 0, sizeof(params));
5781  params.query = query;
5782  params.index = index;
5783  params.resultGroup = group;
5784  params.resultElement = element;
5785 
5786  return context->InvokeService(context, _OrthancPluginService_GetFindQueryTag, &params);
5787  }
5788 
5789 
5803  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetFindQueryTagName(
5804  OrthancPluginContext* context,
5805  const OrthancPluginFindQuery* query,
5806  uint32_t index)
5807  {
5808  char* result;
5809 
5810  _OrthancPluginFindOperation params;
5811  memset(&params, 0, sizeof(params));
5812  params.query = query;
5813  params.index = index;
5814  params.resultString = &result;
5815 
5816  if (context->InvokeService(context, _OrthancPluginService_GetFindQueryTagName, &params) != OrthancPluginErrorCode_Success)
5817  {
5818  /* Error */
5819  return NULL;
5820  }
5821  else
5822  {
5823  return result;
5824  }
5825  }
5826 
5827 
5841  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetFindQueryValue(
5842  OrthancPluginContext* context,
5843  const OrthancPluginFindQuery* query,
5844  uint32_t index)
5845  {
5846  char* result;
5847 
5848  _OrthancPluginFindOperation params;
5849  memset(&params, 0, sizeof(params));
5850  params.query = query;
5851  params.index = index;
5852  params.resultString = &result;
5853 
5854  if (context->InvokeService(context, _OrthancPluginService_GetFindQueryValue, &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  OrthancPluginMoveCallback callback;
5871  OrthancPluginGetMoveSize getMoveSize;
5872  OrthancPluginApplyMove applyMove;
5873  OrthancPluginFreeMove freeMove;
5874  } _OrthancPluginMoveCallback;
5875 
5890  OrthancPluginContext* context,
5891  OrthancPluginMoveCallback callback,
5892  OrthancPluginGetMoveSize getMoveSize,
5893  OrthancPluginApplyMove applyMove,
5894  OrthancPluginFreeMove freeMove)
5895  {
5896  _OrthancPluginMoveCallback params;
5897  params.callback = callback;
5898  params.getMoveSize = getMoveSize;
5899  params.applyMove = applyMove;
5900  params.freeMove = freeMove;
5901 
5902  return context->InvokeService(context, _OrthancPluginService_RegisterMoveCallback, &params);
5903  }
5904 
5905 
5906 
5907  typedef struct
5908  {
5909  OrthancPluginFindMatcher** target;
5910  const void* query;
5911  uint32_t size;
5912  } _OrthancPluginCreateFindMatcher;
5913 
5914 
5929  OrthancPluginContext* context,
5930  const void* query,
5931  uint32_t size)
5932  {
5933  OrthancPluginFindMatcher* target = NULL;
5934 
5935  _OrthancPluginCreateFindMatcher params;
5936  memset(&params, 0, sizeof(params));
5937  params.target = &target;
5938  params.query = query;
5939  params.size = size;
5940 
5941  if (context->InvokeService(context, _OrthancPluginService_CreateFindMatcher, &params) != OrthancPluginErrorCode_Success)
5942  {
5943  return NULL;
5944  }
5945  else
5946  {
5947  return target;
5948  }
5949  }
5950 
5951 
5952  typedef struct
5953  {
5954  OrthancPluginFindMatcher* matcher;
5955  } _OrthancPluginFreeFindMatcher;
5956 
5966  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeFindMatcher(
5967  OrthancPluginContext* context,
5968  OrthancPluginFindMatcher* matcher)
5969  {
5970  _OrthancPluginFreeFindMatcher params;
5971  params.matcher = matcher;
5972 
5973  context->InvokeService(context, _OrthancPluginService_FreeFindMatcher, &params);
5974  }
5975 
5976 
5977  typedef struct
5978  {
5979  const OrthancPluginFindMatcher* matcher;
5980  const void* dicom;
5981  uint32_t size;
5982  int32_t* isMatch;
5983  } _OrthancPluginFindMatcherIsMatch;
5984 
5999  ORTHANC_PLUGIN_INLINE int32_t OrthancPluginFindMatcherIsMatch(
6000  OrthancPluginContext* context,
6001  const OrthancPluginFindMatcher* matcher,
6002  const void* dicom,
6003  uint32_t size)
6004  {
6005  int32_t isMatch = 0;
6006 
6007  _OrthancPluginFindMatcherIsMatch params;
6008  params.matcher = matcher;
6009  params.dicom = dicom;
6010  params.size = size;
6011  params.isMatch = &isMatch;
6012 
6013  if (context->InvokeService(context, _OrthancPluginService_FindMatcherIsMatch, &params) == OrthancPluginErrorCode_Success)
6014  {
6015  return isMatch;
6016  }
6017  else
6018  {
6019  /* Error: Assume non-match */
6020  return 0;
6021  }
6022  }
6023 
6024 
6025  typedef struct
6026  {
6028  } _OrthancPluginIncomingHttpRequestFilter2;
6029 
6042  OrthancPluginContext* context,
6044  {
6045  _OrthancPluginIncomingHttpRequestFilter2 params;
6046  params.callback = callback;
6047 
6048  return context->InvokeService(context, _OrthancPluginService_RegisterIncomingHttpRequestFilter2, &params);
6049  }
6050 
6051 
6052 
6053  typedef struct
6054  {
6055  OrthancPluginPeers** peers;
6056  } _OrthancPluginGetPeers;
6057 
6070  OrthancPluginContext* context)
6071  {
6072  OrthancPluginPeers* peers = NULL;
6073 
6074  _OrthancPluginGetPeers params;
6075  memset(&params, 0, sizeof(params));
6076  params.peers = &peers;
6077 
6078  if (context->InvokeService(context, _OrthancPluginService_GetPeers, &params) != OrthancPluginErrorCode_Success)
6079  {
6080  return NULL;
6081  }
6082  else
6083  {
6084  return peers;
6085  }
6086  }
6087 
6088 
6089  typedef struct
6090  {
6091  OrthancPluginPeers* peers;
6092  } _OrthancPluginFreePeers;
6093 
6103  ORTHANC_PLUGIN_INLINE void OrthancPluginFreePeers(
6104  OrthancPluginContext* context,
6105  OrthancPluginPeers* peers)
6106  {
6107  _OrthancPluginFreePeers params;
6108  params.peers = peers;
6109 
6110  context->InvokeService(context, _OrthancPluginService_FreePeers, &params);
6111  }
6112 
6113 
6114  typedef struct
6115  {
6116  uint32_t* target;
6117  const OrthancPluginPeers* peers;
6118  } _OrthancPluginGetPeersCount;
6119 
6133  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetPeersCount(
6134  OrthancPluginContext* context,
6135  const OrthancPluginPeers* peers)
6136  {
6137  uint32_t target = 0;
6138 
6139  _OrthancPluginGetPeersCount params;
6140  memset(&params, 0, sizeof(params));
6141  params.target = &target;
6142  params.peers = peers;
6143 
6144  if (context->InvokeService(context, _OrthancPluginService_GetPeersCount, &params) != OrthancPluginErrorCode_Success)
6145  {
6146  /* Error */
6147  return 0;
6148  }
6149  else
6150  {
6151  return target;
6152  }
6153  }
6154 
6155 
6156  typedef struct
6157  {
6158  const char** target;
6159  const OrthancPluginPeers* peers;
6160  uint32_t peerIndex;
6161  const char* userProperty;
6162  } _OrthancPluginGetPeerProperty;
6163 
6181  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetPeerName(
6182  OrthancPluginContext* context,
6183  const OrthancPluginPeers* peers,
6184  uint32_t peerIndex)
6185  {
6186  const char* target = NULL;
6187 
6188  _OrthancPluginGetPeerProperty params;
6189  memset(&params, 0, sizeof(params));
6190  params.target = &target;
6191  params.peers = peers;
6192  params.peerIndex = peerIndex;
6193  params.userProperty = NULL;
6194 
6195  if (context->InvokeService(context, _OrthancPluginService_GetPeerName, &params) != OrthancPluginErrorCode_Success)
6196  {
6197  /* Error */
6198  return NULL;
6199  }
6200  else
6201  {
6202  return target;
6203  }
6204  }
6205 
6206 
6222  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetPeerUrl(
6223  OrthancPluginContext* context,
6224  const OrthancPluginPeers* peers,
6225  uint32_t peerIndex)
6226  {
6227  const char* target = NULL;
6228 
6229  _OrthancPluginGetPeerProperty params;
6230  memset(&params, 0, sizeof(params));
6231  params.target = &target;
6232  params.peers = peers;
6233  params.peerIndex = peerIndex;
6234  params.userProperty = NULL;
6235 
6236  if (context->InvokeService(context, _OrthancPluginService_GetPeerUrl, &params) != OrthancPluginErrorCode_Success)
6237  {
6238  /* Error */
6239  return NULL;
6240  }
6241  else
6242  {
6243  return target;
6244  }
6245  }
6246 
6247 
6248 
6268  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetPeerUserProperty(
6269  OrthancPluginContext* context,
6270  const OrthancPluginPeers* peers,
6271  uint32_t peerIndex,
6272  const char* userProperty)
6273  {
6274  const char* target = NULL;
6275 
6276  _OrthancPluginGetPeerProperty params;
6277  memset(&params, 0, sizeof(params));
6278  params.target = &target;
6279  params.peers = peers;
6280  params.peerIndex = peerIndex;
6281  params.userProperty = userProperty;
6282 
6283  if (context->InvokeService(context, _OrthancPluginService_GetPeerUserProperty, &params) != OrthancPluginErrorCode_Success)
6284  {
6285  /* No such user property */
6286  return NULL;
6287  }
6288  else
6289  {
6290  return target;
6291  }
6292  }
6293 
6294 
6295 
6296  typedef struct
6297  {
6298  OrthancPluginMemoryBuffer* answerBody;
6299  OrthancPluginMemoryBuffer* answerHeaders;
6300  uint16_t* httpStatus;
6301  const OrthancPluginPeers* peers;
6302  uint32_t peerIndex;
6303  OrthancPluginHttpMethod method;
6304  const char* uri;
6305  uint32_t additionalHeadersCount;
6306  const char* const* additionalHeadersKeys;
6307  const char* const* additionalHeadersValues;
6308  const void* body;
6309  uint32_t bodySize;
6310  uint32_t timeout;
6311  } _OrthancPluginCallPeerApi;
6312 
6349  OrthancPluginContext* context,
6350  OrthancPluginMemoryBuffer* answerBody,
6351  OrthancPluginMemoryBuffer* answerHeaders,
6352  uint16_t* httpStatus,
6353  const OrthancPluginPeers* peers,
6354  uint32_t peerIndex,
6355  OrthancPluginHttpMethod method,
6356  const char* uri,
6357  uint32_t additionalHeadersCount,
6358  const char* const* additionalHeadersKeys,
6359  const char* const* additionalHeadersValues,
6360  const void* body,
6361  uint32_t bodySize,
6362  uint32_t timeout)
6363  {
6364  _OrthancPluginCallPeerApi params;
6365  memset(&params, 0, sizeof(params));
6366 
6367  params.answerBody = answerBody;
6368  params.answerHeaders = answerHeaders;
6369  params.httpStatus = httpStatus;
6370  params.peers = peers;
6371  params.peerIndex = peerIndex;
6372  params.method = method;
6373  params.uri = uri;
6374  params.additionalHeadersCount = additionalHeadersCount;
6375  params.additionalHeadersKeys = additionalHeadersKeys;
6376  params.additionalHeadersValues = additionalHeadersValues;
6377  params.body = body;
6378  params.bodySize = bodySize;
6379  params.timeout = timeout;
6380 
6381  return context->InvokeService(context, _OrthancPluginService_CallPeerApi, &params);
6382  }
6383 
6384 
6385 
6386 
6387 
6388  typedef struct
6389  {
6390  OrthancPluginJob** target;
6391  void *job;
6392  OrthancPluginJobFinalize finalize;
6393  const char *type;
6394  OrthancPluginJobGetProgress getProgress;
6395  OrthancPluginJobGetContent getContent;
6396  OrthancPluginJobGetSerialized getSerialized;
6397  OrthancPluginJobStep step;
6398  OrthancPluginJobStop stop;
6399  OrthancPluginJobReset reset;
6400  } _OrthancPluginCreateJob;
6401 
6434  OrthancPluginContext *context,
6435  void *job,
6436  OrthancPluginJobFinalize finalize,
6437  const char *type,
6438  OrthancPluginJobGetProgress getProgress,
6439  OrthancPluginJobGetContent getContent,
6440  OrthancPluginJobGetSerialized getSerialized,
6441  OrthancPluginJobStep step,
6442  OrthancPluginJobStop stop,
6443  OrthancPluginJobReset reset)
6444  {
6445  OrthancPluginJob* target = NULL;
6446 
6447  _OrthancPluginCreateJob params;
6448  memset(&params, 0, sizeof(params));
6449 
6450  params.target = &target;
6451  params.job = job;
6452  params.finalize = finalize;
6453  params.type = type;
6454  params.getProgress = getProgress;
6455  params.getContent = getContent;
6456  params.getSerialized = getSerialized;
6457  params.step = step;
6458  params.stop = stop;
6459  params.reset = reset;
6460 
6461  if (context->InvokeService(context, _OrthancPluginService_CreateJob, &params) != OrthancPluginErrorCode_Success ||
6462  target == NULL)
6463  {
6464  /* Error */
6465  return NULL;
6466  }
6467  else
6468  {
6469  return target;
6470  }
6471  }
6472 
6473 
6474  typedef struct
6475  {
6476  OrthancPluginJob* job;
6477  } _OrthancPluginFreeJob;
6478 
6488  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeJob(
6489  OrthancPluginContext* context,
6490  OrthancPluginJob* job)
6491  {
6492  _OrthancPluginFreeJob params;
6493  params.job = job;
6494 
6495  context->InvokeService(context, _OrthancPluginService_FreeJob, &params);
6496  }
6497 
6498 
6499 
6500  typedef struct
6501  {
6502  char** resultId;
6503  OrthancPluginJob *job;
6504  int priority;
6505  } _OrthancPluginSubmitJob;
6506 
6520  ORTHANC_PLUGIN_INLINE char *OrthancPluginSubmitJob(
6521  OrthancPluginContext *context,
6522  OrthancPluginJob *job,
6523  int priority)
6524  {
6525  char* resultId = NULL;
6526 
6527  _OrthancPluginSubmitJob params;
6528  memset(&params, 0, sizeof(params));
6529 
6530  params.resultId = &resultId;
6531  params.job = job;
6532  params.priority = priority;
6533 
6534  if (context->InvokeService(context, _OrthancPluginService_SubmitJob, &params) != OrthancPluginErrorCode_Success ||
6535  resultId == NULL)
6536  {
6537  /* Error */
6538  return NULL;
6539  }
6540  else
6541  {
6542  return resultId;
6543  }
6544  }
6545 
6546 
6547 
6548  typedef struct
6549  {
6550  OrthancPluginJobsUnserializer unserializer;
6551  } _OrthancPluginJobsUnserializer;
6552 
6565  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterJobsUnserializer(
6566  OrthancPluginContext* context,
6567  OrthancPluginJobsUnserializer unserializer)
6568  {
6569  _OrthancPluginJobsUnserializer params;
6570  params.unserializer = unserializer;
6571 
6572  context->InvokeService(context, _OrthancPluginService_RegisterJobsUnserializer, &params);
6573  }
6574 
6575 
6576 
6577  typedef struct
6578  {
6579  OrthancPluginRestOutput* output;
6580  const char* details;
6581  uint8_t log;
6582  } _OrthancPluginSetHttpErrorDetails;
6583 
6601  ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpErrorDetails(
6602  OrthancPluginContext* context,
6603  OrthancPluginRestOutput* output,
6604  const char* details,
6605  uint8_t log)
6606  {
6607  _OrthancPluginSetHttpErrorDetails params;
6608  params.output = output;
6609  params.details = details;
6610  params.log = log;
6611  context->InvokeService(context, _OrthancPluginService_SetHttpErrorDetails, &params);
6612  }
6613 
6614 
6615 
6616  typedef struct
6617  {
6618  const char** result;
6619  const char* argument;
6620  } _OrthancPluginRetrieveStaticString;
6621 
6633  ORTHANC_PLUGIN_INLINE const char* OrthancPluginAutodetectMimeType(
6634  OrthancPluginContext* context,
6635  const char* path)
6636  {
6637  const char* result = NULL;
6638 
6639  _OrthancPluginRetrieveStaticString params;
6640  params.result = &result;
6641  params.argument = path;
6642 
6643  if (context->InvokeService(context, _OrthancPluginService_AutodetectMimeType, &params) != OrthancPluginErrorCode_Success)
6644  {
6645  /* Error */
6646  return NULL;
6647  }
6648  else
6649  {
6650  return result;
6651  }
6652  }
6653 
6654 
6655 
6656  typedef struct
6657  {
6658  const char* name;
6659  float value;
6660  OrthancPluginMetricsType type;
6661  } _OrthancPluginSetMetricsValue;
6662 
6677  ORTHANC_PLUGIN_INLINE void OrthancPluginSetMetricsValue(
6678  OrthancPluginContext* context,
6679  const char* name,
6680  float value,
6681  OrthancPluginMetricsType type)
6682  {
6683  _OrthancPluginSetMetricsValue params;
6684  params.name = name;
6685  params.value = value;
6686  params.type = type;
6687  context->InvokeService(context, _OrthancPluginService_SetMetricsValue, &params);
6688  }
6689 
6690 
6691 
6692  typedef struct
6693  {
6695  } _OrthancPluginRegisterRefreshMetricsCallback;
6696 
6708  OrthancPluginContext* context,
6710  {
6711  _OrthancPluginRegisterRefreshMetricsCallback params;
6712  params.callback = callback;
6713  context->InvokeService(context, _OrthancPluginService_RegisterRefreshMetricsCallback, &params);
6714  }
6715 
6716 
6717 
6718 
6719  typedef struct
6720  {
6721  char** target;
6722  const void* dicom;
6723  uint32_t dicomSize;
6725  } _OrthancPluginEncodeDicomWeb;
6726 
6742  ORTHANC_PLUGIN_INLINE char* OrthancPluginEncodeDicomWebJson(
6743  OrthancPluginContext* context,
6744  const void* dicom,
6745  uint32_t dicomSize,
6747  {
6748  char* target = NULL;
6749 
6750  _OrthancPluginEncodeDicomWeb params;
6751  params.target = &target;
6752  params.dicom = dicom;
6753  params.dicomSize = dicomSize;
6754  params.callback = callback;
6755 
6756  if (context->InvokeService(context, _OrthancPluginService_EncodeDicomWebJson, &params) != OrthancPluginErrorCode_Success)
6757  {
6758  /* Error */
6759  return NULL;
6760  }
6761  else
6762  {
6763  return target;
6764  }
6765  }
6766 
6767 
6783  ORTHANC_PLUGIN_INLINE char* OrthancPluginEncodeDicomWebXml(
6784  OrthancPluginContext* context,
6785  const void* dicom,
6786  uint32_t dicomSize,
6788  {
6789  char* target = NULL;
6790 
6791  _OrthancPluginEncodeDicomWeb params;
6792  params.target = &target;
6793  params.dicom = dicom;
6794  params.dicomSize = dicomSize;
6795  params.callback = callback;
6796 
6797  if (context->InvokeService(context, _OrthancPluginService_EncodeDicomWebXml, &params) != OrthancPluginErrorCode_Success)
6798  {
6799  /* Error */
6800  return NULL;
6801  }
6802  else
6803  {
6804  return target;
6805  }
6806  }
6807 
6808 
6809 
6826  void* answer,
6827  const char* key,
6828  const char* value);
6829 
6830 
6847  void* answer,
6848  const void* data,
6849  uint32_t size);
6850 
6851 
6866  typedef uint8_t (*OrthancPluginChunkedClientRequestIsDone) (void* request);
6867 
6868 
6884 
6885 
6899  typedef const void* (*OrthancPluginChunkedClientRequestGetChunkData) (void* request);
6900 
6901 
6915  typedef uint32_t (*OrthancPluginChunkedClientRequestGetChunkSize) (void* request);
6916 
6917 
6918  typedef struct
6919  {
6920  void* answer;
6923  uint16_t* httpStatus;
6924  OrthancPluginHttpMethod method;
6925  const char* url;
6926  uint32_t headersCount;
6927  const char* const* headersKeys;
6928  const char* const* headersValues;
6929  void* request;
6934  const char* username;
6935  const char* password;
6936  uint32_t timeout;
6937  const char* certificateFile;
6938  const char* certificateKeyFile;
6939  const char* certificateKeyPassword;
6940  uint8_t pkcs11;
6941  } _OrthancPluginChunkedHttpClient;
6942 
6943 
6995  OrthancPluginContext* context,
6996  void* answer,
6999  uint16_t* httpStatus,
7000  OrthancPluginHttpMethod method,
7001  const char* url,
7002  uint32_t headersCount,
7003  const char* const* headersKeys,
7004  const char* const* headersValues,
7005  void* request,
7010  const char* username,
7011  const char* password,
7012  uint32_t timeout,
7013  const char* certificateFile,
7014  const char* certificateKeyFile,
7015  const char* certificateKeyPassword,
7016  uint8_t pkcs11)
7017  {
7018  _OrthancPluginChunkedHttpClient params;
7019  memset(&params, 0, sizeof(params));
7020 
7021  /* In common with OrthancPluginHttpClient() */
7022  params.httpStatus = httpStatus;
7023  params.method = method;
7024  params.url = url;
7025  params.headersCount = headersCount;
7026  params.headersKeys = headersKeys;
7027  params.headersValues = headersValues;
7028  params.username = username;
7029  params.password = password;
7030  params.timeout = timeout;
7031  params.certificateFile = certificateFile;
7032  params.certificateKeyFile = certificateKeyFile;
7033  params.certificateKeyPassword = certificateKeyPassword;
7034  params.pkcs11 = pkcs11;
7035 
7036  /* For chunked body/answer */
7037  params.answer = answer;
7038  params.answerAddChunk = answerAddChunk;
7039  params.answerAddHeader = answerAddHeader;
7040  params.request = request;
7041  params.requestIsDone = requestIsDone;
7042  params.requestChunkData = requestChunkData;
7043  params.requestChunkSize = requestChunkSize;
7044  params.requestNext = requestNext;
7045 
7046  return context->InvokeService(context, _OrthancPluginService_ChunkedHttpClient, &params);
7047  }
7048 
7049 
7050 
7055  typedef struct _OrthancPluginServerChunkedRequestReader_t OrthancPluginServerChunkedRequestReader;
7056 
7057 
7058 
7076  const char* url,
7077  const OrthancPluginHttpRequest* request);
7078 
7079 
7095  const void* data,
7096  uint32_t size);
7097 
7098 
7115  OrthancPluginRestOutput* output);
7116 
7117 
7133 
7134  typedef struct
7135  {
7136  const char* pathRegularExpression;
7137  OrthancPluginRestCallback getHandler;
7139  OrthancPluginRestCallback deleteHandler;
7144  } _OrthancPluginChunkedRestCallback;
7145 
7146 
7176  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterChunkedRestCallback(
7177  OrthancPluginContext* context,
7178  const char* pathRegularExpression,
7179  OrthancPluginRestCallback getHandler,
7181  OrthancPluginRestCallback deleteHandler,
7186  {
7187  _OrthancPluginChunkedRestCallback params;
7188  params.pathRegularExpression = pathRegularExpression;
7189  params.getHandler = getHandler;
7190  params.postHandler = postHandler;
7191  params.deleteHandler = deleteHandler;
7192  params.putHandler = putHandler;
7193  params.addChunk = addChunk;
7194  params.execute = execute;
7195  params.finalize = finalize;
7196 
7197  context->InvokeService(context, _OrthancPluginService_RegisterChunkedRestCallback, &params);
7198  }
7199 
7200 
7201 
7202 
7203 
7204  typedef struct
7205  {
7206  char** result;
7207  uint16_t group;
7208  uint16_t element;
7209  const char* privateCreator;
7210  } _OrthancPluginGetTagName;
7211 
7227  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetTagName(
7228  OrthancPluginContext* context,
7229  uint16_t group,
7230  uint16_t element,
7231  const char* privateCreator)
7232  {
7233  char* result;
7234 
7235  _OrthancPluginGetTagName params;
7236  params.result = &result;
7237  params.group = group;
7238  params.element = element;
7239  params.privateCreator = privateCreator;
7240 
7241  if (context->InvokeService(context, _OrthancPluginService_GetTagName, &params) != OrthancPluginErrorCode_Success)
7242  {
7243  /* Error */
7244  return NULL;
7245  }
7246  else
7247  {
7248  return result;
7249  }
7250  }
7251 
7252 
7253 
7254 #ifdef __cplusplus
7255 }
7256 #endif
7257 
7258 
Definition: OrthancCPlugin.h:740
const char * OrthancPluginGetInstanceRemoteAet(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the AET of a DICOM instance.
Definition: OrthancCPlugin.h:2669
Definition: OrthancCPlugin.h:842
int OrthancPluginHasInstanceMetadata(OrthancPluginContext *context, OrthancPluginDicomInstance *instance, const char *metadata)
Check whether a DICOM instance is associated with some metadata.
Definition: OrthancCPlugin.h:2848
OrthancPluginChangeType
Definition: OrthancCPlugin.h:695
Definition: OrthancCPlugin.h:239
void OrthancPluginSendHttpStatusCode(OrthancPluginContext *context, OrthancPluginRestOutput *output, uint16_t status)
Send a HTTP status code.
Definition: OrthancCPlugin.h:2532
void OrthancPluginFreePeers(OrthancPluginContext *context, OrthancPluginPeers *peers)
Free the list of available Orthanc peers.
Definition: OrthancCPlugin.h:6103
struct _OrthancPluginRestOutput_t OrthancPluginRestOutput
Opaque structure that represents the HTTP connection to the client application.
Definition: OrthancCPlugin.h:963
OrthancPluginErrorCode OrthancPluginFindAddAnswer(OrthancPluginContext *context, OrthancPluginFindAnswers *answers, const void *dicom, uint32_t size)
Add one answer to some C-Find request.
Definition: OrthancCPlugin.h:5682
void OrthancPluginSetHttpHeader(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *key, const char *value)
Set some HTTP header.
Definition: OrthancCPlugin.h:2633
Definition: OrthancCPlugin.h:763
Definition: OrthancCPlugin.h:931
Definition: OrthancCPlugin.h:275
void OrthancPluginLogInfo(OrthancPluginContext *context, const char *message)
Log an information.
Definition: OrthancCPlugin.h:1799
OrthancPluginErrorCode OrthancPluginRegisterDecodeImageCallback(OrthancPluginContext *context, OrthancPluginDecodeImageCallback callback)
Register a callback to handle the decoding of DICOM images.
Definition: OrthancCPlugin.h:5140
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:5549
Definition: OrthancCPlugin.h:843
The parameters of a REST request.
Definition: OrthancCPlugin.h:335
void OrthancPluginRedirect(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *redirection)
Redirect a REST request.
Definition: OrthancCPlugin.h:2315
OrthancPluginContentType
Definition: OrthancCPlugin.h:664
OrthancPluginErrorCode OrthancPluginRestApiDeleteAfterPlugins(OrthancPluginContext *context, const char *uri)
Make a DELETE call to the REST API, as tainted by the plugins.
Definition: OrthancCPlugin.h:2220
Definition: OrthancCPlugin.h:681
OrthancPluginErrorCode(* OrthancPluginChunkedClientRequestNext)(void *request)
Callback to advance in the request body during a chunked transfer.
Definition: OrthancCPlugin.h:6883
Definition: OrthancCPlugin.h:762
struct _OrthancPluginDicomWebNode_t OrthancPluginDicomWebNode
Opaque structure that represents a node in a JSON or XML document used in DICOMweb.
Definition: OrthancCPlugin.h:1051
Definition: OrthancCPlugin.h:874
const char * OrthancPluginGetInstanceData(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the data of a DICOM file.
Definition: OrthancCPlugin.h:2735
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:3916
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:4008
OrthancPluginJobStepStatus
Definition: OrthancCPlugin.h:884
int OrthancPluginCheckVersion(OrthancPluginContext *context)
Check the compatibility of the plugin wrt. the version of its hosting Orthanc.
Definition: OrthancCPlugin.h:1732
void OrthancPluginSetHttpErrorDetails(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *details, uint8_t log)
Provide a detailed description for an HTTP error.
Definition: OrthancCPlugin.h:6601
Definition: OrthancCPlugin.h:267
Definition: OrthancCPlugin.h:209
Definition: OrthancCPlugin.h:265
OrthancPluginInstanceOrigin
Definition: OrthancCPlugin.h:869
const char *(* OrthancPluginJobGetContent)(void *job)
Callback to retrieve the content of one custom job.
Definition: OrthancCPlugin.h:1412
Definition: OrthancCPlugin.h:760
Definition: OrthancCPlugin.h:902
int64_t OrthancPluginGetInstanceSize(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the size of a DICOM file.
Definition: OrthancCPlugin.h:2702
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:4656
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:2168
Definition: OrthancCPlugin.h:290
Graylevel, unsigned 16bpp image.
Definition: OrthancCPlugin.h:588
Definition: OrthancCPlugin.h:710
Definition: OrthancCPlugin.h:231
const char *const * headersValues
The values of the HTTP headers.
Definition: OrthancCPlugin.h:395
Definition: OrthancCPlugin.h:277
Definition: OrthancCPlugin.h:279
const char *const * headersKeys
The keys of the HTTP headers (always converted to low-case).
Definition: OrthancCPlugin.h:390
Definition: OrthancCPlugin.h:263
OrthancPluginCreateDicomFlags
Definition: OrthancCPlugin.h:824
char * OrthancPluginComputeSha1(OrthancPluginContext *context, const void *buffer, uint32_t size)
Compute a SHA-1 hash.
Definition: OrthancCPlugin.h:5348
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:6433
Definition: OrthancCPlugin.h:281
OrthancPluginPixelFormat
Definition: OrthancCPlugin.h:572
Definition: OrthancCPlugin.h:875
uint32_t getCount
For a GET request, the number of GET parameters.
Definition: OrthancCPlugin.h:355
char * OrthancPluginSubmitJob(OrthancPluginContext *context, OrthancPluginJob *job, int priority)
Submit a new job to the jobs engine of Orthanc.
Definition: OrthancCPlugin.h:6520
Definition: OrthancCPlugin.h:614
void OrthancPluginRegisterStorageArea(OrthancPluginContext *context, OrthancPluginStorageCreate create, OrthancPluginStorageRead read, OrthancPluginStorageRemove remove)
Register a custom storage area.
Definition: OrthancCPlugin.h:2934
const char * OrthancPluginAutodetectMimeType(OrthancPluginContext *context, const char *path)
Detect the MIME type of a file.
Definition: OrthancCPlugin.h:6633
Definition: OrthancCPlugin.h:858
OrthancPluginErrorCode OrthancPluginGetDicomForInstance(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *instanceId)
Retrieve a DICOM instance using its Orthanc identifier.
Definition: OrthancCPlugin.h:2033
struct _OrthancPluginServerChunkedRequestReader_t OrthancPluginServerChunkedRequestReader
Opaque structure that reads the content of a HTTP request body during a chunked HTTP transfer...
Definition: OrthancCPlugin.h:7055
OrthancPluginImageFormat
Definition: OrthancCPlugin.h:737
Definition: OrthancCPlugin.h:217
Definition: OrthancCPlugin.h:303
void OrthancPluginFreeString(OrthancPluginContext *context, char *str)
Free a string.
Definition: OrthancCPlugin.h:1598
Definition: OrthancCPlugin.h:287
const char * OrthancPluginGetFontName(OrthancPluginContext *context, uint32_t fontIndex)
Return the name of a font.
Definition: OrthancCPlugin.h:4292
Definition: OrthancCPlugin.h:237
Definition: OrthancCPlugin.h:293
Definition: OrthancCPlugin.h:285
Definition: OrthancCPlugin.h:323
Definition: OrthancCPlugin.h:228
char * OrthancPluginComputeMd5(OrthancPluginContext *context, const void *buffer, uint32_t size)
Compute an MD5 hash.
Definition: OrthancCPlugin.h:5312
Definition: OrthancCPlugin.h:886
Definition: OrthancCPlugin.h:230
OrthancPluginErrorCode
Definition: OrthancCPlugin.h:203
struct _OrthancPluginJob_t OrthancPluginJob
Opaque structure to a job to be executed by Orthanc.
Definition: OrthancCPlugin.h:1042
OrthancPluginImage * OrthancPluginConvertPixelFormat(OrthancPluginContext *context, const OrthancPluginImage *source, OrthancPluginPixelFormat targetFormat)
Change the pixel format of an image.
Definition: OrthancCPlugin.h:4217
Definition: OrthancCPlugin.h:288
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:1189
Definition: OrthancCPlugin.h:704
OrthancPluginErrorCode OrthancPluginStorageAreaRead(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, OrthancPluginStorageArea *storageArea, const char *uuid, OrthancPluginContentType type)
Read a file from the storage area.
Definition: OrthancCPlugin.h:4471
uint32_t OrthancPluginGetFontsCount(OrthancPluginContext *context)
Return the number of available fonts.
Definition: OrthancCPlugin.h:4252
char * OrthancPluginGetConfigurationPath(OrthancPluginContext *context)
Return the path to the configuration file(s).
Definition: OrthancCPlugin.h:3031
Definition: OrthancCPlugin.h:226
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:5772
void OrthancPluginRegisterOnChangeCallback(OrthancPluginContext *context, OrthancPluginOnChangeCallback callback)
Register a callback to monitor changes.
Definition: OrthancCPlugin.h:3073
Color image in RGBA32 format.
Definition: OrthancCPlugin.h:612
Definition: OrthancCPlugin.h:808
OrthancPluginDicomToJsonFlags
Definition: OrthancCPlugin.h:805
Definition: OrthancCPlugin.h:903
Definition: OrthancCPlugin.h:219
void OrthancPluginSendMethodNotAllowed(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *allowedMethods)
Signal that this URI does not support this HTTP method.
Definition: OrthancCPlugin.h:2578
Definition: OrthancCPlugin.h:724
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:2245
char * OrthancPluginGenerateUuid(OrthancPluginContext *context)
Generate an UUID.
Definition: OrthancCPlugin.h:5604
float(* OrthancPluginJobGetProgress)(void *job)
Callback to check the progress of one custom job.
Definition: OrthancCPlugin.h:1397
Definition: OrthancCPlugin.h:712
uint8_t(* OrthancPluginChunkedClientRequestIsDone)(void *request)
Callback to know whether the request body is entirely read during a chunked transfer.
Definition: OrthancCPlugin.h:6866
Definition: OrthancCPlugin.h:901
Definition: OrthancCPlugin.h:698
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:5266
Definition: OrthancCPlugin.h:264
OrthancPluginDicomToJsonFormat
Definition: OrthancCPlugin.h:790
OrthancPluginErrorCode OrthancPluginLookupDictionary(OrthancPluginContext *context, OrthancPluginDictionaryEntry *target, const char *name)
Get information about the given DICOM tag.
Definition: OrthancCPlugin.h:5394
OrthancPluginErrorCode(* OrthancPluginJobStop)(void *job, OrthancPluginJobStopReason reason)
Callback executed once one custom job leaves the "running" state.
Definition: OrthancCPlugin.h:1469
Definition: OrthancCPlugin.h:792
const void *(* OrthancPluginChunkedClientRequestGetChunkData)(void *request)
Callback to read the current chunk of the request body during a chunked transfer. ...
Definition: OrthancCPlugin.h:6899
OrthancPluginErrorCode OrthancPluginRegisterErrorCode(OrthancPluginContext *context, int32_t code, uint16_t httpStatus, const char *message)
Declare a custom error code for this plugin.
Definition: OrthancCPlugin.h:4547
Definition: OrthancCPlugin.h:245
uint16_t group
Definition: OrthancCPlugin.h:1581
void * OrthancPluginGetImageBuffer(OrthancPluginContext *context, const OrthancPluginImage *image)
Return a pointer to the content of an image.
Definition: OrthancCPlugin.h:3786
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:1216
Definition: OrthancCPlugin.h:753
uint32_t minMultiplicity
Definition: OrthancCPlugin.h:1584
Definition: OrthancCPlugin.h:794
Definition: OrthancCPlugin.h:765
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:4925
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:4141
const char * OrthancPluginGetInstanceMetadata(OrthancPluginContext *context, OrthancPluginDicomInstance *instance, const char *metadata)
Get the value of some metadata associated with a given DICOM instance.
Definition: OrthancCPlugin.h:2886
Definition: OrthancCPlugin.h:900
OrthancPluginJobStopReason
Definition: OrthancCPlugin.h:898
struct _OrthancPluginWorklistQuery_t OrthancPluginWorklistQuery
Opaque structure to an object that represents a C-Find query for worklists.
Definition: OrthancCPlugin.h:994
Definition: OrthancCPlugin.h:739
Definition: OrthancCPlugin.h:257
struct _OrthancPluginStorageArea_t OrthancPluginStorageArea
Opaque structure that represents the storage area that is actually used by Orthanc.
Definition: OrthancCPlugin.h:986
Definition: OrthancCPlugin.h:249
Definition: OrthancCPlugin.h:666
Definition: OrthancCPlugin.h:702
Color image in RGB48 format.
Definition: OrthancCPlugin.h:622
uint32_t OrthancPluginGetExpectedDatabaseVersion(OrthancPluginContext *context)
Get the expected version of the database schema.
Definition: OrthancCPlugin.h:3318
Definition: OrthancCPlugin.h:280
Graylevel 8bpp image.
Definition: OrthancCPlugin.h:580
Definition: OrthancCPlugin.h:278
Definition: OrthancCPlugin.h:220
OrthancPluginConstraintType
Definition: OrthancCPlugin.h:854
OrthancPluginResourceType
Definition: OrthancCPlugin.h:678
OrthancPluginHttpMethod
Definition: OrthancCPlugin.h:320
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:1113
Definition: OrthancCPlugin.h:236
uint32_t OrthancPluginGetImageHeight(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the height of an image.
Definition: OrthancCPlugin.h:3717
OrthancPluginValueRepresentation
Definition: OrthancCPlugin.h:751
char * OrthancPluginGetConfiguration(OrthancPluginContext *context)
Return the content of the configuration file(s).
Definition: OrthancCPlugin.h:3351
Definition: OrthancCPlugin.h:207
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:3615
OrthancPluginImage * OrthancPluginUncompressImage(OrthancPluginContext *context, const void *data, uint32_t size, OrthancPluginImageFormat format)
Decode a compressed image.
Definition: OrthancCPlugin.h:3829
Definition: OrthancCPlugin.h:283
Definition: OrthancCPlugin.h:755
Definition: OrthancCPlugin.h:223
char * OrthancPluginEncodeDicomWebXml(OrthancPluginContext *context, const void *dicom, uint32_t dicomSize, OrthancPluginDicomWebBinaryCallback callback)
Convert a DICOM instance to DICOMweb XML.
Definition: OrthancCPlugin.h:6783
Definition: OrthancCPlugin.h:683
OrthancPluginErrorCode(* OrthancPluginRestCallback)(OrthancPluginRestOutput *output, const char *url, const OrthancPluginHttpRequest *request)
Signature of a callback function that answers to a REST request.
Definition: OrthancCPlugin.h:1059
Definition: OrthancCPlugin.h:274
Definition: OrthancCPlugin.h:725
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:1247
Definition: OrthancCPlugin.h:758
Definition: OrthancCPlugin.h:291
Definition: OrthancCPlugin.h:888
void OrthancPluginSetMetricsValue(OrthancPluginContext *context, const char *name, float value, OrthancPluginMetricsType type)
Set the value of a metrics.
Definition: OrthancCPlugin.h:6677
char * OrthancPluginGetOrthancDirectory(OrthancPluginContext *context)
Return the directory containing the Orthanc.
Definition: OrthancCPlugin.h:2996
Definition: OrthancCPlugin.h:241
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:2133
Definition: OrthancCPlugin.h:727
Definition: OrthancCPlugin.h:777
Definition: OrthancCPlugin.h:266
Color image in RGB24 format.
Definition: OrthancCPlugin.h:604
OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter2(OrthancPluginContext *context, OrthancPluginIncomingHttpRequestFilter2 callback)
Register a callback to filter incoming HTTP requests.
Definition: OrthancCPlugin.h:6041
Graylevel, signed 16bpp image.
Definition: OrthancCPlugin.h:596
Definition: OrthancCPlugin.h:912
An entry in the dictionary of DICOM tags.
Definition: OrthancCPlugin.h:1579
Definition: OrthancCPlugin.h:276
Definition: OrthancCPlugin.h:213
Definition: OrthancCPlugin.h:697
OrthancPluginCompressionType
Definition: OrthancCPlugin.h:722
Definition: OrthancCPlugin.h:205
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:4851
Definition: OrthancCPlugin.h:811
struct _OrthancPluginPeers_t OrthancPluginPeers
Opaque structure to the set of remote Orthanc Peers that are known to the local Orthanc server...
Definition: OrthancCPlugin.h:1034
OrthancPluginPixelFormat OrthancPluginGetImagePixelFormat(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the pixel format of an image.
Definition: OrthancCPlugin.h:3651
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:4377
uint32_t OrthancPluginGetImagePitch(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the pitch of an image.
Definition: OrthancCPlugin.h:3752
Definition: OrthancCPlugin.h:667
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:1992
Definition: OrthancCPlugin.h:296
Definition: OrthancCPlugin.h:302
OrthancPluginJobStepStatus(* OrthancPluginJobStep)(void *job)
Callback to execute one step of a custom job.
Definition: OrthancCPlugin.h:1445
uint32_t maxMultiplicity
Definition: OrthancCPlugin.h:1585
Definition: OrthancCPlugin.h:930
Definition: OrthancCPlugin.h:295
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:1091
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:4744
void(* OrthancPluginFree)(void *buffer)
Signature of a function to free dynamic memory.
Definition: OrthancCPlugin.h:1103
Definition: OrthancCPlugin.h:859
uint32_t OrthancPluginGetCommandLineArgumentsCount(OrthancPluginContext *context)
Get the number of command-line arguments.
Definition: OrthancCPlugin.h:3252
Definition: OrthancCPlugin.h:247
void OrthancPluginSendUnauthorized(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *realm)
Signal that a REST request is not authorized.
Definition: OrthancCPlugin.h:2555
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:6348
Definition: OrthancCPlugin.h:215
Graylevel, unsigned 64bpp image.
Definition: OrthancCPlugin.h:654
Definition: OrthancCPlugin.h:272
Definition: OrthancCPlugin.h:260
void OrthancPluginFreeFindMatcher(OrthancPluginContext *context, OrthancPluginFindMatcher *matcher)
Free a C-Find matcher.
Definition: OrthancCPlugin.h:5966
Definition: OrthancCPlugin.h:292
void OrthancPluginLogError(OrthancPluginContext *context, const char *message)
Log an error.
Definition: OrthancCPlugin.h:1767
Definition: OrthancCPlugin.h:234
OrthancPluginFindMatcher * OrthancPluginCreateFindMatcher(OrthancPluginContext *context, const void *query, uint32_t size)
Create a C-Find matcher.
Definition: OrthancCPlugin.h:5928
void * data
The content of the buffer.
Definition: OrthancCPlugin.h:948
uint32_t OrthancPluginGetFontSize(OrthancPluginContext *context, uint32_t fontIndex)
Return the size of a font.
Definition: OrthancCPlugin.h:4324
void OrthancPluginExtendOrthancExplorer(OrthancPluginContext *context, const char *javascript)
Extend the JavaScript code of Orthanc Explorer.
Definition: OrthancCPlugin.h:3148
Definition: OrthancCPlugin.h:873
void(* OrthancPluginRefreshMetricsCallback)()
Callback executed to update the metrics of the plugin.
Definition: OrthancCPlugin.h:1520
OrthancPluginErrorCode OrthancPluginRestApiGet(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri)
Make a GET call to the built-in Orthanc REST API.
Definition: OrthancCPlugin.h:2066
const char * OrthancPluginGetErrorDescription(OrthancPluginContext *context, OrthancPluginErrorCode error)
Get the description of a given error code.
Definition: OrthancCPlugin.h:3562
uint32_t headersCount
The number of HTTP headers.
Definition: OrthancCPlugin.h:385
Definition: OrthancCPlugin.h:703
Definition: OrthancCPlugin.h:810
void OrthancPluginFreeMemoryBuffer(OrthancPluginContext *context, OrthancPluginMemoryBuffer *buffer)
Free a memory buffer.
Definition: OrthancCPlugin.h:1751
OrthancPluginErrorCode OrthancPluginRegisterWorklistCallback(OrthancPluginContext *context, OrthancPluginWorklistCallback callback)
Register a callback to handle modality worklists requests.
Definition: OrthancCPlugin.h:4889
OrthancPluginErrorCode(* OrthancPluginStorageCreate)(const char *uuid, const void *content, int64_t size, OrthancPluginContentType type)
Callback for writing to the storage area.
Definition: OrthancCPlugin.h:1132
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:1317
Definition: OrthancCPlugin.h:771
OrthancPluginErrorCode OrthancPluginRestApiDelete(OrthancPluginContext *context, const char *uri)
Make a DELETE call to the built-in Orthanc REST API.
Definition: OrthancCPlugin.h:2197
Definition: OrthancCPlugin.h:775
Definition: OrthancCPlugin.h:682
OrthancPluginErrorCode OrthancPluginReadFile(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *path)
Read a file.
Definition: OrthancCPlugin.h:3500
Definition: OrthancCPlugin.h:764
Definition: OrthancCPlugin.h:844
struct _OrthancPluginFindAnswers_t OrthancPluginFindAnswers
Opaque structure to an object that represents the answers to a C-Find query for worklists.
Definition: OrthancCPlugin.h:1018
OrthancPluginErrorCode OrthancPluginRegisterMoveCallback(OrthancPluginContext *context, OrthancPluginMoveCallback callback, OrthancPluginGetMoveSize getMoveSize, OrthancPluginApplyMove applyMove, OrthancPluginFreeMove freeMove)
Register a callback to handle C-Move requests.
Definition: OrthancCPlugin.h:5889
Definition: OrthancCPlugin.h:324
Definition: OrthancCPlugin.h:711
OrthancPluginImage * OrthancPluginCreateImage(OrthancPluginContext *context, OrthancPluginPixelFormat format, uint32_t width, uint32_t height)
Create an image.
Definition: OrthancCPlugin.h:5178
Definition: OrthancCPlugin.h:766
Definition: OrthancCPlugin.h:252
char * OrthancPluginGetOrthancPath(OrthancPluginContext *context)
Return the path to the Orthanc executable.
Definition: OrthancCPlugin.h:2966
char * OrthancPluginGetGlobalProperty(OrthancPluginContext *context, int32_t property, const char *defaultValue)
Get the value of a global property.
Definition: OrthancCPlugin.h:3182
Definition: OrthancCPlugin.h:860
OrthancPluginErrorCode OrthancPluginSendMultipartItem2(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *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:5437
OrthancPluginErrorCode(* OrthancPluginStorageRemove)(const char *uuid, OrthancPluginContentType type)
Callback for removing a file from the storage area.
Definition: OrthancCPlugin.h:1170
Definition: OrthancCPlugin.h:793
Definition: OrthancCPlugin.h:261
Definition: OrthancCPlugin.h:299
Definition: OrthancCPlugin.h:322
Definition: OrthancCPlugin.h:919
Definition: OrthancCPlugin.h:705
Definition: OrthancCPlugin.h:304
OrthancPluginErrorCode OrthancPluginReconstructMainDicomTags(OrthancPluginContext *context, OrthancPluginStorageArea *storageArea, OrthancPluginResourceType level)
Reconstruct the main DICOM tags.
Definition: OrthancCPlugin.h:4700
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:5803
void OrthancPluginRegisterJobsUnserializer(OrthancPluginContext *context, OrthancPluginJobsUnserializer unserializer)
Register an unserializer for custom jobs.
Definition: OrthancCPlugin.h:6565
char * OrthancPluginGetCommandLineArgument(OrthancPluginContext *context, uint32_t argument)
Get the value of a command-line argument.
Definition: OrthancCPlugin.h:3286
OrthancPluginErrorCode OrthancPluginHttpGet(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *url, const char *username, const char *password)
Issue a HTTP GET call.
Definition: OrthancCPlugin.h:4061
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:5221
Definition: OrthancCPlugin.h:269
OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter(OrthancPluginContext *context, OrthancPluginIncomingHttpRequestFilter callback)
Register a callback to filter incoming HTTP requests.
Definition: OrthancCPlugin.h:5475
Definition: OrthancCPlugin.h:227
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:4793
const char *const * getValues
For a GET request, the values of the GET parameters.
Definition: OrthancCPlugin.h:365
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:6268
Definition: OrthancCPlugin.h:778
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:1080
OrthancPluginPeers * OrthancPluginGetPeers(OrthancPluginContext *context)
Return the list of available Orthanc peers.
Definition: OrthancCPlugin.h:6069
char * OrthancPluginGetInstanceSimplifiedJson(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the DICOM tag hierarchy as a JSON file (with simplification).
Definition: OrthancCPlugin.h:2809
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:3463
Definition: OrthancCPlugin.h:262
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:6846
OrthancPluginErrorCode OrthancPluginWorklistMarkIncomplete(OrthancPluginContext *context, OrthancPluginWorklistAnswers *answers)
Mark the set of worklist answers as incomplete.
Definition: OrthancCPlugin.h:4955
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:5107
Definition: OrthancCPlugin.h:255
Definition: OrthancCPlugin.h:741
Definition: OrthancCPlugin.h:214
Definition: OrthancCPlugin.h:268
Definition: OrthancCPlugin.h:221
void OrthancPluginRegisterRestCallbackNoLock(OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback callback)
Register a REST callback, without locking.
Definition: OrthancCPlugin.h:1875
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:4099
OrthancPluginErrorCode(* OrthancPluginFindCallback)(OrthancPluginFindAnswers *answers, const OrthancPluginFindQuery *query, const char *issuerAet, const char *calledAet)
Callback to handle incoming C-Find SCP requests.
Definition: OrthancCPlugin.h:1274
Definition: OrthancCPlugin.h:708
OrthancPluginErrorCode OrthancPluginRegisterFindCallback(OrthancPluginContext *context, OrthancPluginFindCallback callback)
Register a callback to handle C-Find requests.
Definition: OrthancCPlugin.h:5643
struct _OrthancPluginImage_t OrthancPluginImage
Opaque structure that represents an image that is uncompressed in memory.
Definition: OrthancCPlugin.h:978
OrthancPluginErrorCode OrthancPluginStartMultipartAnswer(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *subType, const char *contentType)
Start an HTTP multipart answer.
Definition: OrthancCPlugin.h:3392
struct _OrthancPluginWorklistAnswers_t OrthancPluginWorklistAnswers
Opaque structure to an object that represents the answers to a C-Find query for worklists.
Definition: OrthancCPlugin.h:1002
Definition: OrthancCPlugin.h:206
Definition: OrthancCPlugin.h:232
Definition: OrthancCPlugin.h:225
Definition: OrthancCPlugin.h:841
Definition: OrthancCPlugin.h:300
Definition: OrthancCPlugin.h:271
void(* OrthancPluginFreeMove)(void *moveDriver)
Callback to free one C-Move driver.
Definition: OrthancCPlugin.h:1371
void OrthancPluginSetRootUri(OrthancPluginContext *context, const char *uri)
Set the URI where the plugin provides its Web interface.
Definition: OrthancCPlugin.h:3104
const char *(* OrthancPluginJobGetSerialized)(void *job)
Callback to serialize one custom job.
Definition: OrthancCPlugin.h:1430
OrthancPluginErrorCode OrthancPluginStorageAreaRemove(OrthancPluginContext *context, OrthancPluginStorageArea *storageArea, const char *uuid, OrthancPluginContentType type)
Remove a file from the storage area.
Definition: OrthancCPlugin.h:4508
Definition: OrthancCPlugin.h:887
void OrthancPluginFreeJob(OrthancPluginContext *context, OrthancPluginJob *job)
Free a custom job.
Definition: OrthancCPlugin.h:6488
Definition: OrthancCPlugin.h:770
Definition: OrthancCPlugin.h:709
const char *const * getKeys
For a GET request, the keys of the GET parameters.
Definition: OrthancCPlugin.h:360
Definition: OrthancCPlugin.h:773
Definition: OrthancCPlugin.h:700
char * OrthancPluginLookupPatient(OrthancPluginContext *context, const char *patientID)
Look for a patient.
Definition: OrthancCPlugin.h:2347
Definition: OrthancCPlugin.h:857
OrthancPluginInstanceOrigin OrthancPluginGetInstanceOrigin(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the origin of a DICOM file.
Definition: OrthancCPlugin.h:5058
Definition: OrthancCPlugin.h:774
void OrthancPluginFreeImage(OrthancPluginContext *context, OrthancPluginImage *image)
Free an image.
Definition: OrthancCPlugin.h:3871
OrthancPluginValueRepresentation vr
Definition: OrthancCPlugin.h:1583
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:6994
uint16_t element
Definition: OrthancCPlugin.h:1582
char * OrthancPluginLookupInstance(OrthancPluginContext *context, const char *sopInstanceUID)
Look for an instance.
Definition: OrthancCPlugin.h:2487
Definition: OrthancCPlugin.h:707
OrthancPluginErrorCode OrthancPluginSetGlobalProperty(OrthancPluginContext *context, int32_t property, const char *value)
Set the value of a global property.
Definition: OrthancCPlugin.h:3221
OrthancPluginErrorCode(* OrthancPluginApplyMove)(void *moveDriver)
Callback to apply one C-Move suboperation.
Definition: OrthancCPlugin.h:1357
Definition: OrthancCPlugin.h:238
Definition: OrthancCPlugin.h:668
OrthancPluginErrorCode OrthancPluginSendMultipartItem(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *answer, uint32_t answerSize)
Send an item as a part of some HTTP multipart answer.
Definition: OrthancCPlugin.h:3421
const char *const * groups
The matched values for the groups of the regular expression.
Definition: OrthancCPlugin.h:350
OrthancPluginErrorCode OrthancPluginWriteFile(OrthancPluginContext *context, const char *path, const void *data, uint32_t size)
Write a file.
Definition: OrthancCPlugin.h:3531
Definition: OrthancCPlugin.h:270
OrthancPluginErrorCode(* OrthancPluginStorageRead)(void **content, int64_t *size, const char *uuid, OrthancPluginContentType type)
Callback for reading from the storage area.
Definition: OrthancCPlugin.h:1152
Definition: OrthancCPlugin.h:273
char * OrthancPluginLookupStudy(OrthancPluginContext *context, const char *studyUID)
Look for a study.
Definition: OrthancCPlugin.h:2382
uint32_t size
The number of bytes in the buffer.
Definition: OrthancCPlugin.h:953
Graylevel, floating-point 32bpp image.
Definition: OrthancCPlugin.h:638
Definition: OrthancCPlugin.h:871
Definition: OrthancCPlugin.h:253
OrthancPluginErrorCode(* OrthancPluginJobReset)(void *job)
Callback executed once one stopped custom job is started again.
Definition: OrthancCPlugin.h:1486
char * OrthancPluginEncodeDicomWebJson(OrthancPluginContext *context, const void *dicom, uint32_t dicomSize, OrthancPluginDicomWebBinaryCallback callback)
Convert a DICOM instance to DICOMweb JSON.
Definition: OrthancCPlugin.h:6742
struct _OrthancPluginDicomInstance_t OrthancPluginDicomInstance
Opaque structure that represents a DICOM instance received by Orthanc.
Definition: OrthancCPlugin.h:970
uint32_t groupsCount
The number of groups of the regular expression.
Definition: OrthancCPlugin.h:345
Definition: OrthancCPlugin.h:254
OrthancPluginErrorCode(* OrthancPluginServerChunkedRequestReaderFactory)(OrthancPluginServerChunkedRequestReader **reader, const char *url, const OrthancPluginHttpRequest *request)
Callback to create a reader to handle incoming chunked HTTP transfers.
Definition: OrthancCPlugin.h:7074
Definition: OrthancCPlugin.h:684
void OrthancPluginLogWarning(OrthancPluginContext *context, const char *message)
Log a warning.
Definition: OrthancCPlugin.h:1783
Definition: OrthancCPlugin.h:929
Definition: OrthancCPlugin.h:759
Definition: OrthancCPlugin.h:259
int32_t OrthancPluginWorklistIsMatch(OrthancPluginContext *context, const OrthancPluginWorklistQuery *query, const void *dicom, uint32_t size)
Test whether a worklist matches the query.
Definition: OrthancCPlugin.h:4993
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:1628
Definition: OrthancCPlugin.h:779
const void * body
For a PUT or POST request, the content of the body.
Definition: OrthancCPlugin.h:370
OrthancPluginErrorCode(* OrthancPluginServerChunkedRequestReaderExecute)(OrthancPluginServerChunkedRequestReader *reader, OrthancPluginRestOutput *output)
Callback invoked whenever the request body is entirely received.
Definition: OrthancCPlugin.h:7113
OrthancPluginIdentifierConstraint
Definition: OrthancCPlugin.h:839
uint32_t bodySize
For a PUT or POST request, the number of bytes of the body.
Definition: OrthancCPlugin.h:375
OrthancPluginErrorCode OrthancPluginFindMarkIncomplete(OrthancPluginContext *context, OrthancPluginFindAnswers *answers)
Mark the set of C-Find answers as incomplete.
Definition: OrthancCPlugin.h:5711
Definition: OrthancCPlugin.h:325
OrthancPluginJob *(* OrthancPluginJobsUnserializer)(const char *jobType, const char *serialized)
Callback executed to unserialize a custom job.
Definition: OrthancCPlugin.h:1502
OrthancPluginMetricsType
Definition: OrthancCPlugin.h:910
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:2281
OrthancPluginDicomWebBinaryMode
Definition: OrthancCPlugin.h:927
Definition: OrthancCPlugin.h:243
void OrthancPluginSetCookie(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *cookie, const char *value)
Set a cookie.
Definition: OrthancCPlugin.h:2608
Definition: OrthancCPlugin.h:699
char * OrthancPluginGetTagName(OrthancPluginContext *context, uint16_t group, uint16_t element, const char *privateCreator)
Returns the symbolic name of a DICOM tag.
Definition: OrthancCPlugin.h:7227
uint32_t OrthancPluginGetPeersCount(OrthancPluginContext *context, const OrthancPluginPeers *peers)
Get the number of Orthanc peers.
Definition: OrthancCPlugin.h:6133
Definition: OrthancCPlugin.h:769
char * OrthancPluginGetInstanceJson(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the DICOM tag hierarchy as a JSON file.
Definition: OrthancCPlugin.h:2771
const char * OrthancPluginGetPeerUrl(OrthancPluginContext *context, const OrthancPluginPeers *peers, uint32_t peerIndex)
Get the base URL of an Orthanc peer.
Definition: OrthancCPlugin.h:6222
uint32_t OrthancPluginGetFindQuerySize(OrthancPluginContext *context, const OrthancPluginFindQuery *query)
Get the number of tags in a C-Find query.
Definition: OrthancCPlugin.h:5735
void OrthancPluginSetDescription(OrthancPluginContext *context, const char *description)
Set a description for this plugin.
Definition: OrthancCPlugin.h:3126
Definition: OrthancCPlugin.h:301
Definition: OrthancCPlugin.h:240
void OrthancPluginRegisterOnStoredInstanceCallback(OrthancPluginContext *context, OrthancPluginOnStoredInstanceCallback callback)
Register a callback for received instances.
Definition: OrthancCPlugin.h:1903
Definition: OrthancCPlugin.h:701
Definition: OrthancCPlugin.h:772
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:4603
Definition: OrthancCPlugin.h:256
Definition: OrthancCPlugin.h:218
Definition: OrthancCPlugin.h:776
Definition: OrthancCPlugin.h:756
Graylevel, unsigned 32bpp image.
Definition: OrthancCPlugin.h:630
Definition: OrthancCPlugin.h:856
void OrthancPluginRegisterRestCallback(OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback callback)
Register a REST callback.
Definition: OrthancCPlugin.h:1835
uint32_t(* OrthancPluginChunkedClientRequestGetChunkSize)(void *request)
Callback to read the size of the current request chunk during a chunked transfer. ...
Definition: OrthancCPlugin.h:6915
char * OrthancPluginLookupStudyWithAccessionNumber(OrthancPluginContext *context, const char *accessionNumber)
Look for a study, using the accession number.
Definition: OrthancCPlugin.h:2417
Definition: OrthancCPlugin.h:768
Definition: OrthancCPlugin.h:754
Definition: OrthancCPlugin.h:210
Definition: OrthancCPlugin.h:680
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:7176
OrthancPluginErrorCode OrthancPluginWorklistGetDicomQuery(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const OrthancPluginWorklistQuery *query)
Retrieve the worklist query as a DICOM file.
Definition: OrthancCPlugin.h:5032
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:2096
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:6825
Definition: OrthancCPlugin.h:872
Definition: OrthancCPlugin.h:229
OrthancPluginErrorCode(* OrthancPluginOnStoredInstanceCallback)(OrthancPluginDicomInstance *instance, const char *instanceId)
Signature of a callback function that is triggered when Orthanc receives a DICOM instance.
Definition: OrthancCPlugin.h:1070
Definition: OrthancCPlugin.h:294
Definition: OrthancCPlugin.h:211
Definition: OrthancCPlugin.h:216
struct _OrthancPluginFindQuery_t OrthancPluginFindQuery
Opaque structure to an object that represents a C-Find query.
Definition: OrthancCPlugin.h:1010
Definition: OrthancCPlugin.h:208
Definition: OrthancCPlugin.h:233
Definition: OrthancCPlugin.h:706
Definition: OrthancCPlugin.h:726
void OrthancPluginRegisterRefreshMetricsCallback(OrthancPluginContext *context, OrthancPluginRefreshMetricsCallback callback)
Register a callback to refresh the metrics.
Definition: OrthancCPlugin.h:6707
Definition: OrthancCPlugin.h:246
Definition: OrthancCPlugin.h:244
OrthancPluginHttpMethod method
The HTTP method.
Definition: OrthancCPlugin.h:340
Definition: OrthancCPlugin.h:289
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:4429
void OrthancPluginAnswerBuffer(OrthancPluginContext *context, OrthancPluginRestOutput *output, const void *answer, uint32_t answerSize, const char *mimeType)
Answer to a REST request.
Definition: OrthancCPlugin.h:1935
OrthancPluginErrorCode OrthancPluginHttpDelete(OrthancPluginContext *context, const char *url, const char *username, const char *password)
Issue a HTTP DELETE call.
Definition: OrthancCPlugin.h:4179
A memory buffer allocated by the core system of Orthanc.
Definition: OrthancCPlugin.h:943
void(* OrthancPluginServerChunkedRequestReaderFinalize)(OrthancPluginServerChunkedRequestReader *reader)
Callback invoked to release the resources associated with an incoming HTTP chunked transfer...
Definition: OrthancCPlugin.h:7131
const char * OrthancPluginGetPeerName(OrthancPluginContext *context, const OrthancPluginPeers *peers, uint32_t peerIndex)
Get the symbolic name of an Orthanc peer.
Definition: OrthancCPlugin.h:6181
Color image in BGRA32 format.
Definition: OrthancCPlugin.h:646
Definition: OrthancCPlugin.h:761
Definition: OrthancCPlugin.h:809
Definition: OrthancCPlugin.h:222
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:5999
Definition: OrthancCPlugin.h:767
void(* OrthancPluginJobFinalize)(void *job)
Callback to finalize one custom job.
Definition: OrthancCPlugin.h:1384
char * OrthancPluginLookupSeries(OrthancPluginContext *context, const char *seriesUID)
Look for a series.
Definition: OrthancCPlugin.h:2452
Definition: OrthancCPlugin.h:212
uint32_t(* OrthancPluginGetMoveSize)(void *moveDriver)
Callback to read the size of a C-Move driver.
Definition: OrthancCPlugin.h:1342
Definition: OrthancCPlugin.h:757
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:1548
Definition: OrthancCPlugin.h:282
uint32_t OrthancPluginGetImageWidth(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the width of an image.
Definition: OrthancCPlugin.h:3684
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:7093
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:3961
struct _OrthancPluginFindAnswers_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:1026
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:5841
Definition: OrthancCPlugin.h:242
Definition: OrthancCPlugin.h:235