Orthanc Plugin SDK  1.3.0
Documentation of the plugin interface of Orthanc
OrthancCPlugin.h
1 
107 #pragma once
108 
109 
110 #include <stdio.h>
111 #include <string.h>
112 
113 #ifdef WIN32
114 #define ORTHANC_PLUGINS_API __declspec(dllexport)
115 #else
116 #define ORTHANC_PLUGINS_API
117 #endif
118 
119 #define ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER 1
120 #define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER 3
121 #define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 0
122 
123 
124 
125 /********************************************************************
126  ** Check that function inlining is properly supported. The use of
127  ** inlining is required, to avoid the duplication of object code
128  ** between two compilation modules that would use the Orthanc Plugin
129  ** API.
130  ********************************************************************/
131 
132 /* If the auto-detection of the "inline" keyword below does not work
133  automatically and that your compiler is known to properly support
134  inlining, uncomment the following #define and adapt the definition
135  of "static inline". */
136 
137 /* #define ORTHANC_PLUGIN_INLINE static inline */
138 
139 #ifndef ORTHANC_PLUGIN_INLINE
140 # if __STDC_VERSION__ >= 199901L
141 /* This is C99 or above: http://predef.sourceforge.net/prestd.html */
142 # define ORTHANC_PLUGIN_INLINE static inline
143 # elif defined(__cplusplus)
144 /* This is C++ */
145 # define ORTHANC_PLUGIN_INLINE static inline
146 # elif defined(__GNUC__)
147 /* This is GCC running in C89 mode */
148 # define ORTHANC_PLUGIN_INLINE static __inline
149 # elif defined(_MSC_VER)
150 /* This is Visual Studio running in C89 mode */
151 # define ORTHANC_PLUGIN_INLINE static __inline
152 # else
153 # error Your compiler is not known to support the "inline" keyword
154 # endif
155 #endif
156 
157 
158 
159 /********************************************************************
160  ** Inclusion of standard libraries.
161  ********************************************************************/
162 
168 #include <stdint.h>
169 
170 #include <stdlib.h>
171 
172 
173 
174 /********************************************************************
175  ** Definition of the Orthanc Plugin API.
176  ********************************************************************/
177 
180 #ifdef __cplusplus
181 extern "C"
182 {
183 #endif
184 
188  typedef enum
189  {
286 
287  _OrthancPluginErrorCode_INTERNAL = 0x7fffffff
289 
290 
295  ORTHANC_PLUGINS_API const char* OrthancPluginGetName();
296 
297 
301  typedef enum
302  {
308  _OrthancPluginHttpMethod_INTERNAL = 0x7fffffff
310 
311 
316  typedef struct
317  {
322 
326  uint32_t groupsCount;
327 
331  const char* const* groups;
332 
336  uint32_t getCount;
337 
341  const char* const* getKeys;
342 
346  const char* const* getValues;
347 
351  const char* body;
352 
356  uint32_t bodySize;
357 
358 
359  /* --------------------------------------------------
360  New in version 0.8.1
361  -------------------------------------------------- */
362 
366  uint32_t headersCount;
367 
371  const char* const* headersKeys;
372 
376  const char* const* headersValues;
377 
379 
380 
381  typedef enum
382  {
383  /* Generic services */
384  _OrthancPluginService_LogInfo = 1,
385  _OrthancPluginService_LogWarning = 2,
386  _OrthancPluginService_LogError = 3,
387  _OrthancPluginService_GetOrthancPath = 4,
388  _OrthancPluginService_GetOrthancDirectory = 5,
389  _OrthancPluginService_GetConfigurationPath = 6,
390  _OrthancPluginService_SetPluginProperty = 7,
391  _OrthancPluginService_GetGlobalProperty = 8,
392  _OrthancPluginService_SetGlobalProperty = 9,
393  _OrthancPluginService_GetCommandLineArgumentsCount = 10,
394  _OrthancPluginService_GetCommandLineArgument = 11,
395  _OrthancPluginService_GetExpectedDatabaseVersion = 12,
396  _OrthancPluginService_GetConfiguration = 13,
397  _OrthancPluginService_BufferCompression = 14,
398  _OrthancPluginService_ReadFile = 15,
399  _OrthancPluginService_WriteFile = 16,
400  _OrthancPluginService_GetErrorDescription = 17,
401  _OrthancPluginService_CallHttpClient = 18,
402  _OrthancPluginService_RegisterErrorCode = 19,
403  _OrthancPluginService_RegisterDictionaryTag = 20,
404  _OrthancPluginService_DicomBufferToJson = 21,
405  _OrthancPluginService_DicomInstanceToJson = 22,
406  _OrthancPluginService_CreateDicom = 23,
407  _OrthancPluginService_ComputeMd5 = 24,
408  _OrthancPluginService_ComputeSha1 = 25,
409  _OrthancPluginService_LookupDictionary = 26,
410  _OrthancPluginService_CallHttpClient2 = 27,
411  _OrthancPluginService_GenerateUuid = 28,
412  _OrthancPluginService_RegisterPrivateDictionaryTag = 29,
413 
414  /* Registration of callbacks */
415  _OrthancPluginService_RegisterRestCallback = 1000,
416  _OrthancPluginService_RegisterOnStoredInstanceCallback = 1001,
417  _OrthancPluginService_RegisterStorageArea = 1002,
418  _OrthancPluginService_RegisterOnChangeCallback = 1003,
419  _OrthancPluginService_RegisterRestCallbackNoLock = 1004,
420  _OrthancPluginService_RegisterWorklistCallback = 1005,
421  _OrthancPluginService_RegisterDecodeImageCallback = 1006,
422  _OrthancPluginService_RegisterIncomingHttpRequestFilter = 1007,
423  _OrthancPluginService_RegisterFindCallback = 1008,
424  _OrthancPluginService_RegisterMoveCallback = 1009,
425  _OrthancPluginService_RegisterIncomingHttpRequestFilter2 = 1010,
426 
427  /* Sending answers to REST calls */
428  _OrthancPluginService_AnswerBuffer = 2000,
429  _OrthancPluginService_CompressAndAnswerPngImage = 2001, /* Unused as of Orthanc 0.9.4 */
430  _OrthancPluginService_Redirect = 2002,
431  _OrthancPluginService_SendHttpStatusCode = 2003,
432  _OrthancPluginService_SendUnauthorized = 2004,
433  _OrthancPluginService_SendMethodNotAllowed = 2005,
434  _OrthancPluginService_SetCookie = 2006,
435  _OrthancPluginService_SetHttpHeader = 2007,
436  _OrthancPluginService_StartMultipartAnswer = 2008,
437  _OrthancPluginService_SendMultipartItem = 2009,
438  _OrthancPluginService_SendHttpStatus = 2010,
439  _OrthancPluginService_CompressAndAnswerImage = 2011,
440  _OrthancPluginService_SendMultipartItem2 = 2012,
441 
442  /* Access to the Orthanc database and API */
443  _OrthancPluginService_GetDicomForInstance = 3000,
444  _OrthancPluginService_RestApiGet = 3001,
445  _OrthancPluginService_RestApiPost = 3002,
446  _OrthancPluginService_RestApiDelete = 3003,
447  _OrthancPluginService_RestApiPut = 3004,
448  _OrthancPluginService_LookupPatient = 3005,
449  _OrthancPluginService_LookupStudy = 3006,
450  _OrthancPluginService_LookupSeries = 3007,
451  _OrthancPluginService_LookupInstance = 3008,
452  _OrthancPluginService_LookupStudyWithAccessionNumber = 3009,
453  _OrthancPluginService_RestApiGetAfterPlugins = 3010,
454  _OrthancPluginService_RestApiPostAfterPlugins = 3011,
455  _OrthancPluginService_RestApiDeleteAfterPlugins = 3012,
456  _OrthancPluginService_RestApiPutAfterPlugins = 3013,
457  _OrthancPluginService_ReconstructMainDicomTags = 3014,
458  _OrthancPluginService_RestApiGet2 = 3015,
459 
460  /* Access to DICOM instances */
461  _OrthancPluginService_GetInstanceRemoteAet = 4000,
462  _OrthancPluginService_GetInstanceSize = 4001,
463  _OrthancPluginService_GetInstanceData = 4002,
464  _OrthancPluginService_GetInstanceJson = 4003,
465  _OrthancPluginService_GetInstanceSimplifiedJson = 4004,
466  _OrthancPluginService_HasInstanceMetadata = 4005,
467  _OrthancPluginService_GetInstanceMetadata = 4006,
468  _OrthancPluginService_GetInstanceOrigin = 4007,
469 
470  /* Services for plugins implementing a database back-end */
471  _OrthancPluginService_RegisterDatabaseBackend = 5000,
472  _OrthancPluginService_DatabaseAnswer = 5001,
473  _OrthancPluginService_RegisterDatabaseBackendV2 = 5002,
474  _OrthancPluginService_StorageAreaCreate = 5003,
475  _OrthancPluginService_StorageAreaRead = 5004,
476  _OrthancPluginService_StorageAreaRemove = 5005,
477 
478  /* Primitives for handling images */
479  _OrthancPluginService_GetImagePixelFormat = 6000,
480  _OrthancPluginService_GetImageWidth = 6001,
481  _OrthancPluginService_GetImageHeight = 6002,
482  _OrthancPluginService_GetImagePitch = 6003,
483  _OrthancPluginService_GetImageBuffer = 6004,
484  _OrthancPluginService_UncompressImage = 6005,
485  _OrthancPluginService_FreeImage = 6006,
486  _OrthancPluginService_CompressImage = 6007,
487  _OrthancPluginService_ConvertPixelFormat = 6008,
488  _OrthancPluginService_GetFontsCount = 6009,
489  _OrthancPluginService_GetFontInfo = 6010,
490  _OrthancPluginService_DrawText = 6011,
491  _OrthancPluginService_CreateImage = 6012,
492  _OrthancPluginService_CreateImageAccessor = 6013,
493  _OrthancPluginService_DecodeDicomImage = 6014,
494 
495  /* Primitives for handling C-Find, C-Move and worklists */
496  _OrthancPluginService_WorklistAddAnswer = 7000,
497  _OrthancPluginService_WorklistMarkIncomplete = 7001,
498  _OrthancPluginService_WorklistIsMatch = 7002,
499  _OrthancPluginService_WorklistGetDicomQuery = 7003,
500  _OrthancPluginService_FindAddAnswer = 7004,
501  _OrthancPluginService_FindMarkIncomplete = 7005,
502  _OrthancPluginService_GetFindQuerySize = 7006,
503  _OrthancPluginService_GetFindQueryTag = 7007,
504  _OrthancPluginService_GetFindQueryTagName = 7008,
505  _OrthancPluginService_GetFindQueryValue = 7009,
506  _OrthancPluginService_CreateFindMatcher = 7010,
507  _OrthancPluginService_FreeFindMatcher = 7011,
508  _OrthancPluginService_FindMatcherIsMatch = 7012,
509 
510  _OrthancPluginService_INTERNAL = 0x7fffffff
511  } _OrthancPluginService;
512 
513 
514  typedef enum
515  {
516  _OrthancPluginProperty_Description = 1,
517  _OrthancPluginProperty_RootUri = 2,
518  _OrthancPluginProperty_OrthancExplorer = 3,
519 
520  _OrthancPluginProperty_INTERNAL = 0x7fffffff
521  } _OrthancPluginProperty;
522 
523 
524 
529  typedef enum
530  {
538 
546 
554 
562 
570 
573  _OrthancPluginPixelFormat_INTERNAL = 0x7fffffff
575 
576 
577 
581  typedef enum
582  {
587  _OrthancPluginContentType_INTERNAL = 0x7fffffff
589 
590 
591 
595  typedef enum
596  {
603  _OrthancPluginResourceType_INTERNAL = 0x7fffffff
605 
606 
607 
612  typedef enum
613  {
629  _OrthancPluginChangeType_INTERNAL = 0x7fffffff
631 
632 
637  typedef enum
638  {
644  _OrthancPluginCompressionType_INTERNAL = 0x7fffffff
646 
647 
652  typedef enum
653  {
658  _OrthancPluginImageFormat_INTERNAL = 0x7fffffff
660 
661 
666  typedef enum
667  {
696  _OrthancPluginValueRepresentation_INTERNAL = 0x7fffffff
698 
699 
705  typedef enum
706  {
711  _OrthancPluginDicomToJsonFormat_INTERNAL = 0x7fffffff
713 
714 
720  typedef enum
721  {
722  OrthancPluginDicomToJsonFlags_None = 0,
730  _OrthancPluginDicomToJsonFlags_INTERNAL = 0x7fffffff
732 
733 
739  typedef enum
740  {
741  OrthancPluginCreateDicomFlags_None = 0,
745  _OrthancPluginCreateDicomFlags_INTERNAL = 0x7fffffff
747 
748 
753  typedef enum
754  {
760  _OrthancPluginIdentifierConstraint_INTERNAL = 0x7fffffff
762 
763 
767  typedef enum
768  {
775  _OrthancPluginInstanceOrigin_INTERNAL = 0x7fffffff
777 
778 
786  typedef struct
787  {
791  void* data;
792 
796  uint32_t size;
798 
799 
800 
801 
806  typedef struct _OrthancPluginRestOutput_t OrthancPluginRestOutput;
807 
808 
809 
813  typedef struct _OrthancPluginDicomInstance_t OrthancPluginDicomInstance;
814 
815 
816 
821  typedef struct _OrthancPluginImage_t OrthancPluginImage;
822 
823 
824 
829  typedef struct _OrthancPluginStorageArea_t OrthancPluginStorageArea;
830 
831 
832 
837  typedef struct _OrthancPluginWorklistQuery_t OrthancPluginWorklistQuery;
838 
839 
840 
845  typedef struct _OrthancPluginWorklistAnswers_t OrthancPluginWorklistAnswers;
846 
847 
848 
853  typedef struct _OrthancPluginFindQuery_t OrthancPluginFindQuery;
854 
855 
856 
861  typedef struct _OrthancPluginFindAnswers_t OrthancPluginFindAnswers;
862 
863 
864 
869  typedef struct _OrthancPluginFindAnswers_t OrthancPluginFindMatcher;
870 
871 
872 
878  OrthancPluginRestOutput* output,
879  const char* url,
880  const OrthancPluginHttpRequest* request);
881 
882 
883 
889  OrthancPluginDicomInstance* instance,
890  const char* instanceId);
891 
892 
893 
899  OrthancPluginChangeType changeType,
900  OrthancPluginResourceType resourceType,
901  const char* resourceId);
902 
903 
904 
910  OrthancPluginImage** target,
911  const void* dicom,
912  const uint32_t size,
913  uint32_t frameIndex);
914 
915 
916 
920  typedef void (*OrthancPluginFree) (void* buffer);
921 
922 
923 
937  const char* uuid,
938  const void* content,
939  int64_t size,
941 
942 
943 
957  void** content,
958  int64_t* size,
959  const char* uuid,
961 
962 
963 
975  const char* uuid,
977 
978 
979 
995  const OrthancPluginWorklistQuery* query,
996  const char* issuerAet,
997  const char* calledAet);
998 
999 
1000 
1021  OrthancPluginHttpMethod method,
1022  const char* uri,
1023  const char* ip,
1024  uint32_t headersCount,
1025  const char* const* headersKeys,
1026  const char* const* headersValues);
1027 
1028 
1029 
1052  OrthancPluginHttpMethod method,
1053  const char* uri,
1054  const char* ip,
1055  uint32_t headersCount,
1056  const char* const* headersKeys,
1057  const char* const* headersValues,
1058  uint32_t getArgumentsCount,
1059  const char* const* getArgumentsKeys,
1060  const char* const* getArgumentsValues);
1061 
1062 
1063 
1079  OrthancPluginFindAnswers* answers,
1080  const OrthancPluginFindQuery* query,
1081  const char* issuerAet,
1082  const char* calledAet);
1083 
1084 
1085 
1121  typedef void* (*OrthancPluginMoveCallback) (
1122  OrthancPluginResourceType resourceType,
1123  const char* patientId,
1124  const char* accessionNumber,
1125  const char* studyInstanceUid,
1126  const char* seriesInstanceUid,
1127  const char* sopInstanceUid,
1128  const char* originatorAet,
1129  const char* sourceAet,
1130  const char* targetAet,
1131  uint16_t originatorId);
1132 
1133 
1145  typedef uint32_t (*OrthancPluginGetMoveSize) (void* moveDriver);
1146 
1147 
1159  typedef OrthancPluginErrorCode (*OrthancPluginApplyMove) (void* moveDriver);
1160 
1161 
1172  typedef void (*OrthancPluginFreeMove) (void* moveDriver);
1173 
1174 
1175 
1179  typedef struct _OrthancPluginContext_t
1180  {
1181  void* pluginsManager;
1182  const char* orthancVersion;
1183  OrthancPluginFree Free;
1184  OrthancPluginErrorCode (*InvokeService) (struct _OrthancPluginContext_t* context,
1185  _OrthancPluginService service,
1186  const void* params);
1188 
1189 
1190 
1194  typedef struct
1195  {
1196  uint16_t group;
1197  uint16_t element;
1199  uint32_t minMultiplicity;
1200  uint32_t maxMultiplicity;
1202 
1203 
1204 
1213  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeString(
1214  OrthancPluginContext* context,
1215  char* str)
1216  {
1217  if (str != NULL)
1218  {
1219  context->Free(str);
1220  }
1221  }
1222 
1223 
1237  ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersion(
1238  OrthancPluginContext* context)
1239  {
1240  int major, minor, revision;
1241 
1242  if (sizeof(int32_t) != sizeof(OrthancPluginErrorCode) ||
1243  sizeof(int32_t) != sizeof(OrthancPluginHttpMethod) ||
1244  sizeof(int32_t) != sizeof(_OrthancPluginService) ||
1245  sizeof(int32_t) != sizeof(_OrthancPluginProperty) ||
1246  sizeof(int32_t) != sizeof(OrthancPluginPixelFormat) ||
1247  sizeof(int32_t) != sizeof(OrthancPluginContentType) ||
1248  sizeof(int32_t) != sizeof(OrthancPluginResourceType) ||
1249  sizeof(int32_t) != sizeof(OrthancPluginChangeType) ||
1250  sizeof(int32_t) != sizeof(OrthancPluginCompressionType) ||
1251  sizeof(int32_t) != sizeof(OrthancPluginImageFormat) ||
1252  sizeof(int32_t) != sizeof(OrthancPluginValueRepresentation) ||
1253  sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFormat) ||
1254  sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFlags) ||
1255  sizeof(int32_t) != sizeof(OrthancPluginCreateDicomFlags) ||
1256  sizeof(int32_t) != sizeof(OrthancPluginIdentifierConstraint) ||
1257  sizeof(int32_t) != sizeof(OrthancPluginInstanceOrigin))
1258  {
1259  /* Mismatch in the size of the enumerations */
1260  return 0;
1261  }
1262 
1263  /* Assume compatibility with the mainline */
1264  if (!strcmp(context->orthancVersion, "mainline"))
1265  {
1266  return 1;
1267  }
1268 
1269  /* Parse the version of the Orthanc core */
1270  if (
1271 #ifdef _MSC_VER
1272  sscanf_s
1273 #else
1274  sscanf
1275 #endif
1276  (context->orthancVersion, "%4d.%4d.%4d", &major, &minor, &revision) != 3)
1277  {
1278  return 0;
1279  }
1280 
1281  /* Check the major number of the version */
1282 
1283  if (major > ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER)
1284  {
1285  return 1;
1286  }
1287 
1288  if (major < ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER)
1289  {
1290  return 0;
1291  }
1292 
1293  /* Check the minor number of the version */
1294 
1295  if (minor > ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER)
1296  {
1297  return 1;
1298  }
1299 
1300  if (minor < ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER)
1301  {
1302  return 0;
1303  }
1304 
1305  /* Check the revision number of the version */
1306 
1307  if (revision >= ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER)
1308  {
1309  return 1;
1310  }
1311  else
1312  {
1313  return 0;
1314  }
1315  }
1316 
1317 
1326  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeMemoryBuffer(
1327  OrthancPluginContext* context,
1328  OrthancPluginMemoryBuffer* buffer)
1329  {
1330  context->Free(buffer->data);
1331  }
1332 
1333 
1342  ORTHANC_PLUGIN_INLINE void OrthancPluginLogError(
1343  OrthancPluginContext* context,
1344  const char* message)
1345  {
1346  context->InvokeService(context, _OrthancPluginService_LogError, message);
1347  }
1348 
1349 
1358  ORTHANC_PLUGIN_INLINE void OrthancPluginLogWarning(
1359  OrthancPluginContext* context,
1360  const char* message)
1361  {
1362  context->InvokeService(context, _OrthancPluginService_LogWarning, message);
1363  }
1364 
1365 
1374  ORTHANC_PLUGIN_INLINE void OrthancPluginLogInfo(
1375  OrthancPluginContext* context,
1376  const char* message)
1377  {
1378  context->InvokeService(context, _OrthancPluginService_LogInfo, message);
1379  }
1380 
1381 
1382 
1383  typedef struct
1384  {
1385  const char* pathRegularExpression;
1386  OrthancPluginRestCallback callback;
1387  } _OrthancPluginRestCallback;
1388 
1405  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallback(
1406  OrthancPluginContext* context,
1407  const char* pathRegularExpression,
1408  OrthancPluginRestCallback callback)
1409  {
1410  _OrthancPluginRestCallback params;
1411  params.pathRegularExpression = pathRegularExpression;
1412  params.callback = callback;
1413  context->InvokeService(context, _OrthancPluginService_RegisterRestCallback, &params);
1414  }
1415 
1416 
1417 
1439  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallbackNoLock(
1440  OrthancPluginContext* context,
1441  const char* pathRegularExpression,
1442  OrthancPluginRestCallback callback)
1443  {
1444  _OrthancPluginRestCallback params;
1445  params.pathRegularExpression = pathRegularExpression;
1446  params.callback = callback;
1447  context->InvokeService(context, _OrthancPluginService_RegisterRestCallbackNoLock, &params);
1448  }
1449 
1450 
1451 
1452  typedef struct
1453  {
1455  } _OrthancPluginOnStoredInstanceCallback;
1456 
1468  OrthancPluginContext* context,
1470  {
1471  _OrthancPluginOnStoredInstanceCallback params;
1472  params.callback = callback;
1473 
1474  context->InvokeService(context, _OrthancPluginService_RegisterOnStoredInstanceCallback, &params);
1475  }
1476 
1477 
1478 
1479  typedef struct
1480  {
1481  OrthancPluginRestOutput* output;
1482  const char* answer;
1483  uint32_t answerSize;
1484  const char* mimeType;
1485  } _OrthancPluginAnswerBuffer;
1486 
1499  ORTHANC_PLUGIN_INLINE void OrthancPluginAnswerBuffer(
1500  OrthancPluginContext* context,
1501  OrthancPluginRestOutput* output,
1502  const char* answer,
1503  uint32_t answerSize,
1504  const char* mimeType)
1505  {
1506  _OrthancPluginAnswerBuffer params;
1507  params.output = output;
1508  params.answer = answer;
1509  params.answerSize = answerSize;
1510  params.mimeType = mimeType;
1511  context->InvokeService(context, _OrthancPluginService_AnswerBuffer, &params);
1512  }
1513 
1514 
1515  typedef struct
1516  {
1517  OrthancPluginRestOutput* output;
1518  OrthancPluginPixelFormat format;
1519  uint32_t width;
1520  uint32_t height;
1521  uint32_t pitch;
1522  const void* buffer;
1523  } _OrthancPluginCompressAndAnswerPngImage;
1524 
1525  typedef struct
1526  {
1527  OrthancPluginRestOutput* output;
1528  OrthancPluginImageFormat imageFormat;
1529  OrthancPluginPixelFormat pixelFormat;
1530  uint32_t width;
1531  uint32_t height;
1532  uint32_t pitch;
1533  const void* buffer;
1534  uint8_t quality;
1535  } _OrthancPluginCompressAndAnswerImage;
1536 
1537 
1556  ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerPngImage(
1557  OrthancPluginContext* context,
1558  OrthancPluginRestOutput* output,
1559  OrthancPluginPixelFormat format,
1560  uint32_t width,
1561  uint32_t height,
1562  uint32_t pitch,
1563  const void* buffer)
1564  {
1565  _OrthancPluginCompressAndAnswerImage params;
1566  params.output = output;
1567  params.imageFormat = OrthancPluginImageFormat_Png;
1568  params.pixelFormat = format;
1569  params.width = width;
1570  params.height = height;
1571  params.pitch = pitch;
1572  params.buffer = buffer;
1573  params.quality = 0; /* No quality for PNG */
1574  context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
1575  }
1576 
1577 
1578 
1579  typedef struct
1580  {
1581  OrthancPluginMemoryBuffer* target;
1582  const char* instanceId;
1583  } _OrthancPluginGetDicomForInstance;
1584 
1598  OrthancPluginContext* context,
1599  OrthancPluginMemoryBuffer* target,
1600  const char* instanceId)
1601  {
1602  _OrthancPluginGetDicomForInstance params;
1603  params.target = target;
1604  params.instanceId = instanceId;
1605  return context->InvokeService(context, _OrthancPluginService_GetDicomForInstance, &params);
1606  }
1607 
1608 
1609 
1610  typedef struct
1611  {
1612  OrthancPluginMemoryBuffer* target;
1613  const char* uri;
1614  } _OrthancPluginRestApiGet;
1615 
1631  OrthancPluginContext* context,
1632  OrthancPluginMemoryBuffer* target,
1633  const char* uri)
1634  {
1635  _OrthancPluginRestApiGet params;
1636  params.target = target;
1637  params.uri = uri;
1638  return context->InvokeService(context, _OrthancPluginService_RestApiGet, &params);
1639  }
1640 
1641 
1642 
1661  OrthancPluginContext* context,
1662  OrthancPluginMemoryBuffer* target,
1663  const char* uri)
1664  {
1665  _OrthancPluginRestApiGet params;
1666  params.target = target;
1667  params.uri = uri;
1668  return context->InvokeService(context, _OrthancPluginService_RestApiGetAfterPlugins, &params);
1669  }
1670 
1671 
1672 
1673  typedef struct
1674  {
1675  OrthancPluginMemoryBuffer* target;
1676  const char* uri;
1677  const char* body;
1678  uint32_t bodySize;
1679  } _OrthancPluginRestApiPostPut;
1680 
1698  OrthancPluginContext* context,
1699  OrthancPluginMemoryBuffer* target,
1700  const char* uri,
1701  const char* body,
1702  uint32_t bodySize)
1703  {
1704  _OrthancPluginRestApiPostPut params;
1705  params.target = target;
1706  params.uri = uri;
1707  params.body = body;
1708  params.bodySize = bodySize;
1709  return context->InvokeService(context, _OrthancPluginService_RestApiPost, &params);
1710  }
1711 
1712 
1733  OrthancPluginContext* context,
1734  OrthancPluginMemoryBuffer* target,
1735  const char* uri,
1736  const char* body,
1737  uint32_t bodySize)
1738  {
1739  _OrthancPluginRestApiPostPut params;
1740  params.target = target;
1741  params.uri = uri;
1742  params.body = body;
1743  params.bodySize = bodySize;
1744  return context->InvokeService(context, _OrthancPluginService_RestApiPostAfterPlugins, &params);
1745  }
1746 
1747 
1748 
1762  OrthancPluginContext* context,
1763  const char* uri)
1764  {
1765  return context->InvokeService(context, _OrthancPluginService_RestApiDelete, uri);
1766  }
1767 
1768 
1785  OrthancPluginContext* context,
1786  const char* uri)
1787  {
1788  return context->InvokeService(context, _OrthancPluginService_RestApiDeleteAfterPlugins, uri);
1789  }
1790 
1791 
1792 
1810  OrthancPluginContext* context,
1811  OrthancPluginMemoryBuffer* target,
1812  const char* uri,
1813  const char* body,
1814  uint32_t bodySize)
1815  {
1816  _OrthancPluginRestApiPostPut params;
1817  params.target = target;
1818  params.uri = uri;
1819  params.body = body;
1820  params.bodySize = bodySize;
1821  return context->InvokeService(context, _OrthancPluginService_RestApiPut, &params);
1822  }
1823 
1824 
1825 
1846  OrthancPluginContext* context,
1847  OrthancPluginMemoryBuffer* target,
1848  const char* uri,
1849  const char* body,
1850  uint32_t bodySize)
1851  {
1852  _OrthancPluginRestApiPostPut params;
1853  params.target = target;
1854  params.uri = uri;
1855  params.body = body;
1856  params.bodySize = bodySize;
1857  return context->InvokeService(context, _OrthancPluginService_RestApiPutAfterPlugins, &params);
1858  }
1859 
1860 
1861 
1862  typedef struct
1863  {
1864  OrthancPluginRestOutput* output;
1865  const char* argument;
1866  } _OrthancPluginOutputPlusArgument;
1867 
1879  ORTHANC_PLUGIN_INLINE void OrthancPluginRedirect(
1880  OrthancPluginContext* context,
1881  OrthancPluginRestOutput* output,
1882  const char* redirection)
1883  {
1884  _OrthancPluginOutputPlusArgument params;
1885  params.output = output;
1886  params.argument = redirection;
1887  context->InvokeService(context, _OrthancPluginService_Redirect, &params);
1888  }
1889 
1890 
1891 
1892  typedef struct
1893  {
1894  char** result;
1895  const char* argument;
1896  } _OrthancPluginRetrieveDynamicString;
1897 
1911  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupPatient(
1912  OrthancPluginContext* context,
1913  const char* patientID)
1914  {
1915  char* result;
1916 
1917  _OrthancPluginRetrieveDynamicString params;
1918  params.result = &result;
1919  params.argument = patientID;
1920 
1921  if (context->InvokeService(context, _OrthancPluginService_LookupPatient, &params) != OrthancPluginErrorCode_Success)
1922  {
1923  /* Error */
1924  return NULL;
1925  }
1926  else
1927  {
1928  return result;
1929  }
1930  }
1931 
1932 
1946  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudy(
1947  OrthancPluginContext* context,
1948  const char* studyUID)
1949  {
1950  char* result;
1951 
1952  _OrthancPluginRetrieveDynamicString params;
1953  params.result = &result;
1954  params.argument = studyUID;
1955 
1956  if (context->InvokeService(context, _OrthancPluginService_LookupStudy, &params) != OrthancPluginErrorCode_Success)
1957  {
1958  /* Error */
1959  return NULL;
1960  }
1961  else
1962  {
1963  return result;
1964  }
1965  }
1966 
1967 
1981  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudyWithAccessionNumber(
1982  OrthancPluginContext* context,
1983  const char* accessionNumber)
1984  {
1985  char* result;
1986 
1987  _OrthancPluginRetrieveDynamicString params;
1988  params.result = &result;
1989  params.argument = accessionNumber;
1990 
1991  if (context->InvokeService(context, _OrthancPluginService_LookupStudyWithAccessionNumber, &params) != OrthancPluginErrorCode_Success)
1992  {
1993  /* Error */
1994  return NULL;
1995  }
1996  else
1997  {
1998  return result;
1999  }
2000  }
2001 
2002 
2016  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupSeries(
2017  OrthancPluginContext* context,
2018  const char* seriesUID)
2019  {
2020  char* result;
2021 
2022  _OrthancPluginRetrieveDynamicString params;
2023  params.result = &result;
2024  params.argument = seriesUID;
2025 
2026  if (context->InvokeService(context, _OrthancPluginService_LookupSeries, &params) != OrthancPluginErrorCode_Success)
2027  {
2028  /* Error */
2029  return NULL;
2030  }
2031  else
2032  {
2033  return result;
2034  }
2035  }
2036 
2037 
2051  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupInstance(
2052  OrthancPluginContext* context,
2053  const char* sopInstanceUID)
2054  {
2055  char* result;
2056 
2057  _OrthancPluginRetrieveDynamicString params;
2058  params.result = &result;
2059  params.argument = sopInstanceUID;
2060 
2061  if (context->InvokeService(context, _OrthancPluginService_LookupInstance, &params) != OrthancPluginErrorCode_Success)
2062  {
2063  /* Error */
2064  return NULL;
2065  }
2066  else
2067  {
2068  return result;
2069  }
2070  }
2071 
2072 
2073 
2074  typedef struct
2075  {
2076  OrthancPluginRestOutput* output;
2077  uint16_t status;
2078  } _OrthancPluginSendHttpStatusCode;
2079 
2096  ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatusCode(
2097  OrthancPluginContext* context,
2098  OrthancPluginRestOutput* output,
2099  uint16_t status)
2100  {
2101  _OrthancPluginSendHttpStatusCode params;
2102  params.output = output;
2103  params.status = status;
2104  context->InvokeService(context, _OrthancPluginService_SendHttpStatusCode, &params);
2105  }
2106 
2107 
2119  ORTHANC_PLUGIN_INLINE void OrthancPluginSendUnauthorized(
2120  OrthancPluginContext* context,
2121  OrthancPluginRestOutput* output,
2122  const char* realm)
2123  {
2124  _OrthancPluginOutputPlusArgument params;
2125  params.output = output;
2126  params.argument = realm;
2127  context->InvokeService(context, _OrthancPluginService_SendUnauthorized, &params);
2128  }
2129 
2130 
2142  ORTHANC_PLUGIN_INLINE void OrthancPluginSendMethodNotAllowed(
2143  OrthancPluginContext* context,
2144  OrthancPluginRestOutput* output,
2145  const char* allowedMethods)
2146  {
2147  _OrthancPluginOutputPlusArgument params;
2148  params.output = output;
2149  params.argument = allowedMethods;
2150  context->InvokeService(context, _OrthancPluginService_SendMethodNotAllowed, &params);
2151  }
2152 
2153 
2154  typedef struct
2155  {
2156  OrthancPluginRestOutput* output;
2157  const char* key;
2158  const char* value;
2159  } _OrthancPluginSetHttpHeader;
2160 
2172  ORTHANC_PLUGIN_INLINE void OrthancPluginSetCookie(
2173  OrthancPluginContext* context,
2174  OrthancPluginRestOutput* output,
2175  const char* cookie,
2176  const char* value)
2177  {
2178  _OrthancPluginSetHttpHeader params;
2179  params.output = output;
2180  params.key = cookie;
2181  params.value = value;
2182  context->InvokeService(context, _OrthancPluginService_SetCookie, &params);
2183  }
2184 
2185 
2197  ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpHeader(
2198  OrthancPluginContext* context,
2199  OrthancPluginRestOutput* output,
2200  const char* key,
2201  const char* value)
2202  {
2203  _OrthancPluginSetHttpHeader params;
2204  params.output = output;
2205  params.key = key;
2206  params.value = value;
2207  context->InvokeService(context, _OrthancPluginService_SetHttpHeader, &params);
2208  }
2209 
2210 
2211  typedef struct
2212  {
2213  char** resultStringToFree;
2214  const char** resultString;
2215  int64_t* resultInt64;
2216  const char* key;
2217  OrthancPluginDicomInstance* instance;
2218  OrthancPluginInstanceOrigin* resultOrigin; /* New in Orthanc 0.9.5 SDK */
2219  } _OrthancPluginAccessDicomInstance;
2220 
2221 
2233  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceRemoteAet(
2234  OrthancPluginContext* context,
2235  OrthancPluginDicomInstance* instance)
2236  {
2237  const char* result;
2238 
2239  _OrthancPluginAccessDicomInstance params;
2240  memset(&params, 0, sizeof(params));
2241  params.resultString = &result;
2242  params.instance = instance;
2243 
2244  if (context->InvokeService(context, _OrthancPluginService_GetInstanceRemoteAet, &params) != OrthancPluginErrorCode_Success)
2245  {
2246  /* Error */
2247  return NULL;
2248  }
2249  else
2250  {
2251  return result;
2252  }
2253  }
2254 
2255 
2266  ORTHANC_PLUGIN_INLINE int64_t OrthancPluginGetInstanceSize(
2267  OrthancPluginContext* context,
2268  OrthancPluginDicomInstance* instance)
2269  {
2270  int64_t size;
2271 
2272  _OrthancPluginAccessDicomInstance params;
2273  memset(&params, 0, sizeof(params));
2274  params.resultInt64 = &size;
2275  params.instance = instance;
2276 
2277  if (context->InvokeService(context, _OrthancPluginService_GetInstanceSize, &params) != OrthancPluginErrorCode_Success)
2278  {
2279  /* Error */
2280  return -1;
2281  }
2282  else
2283  {
2284  return size;
2285  }
2286  }
2287 
2288 
2299  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceData(
2300  OrthancPluginContext* context,
2301  OrthancPluginDicomInstance* instance)
2302  {
2303  const char* result;
2304 
2305  _OrthancPluginAccessDicomInstance params;
2306  memset(&params, 0, sizeof(params));
2307  params.resultString = &result;
2308  params.instance = instance;
2309 
2310  if (context->InvokeService(context, _OrthancPluginService_GetInstanceData, &params) != OrthancPluginErrorCode_Success)
2311  {
2312  /* Error */
2313  return NULL;
2314  }
2315  else
2316  {
2317  return result;
2318  }
2319  }
2320 
2321 
2335  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceJson(
2336  OrthancPluginContext* context,
2337  OrthancPluginDicomInstance* instance)
2338  {
2339  char* result;
2340 
2341  _OrthancPluginAccessDicomInstance params;
2342  memset(&params, 0, sizeof(params));
2343  params.resultStringToFree = &result;
2344  params.instance = instance;
2345 
2346  if (context->InvokeService(context, _OrthancPluginService_GetInstanceJson, &params) != OrthancPluginErrorCode_Success)
2347  {
2348  /* Error */
2349  return NULL;
2350  }
2351  else
2352  {
2353  return result;
2354  }
2355  }
2356 
2357 
2373  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceSimplifiedJson(
2374  OrthancPluginContext* context,
2375  OrthancPluginDicomInstance* instance)
2376  {
2377  char* result;
2378 
2379  _OrthancPluginAccessDicomInstance params;
2380  memset(&params, 0, sizeof(params));
2381  params.resultStringToFree = &result;
2382  params.instance = instance;
2383 
2384  if (context->InvokeService(context, _OrthancPluginService_GetInstanceSimplifiedJson, &params) != OrthancPluginErrorCode_Success)
2385  {
2386  /* Error */
2387  return NULL;
2388  }
2389  else
2390  {
2391  return result;
2392  }
2393  }
2394 
2395 
2412  ORTHANC_PLUGIN_INLINE int OrthancPluginHasInstanceMetadata(
2413  OrthancPluginContext* context,
2414  OrthancPluginDicomInstance* instance,
2415  const char* metadata)
2416  {
2417  int64_t result;
2418 
2419  _OrthancPluginAccessDicomInstance params;
2420  memset(&params, 0, sizeof(params));
2421  params.resultInt64 = &result;
2422  params.instance = instance;
2423  params.key = metadata;
2424 
2425  if (context->InvokeService(context, _OrthancPluginService_HasInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
2426  {
2427  /* Error */
2428  return -1;
2429  }
2430  else
2431  {
2432  return (result != 0);
2433  }
2434  }
2435 
2436 
2450  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceMetadata(
2451  OrthancPluginContext* context,
2452  OrthancPluginDicomInstance* instance,
2453  const char* metadata)
2454  {
2455  const char* result;
2456 
2457  _OrthancPluginAccessDicomInstance params;
2458  memset(&params, 0, sizeof(params));
2459  params.resultString = &result;
2460  params.instance = instance;
2461  params.key = metadata;
2462 
2463  if (context->InvokeService(context, _OrthancPluginService_GetInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
2464  {
2465  /* Error */
2466  return NULL;
2467  }
2468  else
2469  {
2470  return result;
2471  }
2472  }
2473 
2474 
2475 
2476  typedef struct
2477  {
2481  OrthancPluginFree free;
2482  } _OrthancPluginRegisterStorageArea;
2483 
2498  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterStorageArea(
2499  OrthancPluginContext* context,
2503  {
2504  _OrthancPluginRegisterStorageArea params;
2505  params.create = create;
2506  params.read = read;
2507  params.remove = remove;
2508 
2509 #ifdef __cplusplus
2510  params.free = ::free;
2511 #else
2512  params.free = free;
2513 #endif
2514 
2515  context->InvokeService(context, _OrthancPluginService_RegisterStorageArea, &params);
2516  }
2517 
2518 
2519 
2530  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancPath(OrthancPluginContext* context)
2531  {
2532  char* result;
2533 
2534  _OrthancPluginRetrieveDynamicString params;
2535  params.result = &result;
2536  params.argument = NULL;
2537 
2538  if (context->InvokeService(context, _OrthancPluginService_GetOrthancPath, &params) != OrthancPluginErrorCode_Success)
2539  {
2540  /* Error */
2541  return NULL;
2542  }
2543  else
2544  {
2545  return result;
2546  }
2547  }
2548 
2549 
2560  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancDirectory(OrthancPluginContext* context)
2561  {
2562  char* result;
2563 
2564  _OrthancPluginRetrieveDynamicString params;
2565  params.result = &result;
2566  params.argument = NULL;
2567 
2568  if (context->InvokeService(context, _OrthancPluginService_GetOrthancDirectory, &params) != OrthancPluginErrorCode_Success)
2569  {
2570  /* Error */
2571  return NULL;
2572  }
2573  else
2574  {
2575  return result;
2576  }
2577  }
2578 
2579 
2595  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfigurationPath(OrthancPluginContext* context)
2596  {
2597  char* result;
2598 
2599  _OrthancPluginRetrieveDynamicString params;
2600  params.result = &result;
2601  params.argument = NULL;
2602 
2603  if (context->InvokeService(context, _OrthancPluginService_GetConfigurationPath, &params) != OrthancPluginErrorCode_Success)
2604  {
2605  /* Error */
2606  return NULL;
2607  }
2608  else
2609  {
2610  return result;
2611  }
2612  }
2613 
2614 
2615 
2616  typedef struct
2617  {
2619  } _OrthancPluginOnChangeCallback;
2620 
2637  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnChangeCallback(
2638  OrthancPluginContext* context,
2640  {
2641  _OrthancPluginOnChangeCallback params;
2642  params.callback = callback;
2643 
2644  context->InvokeService(context, _OrthancPluginService_RegisterOnChangeCallback, &params);
2645  }
2646 
2647 
2648 
2649  typedef struct
2650  {
2651  const char* plugin;
2652  _OrthancPluginProperty property;
2653  const char* value;
2654  } _OrthancPluginSetPluginProperty;
2655 
2656 
2668  ORTHANC_PLUGIN_INLINE void OrthancPluginSetRootUri(
2669  OrthancPluginContext* context,
2670  const char* uri)
2671  {
2672  _OrthancPluginSetPluginProperty params;
2673  params.plugin = OrthancPluginGetName();
2674  params.property = _OrthancPluginProperty_RootUri;
2675  params.value = uri;
2676 
2677  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
2678  }
2679 
2680 
2690  ORTHANC_PLUGIN_INLINE void OrthancPluginSetDescription(
2691  OrthancPluginContext* context,
2692  const char* description)
2693  {
2694  _OrthancPluginSetPluginProperty params;
2695  params.plugin = OrthancPluginGetName();
2696  params.property = _OrthancPluginProperty_Description;
2697  params.value = description;
2698 
2699  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
2700  }
2701 
2702 
2712  ORTHANC_PLUGIN_INLINE void OrthancPluginExtendOrthancExplorer(
2713  OrthancPluginContext* context,
2714  const char* javascript)
2715  {
2716  _OrthancPluginSetPluginProperty params;
2717  params.plugin = OrthancPluginGetName();
2718  params.property = _OrthancPluginProperty_OrthancExplorer;
2719  params.value = javascript;
2720 
2721  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
2722  }
2723 
2724 
2725  typedef struct
2726  {
2727  char** result;
2728  int32_t property;
2729  const char* value;
2730  } _OrthancPluginGlobalProperty;
2731 
2732 
2746  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetGlobalProperty(
2747  OrthancPluginContext* context,
2748  int32_t property,
2749  const char* defaultValue)
2750  {
2751  char* result;
2752 
2753  _OrthancPluginGlobalProperty params;
2754  params.result = &result;
2755  params.property = property;
2756  params.value = defaultValue;
2757 
2758  if (context->InvokeService(context, _OrthancPluginService_GetGlobalProperty, &params) != OrthancPluginErrorCode_Success)
2759  {
2760  /* Error */
2761  return NULL;
2762  }
2763  else
2764  {
2765  return result;
2766  }
2767  }
2768 
2769 
2786  OrthancPluginContext* context,
2787  int32_t property,
2788  const char* value)
2789  {
2790  _OrthancPluginGlobalProperty params;
2791  params.result = NULL;
2792  params.property = property;
2793  params.value = value;
2794 
2795  return context->InvokeService(context, _OrthancPluginService_SetGlobalProperty, &params);
2796  }
2797 
2798 
2799 
2800  typedef struct
2801  {
2802  int32_t *resultInt32;
2803  uint32_t *resultUint32;
2804  int64_t *resultInt64;
2805  uint64_t *resultUint64;
2806  } _OrthancPluginReturnSingleValue;
2807 
2816  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetCommandLineArgumentsCount(
2817  OrthancPluginContext* context)
2818  {
2819  uint32_t count = 0;
2820 
2821  _OrthancPluginReturnSingleValue params;
2822  memset(&params, 0, sizeof(params));
2823  params.resultUint32 = &count;
2824 
2825  if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgumentsCount, &params) != OrthancPluginErrorCode_Success)
2826  {
2827  /* Error */
2828  return 0;
2829  }
2830  else
2831  {
2832  return count;
2833  }
2834  }
2835 
2836 
2837 
2850  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetCommandLineArgument(
2851  OrthancPluginContext* context,
2852  uint32_t argument)
2853  {
2854  char* result;
2855 
2856  _OrthancPluginGlobalProperty params;
2857  params.result = &result;
2858  params.property = (int32_t) argument;
2859  params.value = NULL;
2860 
2861  if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgument, &params) != OrthancPluginErrorCode_Success)
2862  {
2863  /* Error */
2864  return NULL;
2865  }
2866  else
2867  {
2868  return result;
2869  }
2870  }
2871 
2872 
2883  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetExpectedDatabaseVersion(
2884  OrthancPluginContext* context)
2885  {
2886  uint32_t count = 0;
2887 
2888  _OrthancPluginReturnSingleValue params;
2889  memset(&params, 0, sizeof(params));
2890  params.resultUint32 = &count;
2891 
2892  if (context->InvokeService(context, _OrthancPluginService_GetExpectedDatabaseVersion, &params) != OrthancPluginErrorCode_Success)
2893  {
2894  /* Error */
2895  return 0;
2896  }
2897  else
2898  {
2899  return count;
2900  }
2901  }
2902 
2903 
2904 
2916  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfiguration(OrthancPluginContext* context)
2917  {
2918  char* result;
2919 
2920  _OrthancPluginRetrieveDynamicString params;
2921  params.result = &result;
2922  params.argument = NULL;
2923 
2924  if (context->InvokeService(context, _OrthancPluginService_GetConfiguration, &params) != OrthancPluginErrorCode_Success)
2925  {
2926  /* Error */
2927  return NULL;
2928  }
2929  else
2930  {
2931  return result;
2932  }
2933  }
2934 
2935 
2936 
2937  typedef struct
2938  {
2939  OrthancPluginRestOutput* output;
2940  const char* subType;
2941  const char* contentType;
2942  } _OrthancPluginStartMultipartAnswer;
2943 
2958  OrthancPluginContext* context,
2959  OrthancPluginRestOutput* output,
2960  const char* subType,
2961  const char* contentType)
2962  {
2963  _OrthancPluginStartMultipartAnswer params;
2964  params.output = output;
2965  params.subType = subType;
2966  params.contentType = contentType;
2967  return context->InvokeService(context, _OrthancPluginService_StartMultipartAnswer, &params);
2968  }
2969 
2970 
2987  OrthancPluginContext* context,
2988  OrthancPluginRestOutput* output,
2989  const char* answer,
2990  uint32_t answerSize)
2991  {
2992  _OrthancPluginAnswerBuffer params;
2993  params.output = output;
2994  params.answer = answer;
2995  params.answerSize = answerSize;
2996  params.mimeType = NULL;
2997  return context->InvokeService(context, _OrthancPluginService_SendMultipartItem, &params);
2998  }
2999 
3000 
3001 
3002  typedef struct
3003  {
3004  OrthancPluginMemoryBuffer* target;
3005  const void* source;
3006  uint32_t size;
3007  OrthancPluginCompressionType compression;
3008  uint8_t uncompress;
3009  } _OrthancPluginBufferCompression;
3010 
3011 
3029  OrthancPluginContext* context,
3030  OrthancPluginMemoryBuffer* target,
3031  const void* source,
3032  uint32_t size,
3033  OrthancPluginCompressionType compression,
3034  uint8_t uncompress)
3035  {
3036  _OrthancPluginBufferCompression params;
3037  params.target = target;
3038  params.source = source;
3039  params.size = size;
3040  params.compression = compression;
3041  params.uncompress = uncompress;
3042 
3043  return context->InvokeService(context, _OrthancPluginService_BufferCompression, &params);
3044  }
3045 
3046 
3047 
3048  typedef struct
3049  {
3050  OrthancPluginMemoryBuffer* target;
3051  const char* path;
3052  } _OrthancPluginReadFile;
3053 
3066  OrthancPluginContext* context,
3067  OrthancPluginMemoryBuffer* target,
3068  const char* path)
3069  {
3070  _OrthancPluginReadFile params;
3071  params.target = target;
3072  params.path = path;
3073  return context->InvokeService(context, _OrthancPluginService_ReadFile, &params);
3074  }
3075 
3076 
3077 
3078  typedef struct
3079  {
3080  const char* path;
3081  const void* data;
3082  uint32_t size;
3083  } _OrthancPluginWriteFile;
3084 
3097  OrthancPluginContext* context,
3098  const char* path,
3099  const void* data,
3100  uint32_t size)
3101  {
3102  _OrthancPluginWriteFile params;
3103  params.path = path;
3104  params.data = data;
3105  params.size = size;
3106  return context->InvokeService(context, _OrthancPluginService_WriteFile, &params);
3107  }
3108 
3109 
3110 
3111  typedef struct
3112  {
3113  const char** target;
3114  OrthancPluginErrorCode error;
3115  } _OrthancPluginGetErrorDescription;
3116 
3127  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetErrorDescription(
3128  OrthancPluginContext* context,
3129  OrthancPluginErrorCode error)
3130  {
3131  const char* result = NULL;
3132 
3133  _OrthancPluginGetErrorDescription params;
3134  params.target = &result;
3135  params.error = error;
3136 
3137  if (context->InvokeService(context, _OrthancPluginService_GetErrorDescription, &params) != OrthancPluginErrorCode_Success ||
3138  result == NULL)
3139  {
3140  return "Unknown error code";
3141  }
3142  else
3143  {
3144  return result;
3145  }
3146  }
3147 
3148 
3149 
3150  typedef struct
3151  {
3152  OrthancPluginRestOutput* output;
3153  uint16_t status;
3154  const char* body;
3155  uint32_t bodySize;
3156  } _OrthancPluginSendHttpStatus;
3157 
3180  ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatus(
3181  OrthancPluginContext* context,
3182  OrthancPluginRestOutput* output,
3183  uint16_t status,
3184  const char* body,
3185  uint32_t bodySize)
3186  {
3187  _OrthancPluginSendHttpStatus params;
3188  params.output = output;
3189  params.status = status;
3190  params.body = body;
3191  params.bodySize = bodySize;
3192  context->InvokeService(context, _OrthancPluginService_SendHttpStatus, &params);
3193  }
3194 
3195 
3196 
3197  typedef struct
3198  {
3199  const OrthancPluginImage* image;
3200  uint32_t* resultUint32;
3201  OrthancPluginPixelFormat* resultPixelFormat;
3202  void** resultBuffer;
3203  } _OrthancPluginGetImageInfo;
3204 
3205 
3217  OrthancPluginContext* context,
3218  const OrthancPluginImage* image)
3219  {
3220  OrthancPluginPixelFormat target;
3221 
3222  _OrthancPluginGetImageInfo params;
3223  memset(&params, 0, sizeof(params));
3224  params.image = image;
3225  params.resultPixelFormat = &target;
3226 
3227  if (context->InvokeService(context, _OrthancPluginService_GetImagePixelFormat, &params) != OrthancPluginErrorCode_Success)
3228  {
3230  }
3231  else
3232  {
3233  return (OrthancPluginPixelFormat) target;
3234  }
3235  }
3236 
3237 
3238 
3249  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageWidth(
3250  OrthancPluginContext* context,
3251  const OrthancPluginImage* image)
3252  {
3253  uint32_t width;
3254 
3255  _OrthancPluginGetImageInfo params;
3256  memset(&params, 0, sizeof(params));
3257  params.image = image;
3258  params.resultUint32 = &width;
3259 
3260  if (context->InvokeService(context, _OrthancPluginService_GetImageWidth, &params) != OrthancPluginErrorCode_Success)
3261  {
3262  return 0;
3263  }
3264  else
3265  {
3266  return width;
3267  }
3268  }
3269 
3270 
3271 
3282  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageHeight(
3283  OrthancPluginContext* context,
3284  const OrthancPluginImage* image)
3285  {
3286  uint32_t height;
3287 
3288  _OrthancPluginGetImageInfo params;
3289  memset(&params, 0, sizeof(params));
3290  params.image = image;
3291  params.resultUint32 = &height;
3292 
3293  if (context->InvokeService(context, _OrthancPluginService_GetImageHeight, &params) != OrthancPluginErrorCode_Success)
3294  {
3295  return 0;
3296  }
3297  else
3298  {
3299  return height;
3300  }
3301  }
3302 
3303 
3304 
3317  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImagePitch(
3318  OrthancPluginContext* context,
3319  const OrthancPluginImage* image)
3320  {
3321  uint32_t pitch;
3322 
3323  _OrthancPluginGetImageInfo params;
3324  memset(&params, 0, sizeof(params));
3325  params.image = image;
3326  params.resultUint32 = &pitch;
3327 
3328  if (context->InvokeService(context, _OrthancPluginService_GetImagePitch, &params) != OrthancPluginErrorCode_Success)
3329  {
3330  return 0;
3331  }
3332  else
3333  {
3334  return pitch;
3335  }
3336  }
3337 
3338 
3339 
3351  ORTHANC_PLUGIN_INLINE void* OrthancPluginGetImageBuffer(
3352  OrthancPluginContext* context,
3353  const OrthancPluginImage* image)
3354  {
3355  void* target = NULL;
3356 
3357  _OrthancPluginGetImageInfo params;
3358  memset(&params, 0, sizeof(params));
3359  params.resultBuffer = &target;
3360  params.image = image;
3361 
3362  if (context->InvokeService(context, _OrthancPluginService_GetImageBuffer, &params) != OrthancPluginErrorCode_Success)
3363  {
3364  return NULL;
3365  }
3366  else
3367  {
3368  return target;
3369  }
3370  }
3371 
3372 
3373  typedef struct
3374  {
3375  OrthancPluginImage** target;
3376  const void* data;
3377  uint32_t size;
3378  OrthancPluginImageFormat format;
3379  } _OrthancPluginUncompressImage;
3380 
3381 
3395  OrthancPluginContext* context,
3396  const void* data,
3397  uint32_t size,
3398  OrthancPluginImageFormat format)
3399  {
3400  OrthancPluginImage* target = NULL;
3401 
3402  _OrthancPluginUncompressImage params;
3403  memset(&params, 0, sizeof(params));
3404  params.target = &target;
3405  params.data = data;
3406  params.size = size;
3407  params.format = format;
3408 
3409  if (context->InvokeService(context, _OrthancPluginService_UncompressImage, &params) != OrthancPluginErrorCode_Success)
3410  {
3411  return NULL;
3412  }
3413  else
3414  {
3415  return target;
3416  }
3417  }
3418 
3419 
3420 
3421 
3422  typedef struct
3423  {
3424  OrthancPluginImage* image;
3425  } _OrthancPluginFreeImage;
3426 
3436  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeImage(
3437  OrthancPluginContext* context,
3438  OrthancPluginImage* image)
3439  {
3440  _OrthancPluginFreeImage params;
3441  params.image = image;
3442 
3443  context->InvokeService(context, _OrthancPluginService_FreeImage, &params);
3444  }
3445 
3446 
3447 
3448 
3449  typedef struct
3450  {
3451  OrthancPluginMemoryBuffer* target;
3452  OrthancPluginImageFormat imageFormat;
3453  OrthancPluginPixelFormat pixelFormat;
3454  uint32_t width;
3455  uint32_t height;
3456  uint32_t pitch;
3457  const void* buffer;
3458  uint8_t quality;
3459  } _OrthancPluginCompressImage;
3460 
3461 
3482  OrthancPluginContext* context,
3483  OrthancPluginMemoryBuffer* target,
3484  OrthancPluginPixelFormat format,
3485  uint32_t width,
3486  uint32_t height,
3487  uint32_t pitch,
3488  const void* buffer)
3489  {
3490  _OrthancPluginCompressImage params;
3491  memset(&params, 0, sizeof(params));
3492  params.target = target;
3493  params.imageFormat = OrthancPluginImageFormat_Png;
3494  params.pixelFormat = format;
3495  params.width = width;
3496  params.height = height;
3497  params.pitch = pitch;
3498  params.buffer = buffer;
3499  params.quality = 0; /* Unused for PNG */
3500 
3501  return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
3502  }
3503 
3504 
3527  OrthancPluginContext* context,
3528  OrthancPluginMemoryBuffer* target,
3529  OrthancPluginPixelFormat format,
3530  uint32_t width,
3531  uint32_t height,
3532  uint32_t pitch,
3533  const void* buffer,
3534  uint8_t quality)
3535  {
3536  _OrthancPluginCompressImage params;
3537  memset(&params, 0, sizeof(params));
3538  params.target = target;
3539  params.imageFormat = OrthancPluginImageFormat_Jpeg;
3540  params.pixelFormat = format;
3541  params.width = width;
3542  params.height = height;
3543  params.pitch = pitch;
3544  params.buffer = buffer;
3545  params.quality = quality;
3546 
3547  return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
3548  }
3549 
3550 
3551 
3573  ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerJpegImage(
3574  OrthancPluginContext* context,
3575  OrthancPluginRestOutput* output,
3576  OrthancPluginPixelFormat format,
3577  uint32_t width,
3578  uint32_t height,
3579  uint32_t pitch,
3580  const void* buffer,
3581  uint8_t quality)
3582  {
3583  _OrthancPluginCompressAndAnswerImage params;
3584  params.output = output;
3585  params.imageFormat = OrthancPluginImageFormat_Jpeg;
3586  params.pixelFormat = format;
3587  params.width = width;
3588  params.height = height;
3589  params.pitch = pitch;
3590  params.buffer = buffer;
3591  params.quality = quality;
3592  context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
3593  }
3594 
3595 
3596 
3597 
3598  typedef struct
3599  {
3600  OrthancPluginMemoryBuffer* target;
3601  OrthancPluginHttpMethod method;
3602  const char* url;
3603  const char* username;
3604  const char* password;
3605  const char* body;
3606  uint32_t bodySize;
3607  } _OrthancPluginCallHttpClient;
3608 
3609 
3626  OrthancPluginContext* context,
3627  OrthancPluginMemoryBuffer* target,
3628  const char* url,
3629  const char* username,
3630  const char* password)
3631  {
3632  _OrthancPluginCallHttpClient params;
3633  memset(&params, 0, sizeof(params));
3634 
3635  params.target = target;
3636  params.method = OrthancPluginHttpMethod_Get;
3637  params.url = url;
3638  params.username = username;
3639  params.password = password;
3640 
3641  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3642  }
3643 
3644 
3663  OrthancPluginContext* context,
3664  OrthancPluginMemoryBuffer* target,
3665  const char* url,
3666  const char* body,
3667  uint32_t bodySize,
3668  const char* username,
3669  const char* password)
3670  {
3671  _OrthancPluginCallHttpClient params;
3672  memset(&params, 0, sizeof(params));
3673 
3674  params.target = target;
3675  params.method = OrthancPluginHttpMethod_Post;
3676  params.url = url;
3677  params.body = body;
3678  params.bodySize = bodySize;
3679  params.username = username;
3680  params.password = password;
3681 
3682  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3683  }
3684 
3685 
3704  OrthancPluginContext* context,
3705  OrthancPluginMemoryBuffer* target,
3706  const char* url,
3707  const char* body,
3708  uint32_t bodySize,
3709  const char* username,
3710  const char* password)
3711  {
3712  _OrthancPluginCallHttpClient params;
3713  memset(&params, 0, sizeof(params));
3714 
3715  params.target = target;
3716  params.method = OrthancPluginHttpMethod_Put;
3717  params.url = url;
3718  params.body = body;
3719  params.bodySize = bodySize;
3720  params.username = username;
3721  params.password = password;
3722 
3723  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3724  }
3725 
3726 
3741  OrthancPluginContext* context,
3742  const char* url,
3743  const char* username,
3744  const char* password)
3745  {
3746  _OrthancPluginCallHttpClient params;
3747  memset(&params, 0, sizeof(params));
3748 
3749  params.method = OrthancPluginHttpMethod_Delete;
3750  params.url = url;
3751  params.username = username;
3752  params.password = password;
3753 
3754  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3755  }
3756 
3757 
3758 
3759  typedef struct
3760  {
3761  OrthancPluginImage** target;
3762  const OrthancPluginImage* source;
3763  OrthancPluginPixelFormat targetFormat;
3764  } _OrthancPluginConvertPixelFormat;
3765 
3766 
3779  OrthancPluginContext* context,
3780  const OrthancPluginImage* source,
3781  OrthancPluginPixelFormat targetFormat)
3782  {
3783  OrthancPluginImage* target = NULL;
3784 
3785  _OrthancPluginConvertPixelFormat params;
3786  params.target = &target;
3787  params.source = source;
3788  params.targetFormat = targetFormat;
3789 
3790  if (context->InvokeService(context, _OrthancPluginService_ConvertPixelFormat, &params) != OrthancPluginErrorCode_Success)
3791  {
3792  return NULL;
3793  }
3794  else
3795  {
3796  return target;
3797  }
3798  }
3799 
3800 
3801 
3813  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontsCount(
3814  OrthancPluginContext* context)
3815  {
3816  uint32_t count = 0;
3817 
3818  _OrthancPluginReturnSingleValue params;
3819  memset(&params, 0, sizeof(params));
3820  params.resultUint32 = &count;
3821 
3822  if (context->InvokeService(context, _OrthancPluginService_GetFontsCount, &params) != OrthancPluginErrorCode_Success)
3823  {
3824  /* Error */
3825  return 0;
3826  }
3827  else
3828  {
3829  return count;
3830  }
3831  }
3832 
3833 
3834 
3835 
3836  typedef struct
3837  {
3838  uint32_t fontIndex; /* in */
3839  const char** name; /* out */
3840  uint32_t* size; /* out */
3841  } _OrthancPluginGetFontInfo;
3842 
3853  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetFontName(
3854  OrthancPluginContext* context,
3855  uint32_t fontIndex)
3856  {
3857  const char* result = NULL;
3858 
3859  _OrthancPluginGetFontInfo params;
3860  memset(&params, 0, sizeof(params));
3861  params.name = &result;
3862  params.fontIndex = fontIndex;
3863 
3864  if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
3865  {
3866  return NULL;
3867  }
3868  else
3869  {
3870  return result;
3871  }
3872  }
3873 
3874 
3885  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontSize(
3886  OrthancPluginContext* context,
3887  uint32_t fontIndex)
3888  {
3889  uint32_t result;
3890 
3891  _OrthancPluginGetFontInfo params;
3892  memset(&params, 0, sizeof(params));
3893  params.size = &result;
3894  params.fontIndex = fontIndex;
3895 
3896  if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
3897  {
3898  return 0;
3899  }
3900  else
3901  {
3902  return result;
3903  }
3904  }
3905 
3906 
3907 
3908  typedef struct
3909  {
3910  OrthancPluginImage* image;
3911  uint32_t fontIndex;
3912  const char* utf8Text;
3913  int32_t x;
3914  int32_t y;
3915  uint8_t r;
3916  uint8_t g;
3917  uint8_t b;
3918  } _OrthancPluginDrawText;
3919 
3920 
3939  OrthancPluginContext* context,
3940  OrthancPluginImage* image,
3941  uint32_t fontIndex,
3942  const char* utf8Text,
3943  int32_t x,
3944  int32_t y,
3945  uint8_t r,
3946  uint8_t g,
3947  uint8_t b)
3948  {
3949  _OrthancPluginDrawText params;
3950  memset(&params, 0, sizeof(params));
3951  params.image = image;
3952  params.fontIndex = fontIndex;
3953  params.utf8Text = utf8Text;
3954  params.x = x;
3955  params.y = y;
3956  params.r = r;
3957  params.g = g;
3958  params.b = b;
3959 
3960  return context->InvokeService(context, _OrthancPluginService_DrawText, &params);
3961  }
3962 
3963 
3964 
3965  typedef struct
3966  {
3967  OrthancPluginStorageArea* storageArea;
3968  const char* uuid;
3969  const void* content;
3970  uint64_t size;
3972  } _OrthancPluginStorageAreaCreate;
3973 
3974 
3991  OrthancPluginContext* context,
3992  OrthancPluginStorageArea* storageArea,
3993  const char* uuid,
3994  const void* content,
3995  uint64_t size,
3997  {
3998  _OrthancPluginStorageAreaCreate params;
3999  params.storageArea = storageArea;
4000  params.uuid = uuid;
4001  params.content = content;
4002  params.size = size;
4003  params.type = type;
4004 
4005  return context->InvokeService(context, _OrthancPluginService_StorageAreaCreate, &params);
4006  }
4007 
4008 
4009  typedef struct
4010  {
4011  OrthancPluginMemoryBuffer* target;
4012  OrthancPluginStorageArea* storageArea;
4013  const char* uuid;
4015  } _OrthancPluginStorageAreaRead;
4016 
4017 
4033  OrthancPluginContext* context,
4034  OrthancPluginMemoryBuffer* target,
4035  OrthancPluginStorageArea* storageArea,
4036  const char* uuid,
4038  {
4039  _OrthancPluginStorageAreaRead params;
4040  params.target = target;
4041  params.storageArea = storageArea;
4042  params.uuid = uuid;
4043  params.type = type;
4044 
4045  return context->InvokeService(context, _OrthancPluginService_StorageAreaRead, &params);
4046  }
4047 
4048 
4049  typedef struct
4050  {
4051  OrthancPluginStorageArea* storageArea;
4052  const char* uuid;
4054  } _OrthancPluginStorageAreaRemove;
4055 
4070  OrthancPluginContext* context,
4071  OrthancPluginStorageArea* storageArea,
4072  const char* uuid,
4074  {
4075  _OrthancPluginStorageAreaRemove params;
4076  params.storageArea = storageArea;
4077  params.uuid = uuid;
4078  params.type = type;
4079 
4080  return context->InvokeService(context, _OrthancPluginService_StorageAreaRemove, &params);
4081  }
4082 
4083 
4084 
4085  typedef struct
4086  {
4087  OrthancPluginErrorCode* target;
4088  int32_t code;
4089  uint16_t httpStatus;
4090  const char* message;
4091  } _OrthancPluginRegisterErrorCode;
4092 
4109  OrthancPluginContext* context,
4110  int32_t code,
4111  uint16_t httpStatus,
4112  const char* message)
4113  {
4114  OrthancPluginErrorCode target;
4115 
4116  _OrthancPluginRegisterErrorCode params;
4117  params.target = &target;
4118  params.code = code;
4119  params.httpStatus = httpStatus;
4120  params.message = message;
4121 
4122  if (context->InvokeService(context, _OrthancPluginService_RegisterErrorCode, &params) == OrthancPluginErrorCode_Success)
4123  {
4124  return target;
4125  }
4126  else
4127  {
4128  /* There was an error while assigned the error. Use a generic code. */
4130  }
4131  }
4132 
4133 
4134 
4135  typedef struct
4136  {
4137  uint16_t group;
4138  uint16_t element;
4140  const char* name;
4141  uint32_t minMultiplicity;
4142  uint32_t maxMultiplicity;
4143  } _OrthancPluginRegisterDictionaryTag;
4144 
4165  OrthancPluginContext* context,
4166  uint16_t group,
4167  uint16_t element,
4169  const char* name,
4170  uint32_t minMultiplicity,
4171  uint32_t maxMultiplicity)
4172  {
4173  _OrthancPluginRegisterDictionaryTag params;
4174  params.group = group;
4175  params.element = element;
4176  params.vr = vr;
4177  params.name = name;
4178  params.minMultiplicity = minMultiplicity;
4179  params.maxMultiplicity = maxMultiplicity;
4180 
4181  return context->InvokeService(context, _OrthancPluginService_RegisterDictionaryTag, &params);
4182  }
4183 
4184 
4185 
4186  typedef struct
4187  {
4188  uint16_t group;
4189  uint16_t element;
4191  const char* name;
4192  uint32_t minMultiplicity;
4193  uint32_t maxMultiplicity;
4194  const char* privateCreator;
4195  } _OrthancPluginRegisterPrivateDictionaryTag;
4196 
4218  OrthancPluginContext* context,
4219  uint16_t group,
4220  uint16_t element,
4222  const char* name,
4223  uint32_t minMultiplicity,
4224  uint32_t maxMultiplicity,
4225  const char* privateCreator)
4226  {
4227  _OrthancPluginRegisterPrivateDictionaryTag params;
4228  params.group = group;
4229  params.element = element;
4230  params.vr = vr;
4231  params.name = name;
4232  params.minMultiplicity = minMultiplicity;
4233  params.maxMultiplicity = maxMultiplicity;
4234  params.privateCreator = privateCreator;
4235 
4236  return context->InvokeService(context, _OrthancPluginService_RegisterPrivateDictionaryTag, &params);
4237  }
4238 
4239 
4240 
4241  typedef struct
4242  {
4243  OrthancPluginStorageArea* storageArea;
4245  } _OrthancPluginReconstructMainDicomTags;
4246 
4264  OrthancPluginContext* context,
4265  OrthancPluginStorageArea* storageArea,
4267  {
4268  _OrthancPluginReconstructMainDicomTags params;
4269  params.level = level;
4270  params.storageArea = storageArea;
4271 
4272  return context->InvokeService(context, _OrthancPluginService_ReconstructMainDicomTags, &params);
4273  }
4274 
4275 
4276  typedef struct
4277  {
4278  char** result;
4279  const char* instanceId;
4280  const void* buffer;
4281  uint32_t size;
4284  uint32_t maxStringLength;
4285  } _OrthancPluginDicomToJson;
4286 
4287 
4307  ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomBufferToJson(
4308  OrthancPluginContext* context,
4309  const void* buffer,
4310  uint32_t size,
4313  uint32_t maxStringLength)
4314  {
4315  char* result;
4316 
4317  _OrthancPluginDicomToJson params;
4318  memset(&params, 0, sizeof(params));
4319  params.result = &result;
4320  params.buffer = buffer;
4321  params.size = size;
4322  params.format = format;
4323  params.flags = flags;
4324  params.maxStringLength = maxStringLength;
4325 
4326  if (context->InvokeService(context, _OrthancPluginService_DicomBufferToJson, &params) != OrthancPluginErrorCode_Success)
4327  {
4328  /* Error */
4329  return NULL;
4330  }
4331  else
4332  {
4333  return result;
4334  }
4335  }
4336 
4337 
4356  ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomInstanceToJson(
4357  OrthancPluginContext* context,
4358  const char* instanceId,
4361  uint32_t maxStringLength)
4362  {
4363  char* result;
4364 
4365  _OrthancPluginDicomToJson params;
4366  memset(&params, 0, sizeof(params));
4367  params.result = &result;
4368  params.instanceId = instanceId;
4369  params.format = format;
4370  params.flags = flags;
4371  params.maxStringLength = maxStringLength;
4372 
4373  if (context->InvokeService(context, _OrthancPluginService_DicomInstanceToJson, &params) != OrthancPluginErrorCode_Success)
4374  {
4375  /* Error */
4376  return NULL;
4377  }
4378  else
4379  {
4380  return result;
4381  }
4382  }
4383 
4384 
4385  typedef struct
4386  {
4387  OrthancPluginMemoryBuffer* target;
4388  const char* uri;
4389  uint32_t headersCount;
4390  const char* const* headersKeys;
4391  const char* const* headersValues;
4392  int32_t afterPlugins;
4393  } _OrthancPluginRestApiGet2;
4394 
4415  OrthancPluginContext* context,
4416  OrthancPluginMemoryBuffer* target,
4417  const char* uri,
4418  uint32_t headersCount,
4419  const char* const* headersKeys,
4420  const char* const* headersValues,
4421  int32_t afterPlugins)
4422  {
4423  _OrthancPluginRestApiGet2 params;
4424  params.target = target;
4425  params.uri = uri;
4426  params.headersCount = headersCount;
4427  params.headersKeys = headersKeys;
4428  params.headersValues = headersValues;
4429  params.afterPlugins = afterPlugins;
4430 
4431  return context->InvokeService(context, _OrthancPluginService_RestApiGet2, &params);
4432  }
4433 
4434 
4435 
4436  typedef struct
4437  {
4439  } _OrthancPluginWorklistCallback;
4440 
4453  OrthancPluginContext* context,
4455  {
4456  _OrthancPluginWorklistCallback params;
4457  params.callback = callback;
4458 
4459  return context->InvokeService(context, _OrthancPluginService_RegisterWorklistCallback, &params);
4460  }
4461 
4462 
4463 
4464  typedef struct
4465  {
4467  const OrthancPluginWorklistQuery* query;
4468  const void* dicom;
4469  uint32_t size;
4470  } _OrthancPluginWorklistAnswersOperation;
4471 
4489  OrthancPluginContext* context,
4491  const OrthancPluginWorklistQuery* query,
4492  const void* dicom,
4493  uint32_t size)
4494  {
4495  _OrthancPluginWorklistAnswersOperation params;
4496  params.answers = answers;
4497  params.query = query;
4498  params.dicom = dicom;
4499  params.size = size;
4500 
4501  return context->InvokeService(context, _OrthancPluginService_WorklistAddAnswer, &params);
4502  }
4503 
4504 
4519  OrthancPluginContext* context,
4521  {
4522  _OrthancPluginWorklistAnswersOperation params;
4523  params.answers = answers;
4524  params.query = NULL;
4525  params.dicom = NULL;
4526  params.size = 0;
4527 
4528  return context->InvokeService(context, _OrthancPluginService_WorklistMarkIncomplete, &params);
4529  }
4530 
4531 
4532  typedef struct
4533  {
4534  const OrthancPluginWorklistQuery* query;
4535  const void* dicom;
4536  uint32_t size;
4537  int32_t* isMatch;
4538  OrthancPluginMemoryBuffer* target;
4539  } _OrthancPluginWorklistQueryOperation;
4540 
4556  ORTHANC_PLUGIN_INLINE int32_t OrthancPluginWorklistIsMatch(
4557  OrthancPluginContext* context,
4558  const OrthancPluginWorklistQuery* query,
4559  const void* dicom,
4560  uint32_t size)
4561  {
4562  int32_t isMatch = 0;
4563 
4564  _OrthancPluginWorklistQueryOperation params;
4565  params.query = query;
4566  params.dicom = dicom;
4567  params.size = size;
4568  params.isMatch = &isMatch;
4569  params.target = NULL;
4570 
4571  if (context->InvokeService(context, _OrthancPluginService_WorklistIsMatch, &params) == OrthancPluginErrorCode_Success)
4572  {
4573  return isMatch;
4574  }
4575  else
4576  {
4577  /* Error: Assume non-match */
4578  return 0;
4579  }
4580  }
4581 
4582 
4596  OrthancPluginContext* context,
4597  OrthancPluginMemoryBuffer* target,
4598  const OrthancPluginWorklistQuery* query)
4599  {
4600  _OrthancPluginWorklistQueryOperation params;
4601  params.query = query;
4602  params.dicom = NULL;
4603  params.size = 0;
4604  params.isMatch = NULL;
4605  params.target = target;
4606 
4607  return context->InvokeService(context, _OrthancPluginService_WorklistGetDicomQuery, &params);
4608  }
4609 
4610 
4622  OrthancPluginContext* context,
4623  OrthancPluginDicomInstance* instance)
4624  {
4626 
4627  _OrthancPluginAccessDicomInstance params;
4628  memset(&params, 0, sizeof(params));
4629  params.resultOrigin = &origin;
4630  params.instance = instance;
4631 
4632  if (context->InvokeService(context, _OrthancPluginService_GetInstanceOrigin, &params) != OrthancPluginErrorCode_Success)
4633  {
4634  /* Error */
4636  }
4637  else
4638  {
4639  return origin;
4640  }
4641  }
4642 
4643 
4644  typedef struct
4645  {
4646  OrthancPluginMemoryBuffer* target;
4647  const char* json;
4648  const OrthancPluginImage* pixelData;
4650  } _OrthancPluginCreateDicom;
4651 
4671  OrthancPluginContext* context,
4672  OrthancPluginMemoryBuffer* target,
4673  const char* json,
4674  const OrthancPluginImage* pixelData,
4676  {
4677  _OrthancPluginCreateDicom params;
4678  params.target = target;
4679  params.json = json;
4680  params.pixelData = pixelData;
4681  params.flags = flags;
4682 
4683  return context->InvokeService(context, _OrthancPluginService_CreateDicom, &params);
4684  }
4685 
4686 
4687  typedef struct
4688  {
4690  } _OrthancPluginDecodeImageCallback;
4691 
4704  OrthancPluginContext* context,
4706  {
4707  _OrthancPluginDecodeImageCallback params;
4708  params.callback = callback;
4709 
4710  return context->InvokeService(context, _OrthancPluginService_RegisterDecodeImageCallback, &params);
4711  }
4712 
4713 
4714 
4715  typedef struct
4716  {
4717  OrthancPluginImage** target;
4718  OrthancPluginPixelFormat format;
4719  uint32_t width;
4720  uint32_t height;
4721  uint32_t pitch;
4722  void* buffer;
4723  const void* constBuffer;
4724  uint32_t bufferSize;
4725  uint32_t frameIndex;
4726  } _OrthancPluginCreateImage;
4727 
4728 
4742  OrthancPluginContext* context,
4743  OrthancPluginPixelFormat format,
4744  uint32_t width,
4745  uint32_t height)
4746  {
4747  OrthancPluginImage* target = NULL;
4748 
4749  _OrthancPluginCreateImage params;
4750  memset(&params, 0, sizeof(params));
4751  params.target = &target;
4752  params.format = format;
4753  params.width = width;
4754  params.height = height;
4755 
4756  if (context->InvokeService(context, _OrthancPluginService_CreateImage, &params) != OrthancPluginErrorCode_Success)
4757  {
4758  return NULL;
4759  }
4760  else
4761  {
4762  return target;
4763  }
4764  }
4765 
4766 
4785  OrthancPluginContext* context,
4786  OrthancPluginPixelFormat format,
4787  uint32_t width,
4788  uint32_t height,
4789  uint32_t pitch,
4790  void* buffer)
4791  {
4792  OrthancPluginImage* target = NULL;
4793 
4794  _OrthancPluginCreateImage params;
4795  memset(&params, 0, sizeof(params));
4796  params.target = &target;
4797  params.format = format;
4798  params.width = width;
4799  params.height = height;
4800  params.pitch = pitch;
4801  params.buffer = buffer;
4802 
4803  if (context->InvokeService(context, _OrthancPluginService_CreateImageAccessor, &params) != OrthancPluginErrorCode_Success)
4804  {
4805  return NULL;
4806  }
4807  else
4808  {
4809  return target;
4810  }
4811  }
4812 
4813 
4814 
4830  OrthancPluginContext* context,
4831  const void* buffer,
4832  uint32_t bufferSize,
4833  uint32_t frameIndex)
4834  {
4835  OrthancPluginImage* target = NULL;
4836 
4837  _OrthancPluginCreateImage params;
4838  memset(&params, 0, sizeof(params));
4839  params.target = &target;
4840  params.constBuffer = buffer;
4841  params.bufferSize = bufferSize;
4842  params.frameIndex = frameIndex;
4843 
4844  if (context->InvokeService(context, _OrthancPluginService_DecodeDicomImage, &params) != OrthancPluginErrorCode_Success)
4845  {
4846  return NULL;
4847  }
4848  else
4849  {
4850  return target;
4851  }
4852  }
4853 
4854 
4855 
4856  typedef struct
4857  {
4858  char** result;
4859  const void* buffer;
4860  uint32_t size;
4861  } _OrthancPluginComputeHash;
4862 
4875  ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeMd5(
4876  OrthancPluginContext* context,
4877  const void* buffer,
4878  uint32_t size)
4879  {
4880  char* result;
4881 
4882  _OrthancPluginComputeHash params;
4883  params.result = &result;
4884  params.buffer = buffer;
4885  params.size = size;
4886 
4887  if (context->InvokeService(context, _OrthancPluginService_ComputeMd5, &params) != OrthancPluginErrorCode_Success)
4888  {
4889  /* Error */
4890  return NULL;
4891  }
4892  else
4893  {
4894  return result;
4895  }
4896  }
4897 
4898 
4911  ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeSha1(
4912  OrthancPluginContext* context,
4913  const void* buffer,
4914  uint32_t size)
4915  {
4916  char* result;
4917 
4918  _OrthancPluginComputeHash params;
4919  params.result = &result;
4920  params.buffer = buffer;
4921  params.size = size;
4922 
4923  if (context->InvokeService(context, _OrthancPluginService_ComputeSha1, &params) != OrthancPluginErrorCode_Success)
4924  {
4925  /* Error */
4926  return NULL;
4927  }
4928  else
4929  {
4930  return result;
4931  }
4932  }
4933 
4934 
4935 
4936  typedef struct
4937  {
4939  const char* name;
4940  } _OrthancPluginLookupDictionary;
4941 
4958  OrthancPluginContext* context,
4960  const char* name)
4961  {
4962  _OrthancPluginLookupDictionary params;
4963  params.target = target;
4964  params.name = name;
4965  return context->InvokeService(context, _OrthancPluginService_LookupDictionary, &params);
4966  }
4967 
4968 
4969 
4970  typedef struct
4971  {
4972  OrthancPluginRestOutput* output;
4973  const char* answer;
4974  uint32_t answerSize;
4975  uint32_t headersCount;
4976  const char* const* headersKeys;
4977  const char* const* headersValues;
4978  } _OrthancPluginSendMultipartItem2;
4979 
5001  OrthancPluginContext* context,
5002  OrthancPluginRestOutput* output,
5003  const char* answer,
5004  uint32_t answerSize,
5005  uint32_t headersCount,
5006  const char* const* headersKeys,
5007  const char* const* headersValues)
5008  {
5009  _OrthancPluginSendMultipartItem2 params;
5010  params.output = output;
5011  params.answer = answer;
5012  params.answerSize = answerSize;
5013  params.headersCount = headersCount;
5014  params.headersKeys = headersKeys;
5015  params.headersValues = headersValues;
5016 
5017  return context->InvokeService(context, _OrthancPluginService_SendMultipartItem2, &params);
5018  }
5019 
5020 
5021  typedef struct
5022  {
5024  } _OrthancPluginIncomingHttpRequestFilter;
5025 
5039  OrthancPluginContext* context,
5041  {
5042  _OrthancPluginIncomingHttpRequestFilter params;
5043  params.callback = callback;
5044 
5045  return context->InvokeService(context, _OrthancPluginService_RegisterIncomingHttpRequestFilter, &params);
5046  }
5047 
5048 
5049 
5050  typedef struct
5051  {
5052  OrthancPluginMemoryBuffer* answerBody;
5053  OrthancPluginMemoryBuffer* answerHeaders;
5054  uint16_t* httpStatus;
5055  OrthancPluginHttpMethod method;
5056  const char* url;
5057  uint32_t headersCount;
5058  const char* const* headersKeys;
5059  const char* const* headersValues;
5060  const char* body;
5061  uint32_t bodySize;
5062  const char* username;
5063  const char* password;
5064  uint32_t timeout;
5065  const char* certificateFile;
5066  const char* certificateKeyFile;
5067  const char* certificateKeyPassword;
5068  uint8_t pkcs11;
5069  } _OrthancPluginCallHttpClient2;
5070 
5071 
5072 
5111  OrthancPluginContext* context,
5112  OrthancPluginMemoryBuffer* answerBody,
5113  OrthancPluginMemoryBuffer* answerHeaders,
5114  uint16_t* httpStatus,
5115  OrthancPluginHttpMethod method,
5116  const char* url,
5117  uint32_t headersCount,
5118  const char* const* headersKeys,
5119  const char* const* headersValues,
5120  const char* body,
5121  uint32_t bodySize,
5122  const char* username,
5123  const char* password,
5124  uint32_t timeout,
5125  const char* certificateFile,
5126  const char* certificateKeyFile,
5127  const char* certificateKeyPassword,
5128  uint8_t pkcs11)
5129  {
5130  _OrthancPluginCallHttpClient2 params;
5131  memset(&params, 0, sizeof(params));
5132 
5133  params.answerBody = answerBody;
5134  params.answerHeaders = answerHeaders;
5135  params.httpStatus = httpStatus;
5136  params.method = method;
5137  params.url = url;
5138  params.headersCount = headersCount;
5139  params.headersKeys = headersKeys;
5140  params.headersValues = headersValues;
5141  params.body = body;
5142  params.bodySize = bodySize;
5143  params.username = username;
5144  params.password = password;
5145  params.timeout = timeout;
5146  params.certificateFile = certificateFile;
5147  params.certificateKeyFile = certificateKeyFile;
5148  params.certificateKeyPassword = certificateKeyPassword;
5149  params.pkcs11 = pkcs11;
5150 
5151  return context->InvokeService(context, _OrthancPluginService_CallHttpClient2, &params);
5152  }
5153 
5154 
5165  ORTHANC_PLUGIN_INLINE char* OrthancPluginGenerateUuid(
5166  OrthancPluginContext* context)
5167  {
5168  char* result;
5169 
5170  _OrthancPluginRetrieveDynamicString params;
5171  params.result = &result;
5172  params.argument = NULL;
5173 
5174  if (context->InvokeService(context, _OrthancPluginService_GenerateUuid, &params) != OrthancPluginErrorCode_Success)
5175  {
5176  /* Error */
5177  return NULL;
5178  }
5179  else
5180  {
5181  return result;
5182  }
5183  }
5184 
5185 
5186 
5187 
5188  typedef struct
5189  {
5190  OrthancPluginFindCallback callback;
5191  } _OrthancPluginFindCallback;
5192 
5205  OrthancPluginContext* context,
5206  OrthancPluginFindCallback callback)
5207  {
5208  _OrthancPluginFindCallback params;
5209  params.callback = callback;
5210 
5211  return context->InvokeService(context, _OrthancPluginService_RegisterFindCallback, &params);
5212  }
5213 
5214 
5215  typedef struct
5216  {
5217  OrthancPluginFindAnswers *answers;
5218  const OrthancPluginFindQuery *query;
5219  const void *dicom;
5220  uint32_t size;
5221  uint32_t index;
5222  uint32_t *resultUint32;
5223  uint16_t *resultGroup;
5224  uint16_t *resultElement;
5225  char **resultString;
5226  } _OrthancPluginFindOperation;
5227 
5244  OrthancPluginContext* context,
5245  OrthancPluginFindAnswers* answers,
5246  const void* dicom,
5247  uint32_t size)
5248  {
5249  _OrthancPluginFindOperation params;
5250  memset(&params, 0, sizeof(params));
5251  params.answers = answers;
5252  params.dicom = dicom;
5253  params.size = size;
5254 
5255  return context->InvokeService(context, _OrthancPluginService_FindAddAnswer, &params);
5256  }
5257 
5258 
5273  OrthancPluginContext* context,
5274  OrthancPluginFindAnswers* answers)
5275  {
5276  _OrthancPluginFindOperation params;
5277  memset(&params, 0, sizeof(params));
5278  params.answers = answers;
5279 
5280  return context->InvokeService(context, _OrthancPluginService_FindMarkIncomplete, &params);
5281  }
5282 
5283 
5284 
5296  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFindQuerySize(
5297  OrthancPluginContext* context,
5298  const OrthancPluginFindQuery* query)
5299  {
5300  uint32_t count = 0;
5301 
5302  _OrthancPluginFindOperation params;
5303  memset(&params, 0, sizeof(params));
5304  params.query = query;
5305  params.resultUint32 = &count;
5306 
5307  if (context->InvokeService(context, _OrthancPluginService_GetFindQuerySize, &params) != OrthancPluginErrorCode_Success)
5308  {
5309  /* Error */
5310  return 0;
5311  }
5312  else
5313  {
5314  return count;
5315  }
5316  }
5317 
5318 
5334  OrthancPluginContext* context,
5335  uint16_t* group,
5336  uint16_t* element,
5337  const OrthancPluginFindQuery* query,
5338  uint32_t index)
5339  {
5340  _OrthancPluginFindOperation params;
5341  memset(&params, 0, sizeof(params));
5342  params.query = query;
5343  params.index = index;
5344  params.resultGroup = group;
5345  params.resultElement = element;
5346 
5347  return context->InvokeService(context, _OrthancPluginService_GetFindQueryTag, &params);
5348  }
5349 
5350 
5364  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetFindQueryTagName(
5365  OrthancPluginContext* context,
5366  const OrthancPluginFindQuery* query,
5367  uint32_t index)
5368  {
5369  char* result;
5370 
5371  _OrthancPluginFindOperation params;
5372  memset(&params, 0, sizeof(params));
5373  params.query = query;
5374  params.index = index;
5375  params.resultString = &result;
5376 
5377  if (context->InvokeService(context, _OrthancPluginService_GetFindQueryTagName, &params) != OrthancPluginErrorCode_Success)
5378  {
5379  /* Error */
5380  return NULL;
5381  }
5382  else
5383  {
5384  return result;
5385  }
5386  }
5387 
5388 
5402  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetFindQueryValue(
5403  OrthancPluginContext* context,
5404  const OrthancPluginFindQuery* query,
5405  uint32_t index)
5406  {
5407  char* result;
5408 
5409  _OrthancPluginFindOperation params;
5410  memset(&params, 0, sizeof(params));
5411  params.query = query;
5412  params.index = index;
5413  params.resultString = &result;
5414 
5415  if (context->InvokeService(context, _OrthancPluginService_GetFindQueryValue, &params) != OrthancPluginErrorCode_Success)
5416  {
5417  /* Error */
5418  return NULL;
5419  }
5420  else
5421  {
5422  return result;
5423  }
5424  }
5425 
5426 
5427 
5428 
5429  typedef struct
5430  {
5431  OrthancPluginMoveCallback callback;
5432  OrthancPluginGetMoveSize getMoveSize;
5433  OrthancPluginApplyMove applyMove;
5434  OrthancPluginFreeMove freeMove;
5435  } _OrthancPluginMoveCallback;
5436 
5451  OrthancPluginContext* context,
5452  OrthancPluginMoveCallback callback,
5453  OrthancPluginGetMoveSize getMoveSize,
5454  OrthancPluginApplyMove applyMove,
5455  OrthancPluginFreeMove freeMove)
5456  {
5457  _OrthancPluginMoveCallback params;
5458  params.callback = callback;
5459  params.getMoveSize = getMoveSize;
5460  params.applyMove = applyMove;
5461  params.freeMove = freeMove;
5462 
5463  return context->InvokeService(context, _OrthancPluginService_RegisterMoveCallback, &params);
5464  }
5465 
5466 
5467 
5468  typedef struct
5469  {
5470  OrthancPluginFindMatcher** target;
5471  const void* query;
5472  uint32_t size;
5473  } _OrthancPluginCreateFindMatcher;
5474 
5475 
5490  OrthancPluginContext* context,
5491  const void* query,
5492  uint32_t size)
5493  {
5494  OrthancPluginFindMatcher* target = NULL;
5495 
5496  _OrthancPluginCreateFindMatcher params;
5497  memset(&params, 0, sizeof(params));
5498  params.target = &target;
5499  params.query = query;
5500  params.size = size;
5501 
5502  if (context->InvokeService(context, _OrthancPluginService_CreateFindMatcher, &params) != OrthancPluginErrorCode_Success)
5503  {
5504  return NULL;
5505  }
5506  else
5507  {
5508  return target;
5509  }
5510  }
5511 
5512 
5513  typedef struct
5514  {
5515  OrthancPluginFindMatcher* matcher;
5516  } _OrthancPluginFreeFindMatcher;
5517 
5527  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeFindMatcher(
5528  OrthancPluginContext* context,
5529  OrthancPluginFindMatcher* matcher)
5530  {
5531  _OrthancPluginFreeFindMatcher params;
5532  params.matcher = matcher;
5533 
5534  context->InvokeService(context, _OrthancPluginService_FreeFindMatcher, &params);
5535  }
5536 
5537 
5538  typedef struct
5539  {
5540  const OrthancPluginFindMatcher* matcher;
5541  const void* dicom;
5542  uint32_t size;
5543  int32_t* isMatch;
5544  } _OrthancPluginFindMatcherIsMatch;
5545 
5560  ORTHANC_PLUGIN_INLINE int32_t OrthancPluginFindMatcherIsMatch(
5561  OrthancPluginContext* context,
5562  const OrthancPluginFindMatcher* matcher,
5563  const void* dicom,
5564  uint32_t size)
5565  {
5566  int32_t isMatch = 0;
5567 
5568  _OrthancPluginFindMatcherIsMatch params;
5569  params.matcher = matcher;
5570  params.dicom = dicom;
5571  params.size = size;
5572  params.isMatch = &isMatch;
5573 
5574  if (context->InvokeService(context, _OrthancPluginService_FindMatcherIsMatch, &params) == OrthancPluginErrorCode_Success)
5575  {
5576  return isMatch;
5577  }
5578  else
5579  {
5580  /* Error: Assume non-match */
5581  return 0;
5582  }
5583  }
5584 
5585 
5586  typedef struct
5587  {
5589  } _OrthancPluginIncomingHttpRequestFilter2;
5590 
5603  OrthancPluginContext* context,
5605  {
5606  _OrthancPluginIncomingHttpRequestFilter2 params;
5607  params.callback = callback;
5608 
5609  return context->InvokeService(context, _OrthancPluginService_RegisterIncomingHttpRequestFilter2, &params);
5610  }
5611 
5612 #ifdef __cplusplus
5613 }
5614 #endif
5615 
5616 
Definition: OrthancCPlugin.h:655
const char * OrthancPluginGetInstanceRemoteAet(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the AET of a DICOM instance.
Definition: OrthancCPlugin.h:2233
Definition: OrthancCPlugin.h:756
int OrthancPluginHasInstanceMetadata(OrthancPluginContext *context, OrthancPluginDicomInstance *instance, const char *metadata)
Check whether a DICOM instance is associated with some metadata.
Definition: OrthancCPlugin.h:2412
struct _OrthancPluginFindQuery_t OrthancPluginFindQuery
Opaque structure to an object that represents a C-Find query.
Definition: OrthancCPlugin.h:853
OrthancPluginChangeType
Definition: OrthancCPlugin.h:612
Definition: OrthancCPlugin.h:224
void OrthancPluginSendHttpStatusCode(OrthancPluginContext *context, OrthancPluginRestOutput *output, uint16_t status)
Send a HTTP status code.
Definition: OrthancCPlugin.h:2096
struct _OrthancPluginRestOutput_t OrthancPluginRestOutput
Opaque structure that represents the HTTP connection to the client application.
Definition: OrthancCPlugin.h:806
void OrthancPluginSetHttpHeader(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *key, const char *value)
Set some HTTP header.
Definition: OrthancCPlugin.h:2197
Definition: OrthancCPlugin.h:678
void(* OrthancPluginFreeMove)(void *moveDriver)
Callback to free one C-Move driver.
Definition: OrthancCPlugin.h:1172
Definition: OrthancCPlugin.h:257
void OrthancPluginLogInfo(OrthancPluginContext *context, const char *message)
Log an information.
Definition: OrthancCPlugin.h:1374
OrthancPluginErrorCode OrthancPluginRegisterDecodeImageCallback(OrthancPluginContext *context, OrthancPluginDecodeImageCallback callback)
Register a callback to handle the decoding of DICOM images.
Definition: OrthancCPlugin.h:4703
Definition: OrthancCPlugin.h:757
The parameters of a REST request.
Definition: OrthancCPlugin.h:316
void OrthancPluginRedirect(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *redirection)
Redirect a REST request.
Definition: OrthancCPlugin.h:1879
OrthancPluginContentType
Definition: OrthancCPlugin.h:581
OrthancPluginErrorCode OrthancPluginRestApiDeleteAfterPlugins(OrthancPluginContext *context, const char *uri)
Make a DELETE call to the REST API, as tainted by the plugins.
Definition: OrthancCPlugin.h:1784
Definition: OrthancCPlugin.h:598
Definition: OrthancCPlugin.h:677
Definition: OrthancCPlugin.h:772
const char * OrthancPluginGetInstanceData(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the data of a DICOM file.
Definition: OrthancCPlugin.h:2299
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:3481
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:3573
int OrthancPluginCheckVersion(OrthancPluginContext *context)
Check the compatibility of the plugin wrt. the version of its hosting Orthanc.
Definition: OrthancCPlugin.h:1237
Definition: OrthancCPlugin.h:249
Definition: OrthancCPlugin.h:194
Definition: OrthancCPlugin.h:247
OrthancPluginInstanceOrigin
Definition: OrthancCPlugin.h:767
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:4488
Definition: OrthancCPlugin.h:675
OrthancPluginErrorCode OrthancPluginRegisterWorklistCallback(OrthancPluginContext *context, OrthancPluginWorklistCallback callback)
Register a callback to handle modality worklists requests.
Definition: OrthancCPlugin.h:4452
int64_t OrthancPluginGetInstanceSize(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the size of a DICOM file.
Definition: OrthancCPlugin.h:2266
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:4217
Definition: OrthancCPlugin.h:272
Graylevel, unsigned 16bpp image.
Definition: OrthancCPlugin.h:545
Definition: OrthancCPlugin.h:627
Definition: OrthancCPlugin.h:216
const char *const * headersValues
The values of the HTTP headers.
Definition: OrthancCPlugin.h:376
Definition: OrthancCPlugin.h:259
Definition: OrthancCPlugin.h:261
const char *const * headersKeys
The keys of the HTTP headers (always converted to low-case).
Definition: OrthancCPlugin.h:371
Definition: OrthancCPlugin.h:245
OrthancPluginCreateDicomFlags
Definition: OrthancCPlugin.h:739
char * OrthancPluginComputeSha1(OrthancPluginContext *context, const void *buffer, uint32_t size)
Compute a SHA-1 hash.
Definition: OrthancCPlugin.h:4911
Definition: OrthancCPlugin.h:263
OrthancPluginPixelFormat
Definition: OrthancCPlugin.h:529
Definition: OrthancCPlugin.h:773
uint32_t getCount
For a GET request, the number of GET parameters.
Definition: OrthancCPlugin.h:336
Definition: OrthancCPlugin.h:571
void OrthancPluginRegisterStorageArea(OrthancPluginContext *context, OrthancPluginStorageCreate create, OrthancPluginStorageRead read, OrthancPluginStorageRemove remove)
Register a custom storage area.
Definition: OrthancCPlugin.h:2498
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:993
OrthancPluginErrorCode OrthancPluginGetDicomForInstance(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *instanceId)
Retrieve a DICOM instance using its Orthanc identifier.
Definition: OrthancCPlugin.h:1597
OrthancPluginImageFormat
Definition: OrthancCPlugin.h:652
OrthancPluginErrorCode OrthancPluginWorklistGetDicomQuery(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const OrthancPluginWorklistQuery *query)
Retrieve the worklist query as a DICOM file.
Definition: OrthancCPlugin.h:4595
Definition: OrthancCPlugin.h:202
Definition: OrthancCPlugin.h:285
void OrthancPluginFreeString(OrthancPluginContext *context, char *str)
Free a string.
Definition: OrthancCPlugin.h:1213
Definition: OrthancCPlugin.h:269
const char * OrthancPluginGetFontName(OrthancPluginContext *context, uint32_t fontIndex)
Return the name of a font.
Definition: OrthancCPlugin.h:3853
Definition: OrthancCPlugin.h:222
Definition: OrthancCPlugin.h:275
Definition: OrthancCPlugin.h:267
Definition: OrthancCPlugin.h:304
void(* OrthancPluginFree)(void *buffer)
Signature of a function to free dynamic memory.
Definition: OrthancCPlugin.h:920
Definition: OrthancCPlugin.h:213
char * OrthancPluginComputeMd5(OrthancPluginContext *context, const void *buffer, uint32_t size)
Compute an MD5 hash.
Definition: OrthancCPlugin.h:4875
Definition: OrthancCPlugin.h:215
OrthancPluginErrorCode
Definition: OrthancCPlugin.h:188
OrthancPluginImage * OrthancPluginConvertPixelFormat(OrthancPluginContext *context, const OrthancPluginImage *source, OrthancPluginPixelFormat targetFormat)
Change the pixel format of an image.
Definition: OrthancCPlugin.h:3778
Definition: OrthancCPlugin.h:270
Definition: OrthancCPlugin.h:621
OrthancPluginErrorCode OrthancPluginStorageAreaRead(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, OrthancPluginStorageArea *storageArea, const char *uuid, OrthancPluginContentType type)
Read a file from the storage area.
Definition: OrthancCPlugin.h:4032
uint32_t OrthancPluginGetFontsCount(OrthancPluginContext *context)
Return the number of available fonts.
Definition: OrthancCPlugin.h:3813
char * OrthancPluginGetConfigurationPath(OrthancPluginContext *context)
Return the path to the configuration file(s).
Definition: OrthancCPlugin.h:2595
uint32_t(* OrthancPluginGetMoveSize)(void *moveDriver)
Callback to read the size of a C-Move driver.
Definition: OrthancCPlugin.h:1145
Definition: OrthancCPlugin.h:211
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 char *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:5110
void OrthancPluginRegisterOnChangeCallback(OrthancPluginContext *context, OrthancPluginOnChangeCallback callback)
Register a callback to monitor changes.
Definition: OrthancCPlugin.h:2637
Color image in RGBA32 format.
Definition: OrthancCPlugin.h:569
Definition: OrthancCPlugin.h:723
OrthancPluginDicomToJsonFlags
Definition: OrthancCPlugin.h:720
Definition: OrthancCPlugin.h:204
void OrthancPluginSendMethodNotAllowed(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *allowedMethods)
Signal that this URI does not support this HTTP method.
Definition: OrthancCPlugin.h:2142
Definition: OrthancCPlugin.h:639
char * OrthancPluginGenerateUuid(OrthancPluginContext *context)
Generate an UUID.
Definition: OrthancCPlugin.h:5165
void OrthancPluginAnswerBuffer(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *answer, uint32_t answerSize, const char *mimeType)
Answer to a REST request.
Definition: OrthancCPlugin.h:1499
Definition: OrthancCPlugin.h:615
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:4829
Definition: OrthancCPlugin.h:246
OrthancPluginDicomToJsonFormat
Definition: OrthancCPlugin.h:705
OrthancPluginErrorCode OrthancPluginLookupDictionary(OrthancPluginContext *context, OrthancPluginDictionaryEntry *target, const char *name)
Get information about the given DICOM tag.
Definition: OrthancCPlugin.h:4957
Definition: OrthancCPlugin.h:707
OrthancPluginErrorCode OrthancPluginRegisterErrorCode(OrthancPluginContext *context, int32_t code, uint16_t httpStatus, const char *message)
Declare a custom error code for this plugin.
Definition: OrthancCPlugin.h:4108
Definition: OrthancCPlugin.h:227
uint16_t group
Definition: OrthancCPlugin.h:1196
void * OrthancPluginGetImageBuffer(OrthancPluginContext *context, const OrthancPluginImage *image)
Return a pointer to the content of an image.
Definition: OrthancCPlugin.h:3351
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:1020
Definition: OrthancCPlugin.h:668
uint32_t minMultiplicity
Definition: OrthancCPlugin.h:1199
Definition: OrthancCPlugin.h:709
Definition: OrthancCPlugin.h:680
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:2450
Definition: OrthancCPlugin.h:654
Definition: OrthancCPlugin.h:239
struct _OrthancPluginStorageArea_t OrthancPluginStorageArea
Opaque structure that represents the storage area that is actually used by Orthanc.
Definition: OrthancCPlugin.h:829
Definition: OrthancCPlugin.h:231
Definition: OrthancCPlugin.h:583
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:5333
Definition: OrthancCPlugin.h:619
OrthancPluginErrorCode OrthancPluginRestApiPutAfterPlugins(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const char *body, uint32_t bodySize)
Make a PUT call to the REST API, as tainted by the plugins.
Definition: OrthancCPlugin.h:1845
uint32_t OrthancPluginGetExpectedDatabaseVersion(OrthancPluginContext *context)
Get the expected version of the database schema.
Definition: OrthancCPlugin.h:2883
Definition: OrthancCPlugin.h:262
Graylevel 8bpp image.
Definition: OrthancCPlugin.h:537
Definition: OrthancCPlugin.h:260
Definition: OrthancCPlugin.h:205
OrthancPluginResourceType
Definition: OrthancCPlugin.h:595
OrthancPluginHttpMethod
Definition: OrthancCPlugin.h:301
Definition: OrthancCPlugin.h:221
uint32_t OrthancPluginGetImageHeight(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the height of an image.
Definition: OrthancCPlugin.h:3282
OrthancPluginValueRepresentation
Definition: OrthancCPlugin.h:666
char * OrthancPluginGetConfiguration(OrthancPluginContext *context)
Return the content of the configuration file(s).
Definition: OrthancCPlugin.h:2916
Definition: OrthancCPlugin.h:192
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:3180
OrthancPluginImage * OrthancPluginUncompressImage(OrthancPluginContext *context, const void *data, uint32_t size, OrthancPluginImageFormat format)
Decode a compressed image.
Definition: OrthancCPlugin.h:3394
Definition: OrthancCPlugin.h:265
Definition: OrthancCPlugin.h:670
Definition: OrthancCPlugin.h:208
Definition: OrthancCPlugin.h:600
OrthancPluginErrorCode(* OrthancPluginRestCallback)(OrthancPluginRestOutput *output, const char *url, const OrthancPluginHttpRequest *request)
Signature of a callback function that answers to a REST request.
Definition: OrthancCPlugin.h:877
Definition: OrthancCPlugin.h:256
Definition: OrthancCPlugin.h:640
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:1051
Definition: OrthancCPlugin.h:673
Definition: OrthancCPlugin.h:273
char * OrthancPluginGetOrthancDirectory(OrthancPluginContext *context)
Return the directory containing the Orthanc.
Definition: OrthancCPlugin.h:2560
Definition: OrthancCPlugin.h:226
Definition: OrthancCPlugin.h:642
OrthancPluginErrorCode OrthancPluginFindAddAnswer(OrthancPluginContext *context, OrthancPluginFindAnswers *answers, const void *dicom, uint32_t size)
Add one answer to some C-Find request.
Definition: OrthancCPlugin.h:5243
Definition: OrthancCPlugin.h:692
Definition: OrthancCPlugin.h:248
Color image in RGB24 format.
Definition: OrthancCPlugin.h:561
OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter2(OrthancPluginContext *context, OrthancPluginIncomingHttpRequestFilter2 callback)
Register a callback to filter incoming HTTP requests.
Definition: OrthancCPlugin.h:5602
OrthancPluginErrorCode OrthancPluginWorklistMarkIncomplete(OrthancPluginContext *context, OrthancPluginWorklistAnswers *answers)
Mark the set of worklist answers as incomplete.
Definition: OrthancCPlugin.h:4518
Graylevel, signed 16bpp image.
Definition: OrthancCPlugin.h:553
An entry in the dictionary of DICOM tags.
Definition: OrthancCPlugin.h:1194
Definition: OrthancCPlugin.h:258
Definition: OrthancCPlugin.h:198
Definition: OrthancCPlugin.h:614
OrthancPluginCompressionType
Definition: OrthancCPlugin.h:637
OrthancPluginErrorCode OrthancPluginHttpPut(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *url, const char *body, uint32_t bodySize, const char *username, const char *password)
Issue a HTTP PUT call.
Definition: OrthancCPlugin.h:3703
Definition: OrthancCPlugin.h:190
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:4414
Definition: OrthancCPlugin.h:726
OrthancPluginPixelFormat OrthancPluginGetImagePixelFormat(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the pixel format of an image.
Definition: OrthancCPlugin.h:3216
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:3938
uint32_t OrthancPluginGetImagePitch(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the pitch of an image.
Definition: OrthancCPlugin.h:3317
Definition: OrthancCPlugin.h:584
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:1556
Definition: OrthancCPlugin.h:278
Definition: OrthancCPlugin.h:284
struct _OrthancPluginWorklistAnswers_t OrthancPluginWorklistAnswers
Opaque structure to an object that represents the answers to a C-Find query for worklists.
Definition: OrthancCPlugin.h:845
uint32_t maxMultiplicity
Definition: OrthancCPlugin.h:1200
OrthancPluginErrorCode OrthancPluginRegisterFindCallback(OrthancPluginContext *context, OrthancPluginFindCallback callback)
Register a callback to handle C-Find requests.
Definition: OrthancCPlugin.h:5204
Definition: OrthancCPlugin.h:277
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:909
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:4307
uint32_t OrthancPluginGetCommandLineArgumentsCount(OrthancPluginContext *context)
Get the number of command-line arguments.
Definition: OrthancCPlugin.h:2816
Definition: OrthancCPlugin.h:229
void OrthancPluginSendUnauthorized(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *realm)
Signal that a REST request is not authorized.
Definition: OrthancCPlugin.h:2119
Definition: OrthancCPlugin.h:200
Definition: OrthancCPlugin.h:254
Definition: OrthancCPlugin.h:242
void OrthancPluginFreeFindMatcher(OrthancPluginContext *context, OrthancPluginFindMatcher *matcher)
Free a C-Find matcher.
Definition: OrthancCPlugin.h:5527
Definition: OrthancCPlugin.h:274
void OrthancPluginLogError(OrthancPluginContext *context, const char *message)
Log an error.
Definition: OrthancCPlugin.h:1342
Definition: OrthancCPlugin.h:219
struct _OrthancPluginWorklistQuery_t OrthancPluginWorklistQuery
Opaque structure to an object that represents a C-Find query for worklists.
Definition: OrthancCPlugin.h:837
OrthancPluginFindMatcher * OrthancPluginCreateFindMatcher(OrthancPluginContext *context, const void *query, uint32_t size)
Create a C-Find matcher.
Definition: OrthancCPlugin.h:5489
void * data
The content of the buffer.
Definition: OrthancCPlugin.h:791
uint32_t OrthancPluginGetFontSize(OrthancPluginContext *context, uint32_t fontIndex)
Return the size of a font.
Definition: OrthancCPlugin.h:3885
void OrthancPluginExtendOrthancExplorer(OrthancPluginContext *context, const char *javascript)
Extend the JavaScript code of Orthanc Explorer.
Definition: OrthancCPlugin.h:2712
Definition: OrthancCPlugin.h:771
OrthancPluginErrorCode OrthancPluginRestApiGet(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri)
Make a GET call to the built-in Orthanc REST API.
Definition: OrthancCPlugin.h:1630
const char * OrthancPluginGetErrorDescription(OrthancPluginContext *context, OrthancPluginErrorCode error)
Get the description of a given error code.
Definition: OrthancCPlugin.h:3127
OrthancPluginErrorCode(* OrthancPluginFindCallback)(OrthancPluginFindAnswers *answers, const OrthancPluginFindQuery *query, const char *issuerAet, const char *calledAet)
Callback to handle incoming C-Find SCP requests.
Definition: OrthancCPlugin.h:1078
uint32_t headersCount
The number of HTTP headers.
Definition: OrthancCPlugin.h:366
Definition: OrthancCPlugin.h:620
Definition: OrthancCPlugin.h:725
void OrthancPluginFreeMemoryBuffer(OrthancPluginContext *context, OrthancPluginMemoryBuffer *buffer)
Free a memory buffer.
Definition: OrthancCPlugin.h:1326
OrthancPluginErrorCode(* OrthancPluginStorageCreate)(const char *uuid, const void *content, int64_t size, OrthancPluginContentType type)
Callback for writing to the storage area.
Definition: OrthancCPlugin.h:936
Definition: OrthancCPlugin.h:686
OrthancPluginErrorCode OrthancPluginRestApiDelete(OrthancPluginContext *context, const char *uri)
Make a DELETE call to the built-in Orthanc REST API.
Definition: OrthancCPlugin.h:1761
Definition: OrthancCPlugin.h:690
Definition: OrthancCPlugin.h:599
OrthancPluginErrorCode OrthancPluginReadFile(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *path)
Read a file.
Definition: OrthancCPlugin.h:3065
Definition: OrthancCPlugin.h:679
Definition: OrthancCPlugin.h:758
Definition: OrthancCPlugin.h:305
OrthancPluginImage * OrthancPluginCreateImage(OrthancPluginContext *context, OrthancPluginPixelFormat format, uint32_t width, uint32_t height)
Create an image.
Definition: OrthancCPlugin.h:4741
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:5364
Definition: OrthancCPlugin.h:681
Definition: OrthancCPlugin.h:234
char * OrthancPluginGetOrthancPath(OrthancPluginContext *context)
Return the path to the Orthanc executable.
Definition: OrthancCPlugin.h:2530
char * OrthancPluginGetGlobalProperty(OrthancPluginContext *context, int32_t property, const char *defaultValue)
Get the value of a global property.
Definition: OrthancCPlugin.h:2746
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:5000
OrthancPluginErrorCode(* OrthancPluginStorageRemove)(const char *uuid, OrthancPluginContentType type)
Callback for removing a file from the storage area.
Definition: OrthancCPlugin.h:974
Definition: OrthancCPlugin.h:708
Definition: OrthancCPlugin.h:243
Definition: OrthancCPlugin.h:281
Definition: OrthancCPlugin.h:303
Definition: OrthancCPlugin.h:622
OrthancPluginErrorCode OrthancPluginReconstructMainDicomTags(OrthancPluginContext *context, OrthancPluginStorageArea *storageArea, OrthancPluginResourceType level)
Reconstruct the main DICOM tags.
Definition: OrthancCPlugin.h:4263
char * OrthancPluginGetCommandLineArgument(OrthancPluginContext *context, uint32_t argument)
Get the value of a command-line argument.
Definition: OrthancCPlugin.h:2850
OrthancPluginErrorCode OrthancPluginHttpGet(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *url, const char *username, const char *password)
Issue a HTTP GET call.
Definition: OrthancCPlugin.h:3625
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:4784
Definition: OrthancCPlugin.h:251
OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter(OrthancPluginContext *context, OrthancPluginIncomingHttpRequestFilter callback)
Register a callback to filter incoming HTTP requests.
Definition: OrthancCPlugin.h:5038
Definition: OrthancCPlugin.h:212
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:4356
const char *const * getValues
For a GET request, the values of the GET parameters.
Definition: OrthancCPlugin.h:346
Definition: OrthancCPlugin.h:693
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:898
char * OrthancPluginGetInstanceSimplifiedJson(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the DICOM tag hierarchy as a JSON file (with simplification).
Definition: OrthancCPlugin.h:2373
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:3028
Definition: OrthancCPlugin.h:244
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:4670
Definition: OrthancCPlugin.h:237
Definition: OrthancCPlugin.h:656
Definition: OrthancCPlugin.h:199
const char * body
For a PUT or POST request, the content of the body.
Definition: OrthancCPlugin.h:351
Definition: OrthancCPlugin.h:250
Definition: OrthancCPlugin.h:206
void OrthancPluginRegisterRestCallbackNoLock(OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback callback)
Register a REST callback, without locking.
Definition: OrthancCPlugin.h:1439
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:1121
Definition: OrthancCPlugin.h:625
struct _OrthancPluginImage_t OrthancPluginImage
Opaque structure that represents an image that is uncompressed in memory.
Definition: OrthancCPlugin.h:821
OrthancPluginErrorCode OrthancPluginRestApiPut(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const char *body, uint32_t bodySize)
Make a PUT call to the built-in Orthanc REST API.
Definition: OrthancCPlugin.h:1809
OrthancPluginErrorCode OrthancPluginStartMultipartAnswer(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *subType, const char *contentType)
Start an HTTP multipart answer.
Definition: OrthancCPlugin.h:2957
Definition: OrthancCPlugin.h:191
Definition: OrthancCPlugin.h:217
Definition: OrthancCPlugin.h:210
struct _OrthancPluginFindAnswers_t OrthancPluginFindAnswers
Opaque structure to an object that represents the answers to a C-Find query for worklists.
Definition: OrthancCPlugin.h:861
Definition: OrthancCPlugin.h:755
Definition: OrthancCPlugin.h:282
Definition: OrthancCPlugin.h:253
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:5402
void OrthancPluginSetRootUri(OrthancPluginContext *context, const char *uri)
Set the URI where the plugin provides its Web interface.
Definition: OrthancCPlugin.h:2668
OrthancPluginErrorCode OrthancPluginStorageAreaRemove(OrthancPluginContext *context, OrthancPluginStorageArea *storageArea, const char *uuid, OrthancPluginContentType type)
Remove a file from the storage area.
Definition: OrthancCPlugin.h:4069
Definition: OrthancCPlugin.h:685
Definition: OrthancCPlugin.h:626
const char *const * getKeys
For a GET request, the keys of the GET parameters.
Definition: OrthancCPlugin.h:341
Definition: OrthancCPlugin.h:688
Definition: OrthancCPlugin.h:617
char * OrthancPluginLookupPatient(OrthancPluginContext *context, const char *patientID)
Look for a patient.
Definition: OrthancCPlugin.h:1911
OrthancPluginInstanceOrigin OrthancPluginGetInstanceOrigin(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the origin of a DICOM file.
Definition: OrthancCPlugin.h:4621
Definition: OrthancCPlugin.h:689
void OrthancPluginFreeImage(OrthancPluginContext *context, OrthancPluginImage *image)
Free an image.
Definition: OrthancCPlugin.h:3436
OrthancPluginValueRepresentation vr
Definition: OrthancCPlugin.h:1198
uint16_t element
Definition: OrthancCPlugin.h:1197
char * OrthancPluginLookupInstance(OrthancPluginContext *context, const char *sopInstanceUID)
Look for an instance.
Definition: OrthancCPlugin.h:2051
Definition: OrthancCPlugin.h:624
OrthancPluginErrorCode OrthancPluginSetGlobalProperty(OrthancPluginContext *context, int32_t property, const char *value)
Set the value of a global property.
Definition: OrthancCPlugin.h:2785
Definition: OrthancCPlugin.h:223
Definition: OrthancCPlugin.h:585
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:2986
const char *const * groups
The matched values for the groups of the regular expression.
Definition: OrthancCPlugin.h:331
OrthancPluginErrorCode OrthancPluginWriteFile(OrthancPluginContext *context, const char *path, const void *data, uint32_t size)
Write a file.
Definition: OrthancCPlugin.h:3096
Definition: OrthancCPlugin.h:252
OrthancPluginErrorCode(* OrthancPluginStorageRead)(void **content, int64_t *size, const char *uuid, OrthancPluginContentType type)
Callback for reading from the storage area.
Definition: OrthancCPlugin.h:956
Definition: OrthancCPlugin.h:255
char * OrthancPluginLookupStudy(OrthancPluginContext *context, const char *studyUID)
Look for a study.
Definition: OrthancCPlugin.h:1946
uint32_t size
The number of bytes in the buffer.
Definition: OrthancCPlugin.h:796
Definition: OrthancCPlugin.h:769
OrthancPluginErrorCode OrthancPluginRegisterMoveCallback(OrthancPluginContext *context, OrthancPluginMoveCallback callback, OrthancPluginGetMoveSize getMoveSize, OrthancPluginApplyMove applyMove, OrthancPluginFreeMove freeMove)
Register a callback to handle C-Move requests.
Definition: OrthancCPlugin.h:5450
Definition: OrthancCPlugin.h:235
struct _OrthancPluginDicomInstance_t OrthancPluginDicomInstance
Opaque structure that represents a DICOM instance received by Orthanc.
Definition: OrthancCPlugin.h:813
uint32_t groupsCount
The number of groups of the regular expression.
Definition: OrthancCPlugin.h:326
Definition: OrthancCPlugin.h:236
Definition: OrthancCPlugin.h:601
void OrthancPluginLogWarning(OrthancPluginContext *context, const char *message)
Log a warning.
Definition: OrthancCPlugin.h:1358
Definition: OrthancCPlugin.h:674
Definition: OrthancCPlugin.h:241
Definition: OrthancCPlugin.h:694
OrthancPluginIdentifierConstraint
Definition: OrthancCPlugin.h:753
uint32_t bodySize
For a PUT or POST request, the number of bytes of the body.
Definition: OrthancCPlugin.h:356
Definition: OrthancCPlugin.h:306
void OrthancPluginSetCookie(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *cookie, const char *value)
Set a cookie.
Definition: OrthancCPlugin.h:2172
Definition: OrthancCPlugin.h:616
Definition: OrthancCPlugin.h:684
char * OrthancPluginGetInstanceJson(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the DICOM tag hierarchy as a JSON file.
Definition: OrthancCPlugin.h:2335
void OrthancPluginSetDescription(OrthancPluginContext *context, const char *description)
Set a description for this plugin.
Definition: OrthancCPlugin.h:2690
Definition: OrthancCPlugin.h:283
Definition: OrthancCPlugin.h:225
OrthancPluginErrorCode OrthancPluginRestApiPost(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const char *body, uint32_t bodySize)
Make a POST call to the built-in Orthanc REST API.
Definition: OrthancCPlugin.h:1697
void OrthancPluginRegisterOnStoredInstanceCallback(OrthancPluginContext *context, OrthancPluginOnStoredInstanceCallback callback)
Register a callback for received instances.
Definition: OrthancCPlugin.h:1467
Definition: OrthancCPlugin.h:618
Definition: OrthancCPlugin.h:687
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:4164
Definition: OrthancCPlugin.h:238
Definition: OrthancCPlugin.h:203
Definition: OrthancCPlugin.h:691
OrthancPluginErrorCode OrthancPluginHttpPost(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *url, const char *body, uint32_t bodySize, const char *username, const char *password)
Issue a HTTP POST call.
Definition: OrthancCPlugin.h:3662
Definition: OrthancCPlugin.h:671
OrthancPluginErrorCode OrthancPluginFindMarkIncomplete(OrthancPluginContext *context, OrthancPluginFindAnswers *answers)
Mark the set of C-Find answers as incomplete.
Definition: OrthancCPlugin.h:5272
void OrthancPluginRegisterRestCallback(OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback callback)
Register a REST callback.
Definition: OrthancCPlugin.h:1405
char * OrthancPluginLookupStudyWithAccessionNumber(OrthancPluginContext *context, const char *accessionNumber)
Look for a study, using the accession number.
Definition: OrthancCPlugin.h:1981
Definition: OrthancCPlugin.h:683
Definition: OrthancCPlugin.h:669
Definition: OrthancCPlugin.h:195
Definition: OrthancCPlugin.h:597
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:1660
Definition: OrthancCPlugin.h:770
Definition: OrthancCPlugin.h:214
OrthancPluginErrorCode(* OrthancPluginOnStoredInstanceCallback)(OrthancPluginDicomInstance *instance, const char *instanceId)
Signature of a callback function that is triggered when Orthanc receives a DICOM instance.
Definition: OrthancCPlugin.h:888
Definition: OrthancCPlugin.h:276
Definition: OrthancCPlugin.h:196
Definition: OrthancCPlugin.h:201
OrthancPluginErrorCode OrthancPluginRestApiPostAfterPlugins(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const char *body, uint32_t bodySize)
Make a POST call to the REST API, as tainted by the plugins.
Definition: OrthancCPlugin.h:1732
Definition: OrthancCPlugin.h:193
Definition: OrthancCPlugin.h:218
Definition: OrthancCPlugin.h:623
Definition: OrthancCPlugin.h:641
Definition: OrthancCPlugin.h:228
OrthancPluginErrorCode(* OrthancPluginApplyMove)(void *moveDriver)
Callback to apply one C-Move suboperation.
Definition: OrthancCPlugin.h:1159
OrthancPluginHttpMethod method
The HTTP method.
Definition: OrthancCPlugin.h:321
Definition: OrthancCPlugin.h:271
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:3990
OrthancPluginErrorCode OrthancPluginHttpDelete(OrthancPluginContext *context, const char *url, const char *username, const char *password)
Issue a HTTP DELETE call.
Definition: OrthancCPlugin.h:3740
A memory buffer allocated by the core system of Orthanc.
Definition: OrthancCPlugin.h:786
uint32_t OrthancPluginGetFindQuerySize(OrthancPluginContext *context, const OrthancPluginFindQuery *query)
Get the number of tags in a C-Find query.
Definition: OrthancCPlugin.h:5296
Definition: OrthancCPlugin.h:676
Definition: OrthancCPlugin.h:724
Definition: OrthancCPlugin.h:207
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:5560
Definition: OrthancCPlugin.h:682
char * OrthancPluginLookupSeries(OrthancPluginContext *context, const char *seriesUID)
Look for a series.
Definition: OrthancCPlugin.h:2016
Definition: OrthancCPlugin.h:197
Definition: OrthancCPlugin.h:672
Definition: OrthancCPlugin.h:264
int32_t OrthancPluginWorklistIsMatch(OrthancPluginContext *context, const OrthancPluginWorklistQuery *query, const void *dicom, uint32_t size)
Test whether a worklist matches the query.
Definition: OrthancCPlugin.h:4556
uint32_t OrthancPluginGetImageWidth(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the width of an image.
Definition: OrthancCPlugin.h:3249
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:3526
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:869
Definition: OrthancCPlugin.h:220