Orthanc Plugin SDK  1.4.1
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 4
121 #define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 0
122 
123 
124 #if !defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)
125 #define ORTHANC_PLUGINS_VERSION_IS_ABOVE(major, minor, revision) \
126  (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER > major || \
127  (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER == major && \
128  (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER > minor || \
129  (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER == minor && \
130  ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER >= revision))))
131 #endif
132 
133 
134 
135 /********************************************************************
136  ** Check that function inlining is properly supported. The use of
137  ** inlining is required, to avoid the duplication of object code
138  ** between two compilation modules that would use the Orthanc Plugin
139  ** API.
140  ********************************************************************/
141 
142 /* If the auto-detection of the "inline" keyword below does not work
143  automatically and that your compiler is known to properly support
144  inlining, uncomment the following #define and adapt the definition
145  of "static inline". */
146 
147 /* #define ORTHANC_PLUGIN_INLINE static inline */
148 
149 #ifndef ORTHANC_PLUGIN_INLINE
150 # if __STDC_VERSION__ >= 199901L
151 /* This is C99 or above: http://predef.sourceforge.net/prestd.html */
152 # define ORTHANC_PLUGIN_INLINE static inline
153 # elif defined(__cplusplus)
154 /* This is C++ */
155 # define ORTHANC_PLUGIN_INLINE static inline
156 # elif defined(__GNUC__)
157 /* This is GCC running in C89 mode */
158 # define ORTHANC_PLUGIN_INLINE static __inline
159 # elif defined(_MSC_VER)
160 /* This is Visual Studio running in C89 mode */
161 # define ORTHANC_PLUGIN_INLINE static __inline
162 # else
163 # error Your compiler is not known to support the "inline" keyword
164 # endif
165 #endif
166 
167 
168 
169 /********************************************************************
170  ** Inclusion of standard libraries.
171  ********************************************************************/
172 
178 #include <stdint.h>
179 
180 #include <stdlib.h>
181 
182 
183 
184 /********************************************************************
185  ** Definition of the Orthanc Plugin API.
186  ********************************************************************/
187 
190 #ifdef __cplusplus
191 extern "C"
192 {
193 #endif
194 
198  typedef enum
199  {
298 
299  _OrthancPluginErrorCode_INTERNAL = 0x7fffffff
301 
302 
307  ORTHANC_PLUGINS_API const char* OrthancPluginGetName();
308 
309 
313  typedef enum
314  {
320  _OrthancPluginHttpMethod_INTERNAL = 0x7fffffff
322 
323 
328  typedef struct
329  {
334 
338  uint32_t groupsCount;
339 
343  const char* const* groups;
344 
348  uint32_t getCount;
349 
353  const char* const* getKeys;
354 
358  const char* const* getValues;
359 
363  const char* body;
364 
368  uint32_t bodySize;
369 
370 
371  /* --------------------------------------------------
372  New in version 0.8.1
373  -------------------------------------------------- */
374 
378  uint32_t headersCount;
379 
383  const char* const* headersKeys;
384 
388  const char* const* headersValues;
389 
391 
392 
393  typedef enum
394  {
395  /* Generic services */
396  _OrthancPluginService_LogInfo = 1,
397  _OrthancPluginService_LogWarning = 2,
398  _OrthancPluginService_LogError = 3,
399  _OrthancPluginService_GetOrthancPath = 4,
400  _OrthancPluginService_GetOrthancDirectory = 5,
401  _OrthancPluginService_GetConfigurationPath = 6,
402  _OrthancPluginService_SetPluginProperty = 7,
403  _OrthancPluginService_GetGlobalProperty = 8,
404  _OrthancPluginService_SetGlobalProperty = 9,
405  _OrthancPluginService_GetCommandLineArgumentsCount = 10,
406  _OrthancPluginService_GetCommandLineArgument = 11,
407  _OrthancPluginService_GetExpectedDatabaseVersion = 12,
408  _OrthancPluginService_GetConfiguration = 13,
409  _OrthancPluginService_BufferCompression = 14,
410  _OrthancPluginService_ReadFile = 15,
411  _OrthancPluginService_WriteFile = 16,
412  _OrthancPluginService_GetErrorDescription = 17,
413  _OrthancPluginService_CallHttpClient = 18,
414  _OrthancPluginService_RegisterErrorCode = 19,
415  _OrthancPluginService_RegisterDictionaryTag = 20,
416  _OrthancPluginService_DicomBufferToJson = 21,
417  _OrthancPluginService_DicomInstanceToJson = 22,
418  _OrthancPluginService_CreateDicom = 23,
419  _OrthancPluginService_ComputeMd5 = 24,
420  _OrthancPluginService_ComputeSha1 = 25,
421  _OrthancPluginService_LookupDictionary = 26,
422  _OrthancPluginService_CallHttpClient2 = 27,
423  _OrthancPluginService_GenerateUuid = 28,
424  _OrthancPluginService_RegisterPrivateDictionaryTag = 29,
425 
426  /* Registration of callbacks */
427  _OrthancPluginService_RegisterRestCallback = 1000,
428  _OrthancPluginService_RegisterOnStoredInstanceCallback = 1001,
429  _OrthancPluginService_RegisterStorageArea = 1002,
430  _OrthancPluginService_RegisterOnChangeCallback = 1003,
431  _OrthancPluginService_RegisterRestCallbackNoLock = 1004,
432  _OrthancPluginService_RegisterWorklistCallback = 1005,
433  _OrthancPluginService_RegisterDecodeImageCallback = 1006,
434  _OrthancPluginService_RegisterIncomingHttpRequestFilter = 1007,
435  _OrthancPluginService_RegisterFindCallback = 1008,
436  _OrthancPluginService_RegisterMoveCallback = 1009,
437  _OrthancPluginService_RegisterIncomingHttpRequestFilter2 = 1010,
438 
439  /* Sending answers to REST calls */
440  _OrthancPluginService_AnswerBuffer = 2000,
441  _OrthancPluginService_CompressAndAnswerPngImage = 2001, /* Unused as of Orthanc 0.9.4 */
442  _OrthancPluginService_Redirect = 2002,
443  _OrthancPluginService_SendHttpStatusCode = 2003,
444  _OrthancPluginService_SendUnauthorized = 2004,
445  _OrthancPluginService_SendMethodNotAllowed = 2005,
446  _OrthancPluginService_SetCookie = 2006,
447  _OrthancPluginService_SetHttpHeader = 2007,
448  _OrthancPluginService_StartMultipartAnswer = 2008,
449  _OrthancPluginService_SendMultipartItem = 2009,
450  _OrthancPluginService_SendHttpStatus = 2010,
451  _OrthancPluginService_CompressAndAnswerImage = 2011,
452  _OrthancPluginService_SendMultipartItem2 = 2012,
453 
454  /* Access to the Orthanc database and API */
455  _OrthancPluginService_GetDicomForInstance = 3000,
456  _OrthancPluginService_RestApiGet = 3001,
457  _OrthancPluginService_RestApiPost = 3002,
458  _OrthancPluginService_RestApiDelete = 3003,
459  _OrthancPluginService_RestApiPut = 3004,
460  _OrthancPluginService_LookupPatient = 3005,
461  _OrthancPluginService_LookupStudy = 3006,
462  _OrthancPluginService_LookupSeries = 3007,
463  _OrthancPluginService_LookupInstance = 3008,
464  _OrthancPluginService_LookupStudyWithAccessionNumber = 3009,
465  _OrthancPluginService_RestApiGetAfterPlugins = 3010,
466  _OrthancPluginService_RestApiPostAfterPlugins = 3011,
467  _OrthancPluginService_RestApiDeleteAfterPlugins = 3012,
468  _OrthancPluginService_RestApiPutAfterPlugins = 3013,
469  _OrthancPluginService_ReconstructMainDicomTags = 3014,
470  _OrthancPluginService_RestApiGet2 = 3015,
471 
472  /* Access to DICOM instances */
473  _OrthancPluginService_GetInstanceRemoteAet = 4000,
474  _OrthancPluginService_GetInstanceSize = 4001,
475  _OrthancPluginService_GetInstanceData = 4002,
476  _OrthancPluginService_GetInstanceJson = 4003,
477  _OrthancPluginService_GetInstanceSimplifiedJson = 4004,
478  _OrthancPluginService_HasInstanceMetadata = 4005,
479  _OrthancPluginService_GetInstanceMetadata = 4006,
480  _OrthancPluginService_GetInstanceOrigin = 4007,
481 
482  /* Services for plugins implementing a database back-end */
483  _OrthancPluginService_RegisterDatabaseBackend = 5000,
484  _OrthancPluginService_DatabaseAnswer = 5001,
485  _OrthancPluginService_RegisterDatabaseBackendV2 = 5002,
486  _OrthancPluginService_StorageAreaCreate = 5003,
487  _OrthancPluginService_StorageAreaRead = 5004,
488  _OrthancPluginService_StorageAreaRemove = 5005,
489 
490  /* Primitives for handling images */
491  _OrthancPluginService_GetImagePixelFormat = 6000,
492  _OrthancPluginService_GetImageWidth = 6001,
493  _OrthancPluginService_GetImageHeight = 6002,
494  _OrthancPluginService_GetImagePitch = 6003,
495  _OrthancPluginService_GetImageBuffer = 6004,
496  _OrthancPluginService_UncompressImage = 6005,
497  _OrthancPluginService_FreeImage = 6006,
498  _OrthancPluginService_CompressImage = 6007,
499  _OrthancPluginService_ConvertPixelFormat = 6008,
500  _OrthancPluginService_GetFontsCount = 6009,
501  _OrthancPluginService_GetFontInfo = 6010,
502  _OrthancPluginService_DrawText = 6011,
503  _OrthancPluginService_CreateImage = 6012,
504  _OrthancPluginService_CreateImageAccessor = 6013,
505  _OrthancPluginService_DecodeDicomImage = 6014,
506 
507  /* Primitives for handling C-Find, C-Move and worklists */
508  _OrthancPluginService_WorklistAddAnswer = 7000,
509  _OrthancPluginService_WorklistMarkIncomplete = 7001,
510  _OrthancPluginService_WorklistIsMatch = 7002,
511  _OrthancPluginService_WorklistGetDicomQuery = 7003,
512  _OrthancPluginService_FindAddAnswer = 7004,
513  _OrthancPluginService_FindMarkIncomplete = 7005,
514  _OrthancPluginService_GetFindQuerySize = 7006,
515  _OrthancPluginService_GetFindQueryTag = 7007,
516  _OrthancPluginService_GetFindQueryTagName = 7008,
517  _OrthancPluginService_GetFindQueryValue = 7009,
518  _OrthancPluginService_CreateFindMatcher = 7010,
519  _OrthancPluginService_FreeFindMatcher = 7011,
520  _OrthancPluginService_FindMatcherIsMatch = 7012,
521 
522  _OrthancPluginService_INTERNAL = 0x7fffffff
523  } _OrthancPluginService;
524 
525 
526  typedef enum
527  {
528  _OrthancPluginProperty_Description = 1,
529  _OrthancPluginProperty_RootUri = 2,
530  _OrthancPluginProperty_OrthancExplorer = 3,
531 
532  _OrthancPluginProperty_INTERNAL = 0x7fffffff
533  } _OrthancPluginProperty;
534 
535 
536 
541  typedef enum
542  {
550 
558 
566 
574 
582 
592 
600 
608 
616 
624 
625  _OrthancPluginPixelFormat_INTERNAL = 0x7fffffff
627 
628 
629 
633  typedef enum
634  {
639  _OrthancPluginContentType_INTERNAL = 0x7fffffff
641 
642 
643 
647  typedef enum
648  {
655  _OrthancPluginResourceType_INTERNAL = 0x7fffffff
657 
658 
659 
664  typedef enum
665  {
681  _OrthancPluginChangeType_INTERNAL = 0x7fffffff
683 
684 
689  typedef enum
690  {
696  _OrthancPluginCompressionType_INTERNAL = 0x7fffffff
698 
699 
704  typedef enum
705  {
710  _OrthancPluginImageFormat_INTERNAL = 0x7fffffff
712 
713 
718  typedef enum
719  {
748  _OrthancPluginValueRepresentation_INTERNAL = 0x7fffffff
750 
751 
757  typedef enum
758  {
763  _OrthancPluginDicomToJsonFormat_INTERNAL = 0x7fffffff
765 
766 
772  typedef enum
773  {
774  OrthancPluginDicomToJsonFlags_None = 0,
782  _OrthancPluginDicomToJsonFlags_INTERNAL = 0x7fffffff
784 
785 
791  typedef enum
792  {
793  OrthancPluginCreateDicomFlags_None = 0,
797  _OrthancPluginCreateDicomFlags_INTERNAL = 0x7fffffff
799 
800 
805  typedef enum
806  {
812  _OrthancPluginIdentifierConstraint_INTERNAL = 0x7fffffff
814 
815 
819  typedef enum
820  {
827  _OrthancPluginInstanceOrigin_INTERNAL = 0x7fffffff
829 
830 
838  typedef struct
839  {
843  void* data;
844 
848  uint32_t size;
850 
851 
852 
853 
858  typedef struct _OrthancPluginRestOutput_t OrthancPluginRestOutput;
859 
860 
861 
865  typedef struct _OrthancPluginDicomInstance_t OrthancPluginDicomInstance;
866 
867 
868 
873  typedef struct _OrthancPluginImage_t OrthancPluginImage;
874 
875 
876 
881  typedef struct _OrthancPluginStorageArea_t OrthancPluginStorageArea;
882 
883 
884 
889  typedef struct _OrthancPluginWorklistQuery_t OrthancPluginWorklistQuery;
890 
891 
892 
897  typedef struct _OrthancPluginWorklistAnswers_t OrthancPluginWorklistAnswers;
898 
899 
900 
905  typedef struct _OrthancPluginFindQuery_t OrthancPluginFindQuery;
906 
907 
908 
913  typedef struct _OrthancPluginFindAnswers_t OrthancPluginFindAnswers;
914 
915 
916 
921  typedef struct _OrthancPluginFindAnswers_t OrthancPluginFindMatcher;
922 
923 
924 
930  OrthancPluginRestOutput* output,
931  const char* url,
932  const OrthancPluginHttpRequest* request);
933 
934 
935 
941  OrthancPluginDicomInstance* instance,
942  const char* instanceId);
943 
944 
945 
951  OrthancPluginChangeType changeType,
952  OrthancPluginResourceType resourceType,
953  const char* resourceId);
954 
955 
956 
962  OrthancPluginImage** target,
963  const void* dicom,
964  const uint32_t size,
965  uint32_t frameIndex);
966 
967 
968 
972  typedef void (*OrthancPluginFree) (void* buffer);
973 
974 
975 
989  const char* uuid,
990  const void* content,
991  int64_t size,
993 
994 
995 
1009  void** content,
1010  int64_t* size,
1011  const char* uuid,
1013 
1014 
1015 
1027  const char* uuid,
1029 
1030 
1031 
1047  const OrthancPluginWorklistQuery* query,
1048  const char* issuerAet,
1049  const char* calledAet);
1050 
1051 
1052 
1073  OrthancPluginHttpMethod method,
1074  const char* uri,
1075  const char* ip,
1076  uint32_t headersCount,
1077  const char* const* headersKeys,
1078  const char* const* headersValues);
1079 
1080 
1081 
1104  OrthancPluginHttpMethod method,
1105  const char* uri,
1106  const char* ip,
1107  uint32_t headersCount,
1108  const char* const* headersKeys,
1109  const char* const* headersValues,
1110  uint32_t getArgumentsCount,
1111  const char* const* getArgumentsKeys,
1112  const char* const* getArgumentsValues);
1113 
1114 
1115 
1131  OrthancPluginFindAnswers* answers,
1132  const OrthancPluginFindQuery* query,
1133  const char* issuerAet,
1134  const char* calledAet);
1135 
1136 
1137 
1173  typedef void* (*OrthancPluginMoveCallback) (
1174  OrthancPluginResourceType resourceType,
1175  const char* patientId,
1176  const char* accessionNumber,
1177  const char* studyInstanceUid,
1178  const char* seriesInstanceUid,
1179  const char* sopInstanceUid,
1180  const char* originatorAet,
1181  const char* sourceAet,
1182  const char* targetAet,
1183  uint16_t originatorId);
1184 
1185 
1197  typedef uint32_t (*OrthancPluginGetMoveSize) (void* moveDriver);
1198 
1199 
1211  typedef OrthancPluginErrorCode (*OrthancPluginApplyMove) (void* moveDriver);
1212 
1213 
1224  typedef void (*OrthancPluginFreeMove) (void* moveDriver);
1225 
1226 
1227 
1231  typedef struct _OrthancPluginContext_t
1232  {
1233  void* pluginsManager;
1234  const char* orthancVersion;
1235  OrthancPluginFree Free;
1236  OrthancPluginErrorCode (*InvokeService) (struct _OrthancPluginContext_t* context,
1237  _OrthancPluginService service,
1238  const void* params);
1240 
1241 
1242 
1246  typedef struct
1247  {
1248  uint16_t group;
1249  uint16_t element;
1251  uint32_t minMultiplicity;
1252  uint32_t maxMultiplicity;
1254 
1255 
1256 
1265  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeString(
1266  OrthancPluginContext* context,
1267  char* str)
1268  {
1269  if (str != NULL)
1270  {
1271  context->Free(str);
1272  }
1273  }
1274 
1275 
1292  ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersionAdvanced(
1293  OrthancPluginContext* context,
1294  int expectedMajor,
1295  int expectedMinor,
1296  int expectedRevision)
1297  {
1298  int major, minor, revision;
1299 
1300  if (sizeof(int32_t) != sizeof(OrthancPluginErrorCode) ||
1301  sizeof(int32_t) != sizeof(OrthancPluginHttpMethod) ||
1302  sizeof(int32_t) != sizeof(_OrthancPluginService) ||
1303  sizeof(int32_t) != sizeof(_OrthancPluginProperty) ||
1304  sizeof(int32_t) != sizeof(OrthancPluginPixelFormat) ||
1305  sizeof(int32_t) != sizeof(OrthancPluginContentType) ||
1306  sizeof(int32_t) != sizeof(OrthancPluginResourceType) ||
1307  sizeof(int32_t) != sizeof(OrthancPluginChangeType) ||
1308  sizeof(int32_t) != sizeof(OrthancPluginCompressionType) ||
1309  sizeof(int32_t) != sizeof(OrthancPluginImageFormat) ||
1310  sizeof(int32_t) != sizeof(OrthancPluginValueRepresentation) ||
1311  sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFormat) ||
1312  sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFlags) ||
1313  sizeof(int32_t) != sizeof(OrthancPluginCreateDicomFlags) ||
1314  sizeof(int32_t) != sizeof(OrthancPluginIdentifierConstraint) ||
1315  sizeof(int32_t) != sizeof(OrthancPluginInstanceOrigin))
1316  {
1317  /* Mismatch in the size of the enumerations */
1318  return 0;
1319  }
1320 
1321  /* Assume compatibility with the mainline */
1322  if (!strcmp(context->orthancVersion, "mainline"))
1323  {
1324  return 1;
1325  }
1326 
1327  /* Parse the version of the Orthanc core */
1328  if (
1329 #ifdef _MSC_VER
1330  sscanf_s
1331 #else
1332  sscanf
1333 #endif
1334  (context->orthancVersion, "%4d.%4d.%4d", &major, &minor, &revision) != 3)
1335  {
1336  return 0;
1337  }
1338 
1339  /* Check the major number of the version */
1340 
1341  if (major > expectedMajor)
1342  {
1343  return 1;
1344  }
1345 
1346  if (major < expectedMajor)
1347  {
1348  return 0;
1349  }
1350 
1351  /* Check the minor number of the version */
1352 
1353  if (minor > expectedMinor)
1354  {
1355  return 1;
1356  }
1357 
1358  if (minor < expectedMinor)
1359  {
1360  return 0;
1361  }
1362 
1363  /* Check the revision number of the version */
1364 
1365  if (revision >= expectedRevision)
1366  {
1367  return 1;
1368  }
1369  else
1370  {
1371  return 0;
1372  }
1373  }
1374 
1375 
1392  ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersion(
1393  OrthancPluginContext* context)
1394  {
1396  context,
1397  ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
1398  ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
1399  ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
1400  }
1401 
1402 
1411  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeMemoryBuffer(
1412  OrthancPluginContext* context,
1413  OrthancPluginMemoryBuffer* buffer)
1414  {
1415  context->Free(buffer->data);
1416  }
1417 
1418 
1427  ORTHANC_PLUGIN_INLINE void OrthancPluginLogError(
1428  OrthancPluginContext* context,
1429  const char* message)
1430  {
1431  context->InvokeService(context, _OrthancPluginService_LogError, message);
1432  }
1433 
1434 
1443  ORTHANC_PLUGIN_INLINE void OrthancPluginLogWarning(
1444  OrthancPluginContext* context,
1445  const char* message)
1446  {
1447  context->InvokeService(context, _OrthancPluginService_LogWarning, message);
1448  }
1449 
1450 
1459  ORTHANC_PLUGIN_INLINE void OrthancPluginLogInfo(
1460  OrthancPluginContext* context,
1461  const char* message)
1462  {
1463  context->InvokeService(context, _OrthancPluginService_LogInfo, message);
1464  }
1465 
1466 
1467 
1468  typedef struct
1469  {
1470  const char* pathRegularExpression;
1471  OrthancPluginRestCallback callback;
1472  } _OrthancPluginRestCallback;
1473 
1490  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallback(
1491  OrthancPluginContext* context,
1492  const char* pathRegularExpression,
1493  OrthancPluginRestCallback callback)
1494  {
1495  _OrthancPluginRestCallback params;
1496  params.pathRegularExpression = pathRegularExpression;
1497  params.callback = callback;
1498  context->InvokeService(context, _OrthancPluginService_RegisterRestCallback, &params);
1499  }
1500 
1501 
1502 
1524  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallbackNoLock(
1525  OrthancPluginContext* context,
1526  const char* pathRegularExpression,
1527  OrthancPluginRestCallback callback)
1528  {
1529  _OrthancPluginRestCallback params;
1530  params.pathRegularExpression = pathRegularExpression;
1531  params.callback = callback;
1532  context->InvokeService(context, _OrthancPluginService_RegisterRestCallbackNoLock, &params);
1533  }
1534 
1535 
1536 
1537  typedef struct
1538  {
1540  } _OrthancPluginOnStoredInstanceCallback;
1541 
1553  OrthancPluginContext* context,
1555  {
1556  _OrthancPluginOnStoredInstanceCallback params;
1557  params.callback = callback;
1558 
1559  context->InvokeService(context, _OrthancPluginService_RegisterOnStoredInstanceCallback, &params);
1560  }
1561 
1562 
1563 
1564  typedef struct
1565  {
1566  OrthancPluginRestOutput* output;
1567  const char* answer;
1568  uint32_t answerSize;
1569  const char* mimeType;
1570  } _OrthancPluginAnswerBuffer;
1571 
1584  ORTHANC_PLUGIN_INLINE void OrthancPluginAnswerBuffer(
1585  OrthancPluginContext* context,
1586  OrthancPluginRestOutput* output,
1587  const char* answer,
1588  uint32_t answerSize,
1589  const char* mimeType)
1590  {
1591  _OrthancPluginAnswerBuffer params;
1592  params.output = output;
1593  params.answer = answer;
1594  params.answerSize = answerSize;
1595  params.mimeType = mimeType;
1596  context->InvokeService(context, _OrthancPluginService_AnswerBuffer, &params);
1597  }
1598 
1599 
1600  typedef struct
1601  {
1602  OrthancPluginRestOutput* output;
1603  OrthancPluginPixelFormat format;
1604  uint32_t width;
1605  uint32_t height;
1606  uint32_t pitch;
1607  const void* buffer;
1608  } _OrthancPluginCompressAndAnswerPngImage;
1609 
1610  typedef struct
1611  {
1612  OrthancPluginRestOutput* output;
1613  OrthancPluginImageFormat imageFormat;
1614  OrthancPluginPixelFormat pixelFormat;
1615  uint32_t width;
1616  uint32_t height;
1617  uint32_t pitch;
1618  const void* buffer;
1619  uint8_t quality;
1620  } _OrthancPluginCompressAndAnswerImage;
1621 
1622 
1641  ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerPngImage(
1642  OrthancPluginContext* context,
1643  OrthancPluginRestOutput* output,
1644  OrthancPluginPixelFormat format,
1645  uint32_t width,
1646  uint32_t height,
1647  uint32_t pitch,
1648  const void* buffer)
1649  {
1650  _OrthancPluginCompressAndAnswerImage params;
1651  params.output = output;
1652  params.imageFormat = OrthancPluginImageFormat_Png;
1653  params.pixelFormat = format;
1654  params.width = width;
1655  params.height = height;
1656  params.pitch = pitch;
1657  params.buffer = buffer;
1658  params.quality = 0; /* No quality for PNG */
1659  context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
1660  }
1661 
1662 
1663 
1664  typedef struct
1665  {
1666  OrthancPluginMemoryBuffer* target;
1667  const char* instanceId;
1668  } _OrthancPluginGetDicomForInstance;
1669 
1683  OrthancPluginContext* context,
1684  OrthancPluginMemoryBuffer* target,
1685  const char* instanceId)
1686  {
1687  _OrthancPluginGetDicomForInstance params;
1688  params.target = target;
1689  params.instanceId = instanceId;
1690  return context->InvokeService(context, _OrthancPluginService_GetDicomForInstance, &params);
1691  }
1692 
1693 
1694 
1695  typedef struct
1696  {
1697  OrthancPluginMemoryBuffer* target;
1698  const char* uri;
1699  } _OrthancPluginRestApiGet;
1700 
1716  OrthancPluginContext* context,
1717  OrthancPluginMemoryBuffer* target,
1718  const char* uri)
1719  {
1720  _OrthancPluginRestApiGet params;
1721  params.target = target;
1722  params.uri = uri;
1723  return context->InvokeService(context, _OrthancPluginService_RestApiGet, &params);
1724  }
1725 
1726 
1727 
1746  OrthancPluginContext* context,
1747  OrthancPluginMemoryBuffer* target,
1748  const char* uri)
1749  {
1750  _OrthancPluginRestApiGet params;
1751  params.target = target;
1752  params.uri = uri;
1753  return context->InvokeService(context, _OrthancPluginService_RestApiGetAfterPlugins, &params);
1754  }
1755 
1756 
1757 
1758  typedef struct
1759  {
1760  OrthancPluginMemoryBuffer* target;
1761  const char* uri;
1762  const char* body;
1763  uint32_t bodySize;
1764  } _OrthancPluginRestApiPostPut;
1765 
1783  OrthancPluginContext* context,
1784  OrthancPluginMemoryBuffer* target,
1785  const char* uri,
1786  const char* body,
1787  uint32_t bodySize)
1788  {
1789  _OrthancPluginRestApiPostPut params;
1790  params.target = target;
1791  params.uri = uri;
1792  params.body = body;
1793  params.bodySize = bodySize;
1794  return context->InvokeService(context, _OrthancPluginService_RestApiPost, &params);
1795  }
1796 
1797 
1818  OrthancPluginContext* context,
1819  OrthancPluginMemoryBuffer* target,
1820  const char* uri,
1821  const char* body,
1822  uint32_t bodySize)
1823  {
1824  _OrthancPluginRestApiPostPut params;
1825  params.target = target;
1826  params.uri = uri;
1827  params.body = body;
1828  params.bodySize = bodySize;
1829  return context->InvokeService(context, _OrthancPluginService_RestApiPostAfterPlugins, &params);
1830  }
1831 
1832 
1833 
1847  OrthancPluginContext* context,
1848  const char* uri)
1849  {
1850  return context->InvokeService(context, _OrthancPluginService_RestApiDelete, uri);
1851  }
1852 
1853 
1870  OrthancPluginContext* context,
1871  const char* uri)
1872  {
1873  return context->InvokeService(context, _OrthancPluginService_RestApiDeleteAfterPlugins, uri);
1874  }
1875 
1876 
1877 
1895  OrthancPluginContext* context,
1896  OrthancPluginMemoryBuffer* target,
1897  const char* uri,
1898  const char* body,
1899  uint32_t bodySize)
1900  {
1901  _OrthancPluginRestApiPostPut params;
1902  params.target = target;
1903  params.uri = uri;
1904  params.body = body;
1905  params.bodySize = bodySize;
1906  return context->InvokeService(context, _OrthancPluginService_RestApiPut, &params);
1907  }
1908 
1909 
1910 
1931  OrthancPluginContext* context,
1932  OrthancPluginMemoryBuffer* target,
1933  const char* uri,
1934  const char* body,
1935  uint32_t bodySize)
1936  {
1937  _OrthancPluginRestApiPostPut params;
1938  params.target = target;
1939  params.uri = uri;
1940  params.body = body;
1941  params.bodySize = bodySize;
1942  return context->InvokeService(context, _OrthancPluginService_RestApiPutAfterPlugins, &params);
1943  }
1944 
1945 
1946 
1947  typedef struct
1948  {
1949  OrthancPluginRestOutput* output;
1950  const char* argument;
1951  } _OrthancPluginOutputPlusArgument;
1952 
1964  ORTHANC_PLUGIN_INLINE void OrthancPluginRedirect(
1965  OrthancPluginContext* context,
1966  OrthancPluginRestOutput* output,
1967  const char* redirection)
1968  {
1969  _OrthancPluginOutputPlusArgument params;
1970  params.output = output;
1971  params.argument = redirection;
1972  context->InvokeService(context, _OrthancPluginService_Redirect, &params);
1973  }
1974 
1975 
1976 
1977  typedef struct
1978  {
1979  char** result;
1980  const char* argument;
1981  } _OrthancPluginRetrieveDynamicString;
1982 
1996  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupPatient(
1997  OrthancPluginContext* context,
1998  const char* patientID)
1999  {
2000  char* result;
2001 
2002  _OrthancPluginRetrieveDynamicString params;
2003  params.result = &result;
2004  params.argument = patientID;
2005 
2006  if (context->InvokeService(context, _OrthancPluginService_LookupPatient, &params) != OrthancPluginErrorCode_Success)
2007  {
2008  /* Error */
2009  return NULL;
2010  }
2011  else
2012  {
2013  return result;
2014  }
2015  }
2016 
2017 
2031  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudy(
2032  OrthancPluginContext* context,
2033  const char* studyUID)
2034  {
2035  char* result;
2036 
2037  _OrthancPluginRetrieveDynamicString params;
2038  params.result = &result;
2039  params.argument = studyUID;
2040 
2041  if (context->InvokeService(context, _OrthancPluginService_LookupStudy, &params) != OrthancPluginErrorCode_Success)
2042  {
2043  /* Error */
2044  return NULL;
2045  }
2046  else
2047  {
2048  return result;
2049  }
2050  }
2051 
2052 
2066  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudyWithAccessionNumber(
2067  OrthancPluginContext* context,
2068  const char* accessionNumber)
2069  {
2070  char* result;
2071 
2072  _OrthancPluginRetrieveDynamicString params;
2073  params.result = &result;
2074  params.argument = accessionNumber;
2075 
2076  if (context->InvokeService(context, _OrthancPluginService_LookupStudyWithAccessionNumber, &params) != OrthancPluginErrorCode_Success)
2077  {
2078  /* Error */
2079  return NULL;
2080  }
2081  else
2082  {
2083  return result;
2084  }
2085  }
2086 
2087 
2101  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupSeries(
2102  OrthancPluginContext* context,
2103  const char* seriesUID)
2104  {
2105  char* result;
2106 
2107  _OrthancPluginRetrieveDynamicString params;
2108  params.result = &result;
2109  params.argument = seriesUID;
2110 
2111  if (context->InvokeService(context, _OrthancPluginService_LookupSeries, &params) != OrthancPluginErrorCode_Success)
2112  {
2113  /* Error */
2114  return NULL;
2115  }
2116  else
2117  {
2118  return result;
2119  }
2120  }
2121 
2122 
2136  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupInstance(
2137  OrthancPluginContext* context,
2138  const char* sopInstanceUID)
2139  {
2140  char* result;
2141 
2142  _OrthancPluginRetrieveDynamicString params;
2143  params.result = &result;
2144  params.argument = sopInstanceUID;
2145 
2146  if (context->InvokeService(context, _OrthancPluginService_LookupInstance, &params) != OrthancPluginErrorCode_Success)
2147  {
2148  /* Error */
2149  return NULL;
2150  }
2151  else
2152  {
2153  return result;
2154  }
2155  }
2156 
2157 
2158 
2159  typedef struct
2160  {
2161  OrthancPluginRestOutput* output;
2162  uint16_t status;
2163  } _OrthancPluginSendHttpStatusCode;
2164 
2181  ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatusCode(
2182  OrthancPluginContext* context,
2183  OrthancPluginRestOutput* output,
2184  uint16_t status)
2185  {
2186  _OrthancPluginSendHttpStatusCode params;
2187  params.output = output;
2188  params.status = status;
2189  context->InvokeService(context, _OrthancPluginService_SendHttpStatusCode, &params);
2190  }
2191 
2192 
2204  ORTHANC_PLUGIN_INLINE void OrthancPluginSendUnauthorized(
2205  OrthancPluginContext* context,
2206  OrthancPluginRestOutput* output,
2207  const char* realm)
2208  {
2209  _OrthancPluginOutputPlusArgument params;
2210  params.output = output;
2211  params.argument = realm;
2212  context->InvokeService(context, _OrthancPluginService_SendUnauthorized, &params);
2213  }
2214 
2215 
2227  ORTHANC_PLUGIN_INLINE void OrthancPluginSendMethodNotAllowed(
2228  OrthancPluginContext* context,
2229  OrthancPluginRestOutput* output,
2230  const char* allowedMethods)
2231  {
2232  _OrthancPluginOutputPlusArgument params;
2233  params.output = output;
2234  params.argument = allowedMethods;
2235  context->InvokeService(context, _OrthancPluginService_SendMethodNotAllowed, &params);
2236  }
2237 
2238 
2239  typedef struct
2240  {
2241  OrthancPluginRestOutput* output;
2242  const char* key;
2243  const char* value;
2244  } _OrthancPluginSetHttpHeader;
2245 
2257  ORTHANC_PLUGIN_INLINE void OrthancPluginSetCookie(
2258  OrthancPluginContext* context,
2259  OrthancPluginRestOutput* output,
2260  const char* cookie,
2261  const char* value)
2262  {
2263  _OrthancPluginSetHttpHeader params;
2264  params.output = output;
2265  params.key = cookie;
2266  params.value = value;
2267  context->InvokeService(context, _OrthancPluginService_SetCookie, &params);
2268  }
2269 
2270 
2282  ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpHeader(
2283  OrthancPluginContext* context,
2284  OrthancPluginRestOutput* output,
2285  const char* key,
2286  const char* value)
2287  {
2288  _OrthancPluginSetHttpHeader params;
2289  params.output = output;
2290  params.key = key;
2291  params.value = value;
2292  context->InvokeService(context, _OrthancPluginService_SetHttpHeader, &params);
2293  }
2294 
2295 
2296  typedef struct
2297  {
2298  char** resultStringToFree;
2299  const char** resultString;
2300  int64_t* resultInt64;
2301  const char* key;
2302  OrthancPluginDicomInstance* instance;
2303  OrthancPluginInstanceOrigin* resultOrigin; /* New in Orthanc 0.9.5 SDK */
2304  } _OrthancPluginAccessDicomInstance;
2305 
2306 
2318  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceRemoteAet(
2319  OrthancPluginContext* context,
2320  OrthancPluginDicomInstance* instance)
2321  {
2322  const char* result;
2323 
2324  _OrthancPluginAccessDicomInstance params;
2325  memset(&params, 0, sizeof(params));
2326  params.resultString = &result;
2327  params.instance = instance;
2328 
2329  if (context->InvokeService(context, _OrthancPluginService_GetInstanceRemoteAet, &params) != OrthancPluginErrorCode_Success)
2330  {
2331  /* Error */
2332  return NULL;
2333  }
2334  else
2335  {
2336  return result;
2337  }
2338  }
2339 
2340 
2351  ORTHANC_PLUGIN_INLINE int64_t OrthancPluginGetInstanceSize(
2352  OrthancPluginContext* context,
2353  OrthancPluginDicomInstance* instance)
2354  {
2355  int64_t size;
2356 
2357  _OrthancPluginAccessDicomInstance params;
2358  memset(&params, 0, sizeof(params));
2359  params.resultInt64 = &size;
2360  params.instance = instance;
2361 
2362  if (context->InvokeService(context, _OrthancPluginService_GetInstanceSize, &params) != OrthancPluginErrorCode_Success)
2363  {
2364  /* Error */
2365  return -1;
2366  }
2367  else
2368  {
2369  return size;
2370  }
2371  }
2372 
2373 
2384  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceData(
2385  OrthancPluginContext* context,
2386  OrthancPluginDicomInstance* instance)
2387  {
2388  const char* result;
2389 
2390  _OrthancPluginAccessDicomInstance params;
2391  memset(&params, 0, sizeof(params));
2392  params.resultString = &result;
2393  params.instance = instance;
2394 
2395  if (context->InvokeService(context, _OrthancPluginService_GetInstanceData, &params) != OrthancPluginErrorCode_Success)
2396  {
2397  /* Error */
2398  return NULL;
2399  }
2400  else
2401  {
2402  return result;
2403  }
2404  }
2405 
2406 
2420  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceJson(
2421  OrthancPluginContext* context,
2422  OrthancPluginDicomInstance* instance)
2423  {
2424  char* result;
2425 
2426  _OrthancPluginAccessDicomInstance params;
2427  memset(&params, 0, sizeof(params));
2428  params.resultStringToFree = &result;
2429  params.instance = instance;
2430 
2431  if (context->InvokeService(context, _OrthancPluginService_GetInstanceJson, &params) != OrthancPluginErrorCode_Success)
2432  {
2433  /* Error */
2434  return NULL;
2435  }
2436  else
2437  {
2438  return result;
2439  }
2440  }
2441 
2442 
2458  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceSimplifiedJson(
2459  OrthancPluginContext* context,
2460  OrthancPluginDicomInstance* instance)
2461  {
2462  char* result;
2463 
2464  _OrthancPluginAccessDicomInstance params;
2465  memset(&params, 0, sizeof(params));
2466  params.resultStringToFree = &result;
2467  params.instance = instance;
2468 
2469  if (context->InvokeService(context, _OrthancPluginService_GetInstanceSimplifiedJson, &params) != OrthancPluginErrorCode_Success)
2470  {
2471  /* Error */
2472  return NULL;
2473  }
2474  else
2475  {
2476  return result;
2477  }
2478  }
2479 
2480 
2497  ORTHANC_PLUGIN_INLINE int OrthancPluginHasInstanceMetadata(
2498  OrthancPluginContext* context,
2499  OrthancPluginDicomInstance* instance,
2500  const char* metadata)
2501  {
2502  int64_t result;
2503 
2504  _OrthancPluginAccessDicomInstance params;
2505  memset(&params, 0, sizeof(params));
2506  params.resultInt64 = &result;
2507  params.instance = instance;
2508  params.key = metadata;
2509 
2510  if (context->InvokeService(context, _OrthancPluginService_HasInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
2511  {
2512  /* Error */
2513  return -1;
2514  }
2515  else
2516  {
2517  return (result != 0);
2518  }
2519  }
2520 
2521 
2535  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceMetadata(
2536  OrthancPluginContext* context,
2537  OrthancPluginDicomInstance* instance,
2538  const char* metadata)
2539  {
2540  const char* result;
2541 
2542  _OrthancPluginAccessDicomInstance params;
2543  memset(&params, 0, sizeof(params));
2544  params.resultString = &result;
2545  params.instance = instance;
2546  params.key = metadata;
2547 
2548  if (context->InvokeService(context, _OrthancPluginService_GetInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
2549  {
2550  /* Error */
2551  return NULL;
2552  }
2553  else
2554  {
2555  return result;
2556  }
2557  }
2558 
2559 
2560 
2561  typedef struct
2562  {
2566  OrthancPluginFree free;
2567  } _OrthancPluginRegisterStorageArea;
2568 
2583  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterStorageArea(
2584  OrthancPluginContext* context,
2588  {
2589  _OrthancPluginRegisterStorageArea params;
2590  params.create = create;
2591  params.read = read;
2592  params.remove = remove;
2593 
2594 #ifdef __cplusplus
2595  params.free = ::free;
2596 #else
2597  params.free = free;
2598 #endif
2599 
2600  context->InvokeService(context, _OrthancPluginService_RegisterStorageArea, &params);
2601  }
2602 
2603 
2604 
2615  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancPath(OrthancPluginContext* context)
2616  {
2617  char* result;
2618 
2619  _OrthancPluginRetrieveDynamicString params;
2620  params.result = &result;
2621  params.argument = NULL;
2622 
2623  if (context->InvokeService(context, _OrthancPluginService_GetOrthancPath, &params) != OrthancPluginErrorCode_Success)
2624  {
2625  /* Error */
2626  return NULL;
2627  }
2628  else
2629  {
2630  return result;
2631  }
2632  }
2633 
2634 
2645  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancDirectory(OrthancPluginContext* context)
2646  {
2647  char* result;
2648 
2649  _OrthancPluginRetrieveDynamicString params;
2650  params.result = &result;
2651  params.argument = NULL;
2652 
2653  if (context->InvokeService(context, _OrthancPluginService_GetOrthancDirectory, &params) != OrthancPluginErrorCode_Success)
2654  {
2655  /* Error */
2656  return NULL;
2657  }
2658  else
2659  {
2660  return result;
2661  }
2662  }
2663 
2664 
2680  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfigurationPath(OrthancPluginContext* context)
2681  {
2682  char* result;
2683 
2684  _OrthancPluginRetrieveDynamicString params;
2685  params.result = &result;
2686  params.argument = NULL;
2687 
2688  if (context->InvokeService(context, _OrthancPluginService_GetConfigurationPath, &params) != OrthancPluginErrorCode_Success)
2689  {
2690  /* Error */
2691  return NULL;
2692  }
2693  else
2694  {
2695  return result;
2696  }
2697  }
2698 
2699 
2700 
2701  typedef struct
2702  {
2704  } _OrthancPluginOnChangeCallback;
2705 
2722  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnChangeCallback(
2723  OrthancPluginContext* context,
2725  {
2726  _OrthancPluginOnChangeCallback params;
2727  params.callback = callback;
2728 
2729  context->InvokeService(context, _OrthancPluginService_RegisterOnChangeCallback, &params);
2730  }
2731 
2732 
2733 
2734  typedef struct
2735  {
2736  const char* plugin;
2737  _OrthancPluginProperty property;
2738  const char* value;
2739  } _OrthancPluginSetPluginProperty;
2740 
2741 
2753  ORTHANC_PLUGIN_INLINE void OrthancPluginSetRootUri(
2754  OrthancPluginContext* context,
2755  const char* uri)
2756  {
2757  _OrthancPluginSetPluginProperty params;
2758  params.plugin = OrthancPluginGetName();
2759  params.property = _OrthancPluginProperty_RootUri;
2760  params.value = uri;
2761 
2762  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
2763  }
2764 
2765 
2775  ORTHANC_PLUGIN_INLINE void OrthancPluginSetDescription(
2776  OrthancPluginContext* context,
2777  const char* description)
2778  {
2779  _OrthancPluginSetPluginProperty params;
2780  params.plugin = OrthancPluginGetName();
2781  params.property = _OrthancPluginProperty_Description;
2782  params.value = description;
2783 
2784  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
2785  }
2786 
2787 
2797  ORTHANC_PLUGIN_INLINE void OrthancPluginExtendOrthancExplorer(
2798  OrthancPluginContext* context,
2799  const char* javascript)
2800  {
2801  _OrthancPluginSetPluginProperty params;
2802  params.plugin = OrthancPluginGetName();
2803  params.property = _OrthancPluginProperty_OrthancExplorer;
2804  params.value = javascript;
2805 
2806  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
2807  }
2808 
2809 
2810  typedef struct
2811  {
2812  char** result;
2813  int32_t property;
2814  const char* value;
2815  } _OrthancPluginGlobalProperty;
2816 
2817 
2831  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetGlobalProperty(
2832  OrthancPluginContext* context,
2833  int32_t property,
2834  const char* defaultValue)
2835  {
2836  char* result;
2837 
2838  _OrthancPluginGlobalProperty params;
2839  params.result = &result;
2840  params.property = property;
2841  params.value = defaultValue;
2842 
2843  if (context->InvokeService(context, _OrthancPluginService_GetGlobalProperty, &params) != OrthancPluginErrorCode_Success)
2844  {
2845  /* Error */
2846  return NULL;
2847  }
2848  else
2849  {
2850  return result;
2851  }
2852  }
2853 
2854 
2871  OrthancPluginContext* context,
2872  int32_t property,
2873  const char* value)
2874  {
2875  _OrthancPluginGlobalProperty params;
2876  params.result = NULL;
2877  params.property = property;
2878  params.value = value;
2879 
2880  return context->InvokeService(context, _OrthancPluginService_SetGlobalProperty, &params);
2881  }
2882 
2883 
2884 
2885  typedef struct
2886  {
2887  int32_t *resultInt32;
2888  uint32_t *resultUint32;
2889  int64_t *resultInt64;
2890  uint64_t *resultUint64;
2891  } _OrthancPluginReturnSingleValue;
2892 
2901  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetCommandLineArgumentsCount(
2902  OrthancPluginContext* context)
2903  {
2904  uint32_t count = 0;
2905 
2906  _OrthancPluginReturnSingleValue params;
2907  memset(&params, 0, sizeof(params));
2908  params.resultUint32 = &count;
2909 
2910  if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgumentsCount, &params) != OrthancPluginErrorCode_Success)
2911  {
2912  /* Error */
2913  return 0;
2914  }
2915  else
2916  {
2917  return count;
2918  }
2919  }
2920 
2921 
2922 
2935  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetCommandLineArgument(
2936  OrthancPluginContext* context,
2937  uint32_t argument)
2938  {
2939  char* result;
2940 
2941  _OrthancPluginGlobalProperty params;
2942  params.result = &result;
2943  params.property = (int32_t) argument;
2944  params.value = NULL;
2945 
2946  if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgument, &params) != OrthancPluginErrorCode_Success)
2947  {
2948  /* Error */
2949  return NULL;
2950  }
2951  else
2952  {
2953  return result;
2954  }
2955  }
2956 
2957 
2967  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetExpectedDatabaseVersion(
2968  OrthancPluginContext* context)
2969  {
2970  uint32_t count = 0;
2971 
2972  _OrthancPluginReturnSingleValue params;
2973  memset(&params, 0, sizeof(params));
2974  params.resultUint32 = &count;
2975 
2976  if (context->InvokeService(context, _OrthancPluginService_GetExpectedDatabaseVersion, &params) != OrthancPluginErrorCode_Success)
2977  {
2978  /* Error */
2979  return 0;
2980  }
2981  else
2982  {
2983  return count;
2984  }
2985  }
2986 
2987 
2988 
3000  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfiguration(OrthancPluginContext* context)
3001  {
3002  char* result;
3003 
3004  _OrthancPluginRetrieveDynamicString params;
3005  params.result = &result;
3006  params.argument = NULL;
3007 
3008  if (context->InvokeService(context, _OrthancPluginService_GetConfiguration, &params) != OrthancPluginErrorCode_Success)
3009  {
3010  /* Error */
3011  return NULL;
3012  }
3013  else
3014  {
3015  return result;
3016  }
3017  }
3018 
3019 
3020 
3021  typedef struct
3022  {
3023  OrthancPluginRestOutput* output;
3024  const char* subType;
3025  const char* contentType;
3026  } _OrthancPluginStartMultipartAnswer;
3027 
3042  OrthancPluginContext* context,
3043  OrthancPluginRestOutput* output,
3044  const char* subType,
3045  const char* contentType)
3046  {
3047  _OrthancPluginStartMultipartAnswer params;
3048  params.output = output;
3049  params.subType = subType;
3050  params.contentType = contentType;
3051  return context->InvokeService(context, _OrthancPluginService_StartMultipartAnswer, &params);
3052  }
3053 
3054 
3071  OrthancPluginContext* context,
3072  OrthancPluginRestOutput* output,
3073  const char* answer,
3074  uint32_t answerSize)
3075  {
3076  _OrthancPluginAnswerBuffer params;
3077  params.output = output;
3078  params.answer = answer;
3079  params.answerSize = answerSize;
3080  params.mimeType = NULL;
3081  return context->InvokeService(context, _OrthancPluginService_SendMultipartItem, &params);
3082  }
3083 
3084 
3085 
3086  typedef struct
3087  {
3088  OrthancPluginMemoryBuffer* target;
3089  const void* source;
3090  uint32_t size;
3091  OrthancPluginCompressionType compression;
3092  uint8_t uncompress;
3093  } _OrthancPluginBufferCompression;
3094 
3095 
3113  OrthancPluginContext* context,
3114  OrthancPluginMemoryBuffer* target,
3115  const void* source,
3116  uint32_t size,
3117  OrthancPluginCompressionType compression,
3118  uint8_t uncompress)
3119  {
3120  _OrthancPluginBufferCompression params;
3121  params.target = target;
3122  params.source = source;
3123  params.size = size;
3124  params.compression = compression;
3125  params.uncompress = uncompress;
3126 
3127  return context->InvokeService(context, _OrthancPluginService_BufferCompression, &params);
3128  }
3129 
3130 
3131 
3132  typedef struct
3133  {
3134  OrthancPluginMemoryBuffer* target;
3135  const char* path;
3136  } _OrthancPluginReadFile;
3137 
3150  OrthancPluginContext* context,
3151  OrthancPluginMemoryBuffer* target,
3152  const char* path)
3153  {
3154  _OrthancPluginReadFile params;
3155  params.target = target;
3156  params.path = path;
3157  return context->InvokeService(context, _OrthancPluginService_ReadFile, &params);
3158  }
3159 
3160 
3161 
3162  typedef struct
3163  {
3164  const char* path;
3165  const void* data;
3166  uint32_t size;
3167  } _OrthancPluginWriteFile;
3168 
3181  OrthancPluginContext* context,
3182  const char* path,
3183  const void* data,
3184  uint32_t size)
3185  {
3186  _OrthancPluginWriteFile params;
3187  params.path = path;
3188  params.data = data;
3189  params.size = size;
3190  return context->InvokeService(context, _OrthancPluginService_WriteFile, &params);
3191  }
3192 
3193 
3194 
3195  typedef struct
3196  {
3197  const char** target;
3198  OrthancPluginErrorCode error;
3199  } _OrthancPluginGetErrorDescription;
3200 
3211  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetErrorDescription(
3212  OrthancPluginContext* context,
3213  OrthancPluginErrorCode error)
3214  {
3215  const char* result = NULL;
3216 
3217  _OrthancPluginGetErrorDescription params;
3218  params.target = &result;
3219  params.error = error;
3220 
3221  if (context->InvokeService(context, _OrthancPluginService_GetErrorDescription, &params) != OrthancPluginErrorCode_Success ||
3222  result == NULL)
3223  {
3224  return "Unknown error code";
3225  }
3226  else
3227  {
3228  return result;
3229  }
3230  }
3231 
3232 
3233 
3234  typedef struct
3235  {
3236  OrthancPluginRestOutput* output;
3237  uint16_t status;
3238  const char* body;
3239  uint32_t bodySize;
3240  } _OrthancPluginSendHttpStatus;
3241 
3264  ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatus(
3265  OrthancPluginContext* context,
3266  OrthancPluginRestOutput* output,
3267  uint16_t status,
3268  const char* body,
3269  uint32_t bodySize)
3270  {
3271  _OrthancPluginSendHttpStatus params;
3272  params.output = output;
3273  params.status = status;
3274  params.body = body;
3275  params.bodySize = bodySize;
3276  context->InvokeService(context, _OrthancPluginService_SendHttpStatus, &params);
3277  }
3278 
3279 
3280 
3281  typedef struct
3282  {
3283  const OrthancPluginImage* image;
3284  uint32_t* resultUint32;
3285  OrthancPluginPixelFormat* resultPixelFormat;
3286  void** resultBuffer;
3287  } _OrthancPluginGetImageInfo;
3288 
3289 
3301  OrthancPluginContext* context,
3302  const OrthancPluginImage* image)
3303  {
3304  OrthancPluginPixelFormat target;
3305 
3306  _OrthancPluginGetImageInfo params;
3307  memset(&params, 0, sizeof(params));
3308  params.image = image;
3309  params.resultPixelFormat = &target;
3310 
3311  if (context->InvokeService(context, _OrthancPluginService_GetImagePixelFormat, &params) != OrthancPluginErrorCode_Success)
3312  {
3314  }
3315  else
3316  {
3317  return (OrthancPluginPixelFormat) target;
3318  }
3319  }
3320 
3321 
3322 
3333  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageWidth(
3334  OrthancPluginContext* context,
3335  const OrthancPluginImage* image)
3336  {
3337  uint32_t width;
3338 
3339  _OrthancPluginGetImageInfo params;
3340  memset(&params, 0, sizeof(params));
3341  params.image = image;
3342  params.resultUint32 = &width;
3343 
3344  if (context->InvokeService(context, _OrthancPluginService_GetImageWidth, &params) != OrthancPluginErrorCode_Success)
3345  {
3346  return 0;
3347  }
3348  else
3349  {
3350  return width;
3351  }
3352  }
3353 
3354 
3355 
3366  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageHeight(
3367  OrthancPluginContext* context,
3368  const OrthancPluginImage* image)
3369  {
3370  uint32_t height;
3371 
3372  _OrthancPluginGetImageInfo params;
3373  memset(&params, 0, sizeof(params));
3374  params.image = image;
3375  params.resultUint32 = &height;
3376 
3377  if (context->InvokeService(context, _OrthancPluginService_GetImageHeight, &params) != OrthancPluginErrorCode_Success)
3378  {
3379  return 0;
3380  }
3381  else
3382  {
3383  return height;
3384  }
3385  }
3386 
3387 
3388 
3401  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImagePitch(
3402  OrthancPluginContext* context,
3403  const OrthancPluginImage* image)
3404  {
3405  uint32_t pitch;
3406 
3407  _OrthancPluginGetImageInfo params;
3408  memset(&params, 0, sizeof(params));
3409  params.image = image;
3410  params.resultUint32 = &pitch;
3411 
3412  if (context->InvokeService(context, _OrthancPluginService_GetImagePitch, &params) != OrthancPluginErrorCode_Success)
3413  {
3414  return 0;
3415  }
3416  else
3417  {
3418  return pitch;
3419  }
3420  }
3421 
3422 
3423 
3435  ORTHANC_PLUGIN_INLINE void* OrthancPluginGetImageBuffer(
3436  OrthancPluginContext* context,
3437  const OrthancPluginImage* image)
3438  {
3439  void* target = NULL;
3440 
3441  _OrthancPluginGetImageInfo params;
3442  memset(&params, 0, sizeof(params));
3443  params.resultBuffer = &target;
3444  params.image = image;
3445 
3446  if (context->InvokeService(context, _OrthancPluginService_GetImageBuffer, &params) != OrthancPluginErrorCode_Success)
3447  {
3448  return NULL;
3449  }
3450  else
3451  {
3452  return target;
3453  }
3454  }
3455 
3456 
3457  typedef struct
3458  {
3459  OrthancPluginImage** target;
3460  const void* data;
3461  uint32_t size;
3462  OrthancPluginImageFormat format;
3463  } _OrthancPluginUncompressImage;
3464 
3465 
3479  OrthancPluginContext* context,
3480  const void* data,
3481  uint32_t size,
3482  OrthancPluginImageFormat format)
3483  {
3484  OrthancPluginImage* target = NULL;
3485 
3486  _OrthancPluginUncompressImage params;
3487  memset(&params, 0, sizeof(params));
3488  params.target = &target;
3489  params.data = data;
3490  params.size = size;
3491  params.format = format;
3492 
3493  if (context->InvokeService(context, _OrthancPluginService_UncompressImage, &params) != OrthancPluginErrorCode_Success)
3494  {
3495  return NULL;
3496  }
3497  else
3498  {
3499  return target;
3500  }
3501  }
3502 
3503 
3504 
3505 
3506  typedef struct
3507  {
3508  OrthancPluginImage* image;
3509  } _OrthancPluginFreeImage;
3510 
3520  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeImage(
3521  OrthancPluginContext* context,
3522  OrthancPluginImage* image)
3523  {
3524  _OrthancPluginFreeImage params;
3525  params.image = image;
3526 
3527  context->InvokeService(context, _OrthancPluginService_FreeImage, &params);
3528  }
3529 
3530 
3531 
3532 
3533  typedef struct
3534  {
3535  OrthancPluginMemoryBuffer* target;
3536  OrthancPluginImageFormat imageFormat;
3537  OrthancPluginPixelFormat pixelFormat;
3538  uint32_t width;
3539  uint32_t height;
3540  uint32_t pitch;
3541  const void* buffer;
3542  uint8_t quality;
3543  } _OrthancPluginCompressImage;
3544 
3545 
3566  OrthancPluginContext* context,
3567  OrthancPluginMemoryBuffer* target,
3568  OrthancPluginPixelFormat format,
3569  uint32_t width,
3570  uint32_t height,
3571  uint32_t pitch,
3572  const void* buffer)
3573  {
3574  _OrthancPluginCompressImage params;
3575  memset(&params, 0, sizeof(params));
3576  params.target = target;
3577  params.imageFormat = OrthancPluginImageFormat_Png;
3578  params.pixelFormat = format;
3579  params.width = width;
3580  params.height = height;
3581  params.pitch = pitch;
3582  params.buffer = buffer;
3583  params.quality = 0; /* Unused for PNG */
3584 
3585  return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
3586  }
3587 
3588 
3611  OrthancPluginContext* context,
3612  OrthancPluginMemoryBuffer* target,
3613  OrthancPluginPixelFormat format,
3614  uint32_t width,
3615  uint32_t height,
3616  uint32_t pitch,
3617  const void* buffer,
3618  uint8_t quality)
3619  {
3620  _OrthancPluginCompressImage params;
3621  memset(&params, 0, sizeof(params));
3622  params.target = target;
3623  params.imageFormat = OrthancPluginImageFormat_Jpeg;
3624  params.pixelFormat = format;
3625  params.width = width;
3626  params.height = height;
3627  params.pitch = pitch;
3628  params.buffer = buffer;
3629  params.quality = quality;
3630 
3631  return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
3632  }
3633 
3634 
3635 
3657  ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerJpegImage(
3658  OrthancPluginContext* context,
3659  OrthancPluginRestOutput* output,
3660  OrthancPluginPixelFormat format,
3661  uint32_t width,
3662  uint32_t height,
3663  uint32_t pitch,
3664  const void* buffer,
3665  uint8_t quality)
3666  {
3667  _OrthancPluginCompressAndAnswerImage params;
3668  params.output = output;
3669  params.imageFormat = OrthancPluginImageFormat_Jpeg;
3670  params.pixelFormat = format;
3671  params.width = width;
3672  params.height = height;
3673  params.pitch = pitch;
3674  params.buffer = buffer;
3675  params.quality = quality;
3676  context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
3677  }
3678 
3679 
3680 
3681 
3682  typedef struct
3683  {
3684  OrthancPluginMemoryBuffer* target;
3685  OrthancPluginHttpMethod method;
3686  const char* url;
3687  const char* username;
3688  const char* password;
3689  const char* body;
3690  uint32_t bodySize;
3691  } _OrthancPluginCallHttpClient;
3692 
3693 
3710  OrthancPluginContext* context,
3711  OrthancPluginMemoryBuffer* target,
3712  const char* url,
3713  const char* username,
3714  const char* password)
3715  {
3716  _OrthancPluginCallHttpClient params;
3717  memset(&params, 0, sizeof(params));
3718 
3719  params.target = target;
3720  params.method = OrthancPluginHttpMethod_Get;
3721  params.url = url;
3722  params.username = username;
3723  params.password = password;
3724 
3725  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3726  }
3727 
3728 
3747  OrthancPluginContext* context,
3748  OrthancPluginMemoryBuffer* target,
3749  const char* url,
3750  const char* body,
3751  uint32_t bodySize,
3752  const char* username,
3753  const char* password)
3754  {
3755  _OrthancPluginCallHttpClient params;
3756  memset(&params, 0, sizeof(params));
3757 
3758  params.target = target;
3759  params.method = OrthancPluginHttpMethod_Post;
3760  params.url = url;
3761  params.body = body;
3762  params.bodySize = bodySize;
3763  params.username = username;
3764  params.password = password;
3765 
3766  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3767  }
3768 
3769 
3788  OrthancPluginContext* context,
3789  OrthancPluginMemoryBuffer* target,
3790  const char* url,
3791  const char* body,
3792  uint32_t bodySize,
3793  const char* username,
3794  const char* password)
3795  {
3796  _OrthancPluginCallHttpClient params;
3797  memset(&params, 0, sizeof(params));
3798 
3799  params.target = target;
3800  params.method = OrthancPluginHttpMethod_Put;
3801  params.url = url;
3802  params.body = body;
3803  params.bodySize = bodySize;
3804  params.username = username;
3805  params.password = password;
3806 
3807  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3808  }
3809 
3810 
3825  OrthancPluginContext* context,
3826  const char* url,
3827  const char* username,
3828  const char* password)
3829  {
3830  _OrthancPluginCallHttpClient params;
3831  memset(&params, 0, sizeof(params));
3832 
3833  params.method = OrthancPluginHttpMethod_Delete;
3834  params.url = url;
3835  params.username = username;
3836  params.password = password;
3837 
3838  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3839  }
3840 
3841 
3842 
3843  typedef struct
3844  {
3845  OrthancPluginImage** target;
3846  const OrthancPluginImage* source;
3847  OrthancPluginPixelFormat targetFormat;
3848  } _OrthancPluginConvertPixelFormat;
3849 
3850 
3863  OrthancPluginContext* context,
3864  const OrthancPluginImage* source,
3865  OrthancPluginPixelFormat targetFormat)
3866  {
3867  OrthancPluginImage* target = NULL;
3868 
3869  _OrthancPluginConvertPixelFormat params;
3870  params.target = &target;
3871  params.source = source;
3872  params.targetFormat = targetFormat;
3873 
3874  if (context->InvokeService(context, _OrthancPluginService_ConvertPixelFormat, &params) != OrthancPluginErrorCode_Success)
3875  {
3876  return NULL;
3877  }
3878  else
3879  {
3880  return target;
3881  }
3882  }
3883 
3884 
3885 
3897  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontsCount(
3898  OrthancPluginContext* context)
3899  {
3900  uint32_t count = 0;
3901 
3902  _OrthancPluginReturnSingleValue params;
3903  memset(&params, 0, sizeof(params));
3904  params.resultUint32 = &count;
3905 
3906  if (context->InvokeService(context, _OrthancPluginService_GetFontsCount, &params) != OrthancPluginErrorCode_Success)
3907  {
3908  /* Error */
3909  return 0;
3910  }
3911  else
3912  {
3913  return count;
3914  }
3915  }
3916 
3917 
3918 
3919 
3920  typedef struct
3921  {
3922  uint32_t fontIndex; /* in */
3923  const char** name; /* out */
3924  uint32_t* size; /* out */
3925  } _OrthancPluginGetFontInfo;
3926 
3937  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetFontName(
3938  OrthancPluginContext* context,
3939  uint32_t fontIndex)
3940  {
3941  const char* result = NULL;
3942 
3943  _OrthancPluginGetFontInfo params;
3944  memset(&params, 0, sizeof(params));
3945  params.name = &result;
3946  params.fontIndex = fontIndex;
3947 
3948  if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
3949  {
3950  return NULL;
3951  }
3952  else
3953  {
3954  return result;
3955  }
3956  }
3957 
3958 
3969  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontSize(
3970  OrthancPluginContext* context,
3971  uint32_t fontIndex)
3972  {
3973  uint32_t result;
3974 
3975  _OrthancPluginGetFontInfo params;
3976  memset(&params, 0, sizeof(params));
3977  params.size = &result;
3978  params.fontIndex = fontIndex;
3979 
3980  if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
3981  {
3982  return 0;
3983  }
3984  else
3985  {
3986  return result;
3987  }
3988  }
3989 
3990 
3991 
3992  typedef struct
3993  {
3994  OrthancPluginImage* image;
3995  uint32_t fontIndex;
3996  const char* utf8Text;
3997  int32_t x;
3998  int32_t y;
3999  uint8_t r;
4000  uint8_t g;
4001  uint8_t b;
4002  } _OrthancPluginDrawText;
4003 
4004 
4023  OrthancPluginContext* context,
4024  OrthancPluginImage* image,
4025  uint32_t fontIndex,
4026  const char* utf8Text,
4027  int32_t x,
4028  int32_t y,
4029  uint8_t r,
4030  uint8_t g,
4031  uint8_t b)
4032  {
4033  _OrthancPluginDrawText params;
4034  memset(&params, 0, sizeof(params));
4035  params.image = image;
4036  params.fontIndex = fontIndex;
4037  params.utf8Text = utf8Text;
4038  params.x = x;
4039  params.y = y;
4040  params.r = r;
4041  params.g = g;
4042  params.b = b;
4043 
4044  return context->InvokeService(context, _OrthancPluginService_DrawText, &params);
4045  }
4046 
4047 
4048 
4049  typedef struct
4050  {
4051  OrthancPluginStorageArea* storageArea;
4052  const char* uuid;
4053  const void* content;
4054  uint64_t size;
4056  } _OrthancPluginStorageAreaCreate;
4057 
4058 
4075  OrthancPluginContext* context,
4076  OrthancPluginStorageArea* storageArea,
4077  const char* uuid,
4078  const void* content,
4079  uint64_t size,
4081  {
4082  _OrthancPluginStorageAreaCreate params;
4083  params.storageArea = storageArea;
4084  params.uuid = uuid;
4085  params.content = content;
4086  params.size = size;
4087  params.type = type;
4088 
4089  return context->InvokeService(context, _OrthancPluginService_StorageAreaCreate, &params);
4090  }
4091 
4092 
4093  typedef struct
4094  {
4095  OrthancPluginMemoryBuffer* target;
4096  OrthancPluginStorageArea* storageArea;
4097  const char* uuid;
4099  } _OrthancPluginStorageAreaRead;
4100 
4101 
4117  OrthancPluginContext* context,
4118  OrthancPluginMemoryBuffer* target,
4119  OrthancPluginStorageArea* storageArea,
4120  const char* uuid,
4122  {
4123  _OrthancPluginStorageAreaRead params;
4124  params.target = target;
4125  params.storageArea = storageArea;
4126  params.uuid = uuid;
4127  params.type = type;
4128 
4129  return context->InvokeService(context, _OrthancPluginService_StorageAreaRead, &params);
4130  }
4131 
4132 
4133  typedef struct
4134  {
4135  OrthancPluginStorageArea* storageArea;
4136  const char* uuid;
4138  } _OrthancPluginStorageAreaRemove;
4139 
4154  OrthancPluginContext* context,
4155  OrthancPluginStorageArea* storageArea,
4156  const char* uuid,
4158  {
4159  _OrthancPluginStorageAreaRemove params;
4160  params.storageArea = storageArea;
4161  params.uuid = uuid;
4162  params.type = type;
4163 
4164  return context->InvokeService(context, _OrthancPluginService_StorageAreaRemove, &params);
4165  }
4166 
4167 
4168 
4169  typedef struct
4170  {
4171  OrthancPluginErrorCode* target;
4172  int32_t code;
4173  uint16_t httpStatus;
4174  const char* message;
4175  } _OrthancPluginRegisterErrorCode;
4176 
4193  OrthancPluginContext* context,
4194  int32_t code,
4195  uint16_t httpStatus,
4196  const char* message)
4197  {
4198  OrthancPluginErrorCode target;
4199 
4200  _OrthancPluginRegisterErrorCode params;
4201  params.target = &target;
4202  params.code = code;
4203  params.httpStatus = httpStatus;
4204  params.message = message;
4205 
4206  if (context->InvokeService(context, _OrthancPluginService_RegisterErrorCode, &params) == OrthancPluginErrorCode_Success)
4207  {
4208  return target;
4209  }
4210  else
4211  {
4212  /* There was an error while assigned the error. Use a generic code. */
4214  }
4215  }
4216 
4217 
4218 
4219  typedef struct
4220  {
4221  uint16_t group;
4222  uint16_t element;
4224  const char* name;
4225  uint32_t minMultiplicity;
4226  uint32_t maxMultiplicity;
4227  } _OrthancPluginRegisterDictionaryTag;
4228 
4249  OrthancPluginContext* context,
4250  uint16_t group,
4251  uint16_t element,
4253  const char* name,
4254  uint32_t minMultiplicity,
4255  uint32_t maxMultiplicity)
4256  {
4257  _OrthancPluginRegisterDictionaryTag params;
4258  params.group = group;
4259  params.element = element;
4260  params.vr = vr;
4261  params.name = name;
4262  params.minMultiplicity = minMultiplicity;
4263  params.maxMultiplicity = maxMultiplicity;
4264 
4265  return context->InvokeService(context, _OrthancPluginService_RegisterDictionaryTag, &params);
4266  }
4267 
4268 
4269 
4270  typedef struct
4271  {
4272  uint16_t group;
4273  uint16_t element;
4275  const char* name;
4276  uint32_t minMultiplicity;
4277  uint32_t maxMultiplicity;
4278  const char* privateCreator;
4279  } _OrthancPluginRegisterPrivateDictionaryTag;
4280 
4302  OrthancPluginContext* context,
4303  uint16_t group,
4304  uint16_t element,
4306  const char* name,
4307  uint32_t minMultiplicity,
4308  uint32_t maxMultiplicity,
4309  const char* privateCreator)
4310  {
4311  _OrthancPluginRegisterPrivateDictionaryTag params;
4312  params.group = group;
4313  params.element = element;
4314  params.vr = vr;
4315  params.name = name;
4316  params.minMultiplicity = minMultiplicity;
4317  params.maxMultiplicity = maxMultiplicity;
4318  params.privateCreator = privateCreator;
4319 
4320  return context->InvokeService(context, _OrthancPluginService_RegisterPrivateDictionaryTag, &params);
4321  }
4322 
4323 
4324 
4325  typedef struct
4326  {
4327  OrthancPluginStorageArea* storageArea;
4329  } _OrthancPluginReconstructMainDicomTags;
4330 
4346  OrthancPluginContext* context,
4347  OrthancPluginStorageArea* storageArea,
4349  {
4350  _OrthancPluginReconstructMainDicomTags params;
4351  params.level = level;
4352  params.storageArea = storageArea;
4353 
4354  return context->InvokeService(context, _OrthancPluginService_ReconstructMainDicomTags, &params);
4355  }
4356 
4357 
4358  typedef struct
4359  {
4360  char** result;
4361  const char* instanceId;
4362  const void* buffer;
4363  uint32_t size;
4366  uint32_t maxStringLength;
4367  } _OrthancPluginDicomToJson;
4368 
4369 
4389  ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomBufferToJson(
4390  OrthancPluginContext* context,
4391  const void* buffer,
4392  uint32_t size,
4395  uint32_t maxStringLength)
4396  {
4397  char* result;
4398 
4399  _OrthancPluginDicomToJson params;
4400  memset(&params, 0, sizeof(params));
4401  params.result = &result;
4402  params.buffer = buffer;
4403  params.size = size;
4404  params.format = format;
4405  params.flags = flags;
4406  params.maxStringLength = maxStringLength;
4407 
4408  if (context->InvokeService(context, _OrthancPluginService_DicomBufferToJson, &params) != OrthancPluginErrorCode_Success)
4409  {
4410  /* Error */
4411  return NULL;
4412  }
4413  else
4414  {
4415  return result;
4416  }
4417  }
4418 
4419 
4438  ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomInstanceToJson(
4439  OrthancPluginContext* context,
4440  const char* instanceId,
4443  uint32_t maxStringLength)
4444  {
4445  char* result;
4446 
4447  _OrthancPluginDicomToJson params;
4448  memset(&params, 0, sizeof(params));
4449  params.result = &result;
4450  params.instanceId = instanceId;
4451  params.format = format;
4452  params.flags = flags;
4453  params.maxStringLength = maxStringLength;
4454 
4455  if (context->InvokeService(context, _OrthancPluginService_DicomInstanceToJson, &params) != OrthancPluginErrorCode_Success)
4456  {
4457  /* Error */
4458  return NULL;
4459  }
4460  else
4461  {
4462  return result;
4463  }
4464  }
4465 
4466 
4467  typedef struct
4468  {
4469  OrthancPluginMemoryBuffer* target;
4470  const char* uri;
4471  uint32_t headersCount;
4472  const char* const* headersKeys;
4473  const char* const* headersValues;
4474  int32_t afterPlugins;
4475  } _OrthancPluginRestApiGet2;
4476 
4497  OrthancPluginContext* context,
4498  OrthancPluginMemoryBuffer* target,
4499  const char* uri,
4500  uint32_t headersCount,
4501  const char* const* headersKeys,
4502  const char* const* headersValues,
4503  int32_t afterPlugins)
4504  {
4505  _OrthancPluginRestApiGet2 params;
4506  params.target = target;
4507  params.uri = uri;
4508  params.headersCount = headersCount;
4509  params.headersKeys = headersKeys;
4510  params.headersValues = headersValues;
4511  params.afterPlugins = afterPlugins;
4512 
4513  return context->InvokeService(context, _OrthancPluginService_RestApiGet2, &params);
4514  }
4515 
4516 
4517 
4518  typedef struct
4519  {
4521  } _OrthancPluginWorklistCallback;
4522 
4535  OrthancPluginContext* context,
4537  {
4538  _OrthancPluginWorklistCallback params;
4539  params.callback = callback;
4540 
4541  return context->InvokeService(context, _OrthancPluginService_RegisterWorklistCallback, &params);
4542  }
4543 
4544 
4545 
4546  typedef struct
4547  {
4549  const OrthancPluginWorklistQuery* query;
4550  const void* dicom;
4551  uint32_t size;
4552  } _OrthancPluginWorklistAnswersOperation;
4553 
4571  OrthancPluginContext* context,
4573  const OrthancPluginWorklistQuery* query,
4574  const void* dicom,
4575  uint32_t size)
4576  {
4577  _OrthancPluginWorklistAnswersOperation params;
4578  params.answers = answers;
4579  params.query = query;
4580  params.dicom = dicom;
4581  params.size = size;
4582 
4583  return context->InvokeService(context, _OrthancPluginService_WorklistAddAnswer, &params);
4584  }
4585 
4586 
4601  OrthancPluginContext* context,
4603  {
4604  _OrthancPluginWorklistAnswersOperation params;
4605  params.answers = answers;
4606  params.query = NULL;
4607  params.dicom = NULL;
4608  params.size = 0;
4609 
4610  return context->InvokeService(context, _OrthancPluginService_WorklistMarkIncomplete, &params);
4611  }
4612 
4613 
4614  typedef struct
4615  {
4616  const OrthancPluginWorklistQuery* query;
4617  const void* dicom;
4618  uint32_t size;
4619  int32_t* isMatch;
4620  OrthancPluginMemoryBuffer* target;
4621  } _OrthancPluginWorklistQueryOperation;
4622 
4638  ORTHANC_PLUGIN_INLINE int32_t OrthancPluginWorklistIsMatch(
4639  OrthancPluginContext* context,
4640  const OrthancPluginWorklistQuery* query,
4641  const void* dicom,
4642  uint32_t size)
4643  {
4644  int32_t isMatch = 0;
4645 
4646  _OrthancPluginWorklistQueryOperation params;
4647  params.query = query;
4648  params.dicom = dicom;
4649  params.size = size;
4650  params.isMatch = &isMatch;
4651  params.target = NULL;
4652 
4653  if (context->InvokeService(context, _OrthancPluginService_WorklistIsMatch, &params) == OrthancPluginErrorCode_Success)
4654  {
4655  return isMatch;
4656  }
4657  else
4658  {
4659  /* Error: Assume non-match */
4660  return 0;
4661  }
4662  }
4663 
4664 
4678  OrthancPluginContext* context,
4679  OrthancPluginMemoryBuffer* target,
4680  const OrthancPluginWorklistQuery* query)
4681  {
4682  _OrthancPluginWorklistQueryOperation params;
4683  params.query = query;
4684  params.dicom = NULL;
4685  params.size = 0;
4686  params.isMatch = NULL;
4687  params.target = target;
4688 
4689  return context->InvokeService(context, _OrthancPluginService_WorklistGetDicomQuery, &params);
4690  }
4691 
4692 
4704  OrthancPluginContext* context,
4705  OrthancPluginDicomInstance* instance)
4706  {
4708 
4709  _OrthancPluginAccessDicomInstance params;
4710  memset(&params, 0, sizeof(params));
4711  params.resultOrigin = &origin;
4712  params.instance = instance;
4713 
4714  if (context->InvokeService(context, _OrthancPluginService_GetInstanceOrigin, &params) != OrthancPluginErrorCode_Success)
4715  {
4716  /* Error */
4718  }
4719  else
4720  {
4721  return origin;
4722  }
4723  }
4724 
4725 
4726  typedef struct
4727  {
4728  OrthancPluginMemoryBuffer* target;
4729  const char* json;
4730  const OrthancPluginImage* pixelData;
4732  } _OrthancPluginCreateDicom;
4733 
4753  OrthancPluginContext* context,
4754  OrthancPluginMemoryBuffer* target,
4755  const char* json,
4756  const OrthancPluginImage* pixelData,
4758  {
4759  _OrthancPluginCreateDicom params;
4760  params.target = target;
4761  params.json = json;
4762  params.pixelData = pixelData;
4763  params.flags = flags;
4764 
4765  return context->InvokeService(context, _OrthancPluginService_CreateDicom, &params);
4766  }
4767 
4768 
4769  typedef struct
4770  {
4772  } _OrthancPluginDecodeImageCallback;
4773 
4786  OrthancPluginContext* context,
4788  {
4789  _OrthancPluginDecodeImageCallback params;
4790  params.callback = callback;
4791 
4792  return context->InvokeService(context, _OrthancPluginService_RegisterDecodeImageCallback, &params);
4793  }
4794 
4795 
4796 
4797  typedef struct
4798  {
4799  OrthancPluginImage** target;
4800  OrthancPluginPixelFormat format;
4801  uint32_t width;
4802  uint32_t height;
4803  uint32_t pitch;
4804  void* buffer;
4805  const void* constBuffer;
4806  uint32_t bufferSize;
4807  uint32_t frameIndex;
4808  } _OrthancPluginCreateImage;
4809 
4810 
4824  OrthancPluginContext* context,
4825  OrthancPluginPixelFormat format,
4826  uint32_t width,
4827  uint32_t height)
4828  {
4829  OrthancPluginImage* target = NULL;
4830 
4831  _OrthancPluginCreateImage params;
4832  memset(&params, 0, sizeof(params));
4833  params.target = &target;
4834  params.format = format;
4835  params.width = width;
4836  params.height = height;
4837 
4838  if (context->InvokeService(context, _OrthancPluginService_CreateImage, &params) != OrthancPluginErrorCode_Success)
4839  {
4840  return NULL;
4841  }
4842  else
4843  {
4844  return target;
4845  }
4846  }
4847 
4848 
4867  OrthancPluginContext* context,
4868  OrthancPluginPixelFormat format,
4869  uint32_t width,
4870  uint32_t height,
4871  uint32_t pitch,
4872  void* buffer)
4873  {
4874  OrthancPluginImage* target = NULL;
4875 
4876  _OrthancPluginCreateImage params;
4877  memset(&params, 0, sizeof(params));
4878  params.target = &target;
4879  params.format = format;
4880  params.width = width;
4881  params.height = height;
4882  params.pitch = pitch;
4883  params.buffer = buffer;
4884 
4885  if (context->InvokeService(context, _OrthancPluginService_CreateImageAccessor, &params) != OrthancPluginErrorCode_Success)
4886  {
4887  return NULL;
4888  }
4889  else
4890  {
4891  return target;
4892  }
4893  }
4894 
4895 
4896 
4912  OrthancPluginContext* context,
4913  const void* buffer,
4914  uint32_t bufferSize,
4915  uint32_t frameIndex)
4916  {
4917  OrthancPluginImage* target = NULL;
4918 
4919  _OrthancPluginCreateImage params;
4920  memset(&params, 0, sizeof(params));
4921  params.target = &target;
4922  params.constBuffer = buffer;
4923  params.bufferSize = bufferSize;
4924  params.frameIndex = frameIndex;
4925 
4926  if (context->InvokeService(context, _OrthancPluginService_DecodeDicomImage, &params) != OrthancPluginErrorCode_Success)
4927  {
4928  return NULL;
4929  }
4930  else
4931  {
4932  return target;
4933  }
4934  }
4935 
4936 
4937 
4938  typedef struct
4939  {
4940  char** result;
4941  const void* buffer;
4942  uint32_t size;
4943  } _OrthancPluginComputeHash;
4944 
4957  ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeMd5(
4958  OrthancPluginContext* context,
4959  const void* buffer,
4960  uint32_t size)
4961  {
4962  char* result;
4963 
4964  _OrthancPluginComputeHash params;
4965  params.result = &result;
4966  params.buffer = buffer;
4967  params.size = size;
4968 
4969  if (context->InvokeService(context, _OrthancPluginService_ComputeMd5, &params) != OrthancPluginErrorCode_Success)
4970  {
4971  /* Error */
4972  return NULL;
4973  }
4974  else
4975  {
4976  return result;
4977  }
4978  }
4979 
4980 
4993  ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeSha1(
4994  OrthancPluginContext* context,
4995  const void* buffer,
4996  uint32_t size)
4997  {
4998  char* result;
4999 
5000  _OrthancPluginComputeHash params;
5001  params.result = &result;
5002  params.buffer = buffer;
5003  params.size = size;
5004 
5005  if (context->InvokeService(context, _OrthancPluginService_ComputeSha1, &params) != OrthancPluginErrorCode_Success)
5006  {
5007  /* Error */
5008  return NULL;
5009  }
5010  else
5011  {
5012  return result;
5013  }
5014  }
5015 
5016 
5017 
5018  typedef struct
5019  {
5021  const char* name;
5022  } _OrthancPluginLookupDictionary;
5023 
5040  OrthancPluginContext* context,
5042  const char* name)
5043  {
5044  _OrthancPluginLookupDictionary params;
5045  params.target = target;
5046  params.name = name;
5047  return context->InvokeService(context, _OrthancPluginService_LookupDictionary, &params);
5048  }
5049 
5050 
5051 
5052  typedef struct
5053  {
5054  OrthancPluginRestOutput* output;
5055  const char* answer;
5056  uint32_t answerSize;
5057  uint32_t headersCount;
5058  const char* const* headersKeys;
5059  const char* const* headersValues;
5060  } _OrthancPluginSendMultipartItem2;
5061 
5083  OrthancPluginContext* context,
5084  OrthancPluginRestOutput* output,
5085  const char* answer,
5086  uint32_t answerSize,
5087  uint32_t headersCount,
5088  const char* const* headersKeys,
5089  const char* const* headersValues)
5090  {
5091  _OrthancPluginSendMultipartItem2 params;
5092  params.output = output;
5093  params.answer = answer;
5094  params.answerSize = answerSize;
5095  params.headersCount = headersCount;
5096  params.headersKeys = headersKeys;
5097  params.headersValues = headersValues;
5098 
5099  return context->InvokeService(context, _OrthancPluginService_SendMultipartItem2, &params);
5100  }
5101 
5102 
5103  typedef struct
5104  {
5106  } _OrthancPluginIncomingHttpRequestFilter;
5107 
5121  OrthancPluginContext* context,
5123  {
5124  _OrthancPluginIncomingHttpRequestFilter params;
5125  params.callback = callback;
5126 
5127  return context->InvokeService(context, _OrthancPluginService_RegisterIncomingHttpRequestFilter, &params);
5128  }
5129 
5130 
5131 
5132  typedef struct
5133  {
5134  OrthancPluginMemoryBuffer* answerBody;
5135  OrthancPluginMemoryBuffer* answerHeaders;
5136  uint16_t* httpStatus;
5137  OrthancPluginHttpMethod method;
5138  const char* url;
5139  uint32_t headersCount;
5140  const char* const* headersKeys;
5141  const char* const* headersValues;
5142  const char* body;
5143  uint32_t bodySize;
5144  const char* username;
5145  const char* password;
5146  uint32_t timeout;
5147  const char* certificateFile;
5148  const char* certificateKeyFile;
5149  const char* certificateKeyPassword;
5150  uint8_t pkcs11;
5151  } _OrthancPluginCallHttpClient2;
5152 
5153 
5154 
5193  OrthancPluginContext* context,
5194  OrthancPluginMemoryBuffer* answerBody,
5195  OrthancPluginMemoryBuffer* answerHeaders,
5196  uint16_t* httpStatus,
5197  OrthancPluginHttpMethod method,
5198  const char* url,
5199  uint32_t headersCount,
5200  const char* const* headersKeys,
5201  const char* const* headersValues,
5202  const char* body,
5203  uint32_t bodySize,
5204  const char* username,
5205  const char* password,
5206  uint32_t timeout,
5207  const char* certificateFile,
5208  const char* certificateKeyFile,
5209  const char* certificateKeyPassword,
5210  uint8_t pkcs11)
5211  {
5212  _OrthancPluginCallHttpClient2 params;
5213  memset(&params, 0, sizeof(params));
5214 
5215  params.answerBody = answerBody;
5216  params.answerHeaders = answerHeaders;
5217  params.httpStatus = httpStatus;
5218  params.method = method;
5219  params.url = url;
5220  params.headersCount = headersCount;
5221  params.headersKeys = headersKeys;
5222  params.headersValues = headersValues;
5223  params.body = body;
5224  params.bodySize = bodySize;
5225  params.username = username;
5226  params.password = password;
5227  params.timeout = timeout;
5228  params.certificateFile = certificateFile;
5229  params.certificateKeyFile = certificateKeyFile;
5230  params.certificateKeyPassword = certificateKeyPassword;
5231  params.pkcs11 = pkcs11;
5232 
5233  return context->InvokeService(context, _OrthancPluginService_CallHttpClient2, &params);
5234  }
5235 
5236 
5247  ORTHANC_PLUGIN_INLINE char* OrthancPluginGenerateUuid(
5248  OrthancPluginContext* context)
5249  {
5250  char* result;
5251 
5252  _OrthancPluginRetrieveDynamicString params;
5253  params.result = &result;
5254  params.argument = NULL;
5255 
5256  if (context->InvokeService(context, _OrthancPluginService_GenerateUuid, &params) != OrthancPluginErrorCode_Success)
5257  {
5258  /* Error */
5259  return NULL;
5260  }
5261  else
5262  {
5263  return result;
5264  }
5265  }
5266 
5267 
5268 
5269 
5270  typedef struct
5271  {
5272  OrthancPluginFindCallback callback;
5273  } _OrthancPluginFindCallback;
5274 
5287  OrthancPluginContext* context,
5288  OrthancPluginFindCallback callback)
5289  {
5290  _OrthancPluginFindCallback params;
5291  params.callback = callback;
5292 
5293  return context->InvokeService(context, _OrthancPluginService_RegisterFindCallback, &params);
5294  }
5295 
5296 
5297  typedef struct
5298  {
5299  OrthancPluginFindAnswers *answers;
5300  const OrthancPluginFindQuery *query;
5301  const void *dicom;
5302  uint32_t size;
5303  uint32_t index;
5304  uint32_t *resultUint32;
5305  uint16_t *resultGroup;
5306  uint16_t *resultElement;
5307  char **resultString;
5308  } _OrthancPluginFindOperation;
5309 
5326  OrthancPluginContext* context,
5327  OrthancPluginFindAnswers* answers,
5328  const void* dicom,
5329  uint32_t size)
5330  {
5331  _OrthancPluginFindOperation params;
5332  memset(&params, 0, sizeof(params));
5333  params.answers = answers;
5334  params.dicom = dicom;
5335  params.size = size;
5336 
5337  return context->InvokeService(context, _OrthancPluginService_FindAddAnswer, &params);
5338  }
5339 
5340 
5355  OrthancPluginContext* context,
5356  OrthancPluginFindAnswers* answers)
5357  {
5358  _OrthancPluginFindOperation params;
5359  memset(&params, 0, sizeof(params));
5360  params.answers = answers;
5361 
5362  return context->InvokeService(context, _OrthancPluginService_FindMarkIncomplete, &params);
5363  }
5364 
5365 
5366 
5378  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFindQuerySize(
5379  OrthancPluginContext* context,
5380  const OrthancPluginFindQuery* query)
5381  {
5382  uint32_t count = 0;
5383 
5384  _OrthancPluginFindOperation params;
5385  memset(&params, 0, sizeof(params));
5386  params.query = query;
5387  params.resultUint32 = &count;
5388 
5389  if (context->InvokeService(context, _OrthancPluginService_GetFindQuerySize, &params) != OrthancPluginErrorCode_Success)
5390  {
5391  /* Error */
5392  return 0;
5393  }
5394  else
5395  {
5396  return count;
5397  }
5398  }
5399 
5400 
5416  OrthancPluginContext* context,
5417  uint16_t* group,
5418  uint16_t* element,
5419  const OrthancPluginFindQuery* query,
5420  uint32_t index)
5421  {
5422  _OrthancPluginFindOperation params;
5423  memset(&params, 0, sizeof(params));
5424  params.query = query;
5425  params.index = index;
5426  params.resultGroup = group;
5427  params.resultElement = element;
5428 
5429  return context->InvokeService(context, _OrthancPluginService_GetFindQueryTag, &params);
5430  }
5431 
5432 
5446  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetFindQueryTagName(
5447  OrthancPluginContext* context,
5448  const OrthancPluginFindQuery* query,
5449  uint32_t index)
5450  {
5451  char* result;
5452 
5453  _OrthancPluginFindOperation params;
5454  memset(&params, 0, sizeof(params));
5455  params.query = query;
5456  params.index = index;
5457  params.resultString = &result;
5458 
5459  if (context->InvokeService(context, _OrthancPluginService_GetFindQueryTagName, &params) != OrthancPluginErrorCode_Success)
5460  {
5461  /* Error */
5462  return NULL;
5463  }
5464  else
5465  {
5466  return result;
5467  }
5468  }
5469 
5470 
5484  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetFindQueryValue(
5485  OrthancPluginContext* context,
5486  const OrthancPluginFindQuery* query,
5487  uint32_t index)
5488  {
5489  char* result;
5490 
5491  _OrthancPluginFindOperation params;
5492  memset(&params, 0, sizeof(params));
5493  params.query = query;
5494  params.index = index;
5495  params.resultString = &result;
5496 
5497  if (context->InvokeService(context, _OrthancPluginService_GetFindQueryValue, &params) != OrthancPluginErrorCode_Success)
5498  {
5499  /* Error */
5500  return NULL;
5501  }
5502  else
5503  {
5504  return result;
5505  }
5506  }
5507 
5508 
5509 
5510 
5511  typedef struct
5512  {
5513  OrthancPluginMoveCallback callback;
5514  OrthancPluginGetMoveSize getMoveSize;
5515  OrthancPluginApplyMove applyMove;
5516  OrthancPluginFreeMove freeMove;
5517  } _OrthancPluginMoveCallback;
5518 
5533  OrthancPluginContext* context,
5534  OrthancPluginMoveCallback callback,
5535  OrthancPluginGetMoveSize getMoveSize,
5536  OrthancPluginApplyMove applyMove,
5537  OrthancPluginFreeMove freeMove)
5538  {
5539  _OrthancPluginMoveCallback params;
5540  params.callback = callback;
5541  params.getMoveSize = getMoveSize;
5542  params.applyMove = applyMove;
5543  params.freeMove = freeMove;
5544 
5545  return context->InvokeService(context, _OrthancPluginService_RegisterMoveCallback, &params);
5546  }
5547 
5548 
5549 
5550  typedef struct
5551  {
5552  OrthancPluginFindMatcher** target;
5553  const void* query;
5554  uint32_t size;
5555  } _OrthancPluginCreateFindMatcher;
5556 
5557 
5572  OrthancPluginContext* context,
5573  const void* query,
5574  uint32_t size)
5575  {
5576  OrthancPluginFindMatcher* target = NULL;
5577 
5578  _OrthancPluginCreateFindMatcher params;
5579  memset(&params, 0, sizeof(params));
5580  params.target = &target;
5581  params.query = query;
5582  params.size = size;
5583 
5584  if (context->InvokeService(context, _OrthancPluginService_CreateFindMatcher, &params) != OrthancPluginErrorCode_Success)
5585  {
5586  return NULL;
5587  }
5588  else
5589  {
5590  return target;
5591  }
5592  }
5593 
5594 
5595  typedef struct
5596  {
5597  OrthancPluginFindMatcher* matcher;
5598  } _OrthancPluginFreeFindMatcher;
5599 
5609  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeFindMatcher(
5610  OrthancPluginContext* context,
5611  OrthancPluginFindMatcher* matcher)
5612  {
5613  _OrthancPluginFreeFindMatcher params;
5614  params.matcher = matcher;
5615 
5616  context->InvokeService(context, _OrthancPluginService_FreeFindMatcher, &params);
5617  }
5618 
5619 
5620  typedef struct
5621  {
5622  const OrthancPluginFindMatcher* matcher;
5623  const void* dicom;
5624  uint32_t size;
5625  int32_t* isMatch;
5626  } _OrthancPluginFindMatcherIsMatch;
5627 
5642  ORTHANC_PLUGIN_INLINE int32_t OrthancPluginFindMatcherIsMatch(
5643  OrthancPluginContext* context,
5644  const OrthancPluginFindMatcher* matcher,
5645  const void* dicom,
5646  uint32_t size)
5647  {
5648  int32_t isMatch = 0;
5649 
5650  _OrthancPluginFindMatcherIsMatch params;
5651  params.matcher = matcher;
5652  params.dicom = dicom;
5653  params.size = size;
5654  params.isMatch = &isMatch;
5655 
5656  if (context->InvokeService(context, _OrthancPluginService_FindMatcherIsMatch, &params) == OrthancPluginErrorCode_Success)
5657  {
5658  return isMatch;
5659  }
5660  else
5661  {
5662  /* Error: Assume non-match */
5663  return 0;
5664  }
5665  }
5666 
5667 
5668  typedef struct
5669  {
5671  } _OrthancPluginIncomingHttpRequestFilter2;
5672 
5685  OrthancPluginContext* context,
5687  {
5688  _OrthancPluginIncomingHttpRequestFilter2 params;
5689  params.callback = callback;
5690 
5691  return context->InvokeService(context, _OrthancPluginService_RegisterIncomingHttpRequestFilter2, &params);
5692  }
5693 
5694 #ifdef __cplusplus
5695 }
5696 #endif
5697 
5698 
Definition: OrthancCPlugin.h:707
const char * OrthancPluginGetInstanceRemoteAet(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the AET of a DICOM instance.
Definition: OrthancCPlugin.h:2318
Definition: OrthancCPlugin.h:808
int OrthancPluginHasInstanceMetadata(OrthancPluginContext *context, OrthancPluginDicomInstance *instance, const char *metadata)
Check whether a DICOM instance is associated with some metadata.
Definition: OrthancCPlugin.h:2497
OrthancPluginChangeType
Definition: OrthancCPlugin.h:664
Definition: OrthancCPlugin.h:234
void OrthancPluginSendHttpStatusCode(OrthancPluginContext *context, OrthancPluginRestOutput *output, uint16_t status)
Send a HTTP status code.
Definition: OrthancCPlugin.h:2181
struct _OrthancPluginRestOutput_t OrthancPluginRestOutput
Opaque structure that represents the HTTP connection to the client application.
Definition: OrthancCPlugin.h:858
OrthancPluginErrorCode OrthancPluginFindAddAnswer(OrthancPluginContext *context, OrthancPluginFindAnswers *answers, const void *dicom, uint32_t size)
Add one answer to some C-Find request.
Definition: OrthancCPlugin.h:5325
void OrthancPluginSetHttpHeader(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *key, const char *value)
Set some HTTP header.
Definition: OrthancCPlugin.h:2282
Definition: OrthancCPlugin.h:730
void(* OrthancPluginFreeMove)(void *moveDriver)
Callback to free one C-Move driver.
Definition: OrthancCPlugin.h:1224
Definition: OrthancCPlugin.h:269
void OrthancPluginLogInfo(OrthancPluginContext *context, const char *message)
Log an information.
Definition: OrthancCPlugin.h:1459
OrthancPluginErrorCode OrthancPluginRegisterDecodeImageCallback(OrthancPluginContext *context, OrthancPluginDecodeImageCallback callback)
Register a callback to handle the decoding of DICOM images.
Definition: OrthancCPlugin.h:4785
Definition: OrthancCPlugin.h:809
The parameters of a REST request.
Definition: OrthancCPlugin.h:328
void OrthancPluginRedirect(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *redirection)
Redirect a REST request.
Definition: OrthancCPlugin.h:1964
OrthancPluginContentType
Definition: OrthancCPlugin.h:633
OrthancPluginErrorCode OrthancPluginRestApiDeleteAfterPlugins(OrthancPluginContext *context, const char *uri)
Make a DELETE call to the REST API, as tainted by the plugins.
Definition: OrthancCPlugin.h:1869
Definition: OrthancCPlugin.h:650
Definition: OrthancCPlugin.h:729
Definition: OrthancCPlugin.h:824
const char * OrthancPluginGetInstanceData(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the data of a DICOM file.
Definition: OrthancCPlugin.h:2384
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:3565
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:3657
int OrthancPluginCheckVersion(OrthancPluginContext *context)
Check the compatibility of the plugin wrt. the version of its hosting Orthanc.
Definition: OrthancCPlugin.h:1392
Definition: OrthancCPlugin.h:261
Definition: OrthancCPlugin.h:204
Definition: OrthancCPlugin.h:259
OrthancPluginInstanceOrigin
Definition: OrthancCPlugin.h:819
Definition: OrthancCPlugin.h:727
int64_t OrthancPluginGetInstanceSize(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the size of a DICOM file.
Definition: OrthancCPlugin.h:2351
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:4301
Definition: OrthancCPlugin.h:284
Graylevel, unsigned 16bpp image.
Definition: OrthancCPlugin.h:557
Definition: OrthancCPlugin.h:679
Definition: OrthancCPlugin.h:226
const char *const * headersValues
The values of the HTTP headers.
Definition: OrthancCPlugin.h:388
Definition: OrthancCPlugin.h:271
Definition: OrthancCPlugin.h:273
const char *const * headersKeys
The keys of the HTTP headers (always converted to low-case).
Definition: OrthancCPlugin.h:383
Definition: OrthancCPlugin.h:257
OrthancPluginCreateDicomFlags
Definition: OrthancCPlugin.h:791
char * OrthancPluginComputeSha1(OrthancPluginContext *context, const void *buffer, uint32_t size)
Compute a SHA-1 hash.
Definition: OrthancCPlugin.h:4993
Definition: OrthancCPlugin.h:275
OrthancPluginPixelFormat
Definition: OrthancCPlugin.h:541
Definition: OrthancCPlugin.h:825
uint32_t getCount
For a GET request, the number of GET parameters.
Definition: OrthancCPlugin.h:348
Definition: OrthancCPlugin.h:583
void OrthancPluginRegisterStorageArea(OrthancPluginContext *context, OrthancPluginStorageCreate create, OrthancPluginStorageRead read, OrthancPluginStorageRemove remove)
Register a custom storage area.
Definition: OrthancCPlugin.h:2583
OrthancPluginErrorCode OrthancPluginGetDicomForInstance(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *instanceId)
Retrieve a DICOM instance using its Orthanc identifier.
Definition: OrthancCPlugin.h:1682
OrthancPluginImageFormat
Definition: OrthancCPlugin.h:704
Definition: OrthancCPlugin.h:212
Definition: OrthancCPlugin.h:297
void OrthancPluginFreeString(OrthancPluginContext *context, char *str)
Free a string.
Definition: OrthancCPlugin.h:1265
Definition: OrthancCPlugin.h:281
const char * OrthancPluginGetFontName(OrthancPluginContext *context, uint32_t fontIndex)
Return the name of a font.
Definition: OrthancCPlugin.h:3937
Definition: OrthancCPlugin.h:232
Definition: OrthancCPlugin.h:287
Definition: OrthancCPlugin.h:279
Definition: OrthancCPlugin.h:316
void(* OrthancPluginFree)(void *buffer)
Signature of a function to free dynamic memory.
Definition: OrthancCPlugin.h:972
Definition: OrthancCPlugin.h:223
char * OrthancPluginComputeMd5(OrthancPluginContext *context, const void *buffer, uint32_t size)
Compute an MD5 hash.
Definition: OrthancCPlugin.h:4957
Definition: OrthancCPlugin.h:225
OrthancPluginErrorCode
Definition: OrthancCPlugin.h:198
OrthancPluginImage * OrthancPluginConvertPixelFormat(OrthancPluginContext *context, const OrthancPluginImage *source, OrthancPluginPixelFormat targetFormat)
Change the pixel format of an image.
Definition: OrthancCPlugin.h:3862
Definition: OrthancCPlugin.h:282
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:1045
Definition: OrthancCPlugin.h:673
OrthancPluginErrorCode OrthancPluginStorageAreaRead(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, OrthancPluginStorageArea *storageArea, const char *uuid, OrthancPluginContentType type)
Read a file from the storage area.
Definition: OrthancCPlugin.h:4116
uint32_t OrthancPluginGetFontsCount(OrthancPluginContext *context)
Return the number of available fonts.
Definition: OrthancCPlugin.h:3897
char * OrthancPluginGetConfigurationPath(OrthancPluginContext *context)
Return the path to the configuration file(s).
Definition: OrthancCPlugin.h:2680
uint32_t(* OrthancPluginGetMoveSize)(void *moveDriver)
Callback to read the size of a C-Move driver.
Definition: OrthancCPlugin.h:1197
Definition: OrthancCPlugin.h:221
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:5415
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:5192
void OrthancPluginRegisterOnChangeCallback(OrthancPluginContext *context, OrthancPluginOnChangeCallback callback)
Register a callback to monitor changes.
Definition: OrthancCPlugin.h:2722
Color image in RGBA32 format.
Definition: OrthancCPlugin.h:581
Definition: OrthancCPlugin.h:775
OrthancPluginDicomToJsonFlags
Definition: OrthancCPlugin.h:772
Definition: OrthancCPlugin.h:214
void OrthancPluginSendMethodNotAllowed(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *allowedMethods)
Signal that this URI does not support this HTTP method.
Definition: OrthancCPlugin.h:2227
Definition: OrthancCPlugin.h:691
char * OrthancPluginGenerateUuid(OrthancPluginContext *context)
Generate an UUID.
Definition: OrthancCPlugin.h:5247
void OrthancPluginAnswerBuffer(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *answer, uint32_t answerSize, const char *mimeType)
Answer to a REST request.
Definition: OrthancCPlugin.h:1584
Definition: OrthancCPlugin.h:667
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:4911
Definition: OrthancCPlugin.h:258
OrthancPluginDicomToJsonFormat
Definition: OrthancCPlugin.h:757
OrthancPluginErrorCode OrthancPluginLookupDictionary(OrthancPluginContext *context, OrthancPluginDictionaryEntry *target, const char *name)
Get information about the given DICOM tag.
Definition: OrthancCPlugin.h:5039
Definition: OrthancCPlugin.h:759
OrthancPluginErrorCode OrthancPluginRegisterErrorCode(OrthancPluginContext *context, int32_t code, uint16_t httpStatus, const char *message)
Declare a custom error code for this plugin.
Definition: OrthancCPlugin.h:4192
Definition: OrthancCPlugin.h:239
uint16_t group
Definition: OrthancCPlugin.h:1248
void * OrthancPluginGetImageBuffer(OrthancPluginContext *context, const OrthancPluginImage *image)
Return a pointer to the content of an image.
Definition: OrthancCPlugin.h:3435
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:1072
Definition: OrthancCPlugin.h:720
uint32_t minMultiplicity
Definition: OrthancCPlugin.h:1251
Definition: OrthancCPlugin.h:761
Definition: OrthancCPlugin.h:732
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:4570
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:2535
struct _OrthancPluginWorklistQuery_t OrthancPluginWorklistQuery
Opaque structure to an object that represents a C-Find query for worklists.
Definition: OrthancCPlugin.h:889
Definition: OrthancCPlugin.h:706
Definition: OrthancCPlugin.h:251
struct _OrthancPluginStorageArea_t OrthancPluginStorageArea
Opaque structure that represents the storage area that is actually used by Orthanc.
Definition: OrthancCPlugin.h:881
Definition: OrthancCPlugin.h:243
Definition: OrthancCPlugin.h:635
Definition: OrthancCPlugin.h:671
Color image in RGB48 format.
Definition: OrthancCPlugin.h:591
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:1930
uint32_t OrthancPluginGetExpectedDatabaseVersion(OrthancPluginContext *context)
Get the expected version of the database schema.
Definition: OrthancCPlugin.h:2967
Definition: OrthancCPlugin.h:274
Graylevel 8bpp image.
Definition: OrthancCPlugin.h:549
Definition: OrthancCPlugin.h:272
Definition: OrthancCPlugin.h:215
OrthancPluginResourceType
Definition: OrthancCPlugin.h:647
OrthancPluginHttpMethod
Definition: OrthancCPlugin.h:313
Definition: OrthancCPlugin.h:231
uint32_t OrthancPluginGetImageHeight(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the height of an image.
Definition: OrthancCPlugin.h:3366
OrthancPluginValueRepresentation
Definition: OrthancCPlugin.h:718
char * OrthancPluginGetConfiguration(OrthancPluginContext *context)
Return the content of the configuration file(s).
Definition: OrthancCPlugin.h:3000
Definition: OrthancCPlugin.h:202
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:3264
OrthancPluginImage * OrthancPluginUncompressImage(OrthancPluginContext *context, const void *data, uint32_t size, OrthancPluginImageFormat format)
Decode a compressed image.
Definition: OrthancCPlugin.h:3478
Definition: OrthancCPlugin.h:277
Definition: OrthancCPlugin.h:722
Definition: OrthancCPlugin.h:218
Definition: OrthancCPlugin.h:652
OrthancPluginErrorCode(* OrthancPluginRestCallback)(OrthancPluginRestOutput *output, const char *url, const OrthancPluginHttpRequest *request)
Signature of a callback function that answers to a REST request.
Definition: OrthancCPlugin.h:929
Definition: OrthancCPlugin.h:268
Definition: OrthancCPlugin.h:692
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:1103
Definition: OrthancCPlugin.h:725
Definition: OrthancCPlugin.h:285
char * OrthancPluginGetOrthancDirectory(OrthancPluginContext *context)
Return the directory containing the Orthanc.
Definition: OrthancCPlugin.h:2645
Definition: OrthancCPlugin.h:236
Definition: OrthancCPlugin.h:694
Definition: OrthancCPlugin.h:744
Definition: OrthancCPlugin.h:260
Color image in RGB24 format.
Definition: OrthancCPlugin.h:573
OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter2(OrthancPluginContext *context, OrthancPluginIncomingHttpRequestFilter2 callback)
Register a callback to filter incoming HTTP requests.
Definition: OrthancCPlugin.h:5684
Graylevel, signed 16bpp image.
Definition: OrthancCPlugin.h:565
An entry in the dictionary of DICOM tags.
Definition: OrthancCPlugin.h:1246
Definition: OrthancCPlugin.h:270
Definition: OrthancCPlugin.h:208
Definition: OrthancCPlugin.h:666
OrthancPluginCompressionType
Definition: OrthancCPlugin.h:689
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:3787
Definition: OrthancCPlugin.h:200
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:4496
Definition: OrthancCPlugin.h:778
OrthancPluginPixelFormat OrthancPluginGetImagePixelFormat(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the pixel format of an image.
Definition: OrthancCPlugin.h:3300
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:4022
uint32_t OrthancPluginGetImagePitch(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the pitch of an image.
Definition: OrthancCPlugin.h:3401
Definition: OrthancCPlugin.h:636
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:1641
Definition: OrthancCPlugin.h:290
Definition: OrthancCPlugin.h:296
uint32_t maxMultiplicity
Definition: OrthancCPlugin.h:1252
Definition: OrthancCPlugin.h:289
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:961
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:4389
uint32_t OrthancPluginGetCommandLineArgumentsCount(OrthancPluginContext *context)
Get the number of command-line arguments.
Definition: OrthancCPlugin.h:2901
Definition: OrthancCPlugin.h:241
void OrthancPluginSendUnauthorized(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *realm)
Signal that a REST request is not authorized.
Definition: OrthancCPlugin.h:2204
Definition: OrthancCPlugin.h:210
Graylevel, unsigned 64bpp image.
Definition: OrthancCPlugin.h:623
Definition: OrthancCPlugin.h:266
Definition: OrthancCPlugin.h:254
void OrthancPluginFreeFindMatcher(OrthancPluginContext *context, OrthancPluginFindMatcher *matcher)
Free a C-Find matcher.
Definition: OrthancCPlugin.h:5609
Definition: OrthancCPlugin.h:286
void OrthancPluginLogError(OrthancPluginContext *context, const char *message)
Log an error.
Definition: OrthancCPlugin.h:1427
Definition: OrthancCPlugin.h:229
OrthancPluginFindMatcher * OrthancPluginCreateFindMatcher(OrthancPluginContext *context, const void *query, uint32_t size)
Create a C-Find matcher.
Definition: OrthancCPlugin.h:5571
void * data
The content of the buffer.
Definition: OrthancCPlugin.h:843
uint32_t OrthancPluginGetFontSize(OrthancPluginContext *context, uint32_t fontIndex)
Return the size of a font.
Definition: OrthancCPlugin.h:3969
void OrthancPluginExtendOrthancExplorer(OrthancPluginContext *context, const char *javascript)
Extend the JavaScript code of Orthanc Explorer.
Definition: OrthancCPlugin.h:2797
Definition: OrthancCPlugin.h:823
OrthancPluginErrorCode OrthancPluginRestApiGet(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri)
Make a GET call to the built-in Orthanc REST API.
Definition: OrthancCPlugin.h:1715
const char * OrthancPluginGetErrorDescription(OrthancPluginContext *context, OrthancPluginErrorCode error)
Get the description of a given error code.
Definition: OrthancCPlugin.h:3211
uint32_t headersCount
The number of HTTP headers.
Definition: OrthancCPlugin.h:378
Definition: OrthancCPlugin.h:672
Definition: OrthancCPlugin.h:777
void OrthancPluginFreeMemoryBuffer(OrthancPluginContext *context, OrthancPluginMemoryBuffer *buffer)
Free a memory buffer.
Definition: OrthancCPlugin.h:1411
OrthancPluginErrorCode OrthancPluginRegisterWorklistCallback(OrthancPluginContext *context, OrthancPluginWorklistCallback callback)
Register a callback to handle modality worklists requests.
Definition: OrthancCPlugin.h:4534
OrthancPluginErrorCode(* OrthancPluginStorageCreate)(const char *uuid, const void *content, int64_t size, OrthancPluginContentType type)
Callback for writing to the storage area.
Definition: OrthancCPlugin.h:988
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:1173
Definition: OrthancCPlugin.h:738
OrthancPluginErrorCode OrthancPluginRestApiDelete(OrthancPluginContext *context, const char *uri)
Make a DELETE call to the built-in Orthanc REST API.
Definition: OrthancCPlugin.h:1846
Definition: OrthancCPlugin.h:742
Definition: OrthancCPlugin.h:651
OrthancPluginErrorCode OrthancPluginReadFile(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *path)
Read a file.
Definition: OrthancCPlugin.h:3149
Definition: OrthancCPlugin.h:731
Definition: OrthancCPlugin.h:810
struct _OrthancPluginFindAnswers_t OrthancPluginFindAnswers
Opaque structure to an object that represents the answers to a C-Find query for worklists.
Definition: OrthancCPlugin.h:913
OrthancPluginErrorCode OrthancPluginRegisterMoveCallback(OrthancPluginContext *context, OrthancPluginMoveCallback callback, OrthancPluginGetMoveSize getMoveSize, OrthancPluginApplyMove applyMove, OrthancPluginFreeMove freeMove)
Register a callback to handle C-Move requests.
Definition: OrthancCPlugin.h:5532
Definition: OrthancCPlugin.h:317
OrthancPluginImage * OrthancPluginCreateImage(OrthancPluginContext *context, OrthancPluginPixelFormat format, uint32_t width, uint32_t height)
Create an image.
Definition: OrthancCPlugin.h:4823
Definition: OrthancCPlugin.h:733
Definition: OrthancCPlugin.h:246
char * OrthancPluginGetOrthancPath(OrthancPluginContext *context)
Return the path to the Orthanc executable.
Definition: OrthancCPlugin.h:2615
char * OrthancPluginGetGlobalProperty(OrthancPluginContext *context, int32_t property, const char *defaultValue)
Get the value of a global property.
Definition: OrthancCPlugin.h:2831
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:5082
OrthancPluginErrorCode(* OrthancPluginStorageRemove)(const char *uuid, OrthancPluginContentType type)
Callback for removing a file from the storage area.
Definition: OrthancCPlugin.h:1026
Definition: OrthancCPlugin.h:760
Definition: OrthancCPlugin.h:255
Definition: OrthancCPlugin.h:293
Definition: OrthancCPlugin.h:315
Definition: OrthancCPlugin.h:674
OrthancPluginErrorCode OrthancPluginReconstructMainDicomTags(OrthancPluginContext *context, OrthancPluginStorageArea *storageArea, OrthancPluginResourceType level)
Reconstruct the main DICOM tags.
Definition: OrthancCPlugin.h:4345
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:5446
char * OrthancPluginGetCommandLineArgument(OrthancPluginContext *context, uint32_t argument)
Get the value of a command-line argument.
Definition: OrthancCPlugin.h:2935
OrthancPluginErrorCode OrthancPluginHttpGet(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *url, const char *username, const char *password)
Issue a HTTP GET call.
Definition: OrthancCPlugin.h:3709
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:4866
Definition: OrthancCPlugin.h:263
OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter(OrthancPluginContext *context, OrthancPluginIncomingHttpRequestFilter callback)
Register a callback to filter incoming HTTP requests.
Definition: OrthancCPlugin.h:5120
Definition: OrthancCPlugin.h:222
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:4438
const char *const * getValues
For a GET request, the values of the GET parameters.
Definition: OrthancCPlugin.h:358
Definition: OrthancCPlugin.h:745
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:950
char * OrthancPluginGetInstanceSimplifiedJson(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the DICOM tag hierarchy as a JSON file (with simplification).
Definition: OrthancCPlugin.h:2458
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:3112
Definition: OrthancCPlugin.h:256
OrthancPluginErrorCode OrthancPluginWorklistMarkIncomplete(OrthancPluginContext *context, OrthancPluginWorklistAnswers *answers)
Mark the set of worklist answers as incomplete.
Definition: OrthancCPlugin.h:4600
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:4752
Definition: OrthancCPlugin.h:249
Definition: OrthancCPlugin.h:708
Definition: OrthancCPlugin.h:209
const char * body
For a PUT or POST request, the content of the body.
Definition: OrthancCPlugin.h:363
Definition: OrthancCPlugin.h:262
Definition: OrthancCPlugin.h:216
void OrthancPluginRegisterRestCallbackNoLock(OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback callback)
Register a REST callback, without locking.
Definition: OrthancCPlugin.h:1524
OrthancPluginErrorCode(* OrthancPluginFindCallback)(OrthancPluginFindAnswers *answers, const OrthancPluginFindQuery *query, const char *issuerAet, const char *calledAet)
Callback to handle incoming C-Find SCP requests.
Definition: OrthancCPlugin.h:1130
Definition: OrthancCPlugin.h:677
OrthancPluginErrorCode OrthancPluginRegisterFindCallback(OrthancPluginContext *context, OrthancPluginFindCallback callback)
Register a callback to handle C-Find requests.
Definition: OrthancCPlugin.h:5286
struct _OrthancPluginImage_t OrthancPluginImage
Opaque structure that represents an image that is uncompressed in memory.
Definition: OrthancCPlugin.h:873
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:1894
OrthancPluginErrorCode OrthancPluginStartMultipartAnswer(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *subType, const char *contentType)
Start an HTTP multipart answer.
Definition: OrthancCPlugin.h:3041
struct _OrthancPluginWorklistAnswers_t OrthancPluginWorklistAnswers
Opaque structure to an object that represents the answers to a C-Find query for worklists.
Definition: OrthancCPlugin.h:897
Definition: OrthancCPlugin.h:201
Definition: OrthancCPlugin.h:227
Definition: OrthancCPlugin.h:220
Definition: OrthancCPlugin.h:807
Definition: OrthancCPlugin.h:294
Definition: OrthancCPlugin.h:265
void OrthancPluginSetRootUri(OrthancPluginContext *context, const char *uri)
Set the URI where the plugin provides its Web interface.
Definition: OrthancCPlugin.h:2753
OrthancPluginErrorCode OrthancPluginStorageAreaRemove(OrthancPluginContext *context, OrthancPluginStorageArea *storageArea, const char *uuid, OrthancPluginContentType type)
Remove a file from the storage area.
Definition: OrthancCPlugin.h:4153
Definition: OrthancCPlugin.h:737
Definition: OrthancCPlugin.h:678
const char *const * getKeys
For a GET request, the keys of the GET parameters.
Definition: OrthancCPlugin.h:353
Definition: OrthancCPlugin.h:740
Definition: OrthancCPlugin.h:669
char * OrthancPluginLookupPatient(OrthancPluginContext *context, const char *patientID)
Look for a patient.
Definition: OrthancCPlugin.h:1996
OrthancPluginInstanceOrigin OrthancPluginGetInstanceOrigin(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the origin of a DICOM file.
Definition: OrthancCPlugin.h:4703
Definition: OrthancCPlugin.h:741
void OrthancPluginFreeImage(OrthancPluginContext *context, OrthancPluginImage *image)
Free an image.
Definition: OrthancCPlugin.h:3520
OrthancPluginValueRepresentation vr
Definition: OrthancCPlugin.h:1250
uint16_t element
Definition: OrthancCPlugin.h:1249
char * OrthancPluginLookupInstance(OrthancPluginContext *context, const char *sopInstanceUID)
Look for an instance.
Definition: OrthancCPlugin.h:2136
Definition: OrthancCPlugin.h:676
OrthancPluginErrorCode OrthancPluginSetGlobalProperty(OrthancPluginContext *context, int32_t property, const char *value)
Set the value of a global property.
Definition: OrthancCPlugin.h:2870
Definition: OrthancCPlugin.h:233
Definition: OrthancCPlugin.h:637
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:3070
const char *const * groups
The matched values for the groups of the regular expression.
Definition: OrthancCPlugin.h:343
OrthancPluginErrorCode OrthancPluginWriteFile(OrthancPluginContext *context, const char *path, const void *data, uint32_t size)
Write a file.
Definition: OrthancCPlugin.h:3180
Definition: OrthancCPlugin.h:264
OrthancPluginErrorCode(* OrthancPluginStorageRead)(void **content, int64_t *size, const char *uuid, OrthancPluginContentType type)
Callback for reading from the storage area.
Definition: OrthancCPlugin.h:1008
Definition: OrthancCPlugin.h:267
char * OrthancPluginLookupStudy(OrthancPluginContext *context, const char *studyUID)
Look for a study.
Definition: OrthancCPlugin.h:2031
uint32_t size
The number of bytes in the buffer.
Definition: OrthancCPlugin.h:848
Graylevel, floating-point 32bpp image.
Definition: OrthancCPlugin.h:607
Definition: OrthancCPlugin.h:821
Definition: OrthancCPlugin.h:247
struct _OrthancPluginDicomInstance_t OrthancPluginDicomInstance
Opaque structure that represents a DICOM instance received by Orthanc.
Definition: OrthancCPlugin.h:865
uint32_t groupsCount
The number of groups of the regular expression.
Definition: OrthancCPlugin.h:338
Definition: OrthancCPlugin.h:248
Definition: OrthancCPlugin.h:653
void OrthancPluginLogWarning(OrthancPluginContext *context, const char *message)
Log a warning.
Definition: OrthancCPlugin.h:1443
Definition: OrthancCPlugin.h:726
Definition: OrthancCPlugin.h:253
int32_t OrthancPluginWorklistIsMatch(OrthancPluginContext *context, const OrthancPluginWorklistQuery *query, const void *dicom, uint32_t size)
Test whether a worklist matches the query.
Definition: OrthancCPlugin.h:4638
int OrthancPluginCheckVersionAdvanced(OrthancPluginContext *context, int expectedMajor, int expectedMinor, int expectedRevision)
Check that the version of the hosting Orthanc is above a given version.
Definition: OrthancCPlugin.h:1292
Definition: OrthancCPlugin.h:746
OrthancPluginIdentifierConstraint
Definition: OrthancCPlugin.h:805
uint32_t bodySize
For a PUT or POST request, the number of bytes of the body.
Definition: OrthancCPlugin.h:368
OrthancPluginErrorCode OrthancPluginFindMarkIncomplete(OrthancPluginContext *context, OrthancPluginFindAnswers *answers)
Mark the set of C-Find answers as incomplete.
Definition: OrthancCPlugin.h:5354
Definition: OrthancCPlugin.h:318
Definition: OrthancCPlugin.h:238
void OrthancPluginSetCookie(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *cookie, const char *value)
Set a cookie.
Definition: OrthancCPlugin.h:2257
Definition: OrthancCPlugin.h:668
Definition: OrthancCPlugin.h:736
char * OrthancPluginGetInstanceJson(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the DICOM tag hierarchy as a JSON file.
Definition: OrthancCPlugin.h:2420
uint32_t OrthancPluginGetFindQuerySize(OrthancPluginContext *context, const OrthancPluginFindQuery *query)
Get the number of tags in a C-Find query.
Definition: OrthancCPlugin.h:5378
void OrthancPluginSetDescription(OrthancPluginContext *context, const char *description)
Set a description for this plugin.
Definition: OrthancCPlugin.h:2775
Definition: OrthancCPlugin.h:295
Definition: OrthancCPlugin.h:235
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:1782
void OrthancPluginRegisterOnStoredInstanceCallback(OrthancPluginContext *context, OrthancPluginOnStoredInstanceCallback callback)
Register a callback for received instances.
Definition: OrthancCPlugin.h:1552
Definition: OrthancCPlugin.h:670
Definition: OrthancCPlugin.h:739
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:4248
Definition: OrthancCPlugin.h:250
Definition: OrthancCPlugin.h:213
Definition: OrthancCPlugin.h:743
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:3746
Definition: OrthancCPlugin.h:723
Graylevel, unsigned 32bpp image.
Definition: OrthancCPlugin.h:599
void OrthancPluginRegisterRestCallback(OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback callback)
Register a REST callback.
Definition: OrthancCPlugin.h:1490
char * OrthancPluginLookupStudyWithAccessionNumber(OrthancPluginContext *context, const char *accessionNumber)
Look for a study, using the accession number.
Definition: OrthancCPlugin.h:2066
Definition: OrthancCPlugin.h:735
Definition: OrthancCPlugin.h:721
Definition: OrthancCPlugin.h:205
Definition: OrthancCPlugin.h:649
OrthancPluginErrorCode OrthancPluginWorklistGetDicomQuery(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const OrthancPluginWorklistQuery *query)
Retrieve the worklist query as a DICOM file.
Definition: OrthancCPlugin.h:4677
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:1745
Definition: OrthancCPlugin.h:822
Definition: OrthancCPlugin.h:224
OrthancPluginErrorCode(* OrthancPluginOnStoredInstanceCallback)(OrthancPluginDicomInstance *instance, const char *instanceId)
Signature of a callback function that is triggered when Orthanc receives a DICOM instance.
Definition: OrthancCPlugin.h:940
Definition: OrthancCPlugin.h:288
Definition: OrthancCPlugin.h:206
Definition: OrthancCPlugin.h:211
struct _OrthancPluginFindQuery_t OrthancPluginFindQuery
Opaque structure to an object that represents a C-Find query.
Definition: OrthancCPlugin.h:905
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:1817
Definition: OrthancCPlugin.h:203
Definition: OrthancCPlugin.h:228
Definition: OrthancCPlugin.h:675
Definition: OrthancCPlugin.h:693
Definition: OrthancCPlugin.h:240
OrthancPluginErrorCode(* OrthancPluginApplyMove)(void *moveDriver)
Callback to apply one C-Move suboperation.
Definition: OrthancCPlugin.h:1211
OrthancPluginHttpMethod method
The HTTP method.
Definition: OrthancCPlugin.h:333
Definition: OrthancCPlugin.h:283
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:4074
OrthancPluginErrorCode OrthancPluginHttpDelete(OrthancPluginContext *context, const char *url, const char *username, const char *password)
Issue a HTTP DELETE call.
Definition: OrthancCPlugin.h:3824
A memory buffer allocated by the core system of Orthanc.
Definition: OrthancCPlugin.h:838
Color image in BGRA32 format.
Definition: OrthancCPlugin.h:615
Definition: OrthancCPlugin.h:728
Definition: OrthancCPlugin.h:776
Definition: OrthancCPlugin.h:217
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:5642
Definition: OrthancCPlugin.h:734
char * OrthancPluginLookupSeries(OrthancPluginContext *context, const char *seriesUID)
Look for a series.
Definition: OrthancCPlugin.h:2101
Definition: OrthancCPlugin.h:207
Definition: OrthancCPlugin.h:724
Definition: OrthancCPlugin.h:276
uint32_t OrthancPluginGetImageWidth(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the width of an image.
Definition: OrthancCPlugin.h:3333
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:3610
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:921
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:5484
Definition: OrthancCPlugin.h:237
Definition: OrthancCPlugin.h:230