Orthanc Plugin SDK  1.3.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 3
121 #define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 1
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  {
296 
297  _OrthancPluginErrorCode_INTERNAL = 0x7fffffff
299 
300 
305  ORTHANC_PLUGINS_API const char* OrthancPluginGetName();
306 
307 
311  typedef enum
312  {
318  _OrthancPluginHttpMethod_INTERNAL = 0x7fffffff
320 
321 
326  typedef struct
327  {
332 
336  uint32_t groupsCount;
337 
341  const char* const* groups;
342 
346  uint32_t getCount;
347 
351  const char* const* getKeys;
352 
356  const char* const* getValues;
357 
361  const char* body;
362 
366  uint32_t bodySize;
367 
368 
369  /* --------------------------------------------------
370  New in version 0.8.1
371  -------------------------------------------------- */
372 
376  uint32_t headersCount;
377 
381  const char* const* headersKeys;
382 
386  const char* const* headersValues;
387 
389 
390 
391  typedef enum
392  {
393  /* Generic services */
394  _OrthancPluginService_LogInfo = 1,
395  _OrthancPluginService_LogWarning = 2,
396  _OrthancPluginService_LogError = 3,
397  _OrthancPluginService_GetOrthancPath = 4,
398  _OrthancPluginService_GetOrthancDirectory = 5,
399  _OrthancPluginService_GetConfigurationPath = 6,
400  _OrthancPluginService_SetPluginProperty = 7,
401  _OrthancPluginService_GetGlobalProperty = 8,
402  _OrthancPluginService_SetGlobalProperty = 9,
403  _OrthancPluginService_GetCommandLineArgumentsCount = 10,
404  _OrthancPluginService_GetCommandLineArgument = 11,
405  _OrthancPluginService_GetExpectedDatabaseVersion = 12,
406  _OrthancPluginService_GetConfiguration = 13,
407  _OrthancPluginService_BufferCompression = 14,
408  _OrthancPluginService_ReadFile = 15,
409  _OrthancPluginService_WriteFile = 16,
410  _OrthancPluginService_GetErrorDescription = 17,
411  _OrthancPluginService_CallHttpClient = 18,
412  _OrthancPluginService_RegisterErrorCode = 19,
413  _OrthancPluginService_RegisterDictionaryTag = 20,
414  _OrthancPluginService_DicomBufferToJson = 21,
415  _OrthancPluginService_DicomInstanceToJson = 22,
416  _OrthancPluginService_CreateDicom = 23,
417  _OrthancPluginService_ComputeMd5 = 24,
418  _OrthancPluginService_ComputeSha1 = 25,
419  _OrthancPluginService_LookupDictionary = 26,
420  _OrthancPluginService_CallHttpClient2 = 27,
421  _OrthancPluginService_GenerateUuid = 28,
422  _OrthancPluginService_RegisterPrivateDictionaryTag = 29,
423 
424  /* Registration of callbacks */
425  _OrthancPluginService_RegisterRestCallback = 1000,
426  _OrthancPluginService_RegisterOnStoredInstanceCallback = 1001,
427  _OrthancPluginService_RegisterStorageArea = 1002,
428  _OrthancPluginService_RegisterOnChangeCallback = 1003,
429  _OrthancPluginService_RegisterRestCallbackNoLock = 1004,
430  _OrthancPluginService_RegisterWorklistCallback = 1005,
431  _OrthancPluginService_RegisterDecodeImageCallback = 1006,
432  _OrthancPluginService_RegisterIncomingHttpRequestFilter = 1007,
433  _OrthancPluginService_RegisterFindCallback = 1008,
434  _OrthancPluginService_RegisterMoveCallback = 1009,
435  _OrthancPluginService_RegisterIncomingHttpRequestFilter2 = 1010,
436 
437  /* Sending answers to REST calls */
438  _OrthancPluginService_AnswerBuffer = 2000,
439  _OrthancPluginService_CompressAndAnswerPngImage = 2001, /* Unused as of Orthanc 0.9.4 */
440  _OrthancPluginService_Redirect = 2002,
441  _OrthancPluginService_SendHttpStatusCode = 2003,
442  _OrthancPluginService_SendUnauthorized = 2004,
443  _OrthancPluginService_SendMethodNotAllowed = 2005,
444  _OrthancPluginService_SetCookie = 2006,
445  _OrthancPluginService_SetHttpHeader = 2007,
446  _OrthancPluginService_StartMultipartAnswer = 2008,
447  _OrthancPluginService_SendMultipartItem = 2009,
448  _OrthancPluginService_SendHttpStatus = 2010,
449  _OrthancPluginService_CompressAndAnswerImage = 2011,
450  _OrthancPluginService_SendMultipartItem2 = 2012,
451 
452  /* Access to the Orthanc database and API */
453  _OrthancPluginService_GetDicomForInstance = 3000,
454  _OrthancPluginService_RestApiGet = 3001,
455  _OrthancPluginService_RestApiPost = 3002,
456  _OrthancPluginService_RestApiDelete = 3003,
457  _OrthancPluginService_RestApiPut = 3004,
458  _OrthancPluginService_LookupPatient = 3005,
459  _OrthancPluginService_LookupStudy = 3006,
460  _OrthancPluginService_LookupSeries = 3007,
461  _OrthancPluginService_LookupInstance = 3008,
462  _OrthancPluginService_LookupStudyWithAccessionNumber = 3009,
463  _OrthancPluginService_RestApiGetAfterPlugins = 3010,
464  _OrthancPluginService_RestApiPostAfterPlugins = 3011,
465  _OrthancPluginService_RestApiDeleteAfterPlugins = 3012,
466  _OrthancPluginService_RestApiPutAfterPlugins = 3013,
467  _OrthancPluginService_ReconstructMainDicomTags = 3014,
468  _OrthancPluginService_RestApiGet2 = 3015,
469 
470  /* Access to DICOM instances */
471  _OrthancPluginService_GetInstanceRemoteAet = 4000,
472  _OrthancPluginService_GetInstanceSize = 4001,
473  _OrthancPluginService_GetInstanceData = 4002,
474  _OrthancPluginService_GetInstanceJson = 4003,
475  _OrthancPluginService_GetInstanceSimplifiedJson = 4004,
476  _OrthancPluginService_HasInstanceMetadata = 4005,
477  _OrthancPluginService_GetInstanceMetadata = 4006,
478  _OrthancPluginService_GetInstanceOrigin = 4007,
479 
480  /* Services for plugins implementing a database back-end */
481  _OrthancPluginService_RegisterDatabaseBackend = 5000,
482  _OrthancPluginService_DatabaseAnswer = 5001,
483  _OrthancPluginService_RegisterDatabaseBackendV2 = 5002,
484  _OrthancPluginService_StorageAreaCreate = 5003,
485  _OrthancPluginService_StorageAreaRead = 5004,
486  _OrthancPluginService_StorageAreaRemove = 5005,
487 
488  /* Primitives for handling images */
489  _OrthancPluginService_GetImagePixelFormat = 6000,
490  _OrthancPluginService_GetImageWidth = 6001,
491  _OrthancPluginService_GetImageHeight = 6002,
492  _OrthancPluginService_GetImagePitch = 6003,
493  _OrthancPluginService_GetImageBuffer = 6004,
494  _OrthancPluginService_UncompressImage = 6005,
495  _OrthancPluginService_FreeImage = 6006,
496  _OrthancPluginService_CompressImage = 6007,
497  _OrthancPluginService_ConvertPixelFormat = 6008,
498  _OrthancPluginService_GetFontsCount = 6009,
499  _OrthancPluginService_GetFontInfo = 6010,
500  _OrthancPluginService_DrawText = 6011,
501  _OrthancPluginService_CreateImage = 6012,
502  _OrthancPluginService_CreateImageAccessor = 6013,
503  _OrthancPluginService_DecodeDicomImage = 6014,
504 
505  /* Primitives for handling C-Find, C-Move and worklists */
506  _OrthancPluginService_WorklistAddAnswer = 7000,
507  _OrthancPluginService_WorklistMarkIncomplete = 7001,
508  _OrthancPluginService_WorklistIsMatch = 7002,
509  _OrthancPluginService_WorklistGetDicomQuery = 7003,
510  _OrthancPluginService_FindAddAnswer = 7004,
511  _OrthancPluginService_FindMarkIncomplete = 7005,
512  _OrthancPluginService_GetFindQuerySize = 7006,
513  _OrthancPluginService_GetFindQueryTag = 7007,
514  _OrthancPluginService_GetFindQueryTagName = 7008,
515  _OrthancPluginService_GetFindQueryValue = 7009,
516  _OrthancPluginService_CreateFindMatcher = 7010,
517  _OrthancPluginService_FreeFindMatcher = 7011,
518  _OrthancPluginService_FindMatcherIsMatch = 7012,
519 
520  _OrthancPluginService_INTERNAL = 0x7fffffff
521  } _OrthancPluginService;
522 
523 
524  typedef enum
525  {
526  _OrthancPluginProperty_Description = 1,
527  _OrthancPluginProperty_RootUri = 2,
528  _OrthancPluginProperty_OrthancExplorer = 3,
529 
530  _OrthancPluginProperty_INTERNAL = 0x7fffffff
531  } _OrthancPluginProperty;
532 
533 
534 
539  typedef enum
540  {
548 
556 
564 
572 
580 
590 
598 
606 
614 
615  _OrthancPluginPixelFormat_INTERNAL = 0x7fffffff
617 
618 
619 
623  typedef enum
624  {
629  _OrthancPluginContentType_INTERNAL = 0x7fffffff
631 
632 
633 
637  typedef enum
638  {
645  _OrthancPluginResourceType_INTERNAL = 0x7fffffff
647 
648 
649 
654  typedef enum
655  {
671  _OrthancPluginChangeType_INTERNAL = 0x7fffffff
673 
674 
679  typedef enum
680  {
686  _OrthancPluginCompressionType_INTERNAL = 0x7fffffff
688 
689 
694  typedef enum
695  {
700  _OrthancPluginImageFormat_INTERNAL = 0x7fffffff
702 
703 
708  typedef enum
709  {
738  _OrthancPluginValueRepresentation_INTERNAL = 0x7fffffff
740 
741 
747  typedef enum
748  {
753  _OrthancPluginDicomToJsonFormat_INTERNAL = 0x7fffffff
755 
756 
762  typedef enum
763  {
764  OrthancPluginDicomToJsonFlags_None = 0,
772  _OrthancPluginDicomToJsonFlags_INTERNAL = 0x7fffffff
774 
775 
781  typedef enum
782  {
783  OrthancPluginCreateDicomFlags_None = 0,
787  _OrthancPluginCreateDicomFlags_INTERNAL = 0x7fffffff
789 
790 
795  typedef enum
796  {
802  _OrthancPluginIdentifierConstraint_INTERNAL = 0x7fffffff
804 
805 
809  typedef enum
810  {
817  _OrthancPluginInstanceOrigin_INTERNAL = 0x7fffffff
819 
820 
828  typedef struct
829  {
833  void* data;
834 
838  uint32_t size;
840 
841 
842 
843 
848  typedef struct _OrthancPluginRestOutput_t OrthancPluginRestOutput;
849 
850 
851 
855  typedef struct _OrthancPluginDicomInstance_t OrthancPluginDicomInstance;
856 
857 
858 
863  typedef struct _OrthancPluginImage_t OrthancPluginImage;
864 
865 
866 
871  typedef struct _OrthancPluginStorageArea_t OrthancPluginStorageArea;
872 
873 
874 
879  typedef struct _OrthancPluginWorklistQuery_t OrthancPluginWorklistQuery;
880 
881 
882 
887  typedef struct _OrthancPluginWorklistAnswers_t OrthancPluginWorklistAnswers;
888 
889 
890 
895  typedef struct _OrthancPluginFindQuery_t OrthancPluginFindQuery;
896 
897 
898 
903  typedef struct _OrthancPluginFindAnswers_t OrthancPluginFindAnswers;
904 
905 
906 
911  typedef struct _OrthancPluginFindAnswers_t OrthancPluginFindMatcher;
912 
913 
914 
920  OrthancPluginRestOutput* output,
921  const char* url,
922  const OrthancPluginHttpRequest* request);
923 
924 
925 
931  OrthancPluginDicomInstance* instance,
932  const char* instanceId);
933 
934 
935 
941  OrthancPluginChangeType changeType,
942  OrthancPluginResourceType resourceType,
943  const char* resourceId);
944 
945 
946 
952  OrthancPluginImage** target,
953  const void* dicom,
954  const uint32_t size,
955  uint32_t frameIndex);
956 
957 
958 
962  typedef void (*OrthancPluginFree) (void* buffer);
963 
964 
965 
979  const char* uuid,
980  const void* content,
981  int64_t size,
983 
984 
985 
999  void** content,
1000  int64_t* size,
1001  const char* uuid,
1003 
1004 
1005 
1017  const char* uuid,
1019 
1020 
1021 
1037  const OrthancPluginWorklistQuery* query,
1038  const char* issuerAet,
1039  const char* calledAet);
1040 
1041 
1042 
1063  OrthancPluginHttpMethod method,
1064  const char* uri,
1065  const char* ip,
1066  uint32_t headersCount,
1067  const char* const* headersKeys,
1068  const char* const* headersValues);
1069 
1070 
1071 
1094  OrthancPluginHttpMethod method,
1095  const char* uri,
1096  const char* ip,
1097  uint32_t headersCount,
1098  const char* const* headersKeys,
1099  const char* const* headersValues,
1100  uint32_t getArgumentsCount,
1101  const char* const* getArgumentsKeys,
1102  const char* const* getArgumentsValues);
1103 
1104 
1105 
1121  OrthancPluginFindAnswers* answers,
1122  const OrthancPluginFindQuery* query,
1123  const char* issuerAet,
1124  const char* calledAet);
1125 
1126 
1127 
1163  typedef void* (*OrthancPluginMoveCallback) (
1164  OrthancPluginResourceType resourceType,
1165  const char* patientId,
1166  const char* accessionNumber,
1167  const char* studyInstanceUid,
1168  const char* seriesInstanceUid,
1169  const char* sopInstanceUid,
1170  const char* originatorAet,
1171  const char* sourceAet,
1172  const char* targetAet,
1173  uint16_t originatorId);
1174 
1175 
1187  typedef uint32_t (*OrthancPluginGetMoveSize) (void* moveDriver);
1188 
1189 
1201  typedef OrthancPluginErrorCode (*OrthancPluginApplyMove) (void* moveDriver);
1202 
1203 
1214  typedef void (*OrthancPluginFreeMove) (void* moveDriver);
1215 
1216 
1217 
1221  typedef struct _OrthancPluginContext_t
1222  {
1223  void* pluginsManager;
1224  const char* orthancVersion;
1225  OrthancPluginFree Free;
1226  OrthancPluginErrorCode (*InvokeService) (struct _OrthancPluginContext_t* context,
1227  _OrthancPluginService service,
1228  const void* params);
1230 
1231 
1232 
1236  typedef struct
1237  {
1238  uint16_t group;
1239  uint16_t element;
1241  uint32_t minMultiplicity;
1242  uint32_t maxMultiplicity;
1244 
1245 
1246 
1255  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeString(
1256  OrthancPluginContext* context,
1257  char* str)
1258  {
1259  if (str != NULL)
1260  {
1261  context->Free(str);
1262  }
1263  }
1264 
1265 
1279  ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersion(
1280  OrthancPluginContext* context)
1281  {
1282  int major, minor, revision;
1283 
1284  if (sizeof(int32_t) != sizeof(OrthancPluginErrorCode) ||
1285  sizeof(int32_t) != sizeof(OrthancPluginHttpMethod) ||
1286  sizeof(int32_t) != sizeof(_OrthancPluginService) ||
1287  sizeof(int32_t) != sizeof(_OrthancPluginProperty) ||
1288  sizeof(int32_t) != sizeof(OrthancPluginPixelFormat) ||
1289  sizeof(int32_t) != sizeof(OrthancPluginContentType) ||
1290  sizeof(int32_t) != sizeof(OrthancPluginResourceType) ||
1291  sizeof(int32_t) != sizeof(OrthancPluginChangeType) ||
1292  sizeof(int32_t) != sizeof(OrthancPluginCompressionType) ||
1293  sizeof(int32_t) != sizeof(OrthancPluginImageFormat) ||
1294  sizeof(int32_t) != sizeof(OrthancPluginValueRepresentation) ||
1295  sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFormat) ||
1296  sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFlags) ||
1297  sizeof(int32_t) != sizeof(OrthancPluginCreateDicomFlags) ||
1298  sizeof(int32_t) != sizeof(OrthancPluginIdentifierConstraint) ||
1299  sizeof(int32_t) != sizeof(OrthancPluginInstanceOrigin))
1300  {
1301  /* Mismatch in the size of the enumerations */
1302  return 0;
1303  }
1304 
1305  /* Assume compatibility with the mainline */
1306  if (!strcmp(context->orthancVersion, "mainline"))
1307  {
1308  return 1;
1309  }
1310 
1311  /* Parse the version of the Orthanc core */
1312  if (
1313 #ifdef _MSC_VER
1314  sscanf_s
1315 #else
1316  sscanf
1317 #endif
1318  (context->orthancVersion, "%4d.%4d.%4d", &major, &minor, &revision) != 3)
1319  {
1320  return 0;
1321  }
1322 
1323  /* Check the major number of the version */
1324 
1325  if (major > ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER)
1326  {
1327  return 1;
1328  }
1329 
1330  if (major < ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER)
1331  {
1332  return 0;
1333  }
1334 
1335  /* Check the minor number of the version */
1336 
1337  if (minor > ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER)
1338  {
1339  return 1;
1340  }
1341 
1342  if (minor < ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER)
1343  {
1344  return 0;
1345  }
1346 
1347  /* Check the revision number of the version */
1348 
1349  if (revision >= ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER)
1350  {
1351  return 1;
1352  }
1353  else
1354  {
1355  return 0;
1356  }
1357  }
1358 
1359 
1368  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeMemoryBuffer(
1369  OrthancPluginContext* context,
1370  OrthancPluginMemoryBuffer* buffer)
1371  {
1372  context->Free(buffer->data);
1373  }
1374 
1375 
1384  ORTHANC_PLUGIN_INLINE void OrthancPluginLogError(
1385  OrthancPluginContext* context,
1386  const char* message)
1387  {
1388  context->InvokeService(context, _OrthancPluginService_LogError, message);
1389  }
1390 
1391 
1400  ORTHANC_PLUGIN_INLINE void OrthancPluginLogWarning(
1401  OrthancPluginContext* context,
1402  const char* message)
1403  {
1404  context->InvokeService(context, _OrthancPluginService_LogWarning, message);
1405  }
1406 
1407 
1416  ORTHANC_PLUGIN_INLINE void OrthancPluginLogInfo(
1417  OrthancPluginContext* context,
1418  const char* message)
1419  {
1420  context->InvokeService(context, _OrthancPluginService_LogInfo, message);
1421  }
1422 
1423 
1424 
1425  typedef struct
1426  {
1427  const char* pathRegularExpression;
1428  OrthancPluginRestCallback callback;
1429  } _OrthancPluginRestCallback;
1430 
1447  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallback(
1448  OrthancPluginContext* context,
1449  const char* pathRegularExpression,
1450  OrthancPluginRestCallback callback)
1451  {
1452  _OrthancPluginRestCallback params;
1453  params.pathRegularExpression = pathRegularExpression;
1454  params.callback = callback;
1455  context->InvokeService(context, _OrthancPluginService_RegisterRestCallback, &params);
1456  }
1457 
1458 
1459 
1481  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallbackNoLock(
1482  OrthancPluginContext* context,
1483  const char* pathRegularExpression,
1484  OrthancPluginRestCallback callback)
1485  {
1486  _OrthancPluginRestCallback params;
1487  params.pathRegularExpression = pathRegularExpression;
1488  params.callback = callback;
1489  context->InvokeService(context, _OrthancPluginService_RegisterRestCallbackNoLock, &params);
1490  }
1491 
1492 
1493 
1494  typedef struct
1495  {
1497  } _OrthancPluginOnStoredInstanceCallback;
1498 
1510  OrthancPluginContext* context,
1512  {
1513  _OrthancPluginOnStoredInstanceCallback params;
1514  params.callback = callback;
1515 
1516  context->InvokeService(context, _OrthancPluginService_RegisterOnStoredInstanceCallback, &params);
1517  }
1518 
1519 
1520 
1521  typedef struct
1522  {
1523  OrthancPluginRestOutput* output;
1524  const char* answer;
1525  uint32_t answerSize;
1526  const char* mimeType;
1527  } _OrthancPluginAnswerBuffer;
1528 
1541  ORTHANC_PLUGIN_INLINE void OrthancPluginAnswerBuffer(
1542  OrthancPluginContext* context,
1543  OrthancPluginRestOutput* output,
1544  const char* answer,
1545  uint32_t answerSize,
1546  const char* mimeType)
1547  {
1548  _OrthancPluginAnswerBuffer params;
1549  params.output = output;
1550  params.answer = answer;
1551  params.answerSize = answerSize;
1552  params.mimeType = mimeType;
1553  context->InvokeService(context, _OrthancPluginService_AnswerBuffer, &params);
1554  }
1555 
1556 
1557  typedef struct
1558  {
1559  OrthancPluginRestOutput* output;
1560  OrthancPluginPixelFormat format;
1561  uint32_t width;
1562  uint32_t height;
1563  uint32_t pitch;
1564  const void* buffer;
1565  } _OrthancPluginCompressAndAnswerPngImage;
1566 
1567  typedef struct
1568  {
1569  OrthancPluginRestOutput* output;
1570  OrthancPluginImageFormat imageFormat;
1571  OrthancPluginPixelFormat pixelFormat;
1572  uint32_t width;
1573  uint32_t height;
1574  uint32_t pitch;
1575  const void* buffer;
1576  uint8_t quality;
1577  } _OrthancPluginCompressAndAnswerImage;
1578 
1579 
1598  ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerPngImage(
1599  OrthancPluginContext* context,
1600  OrthancPluginRestOutput* output,
1601  OrthancPluginPixelFormat format,
1602  uint32_t width,
1603  uint32_t height,
1604  uint32_t pitch,
1605  const void* buffer)
1606  {
1607  _OrthancPluginCompressAndAnswerImage params;
1608  params.output = output;
1609  params.imageFormat = OrthancPluginImageFormat_Png;
1610  params.pixelFormat = format;
1611  params.width = width;
1612  params.height = height;
1613  params.pitch = pitch;
1614  params.buffer = buffer;
1615  params.quality = 0; /* No quality for PNG */
1616  context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
1617  }
1618 
1619 
1620 
1621  typedef struct
1622  {
1623  OrthancPluginMemoryBuffer* target;
1624  const char* instanceId;
1625  } _OrthancPluginGetDicomForInstance;
1626 
1640  OrthancPluginContext* context,
1641  OrthancPluginMemoryBuffer* target,
1642  const char* instanceId)
1643  {
1644  _OrthancPluginGetDicomForInstance params;
1645  params.target = target;
1646  params.instanceId = instanceId;
1647  return context->InvokeService(context, _OrthancPluginService_GetDicomForInstance, &params);
1648  }
1649 
1650 
1651 
1652  typedef struct
1653  {
1654  OrthancPluginMemoryBuffer* target;
1655  const char* uri;
1656  } _OrthancPluginRestApiGet;
1657 
1673  OrthancPluginContext* context,
1674  OrthancPluginMemoryBuffer* target,
1675  const char* uri)
1676  {
1677  _OrthancPluginRestApiGet params;
1678  params.target = target;
1679  params.uri = uri;
1680  return context->InvokeService(context, _OrthancPluginService_RestApiGet, &params);
1681  }
1682 
1683 
1684 
1703  OrthancPluginContext* context,
1704  OrthancPluginMemoryBuffer* target,
1705  const char* uri)
1706  {
1707  _OrthancPluginRestApiGet params;
1708  params.target = target;
1709  params.uri = uri;
1710  return context->InvokeService(context, _OrthancPluginService_RestApiGetAfterPlugins, &params);
1711  }
1712 
1713 
1714 
1715  typedef struct
1716  {
1717  OrthancPluginMemoryBuffer* target;
1718  const char* uri;
1719  const char* body;
1720  uint32_t bodySize;
1721  } _OrthancPluginRestApiPostPut;
1722 
1740  OrthancPluginContext* context,
1741  OrthancPluginMemoryBuffer* target,
1742  const char* uri,
1743  const char* body,
1744  uint32_t bodySize)
1745  {
1746  _OrthancPluginRestApiPostPut params;
1747  params.target = target;
1748  params.uri = uri;
1749  params.body = body;
1750  params.bodySize = bodySize;
1751  return context->InvokeService(context, _OrthancPluginService_RestApiPost, &params);
1752  }
1753 
1754 
1775  OrthancPluginContext* context,
1776  OrthancPluginMemoryBuffer* target,
1777  const char* uri,
1778  const char* body,
1779  uint32_t bodySize)
1780  {
1781  _OrthancPluginRestApiPostPut params;
1782  params.target = target;
1783  params.uri = uri;
1784  params.body = body;
1785  params.bodySize = bodySize;
1786  return context->InvokeService(context, _OrthancPluginService_RestApiPostAfterPlugins, &params);
1787  }
1788 
1789 
1790 
1804  OrthancPluginContext* context,
1805  const char* uri)
1806  {
1807  return context->InvokeService(context, _OrthancPluginService_RestApiDelete, uri);
1808  }
1809 
1810 
1827  OrthancPluginContext* context,
1828  const char* uri)
1829  {
1830  return context->InvokeService(context, _OrthancPluginService_RestApiDeleteAfterPlugins, uri);
1831  }
1832 
1833 
1834 
1852  OrthancPluginContext* context,
1853  OrthancPluginMemoryBuffer* target,
1854  const char* uri,
1855  const char* body,
1856  uint32_t bodySize)
1857  {
1858  _OrthancPluginRestApiPostPut params;
1859  params.target = target;
1860  params.uri = uri;
1861  params.body = body;
1862  params.bodySize = bodySize;
1863  return context->InvokeService(context, _OrthancPluginService_RestApiPut, &params);
1864  }
1865 
1866 
1867 
1888  OrthancPluginContext* context,
1889  OrthancPluginMemoryBuffer* target,
1890  const char* uri,
1891  const char* body,
1892  uint32_t bodySize)
1893  {
1894  _OrthancPluginRestApiPostPut params;
1895  params.target = target;
1896  params.uri = uri;
1897  params.body = body;
1898  params.bodySize = bodySize;
1899  return context->InvokeService(context, _OrthancPluginService_RestApiPutAfterPlugins, &params);
1900  }
1901 
1902 
1903 
1904  typedef struct
1905  {
1906  OrthancPluginRestOutput* output;
1907  const char* argument;
1908  } _OrthancPluginOutputPlusArgument;
1909 
1921  ORTHANC_PLUGIN_INLINE void OrthancPluginRedirect(
1922  OrthancPluginContext* context,
1923  OrthancPluginRestOutput* output,
1924  const char* redirection)
1925  {
1926  _OrthancPluginOutputPlusArgument params;
1927  params.output = output;
1928  params.argument = redirection;
1929  context->InvokeService(context, _OrthancPluginService_Redirect, &params);
1930  }
1931 
1932 
1933 
1934  typedef struct
1935  {
1936  char** result;
1937  const char* argument;
1938  } _OrthancPluginRetrieveDynamicString;
1939 
1953  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupPatient(
1954  OrthancPluginContext* context,
1955  const char* patientID)
1956  {
1957  char* result;
1958 
1959  _OrthancPluginRetrieveDynamicString params;
1960  params.result = &result;
1961  params.argument = patientID;
1962 
1963  if (context->InvokeService(context, _OrthancPluginService_LookupPatient, &params) != OrthancPluginErrorCode_Success)
1964  {
1965  /* Error */
1966  return NULL;
1967  }
1968  else
1969  {
1970  return result;
1971  }
1972  }
1973 
1974 
1988  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudy(
1989  OrthancPluginContext* context,
1990  const char* studyUID)
1991  {
1992  char* result;
1993 
1994  _OrthancPluginRetrieveDynamicString params;
1995  params.result = &result;
1996  params.argument = studyUID;
1997 
1998  if (context->InvokeService(context, _OrthancPluginService_LookupStudy, &params) != OrthancPluginErrorCode_Success)
1999  {
2000  /* Error */
2001  return NULL;
2002  }
2003  else
2004  {
2005  return result;
2006  }
2007  }
2008 
2009 
2023  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudyWithAccessionNumber(
2024  OrthancPluginContext* context,
2025  const char* accessionNumber)
2026  {
2027  char* result;
2028 
2029  _OrthancPluginRetrieveDynamicString params;
2030  params.result = &result;
2031  params.argument = accessionNumber;
2032 
2033  if (context->InvokeService(context, _OrthancPluginService_LookupStudyWithAccessionNumber, &params) != OrthancPluginErrorCode_Success)
2034  {
2035  /* Error */
2036  return NULL;
2037  }
2038  else
2039  {
2040  return result;
2041  }
2042  }
2043 
2044 
2058  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupSeries(
2059  OrthancPluginContext* context,
2060  const char* seriesUID)
2061  {
2062  char* result;
2063 
2064  _OrthancPluginRetrieveDynamicString params;
2065  params.result = &result;
2066  params.argument = seriesUID;
2067 
2068  if (context->InvokeService(context, _OrthancPluginService_LookupSeries, &params) != OrthancPluginErrorCode_Success)
2069  {
2070  /* Error */
2071  return NULL;
2072  }
2073  else
2074  {
2075  return result;
2076  }
2077  }
2078 
2079 
2093  ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupInstance(
2094  OrthancPluginContext* context,
2095  const char* sopInstanceUID)
2096  {
2097  char* result;
2098 
2099  _OrthancPluginRetrieveDynamicString params;
2100  params.result = &result;
2101  params.argument = sopInstanceUID;
2102 
2103  if (context->InvokeService(context, _OrthancPluginService_LookupInstance, &params) != OrthancPluginErrorCode_Success)
2104  {
2105  /* Error */
2106  return NULL;
2107  }
2108  else
2109  {
2110  return result;
2111  }
2112  }
2113 
2114 
2115 
2116  typedef struct
2117  {
2118  OrthancPluginRestOutput* output;
2119  uint16_t status;
2120  } _OrthancPluginSendHttpStatusCode;
2121 
2138  ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatusCode(
2139  OrthancPluginContext* context,
2140  OrthancPluginRestOutput* output,
2141  uint16_t status)
2142  {
2143  _OrthancPluginSendHttpStatusCode params;
2144  params.output = output;
2145  params.status = status;
2146  context->InvokeService(context, _OrthancPluginService_SendHttpStatusCode, &params);
2147  }
2148 
2149 
2161  ORTHANC_PLUGIN_INLINE void OrthancPluginSendUnauthorized(
2162  OrthancPluginContext* context,
2163  OrthancPluginRestOutput* output,
2164  const char* realm)
2165  {
2166  _OrthancPluginOutputPlusArgument params;
2167  params.output = output;
2168  params.argument = realm;
2169  context->InvokeService(context, _OrthancPluginService_SendUnauthorized, &params);
2170  }
2171 
2172 
2184  ORTHANC_PLUGIN_INLINE void OrthancPluginSendMethodNotAllowed(
2185  OrthancPluginContext* context,
2186  OrthancPluginRestOutput* output,
2187  const char* allowedMethods)
2188  {
2189  _OrthancPluginOutputPlusArgument params;
2190  params.output = output;
2191  params.argument = allowedMethods;
2192  context->InvokeService(context, _OrthancPluginService_SendMethodNotAllowed, &params);
2193  }
2194 
2195 
2196  typedef struct
2197  {
2198  OrthancPluginRestOutput* output;
2199  const char* key;
2200  const char* value;
2201  } _OrthancPluginSetHttpHeader;
2202 
2214  ORTHANC_PLUGIN_INLINE void OrthancPluginSetCookie(
2215  OrthancPluginContext* context,
2216  OrthancPluginRestOutput* output,
2217  const char* cookie,
2218  const char* value)
2219  {
2220  _OrthancPluginSetHttpHeader params;
2221  params.output = output;
2222  params.key = cookie;
2223  params.value = value;
2224  context->InvokeService(context, _OrthancPluginService_SetCookie, &params);
2225  }
2226 
2227 
2239  ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpHeader(
2240  OrthancPluginContext* context,
2241  OrthancPluginRestOutput* output,
2242  const char* key,
2243  const char* value)
2244  {
2245  _OrthancPluginSetHttpHeader params;
2246  params.output = output;
2247  params.key = key;
2248  params.value = value;
2249  context->InvokeService(context, _OrthancPluginService_SetHttpHeader, &params);
2250  }
2251 
2252 
2253  typedef struct
2254  {
2255  char** resultStringToFree;
2256  const char** resultString;
2257  int64_t* resultInt64;
2258  const char* key;
2259  OrthancPluginDicomInstance* instance;
2260  OrthancPluginInstanceOrigin* resultOrigin; /* New in Orthanc 0.9.5 SDK */
2261  } _OrthancPluginAccessDicomInstance;
2262 
2263 
2275  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceRemoteAet(
2276  OrthancPluginContext* context,
2277  OrthancPluginDicomInstance* instance)
2278  {
2279  const char* result;
2280 
2281  _OrthancPluginAccessDicomInstance params;
2282  memset(&params, 0, sizeof(params));
2283  params.resultString = &result;
2284  params.instance = instance;
2285 
2286  if (context->InvokeService(context, _OrthancPluginService_GetInstanceRemoteAet, &params) != OrthancPluginErrorCode_Success)
2287  {
2288  /* Error */
2289  return NULL;
2290  }
2291  else
2292  {
2293  return result;
2294  }
2295  }
2296 
2297 
2308  ORTHANC_PLUGIN_INLINE int64_t OrthancPluginGetInstanceSize(
2309  OrthancPluginContext* context,
2310  OrthancPluginDicomInstance* instance)
2311  {
2312  int64_t size;
2313 
2314  _OrthancPluginAccessDicomInstance params;
2315  memset(&params, 0, sizeof(params));
2316  params.resultInt64 = &size;
2317  params.instance = instance;
2318 
2319  if (context->InvokeService(context, _OrthancPluginService_GetInstanceSize, &params) != OrthancPluginErrorCode_Success)
2320  {
2321  /* Error */
2322  return -1;
2323  }
2324  else
2325  {
2326  return size;
2327  }
2328  }
2329 
2330 
2341  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceData(
2342  OrthancPluginContext* context,
2343  OrthancPluginDicomInstance* instance)
2344  {
2345  const char* result;
2346 
2347  _OrthancPluginAccessDicomInstance params;
2348  memset(&params, 0, sizeof(params));
2349  params.resultString = &result;
2350  params.instance = instance;
2351 
2352  if (context->InvokeService(context, _OrthancPluginService_GetInstanceData, &params) != OrthancPluginErrorCode_Success)
2353  {
2354  /* Error */
2355  return NULL;
2356  }
2357  else
2358  {
2359  return result;
2360  }
2361  }
2362 
2363 
2377  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceJson(
2378  OrthancPluginContext* context,
2379  OrthancPluginDicomInstance* instance)
2380  {
2381  char* result;
2382 
2383  _OrthancPluginAccessDicomInstance params;
2384  memset(&params, 0, sizeof(params));
2385  params.resultStringToFree = &result;
2386  params.instance = instance;
2387 
2388  if (context->InvokeService(context, _OrthancPluginService_GetInstanceJson, &params) != OrthancPluginErrorCode_Success)
2389  {
2390  /* Error */
2391  return NULL;
2392  }
2393  else
2394  {
2395  return result;
2396  }
2397  }
2398 
2399 
2415  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceSimplifiedJson(
2416  OrthancPluginContext* context,
2417  OrthancPluginDicomInstance* instance)
2418  {
2419  char* result;
2420 
2421  _OrthancPluginAccessDicomInstance params;
2422  memset(&params, 0, sizeof(params));
2423  params.resultStringToFree = &result;
2424  params.instance = instance;
2425 
2426  if (context->InvokeService(context, _OrthancPluginService_GetInstanceSimplifiedJson, &params) != OrthancPluginErrorCode_Success)
2427  {
2428  /* Error */
2429  return NULL;
2430  }
2431  else
2432  {
2433  return result;
2434  }
2435  }
2436 
2437 
2454  ORTHANC_PLUGIN_INLINE int OrthancPluginHasInstanceMetadata(
2455  OrthancPluginContext* context,
2456  OrthancPluginDicomInstance* instance,
2457  const char* metadata)
2458  {
2459  int64_t result;
2460 
2461  _OrthancPluginAccessDicomInstance params;
2462  memset(&params, 0, sizeof(params));
2463  params.resultInt64 = &result;
2464  params.instance = instance;
2465  params.key = metadata;
2466 
2467  if (context->InvokeService(context, _OrthancPluginService_HasInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
2468  {
2469  /* Error */
2470  return -1;
2471  }
2472  else
2473  {
2474  return (result != 0);
2475  }
2476  }
2477 
2478 
2492  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceMetadata(
2493  OrthancPluginContext* context,
2494  OrthancPluginDicomInstance* instance,
2495  const char* metadata)
2496  {
2497  const char* result;
2498 
2499  _OrthancPluginAccessDicomInstance params;
2500  memset(&params, 0, sizeof(params));
2501  params.resultString = &result;
2502  params.instance = instance;
2503  params.key = metadata;
2504 
2505  if (context->InvokeService(context, _OrthancPluginService_GetInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
2506  {
2507  /* Error */
2508  return NULL;
2509  }
2510  else
2511  {
2512  return result;
2513  }
2514  }
2515 
2516 
2517 
2518  typedef struct
2519  {
2523  OrthancPluginFree free;
2524  } _OrthancPluginRegisterStorageArea;
2525 
2540  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterStorageArea(
2541  OrthancPluginContext* context,
2545  {
2546  _OrthancPluginRegisterStorageArea params;
2547  params.create = create;
2548  params.read = read;
2549  params.remove = remove;
2550 
2551 #ifdef __cplusplus
2552  params.free = ::free;
2553 #else
2554  params.free = free;
2555 #endif
2556 
2557  context->InvokeService(context, _OrthancPluginService_RegisterStorageArea, &params);
2558  }
2559 
2560 
2561 
2572  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancPath(OrthancPluginContext* context)
2573  {
2574  char* result;
2575 
2576  _OrthancPluginRetrieveDynamicString params;
2577  params.result = &result;
2578  params.argument = NULL;
2579 
2580  if (context->InvokeService(context, _OrthancPluginService_GetOrthancPath, &params) != OrthancPluginErrorCode_Success)
2581  {
2582  /* Error */
2583  return NULL;
2584  }
2585  else
2586  {
2587  return result;
2588  }
2589  }
2590 
2591 
2602  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancDirectory(OrthancPluginContext* context)
2603  {
2604  char* result;
2605 
2606  _OrthancPluginRetrieveDynamicString params;
2607  params.result = &result;
2608  params.argument = NULL;
2609 
2610  if (context->InvokeService(context, _OrthancPluginService_GetOrthancDirectory, &params) != OrthancPluginErrorCode_Success)
2611  {
2612  /* Error */
2613  return NULL;
2614  }
2615  else
2616  {
2617  return result;
2618  }
2619  }
2620 
2621 
2637  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfigurationPath(OrthancPluginContext* context)
2638  {
2639  char* result;
2640 
2641  _OrthancPluginRetrieveDynamicString params;
2642  params.result = &result;
2643  params.argument = NULL;
2644 
2645  if (context->InvokeService(context, _OrthancPluginService_GetConfigurationPath, &params) != OrthancPluginErrorCode_Success)
2646  {
2647  /* Error */
2648  return NULL;
2649  }
2650  else
2651  {
2652  return result;
2653  }
2654  }
2655 
2656 
2657 
2658  typedef struct
2659  {
2661  } _OrthancPluginOnChangeCallback;
2662 
2679  ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnChangeCallback(
2680  OrthancPluginContext* context,
2682  {
2683  _OrthancPluginOnChangeCallback params;
2684  params.callback = callback;
2685 
2686  context->InvokeService(context, _OrthancPluginService_RegisterOnChangeCallback, &params);
2687  }
2688 
2689 
2690 
2691  typedef struct
2692  {
2693  const char* plugin;
2694  _OrthancPluginProperty property;
2695  const char* value;
2696  } _OrthancPluginSetPluginProperty;
2697 
2698 
2710  ORTHANC_PLUGIN_INLINE void OrthancPluginSetRootUri(
2711  OrthancPluginContext* context,
2712  const char* uri)
2713  {
2714  _OrthancPluginSetPluginProperty params;
2715  params.plugin = OrthancPluginGetName();
2716  params.property = _OrthancPluginProperty_RootUri;
2717  params.value = uri;
2718 
2719  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
2720  }
2721 
2722 
2732  ORTHANC_PLUGIN_INLINE void OrthancPluginSetDescription(
2733  OrthancPluginContext* context,
2734  const char* description)
2735  {
2736  _OrthancPluginSetPluginProperty params;
2737  params.plugin = OrthancPluginGetName();
2738  params.property = _OrthancPluginProperty_Description;
2739  params.value = description;
2740 
2741  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
2742  }
2743 
2744 
2754  ORTHANC_PLUGIN_INLINE void OrthancPluginExtendOrthancExplorer(
2755  OrthancPluginContext* context,
2756  const char* javascript)
2757  {
2758  _OrthancPluginSetPluginProperty params;
2759  params.plugin = OrthancPluginGetName();
2760  params.property = _OrthancPluginProperty_OrthancExplorer;
2761  params.value = javascript;
2762 
2763  context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
2764  }
2765 
2766 
2767  typedef struct
2768  {
2769  char** result;
2770  int32_t property;
2771  const char* value;
2772  } _OrthancPluginGlobalProperty;
2773 
2774 
2788  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetGlobalProperty(
2789  OrthancPluginContext* context,
2790  int32_t property,
2791  const char* defaultValue)
2792  {
2793  char* result;
2794 
2795  _OrthancPluginGlobalProperty params;
2796  params.result = &result;
2797  params.property = property;
2798  params.value = defaultValue;
2799 
2800  if (context->InvokeService(context, _OrthancPluginService_GetGlobalProperty, &params) != OrthancPluginErrorCode_Success)
2801  {
2802  /* Error */
2803  return NULL;
2804  }
2805  else
2806  {
2807  return result;
2808  }
2809  }
2810 
2811 
2828  OrthancPluginContext* context,
2829  int32_t property,
2830  const char* value)
2831  {
2832  _OrthancPluginGlobalProperty params;
2833  params.result = NULL;
2834  params.property = property;
2835  params.value = value;
2836 
2837  return context->InvokeService(context, _OrthancPluginService_SetGlobalProperty, &params);
2838  }
2839 
2840 
2841 
2842  typedef struct
2843  {
2844  int32_t *resultInt32;
2845  uint32_t *resultUint32;
2846  int64_t *resultInt64;
2847  uint64_t *resultUint64;
2848  } _OrthancPluginReturnSingleValue;
2849 
2858  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetCommandLineArgumentsCount(
2859  OrthancPluginContext* context)
2860  {
2861  uint32_t count = 0;
2862 
2863  _OrthancPluginReturnSingleValue params;
2864  memset(&params, 0, sizeof(params));
2865  params.resultUint32 = &count;
2866 
2867  if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgumentsCount, &params) != OrthancPluginErrorCode_Success)
2868  {
2869  /* Error */
2870  return 0;
2871  }
2872  else
2873  {
2874  return count;
2875  }
2876  }
2877 
2878 
2879 
2892  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetCommandLineArgument(
2893  OrthancPluginContext* context,
2894  uint32_t argument)
2895  {
2896  char* result;
2897 
2898  _OrthancPluginGlobalProperty params;
2899  params.result = &result;
2900  params.property = (int32_t) argument;
2901  params.value = NULL;
2902 
2903  if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgument, &params) != OrthancPluginErrorCode_Success)
2904  {
2905  /* Error */
2906  return NULL;
2907  }
2908  else
2909  {
2910  return result;
2911  }
2912  }
2913 
2914 
2925  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetExpectedDatabaseVersion(
2926  OrthancPluginContext* context)
2927  {
2928  uint32_t count = 0;
2929 
2930  _OrthancPluginReturnSingleValue params;
2931  memset(&params, 0, sizeof(params));
2932  params.resultUint32 = &count;
2933 
2934  if (context->InvokeService(context, _OrthancPluginService_GetExpectedDatabaseVersion, &params) != OrthancPluginErrorCode_Success)
2935  {
2936  /* Error */
2937  return 0;
2938  }
2939  else
2940  {
2941  return count;
2942  }
2943  }
2944 
2945 
2946 
2958  ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfiguration(OrthancPluginContext* context)
2959  {
2960  char* result;
2961 
2962  _OrthancPluginRetrieveDynamicString params;
2963  params.result = &result;
2964  params.argument = NULL;
2965 
2966  if (context->InvokeService(context, _OrthancPluginService_GetConfiguration, &params) != OrthancPluginErrorCode_Success)
2967  {
2968  /* Error */
2969  return NULL;
2970  }
2971  else
2972  {
2973  return result;
2974  }
2975  }
2976 
2977 
2978 
2979  typedef struct
2980  {
2981  OrthancPluginRestOutput* output;
2982  const char* subType;
2983  const char* contentType;
2984  } _OrthancPluginStartMultipartAnswer;
2985 
3000  OrthancPluginContext* context,
3001  OrthancPluginRestOutput* output,
3002  const char* subType,
3003  const char* contentType)
3004  {
3005  _OrthancPluginStartMultipartAnswer params;
3006  params.output = output;
3007  params.subType = subType;
3008  params.contentType = contentType;
3009  return context->InvokeService(context, _OrthancPluginService_StartMultipartAnswer, &params);
3010  }
3011 
3012 
3029  OrthancPluginContext* context,
3030  OrthancPluginRestOutput* output,
3031  const char* answer,
3032  uint32_t answerSize)
3033  {
3034  _OrthancPluginAnswerBuffer params;
3035  params.output = output;
3036  params.answer = answer;
3037  params.answerSize = answerSize;
3038  params.mimeType = NULL;
3039  return context->InvokeService(context, _OrthancPluginService_SendMultipartItem, &params);
3040  }
3041 
3042 
3043 
3044  typedef struct
3045  {
3046  OrthancPluginMemoryBuffer* target;
3047  const void* source;
3048  uint32_t size;
3049  OrthancPluginCompressionType compression;
3050  uint8_t uncompress;
3051  } _OrthancPluginBufferCompression;
3052 
3053 
3071  OrthancPluginContext* context,
3072  OrthancPluginMemoryBuffer* target,
3073  const void* source,
3074  uint32_t size,
3075  OrthancPluginCompressionType compression,
3076  uint8_t uncompress)
3077  {
3078  _OrthancPluginBufferCompression params;
3079  params.target = target;
3080  params.source = source;
3081  params.size = size;
3082  params.compression = compression;
3083  params.uncompress = uncompress;
3084 
3085  return context->InvokeService(context, _OrthancPluginService_BufferCompression, &params);
3086  }
3087 
3088 
3089 
3090  typedef struct
3091  {
3092  OrthancPluginMemoryBuffer* target;
3093  const char* path;
3094  } _OrthancPluginReadFile;
3095 
3108  OrthancPluginContext* context,
3109  OrthancPluginMemoryBuffer* target,
3110  const char* path)
3111  {
3112  _OrthancPluginReadFile params;
3113  params.target = target;
3114  params.path = path;
3115  return context->InvokeService(context, _OrthancPluginService_ReadFile, &params);
3116  }
3117 
3118 
3119 
3120  typedef struct
3121  {
3122  const char* path;
3123  const void* data;
3124  uint32_t size;
3125  } _OrthancPluginWriteFile;
3126 
3139  OrthancPluginContext* context,
3140  const char* path,
3141  const void* data,
3142  uint32_t size)
3143  {
3144  _OrthancPluginWriteFile params;
3145  params.path = path;
3146  params.data = data;
3147  params.size = size;
3148  return context->InvokeService(context, _OrthancPluginService_WriteFile, &params);
3149  }
3150 
3151 
3152 
3153  typedef struct
3154  {
3155  const char** target;
3156  OrthancPluginErrorCode error;
3157  } _OrthancPluginGetErrorDescription;
3158 
3169  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetErrorDescription(
3170  OrthancPluginContext* context,
3171  OrthancPluginErrorCode error)
3172  {
3173  const char* result = NULL;
3174 
3175  _OrthancPluginGetErrorDescription params;
3176  params.target = &result;
3177  params.error = error;
3178 
3179  if (context->InvokeService(context, _OrthancPluginService_GetErrorDescription, &params) != OrthancPluginErrorCode_Success ||
3180  result == NULL)
3181  {
3182  return "Unknown error code";
3183  }
3184  else
3185  {
3186  return result;
3187  }
3188  }
3189 
3190 
3191 
3192  typedef struct
3193  {
3194  OrthancPluginRestOutput* output;
3195  uint16_t status;
3196  const char* body;
3197  uint32_t bodySize;
3198  } _OrthancPluginSendHttpStatus;
3199 
3222  ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatus(
3223  OrthancPluginContext* context,
3224  OrthancPluginRestOutput* output,
3225  uint16_t status,
3226  const char* body,
3227  uint32_t bodySize)
3228  {
3229  _OrthancPluginSendHttpStatus params;
3230  params.output = output;
3231  params.status = status;
3232  params.body = body;
3233  params.bodySize = bodySize;
3234  context->InvokeService(context, _OrthancPluginService_SendHttpStatus, &params);
3235  }
3236 
3237 
3238 
3239  typedef struct
3240  {
3241  const OrthancPluginImage* image;
3242  uint32_t* resultUint32;
3243  OrthancPluginPixelFormat* resultPixelFormat;
3244  void** resultBuffer;
3245  } _OrthancPluginGetImageInfo;
3246 
3247 
3259  OrthancPluginContext* context,
3260  const OrthancPluginImage* image)
3261  {
3262  OrthancPluginPixelFormat target;
3263 
3264  _OrthancPluginGetImageInfo params;
3265  memset(&params, 0, sizeof(params));
3266  params.image = image;
3267  params.resultPixelFormat = &target;
3268 
3269  if (context->InvokeService(context, _OrthancPluginService_GetImagePixelFormat, &params) != OrthancPluginErrorCode_Success)
3270  {
3272  }
3273  else
3274  {
3275  return (OrthancPluginPixelFormat) target;
3276  }
3277  }
3278 
3279 
3280 
3291  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageWidth(
3292  OrthancPluginContext* context,
3293  const OrthancPluginImage* image)
3294  {
3295  uint32_t width;
3296 
3297  _OrthancPluginGetImageInfo params;
3298  memset(&params, 0, sizeof(params));
3299  params.image = image;
3300  params.resultUint32 = &width;
3301 
3302  if (context->InvokeService(context, _OrthancPluginService_GetImageWidth, &params) != OrthancPluginErrorCode_Success)
3303  {
3304  return 0;
3305  }
3306  else
3307  {
3308  return width;
3309  }
3310  }
3311 
3312 
3313 
3324  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageHeight(
3325  OrthancPluginContext* context,
3326  const OrthancPluginImage* image)
3327  {
3328  uint32_t height;
3329 
3330  _OrthancPluginGetImageInfo params;
3331  memset(&params, 0, sizeof(params));
3332  params.image = image;
3333  params.resultUint32 = &height;
3334 
3335  if (context->InvokeService(context, _OrthancPluginService_GetImageHeight, &params) != OrthancPluginErrorCode_Success)
3336  {
3337  return 0;
3338  }
3339  else
3340  {
3341  return height;
3342  }
3343  }
3344 
3345 
3346 
3359  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImagePitch(
3360  OrthancPluginContext* context,
3361  const OrthancPluginImage* image)
3362  {
3363  uint32_t pitch;
3364 
3365  _OrthancPluginGetImageInfo params;
3366  memset(&params, 0, sizeof(params));
3367  params.image = image;
3368  params.resultUint32 = &pitch;
3369 
3370  if (context->InvokeService(context, _OrthancPluginService_GetImagePitch, &params) != OrthancPluginErrorCode_Success)
3371  {
3372  return 0;
3373  }
3374  else
3375  {
3376  return pitch;
3377  }
3378  }
3379 
3380 
3381 
3393  ORTHANC_PLUGIN_INLINE void* OrthancPluginGetImageBuffer(
3394  OrthancPluginContext* context,
3395  const OrthancPluginImage* image)
3396  {
3397  void* target = NULL;
3398 
3399  _OrthancPluginGetImageInfo params;
3400  memset(&params, 0, sizeof(params));
3401  params.resultBuffer = &target;
3402  params.image = image;
3403 
3404  if (context->InvokeService(context, _OrthancPluginService_GetImageBuffer, &params) != OrthancPluginErrorCode_Success)
3405  {
3406  return NULL;
3407  }
3408  else
3409  {
3410  return target;
3411  }
3412  }
3413 
3414 
3415  typedef struct
3416  {
3417  OrthancPluginImage** target;
3418  const void* data;
3419  uint32_t size;
3420  OrthancPluginImageFormat format;
3421  } _OrthancPluginUncompressImage;
3422 
3423 
3437  OrthancPluginContext* context,
3438  const void* data,
3439  uint32_t size,
3440  OrthancPluginImageFormat format)
3441  {
3442  OrthancPluginImage* target = NULL;
3443 
3444  _OrthancPluginUncompressImage params;
3445  memset(&params, 0, sizeof(params));
3446  params.target = &target;
3447  params.data = data;
3448  params.size = size;
3449  params.format = format;
3450 
3451  if (context->InvokeService(context, _OrthancPluginService_UncompressImage, &params) != OrthancPluginErrorCode_Success)
3452  {
3453  return NULL;
3454  }
3455  else
3456  {
3457  return target;
3458  }
3459  }
3460 
3461 
3462 
3463 
3464  typedef struct
3465  {
3466  OrthancPluginImage* image;
3467  } _OrthancPluginFreeImage;
3468 
3478  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeImage(
3479  OrthancPluginContext* context,
3480  OrthancPluginImage* image)
3481  {
3482  _OrthancPluginFreeImage params;
3483  params.image = image;
3484 
3485  context->InvokeService(context, _OrthancPluginService_FreeImage, &params);
3486  }
3487 
3488 
3489 
3490 
3491  typedef struct
3492  {
3493  OrthancPluginMemoryBuffer* target;
3494  OrthancPluginImageFormat imageFormat;
3495  OrthancPluginPixelFormat pixelFormat;
3496  uint32_t width;
3497  uint32_t height;
3498  uint32_t pitch;
3499  const void* buffer;
3500  uint8_t quality;
3501  } _OrthancPluginCompressImage;
3502 
3503 
3524  OrthancPluginContext* context,
3525  OrthancPluginMemoryBuffer* target,
3526  OrthancPluginPixelFormat format,
3527  uint32_t width,
3528  uint32_t height,
3529  uint32_t pitch,
3530  const void* buffer)
3531  {
3532  _OrthancPluginCompressImage params;
3533  memset(&params, 0, sizeof(params));
3534  params.target = target;
3535  params.imageFormat = OrthancPluginImageFormat_Png;
3536  params.pixelFormat = format;
3537  params.width = width;
3538  params.height = height;
3539  params.pitch = pitch;
3540  params.buffer = buffer;
3541  params.quality = 0; /* Unused for PNG */
3542 
3543  return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
3544  }
3545 
3546 
3569  OrthancPluginContext* context,
3570  OrthancPluginMemoryBuffer* target,
3571  OrthancPluginPixelFormat format,
3572  uint32_t width,
3573  uint32_t height,
3574  uint32_t pitch,
3575  const void* buffer,
3576  uint8_t quality)
3577  {
3578  _OrthancPluginCompressImage params;
3579  memset(&params, 0, sizeof(params));
3580  params.target = target;
3581  params.imageFormat = OrthancPluginImageFormat_Jpeg;
3582  params.pixelFormat = format;
3583  params.width = width;
3584  params.height = height;
3585  params.pitch = pitch;
3586  params.buffer = buffer;
3587  params.quality = quality;
3588 
3589  return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
3590  }
3591 
3592 
3593 
3615  ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerJpegImage(
3616  OrthancPluginContext* context,
3617  OrthancPluginRestOutput* output,
3618  OrthancPluginPixelFormat format,
3619  uint32_t width,
3620  uint32_t height,
3621  uint32_t pitch,
3622  const void* buffer,
3623  uint8_t quality)
3624  {
3625  _OrthancPluginCompressAndAnswerImage params;
3626  params.output = output;
3627  params.imageFormat = OrthancPluginImageFormat_Jpeg;
3628  params.pixelFormat = format;
3629  params.width = width;
3630  params.height = height;
3631  params.pitch = pitch;
3632  params.buffer = buffer;
3633  params.quality = quality;
3634  context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
3635  }
3636 
3637 
3638 
3639 
3640  typedef struct
3641  {
3642  OrthancPluginMemoryBuffer* target;
3643  OrthancPluginHttpMethod method;
3644  const char* url;
3645  const char* username;
3646  const char* password;
3647  const char* body;
3648  uint32_t bodySize;
3649  } _OrthancPluginCallHttpClient;
3650 
3651 
3668  OrthancPluginContext* context,
3669  OrthancPluginMemoryBuffer* target,
3670  const char* url,
3671  const char* username,
3672  const char* password)
3673  {
3674  _OrthancPluginCallHttpClient params;
3675  memset(&params, 0, sizeof(params));
3676 
3677  params.target = target;
3678  params.method = OrthancPluginHttpMethod_Get;
3679  params.url = url;
3680  params.username = username;
3681  params.password = password;
3682 
3683  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3684  }
3685 
3686 
3705  OrthancPluginContext* context,
3706  OrthancPluginMemoryBuffer* target,
3707  const char* url,
3708  const char* body,
3709  uint32_t bodySize,
3710  const char* username,
3711  const char* password)
3712  {
3713  _OrthancPluginCallHttpClient params;
3714  memset(&params, 0, sizeof(params));
3715 
3716  params.target = target;
3717  params.method = OrthancPluginHttpMethod_Post;
3718  params.url = url;
3719  params.body = body;
3720  params.bodySize = bodySize;
3721  params.username = username;
3722  params.password = password;
3723 
3724  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3725  }
3726 
3727 
3746  OrthancPluginContext* context,
3747  OrthancPluginMemoryBuffer* target,
3748  const char* url,
3749  const char* body,
3750  uint32_t bodySize,
3751  const char* username,
3752  const char* password)
3753  {
3754  _OrthancPluginCallHttpClient params;
3755  memset(&params, 0, sizeof(params));
3756 
3757  params.target = target;
3758  params.method = OrthancPluginHttpMethod_Put;
3759  params.url = url;
3760  params.body = body;
3761  params.bodySize = bodySize;
3762  params.username = username;
3763  params.password = password;
3764 
3765  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3766  }
3767 
3768 
3783  OrthancPluginContext* context,
3784  const char* url,
3785  const char* username,
3786  const char* password)
3787  {
3788  _OrthancPluginCallHttpClient params;
3789  memset(&params, 0, sizeof(params));
3790 
3791  params.method = OrthancPluginHttpMethod_Delete;
3792  params.url = url;
3793  params.username = username;
3794  params.password = password;
3795 
3796  return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3797  }
3798 
3799 
3800 
3801  typedef struct
3802  {
3803  OrthancPluginImage** target;
3804  const OrthancPluginImage* source;
3805  OrthancPluginPixelFormat targetFormat;
3806  } _OrthancPluginConvertPixelFormat;
3807 
3808 
3821  OrthancPluginContext* context,
3822  const OrthancPluginImage* source,
3823  OrthancPluginPixelFormat targetFormat)
3824  {
3825  OrthancPluginImage* target = NULL;
3826 
3827  _OrthancPluginConvertPixelFormat params;
3828  params.target = &target;
3829  params.source = source;
3830  params.targetFormat = targetFormat;
3831 
3832  if (context->InvokeService(context, _OrthancPluginService_ConvertPixelFormat, &params) != OrthancPluginErrorCode_Success)
3833  {
3834  return NULL;
3835  }
3836  else
3837  {
3838  return target;
3839  }
3840  }
3841 
3842 
3843 
3855  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontsCount(
3856  OrthancPluginContext* context)
3857  {
3858  uint32_t count = 0;
3859 
3860  _OrthancPluginReturnSingleValue params;
3861  memset(&params, 0, sizeof(params));
3862  params.resultUint32 = &count;
3863 
3864  if (context->InvokeService(context, _OrthancPluginService_GetFontsCount, &params) != OrthancPluginErrorCode_Success)
3865  {
3866  /* Error */
3867  return 0;
3868  }
3869  else
3870  {
3871  return count;
3872  }
3873  }
3874 
3875 
3876 
3877 
3878  typedef struct
3879  {
3880  uint32_t fontIndex; /* in */
3881  const char** name; /* out */
3882  uint32_t* size; /* out */
3883  } _OrthancPluginGetFontInfo;
3884 
3895  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetFontName(
3896  OrthancPluginContext* context,
3897  uint32_t fontIndex)
3898  {
3899  const char* result = NULL;
3900 
3901  _OrthancPluginGetFontInfo params;
3902  memset(&params, 0, sizeof(params));
3903  params.name = &result;
3904  params.fontIndex = fontIndex;
3905 
3906  if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
3907  {
3908  return NULL;
3909  }
3910  else
3911  {
3912  return result;
3913  }
3914  }
3915 
3916 
3927  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontSize(
3928  OrthancPluginContext* context,
3929  uint32_t fontIndex)
3930  {
3931  uint32_t result;
3932 
3933  _OrthancPluginGetFontInfo params;
3934  memset(&params, 0, sizeof(params));
3935  params.size = &result;
3936  params.fontIndex = fontIndex;
3937 
3938  if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
3939  {
3940  return 0;
3941  }
3942  else
3943  {
3944  return result;
3945  }
3946  }
3947 
3948 
3949 
3950  typedef struct
3951  {
3952  OrthancPluginImage* image;
3953  uint32_t fontIndex;
3954  const char* utf8Text;
3955  int32_t x;
3956  int32_t y;
3957  uint8_t r;
3958  uint8_t g;
3959  uint8_t b;
3960  } _OrthancPluginDrawText;
3961 
3962 
3981  OrthancPluginContext* context,
3982  OrthancPluginImage* image,
3983  uint32_t fontIndex,
3984  const char* utf8Text,
3985  int32_t x,
3986  int32_t y,
3987  uint8_t r,
3988  uint8_t g,
3989  uint8_t b)
3990  {
3991  _OrthancPluginDrawText params;
3992  memset(&params, 0, sizeof(params));
3993  params.image = image;
3994  params.fontIndex = fontIndex;
3995  params.utf8Text = utf8Text;
3996  params.x = x;
3997  params.y = y;
3998  params.r = r;
3999  params.g = g;
4000  params.b = b;
4001 
4002  return context->InvokeService(context, _OrthancPluginService_DrawText, &params);
4003  }
4004 
4005 
4006 
4007  typedef struct
4008  {
4009  OrthancPluginStorageArea* storageArea;
4010  const char* uuid;
4011  const void* content;
4012  uint64_t size;
4014  } _OrthancPluginStorageAreaCreate;
4015 
4016 
4033  OrthancPluginContext* context,
4034  OrthancPluginStorageArea* storageArea,
4035  const char* uuid,
4036  const void* content,
4037  uint64_t size,
4039  {
4040  _OrthancPluginStorageAreaCreate params;
4041  params.storageArea = storageArea;
4042  params.uuid = uuid;
4043  params.content = content;
4044  params.size = size;
4045  params.type = type;
4046 
4047  return context->InvokeService(context, _OrthancPluginService_StorageAreaCreate, &params);
4048  }
4049 
4050 
4051  typedef struct
4052  {
4053  OrthancPluginMemoryBuffer* target;
4054  OrthancPluginStorageArea* storageArea;
4055  const char* uuid;
4057  } _OrthancPluginStorageAreaRead;
4058 
4059 
4075  OrthancPluginContext* context,
4076  OrthancPluginMemoryBuffer* target,
4077  OrthancPluginStorageArea* storageArea,
4078  const char* uuid,
4080  {
4081  _OrthancPluginStorageAreaRead params;
4082  params.target = target;
4083  params.storageArea = storageArea;
4084  params.uuid = uuid;
4085  params.type = type;
4086 
4087  return context->InvokeService(context, _OrthancPluginService_StorageAreaRead, &params);
4088  }
4089 
4090 
4091  typedef struct
4092  {
4093  OrthancPluginStorageArea* storageArea;
4094  const char* uuid;
4096  } _OrthancPluginStorageAreaRemove;
4097 
4112  OrthancPluginContext* context,
4113  OrthancPluginStorageArea* storageArea,
4114  const char* uuid,
4116  {
4117  _OrthancPluginStorageAreaRemove params;
4118  params.storageArea = storageArea;
4119  params.uuid = uuid;
4120  params.type = type;
4121 
4122  return context->InvokeService(context, _OrthancPluginService_StorageAreaRemove, &params);
4123  }
4124 
4125 
4126 
4127  typedef struct
4128  {
4129  OrthancPluginErrorCode* target;
4130  int32_t code;
4131  uint16_t httpStatus;
4132  const char* message;
4133  } _OrthancPluginRegisterErrorCode;
4134 
4151  OrthancPluginContext* context,
4152  int32_t code,
4153  uint16_t httpStatus,
4154  const char* message)
4155  {
4156  OrthancPluginErrorCode target;
4157 
4158  _OrthancPluginRegisterErrorCode params;
4159  params.target = &target;
4160  params.code = code;
4161  params.httpStatus = httpStatus;
4162  params.message = message;
4163 
4164  if (context->InvokeService(context, _OrthancPluginService_RegisterErrorCode, &params) == OrthancPluginErrorCode_Success)
4165  {
4166  return target;
4167  }
4168  else
4169  {
4170  /* There was an error while assigned the error. Use a generic code. */
4172  }
4173  }
4174 
4175 
4176 
4177  typedef struct
4178  {
4179  uint16_t group;
4180  uint16_t element;
4182  const char* name;
4183  uint32_t minMultiplicity;
4184  uint32_t maxMultiplicity;
4185  } _OrthancPluginRegisterDictionaryTag;
4186 
4207  OrthancPluginContext* context,
4208  uint16_t group,
4209  uint16_t element,
4211  const char* name,
4212  uint32_t minMultiplicity,
4213  uint32_t maxMultiplicity)
4214  {
4215  _OrthancPluginRegisterDictionaryTag params;
4216  params.group = group;
4217  params.element = element;
4218  params.vr = vr;
4219  params.name = name;
4220  params.minMultiplicity = minMultiplicity;
4221  params.maxMultiplicity = maxMultiplicity;
4222 
4223  return context->InvokeService(context, _OrthancPluginService_RegisterDictionaryTag, &params);
4224  }
4225 
4226 
4227 
4228  typedef struct
4229  {
4230  uint16_t group;
4231  uint16_t element;
4233  const char* name;
4234  uint32_t minMultiplicity;
4235  uint32_t maxMultiplicity;
4236  const char* privateCreator;
4237  } _OrthancPluginRegisterPrivateDictionaryTag;
4238 
4260  OrthancPluginContext* context,
4261  uint16_t group,
4262  uint16_t element,
4264  const char* name,
4265  uint32_t minMultiplicity,
4266  uint32_t maxMultiplicity,
4267  const char* privateCreator)
4268  {
4269  _OrthancPluginRegisterPrivateDictionaryTag params;
4270  params.group = group;
4271  params.element = element;
4272  params.vr = vr;
4273  params.name = name;
4274  params.minMultiplicity = minMultiplicity;
4275  params.maxMultiplicity = maxMultiplicity;
4276  params.privateCreator = privateCreator;
4277 
4278  return context->InvokeService(context, _OrthancPluginService_RegisterPrivateDictionaryTag, &params);
4279  }
4280 
4281 
4282 
4283  typedef struct
4284  {
4285  OrthancPluginStorageArea* storageArea;
4287  } _OrthancPluginReconstructMainDicomTags;
4288 
4306  OrthancPluginContext* context,
4307  OrthancPluginStorageArea* storageArea,
4309  {
4310  _OrthancPluginReconstructMainDicomTags params;
4311  params.level = level;
4312  params.storageArea = storageArea;
4313 
4314  return context->InvokeService(context, _OrthancPluginService_ReconstructMainDicomTags, &params);
4315  }
4316 
4317 
4318  typedef struct
4319  {
4320  char** result;
4321  const char* instanceId;
4322  const void* buffer;
4323  uint32_t size;
4326  uint32_t maxStringLength;
4327  } _OrthancPluginDicomToJson;
4328 
4329 
4349  ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomBufferToJson(
4350  OrthancPluginContext* context,
4351  const void* buffer,
4352  uint32_t size,
4355  uint32_t maxStringLength)
4356  {
4357  char* result;
4358 
4359  _OrthancPluginDicomToJson params;
4360  memset(&params, 0, sizeof(params));
4361  params.result = &result;
4362  params.buffer = buffer;
4363  params.size = size;
4364  params.format = format;
4365  params.flags = flags;
4366  params.maxStringLength = maxStringLength;
4367 
4368  if (context->InvokeService(context, _OrthancPluginService_DicomBufferToJson, &params) != OrthancPluginErrorCode_Success)
4369  {
4370  /* Error */
4371  return NULL;
4372  }
4373  else
4374  {
4375  return result;
4376  }
4377  }
4378 
4379 
4398  ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomInstanceToJson(
4399  OrthancPluginContext* context,
4400  const char* instanceId,
4403  uint32_t maxStringLength)
4404  {
4405  char* result;
4406 
4407  _OrthancPluginDicomToJson params;
4408  memset(&params, 0, sizeof(params));
4409  params.result = &result;
4410  params.instanceId = instanceId;
4411  params.format = format;
4412  params.flags = flags;
4413  params.maxStringLength = maxStringLength;
4414 
4415  if (context->InvokeService(context, _OrthancPluginService_DicomInstanceToJson, &params) != OrthancPluginErrorCode_Success)
4416  {
4417  /* Error */
4418  return NULL;
4419  }
4420  else
4421  {
4422  return result;
4423  }
4424  }
4425 
4426 
4427  typedef struct
4428  {
4429  OrthancPluginMemoryBuffer* target;
4430  const char* uri;
4431  uint32_t headersCount;
4432  const char* const* headersKeys;
4433  const char* const* headersValues;
4434  int32_t afterPlugins;
4435  } _OrthancPluginRestApiGet2;
4436 
4457  OrthancPluginContext* context,
4458  OrthancPluginMemoryBuffer* target,
4459  const char* uri,
4460  uint32_t headersCount,
4461  const char* const* headersKeys,
4462  const char* const* headersValues,
4463  int32_t afterPlugins)
4464  {
4465  _OrthancPluginRestApiGet2 params;
4466  params.target = target;
4467  params.uri = uri;
4468  params.headersCount = headersCount;
4469  params.headersKeys = headersKeys;
4470  params.headersValues = headersValues;
4471  params.afterPlugins = afterPlugins;
4472 
4473  return context->InvokeService(context, _OrthancPluginService_RestApiGet2, &params);
4474  }
4475 
4476 
4477 
4478  typedef struct
4479  {
4481  } _OrthancPluginWorklistCallback;
4482 
4495  OrthancPluginContext* context,
4497  {
4498  _OrthancPluginWorklistCallback params;
4499  params.callback = callback;
4500 
4501  return context->InvokeService(context, _OrthancPluginService_RegisterWorklistCallback, &params);
4502  }
4503 
4504 
4505 
4506  typedef struct
4507  {
4509  const OrthancPluginWorklistQuery* query;
4510  const void* dicom;
4511  uint32_t size;
4512  } _OrthancPluginWorklistAnswersOperation;
4513 
4531  OrthancPluginContext* context,
4533  const OrthancPluginWorklistQuery* query,
4534  const void* dicom,
4535  uint32_t size)
4536  {
4537  _OrthancPluginWorklistAnswersOperation params;
4538  params.answers = answers;
4539  params.query = query;
4540  params.dicom = dicom;
4541  params.size = size;
4542 
4543  return context->InvokeService(context, _OrthancPluginService_WorklistAddAnswer, &params);
4544  }
4545 
4546 
4561  OrthancPluginContext* context,
4563  {
4564  _OrthancPluginWorklistAnswersOperation params;
4565  params.answers = answers;
4566  params.query = NULL;
4567  params.dicom = NULL;
4568  params.size = 0;
4569 
4570  return context->InvokeService(context, _OrthancPluginService_WorklistMarkIncomplete, &params);
4571  }
4572 
4573 
4574  typedef struct
4575  {
4576  const OrthancPluginWorklistQuery* query;
4577  const void* dicom;
4578  uint32_t size;
4579  int32_t* isMatch;
4580  OrthancPluginMemoryBuffer* target;
4581  } _OrthancPluginWorklistQueryOperation;
4582 
4598  ORTHANC_PLUGIN_INLINE int32_t OrthancPluginWorklistIsMatch(
4599  OrthancPluginContext* context,
4600  const OrthancPluginWorklistQuery* query,
4601  const void* dicom,
4602  uint32_t size)
4603  {
4604  int32_t isMatch = 0;
4605 
4606  _OrthancPluginWorklistQueryOperation params;
4607  params.query = query;
4608  params.dicom = dicom;
4609  params.size = size;
4610  params.isMatch = &isMatch;
4611  params.target = NULL;
4612 
4613  if (context->InvokeService(context, _OrthancPluginService_WorklistIsMatch, &params) == OrthancPluginErrorCode_Success)
4614  {
4615  return isMatch;
4616  }
4617  else
4618  {
4619  /* Error: Assume non-match */
4620  return 0;
4621  }
4622  }
4623 
4624 
4638  OrthancPluginContext* context,
4639  OrthancPluginMemoryBuffer* target,
4640  const OrthancPluginWorklistQuery* query)
4641  {
4642  _OrthancPluginWorklistQueryOperation params;
4643  params.query = query;
4644  params.dicom = NULL;
4645  params.size = 0;
4646  params.isMatch = NULL;
4647  params.target = target;
4648 
4649  return context->InvokeService(context, _OrthancPluginService_WorklistGetDicomQuery, &params);
4650  }
4651 
4652 
4664  OrthancPluginContext* context,
4665  OrthancPluginDicomInstance* instance)
4666  {
4668 
4669  _OrthancPluginAccessDicomInstance params;
4670  memset(&params, 0, sizeof(params));
4671  params.resultOrigin = &origin;
4672  params.instance = instance;
4673 
4674  if (context->InvokeService(context, _OrthancPluginService_GetInstanceOrigin, &params) != OrthancPluginErrorCode_Success)
4675  {
4676  /* Error */
4678  }
4679  else
4680  {
4681  return origin;
4682  }
4683  }
4684 
4685 
4686  typedef struct
4687  {
4688  OrthancPluginMemoryBuffer* target;
4689  const char* json;
4690  const OrthancPluginImage* pixelData;
4692  } _OrthancPluginCreateDicom;
4693 
4713  OrthancPluginContext* context,
4714  OrthancPluginMemoryBuffer* target,
4715  const char* json,
4716  const OrthancPluginImage* pixelData,
4718  {
4719  _OrthancPluginCreateDicom params;
4720  params.target = target;
4721  params.json = json;
4722  params.pixelData = pixelData;
4723  params.flags = flags;
4724 
4725  return context->InvokeService(context, _OrthancPluginService_CreateDicom, &params);
4726  }
4727 
4728 
4729  typedef struct
4730  {
4732  } _OrthancPluginDecodeImageCallback;
4733 
4746  OrthancPluginContext* context,
4748  {
4749  _OrthancPluginDecodeImageCallback params;
4750  params.callback = callback;
4751 
4752  return context->InvokeService(context, _OrthancPluginService_RegisterDecodeImageCallback, &params);
4753  }
4754 
4755 
4756 
4757  typedef struct
4758  {
4759  OrthancPluginImage** target;
4760  OrthancPluginPixelFormat format;
4761  uint32_t width;
4762  uint32_t height;
4763  uint32_t pitch;
4764  void* buffer;
4765  const void* constBuffer;
4766  uint32_t bufferSize;
4767  uint32_t frameIndex;
4768  } _OrthancPluginCreateImage;
4769 
4770 
4784  OrthancPluginContext* context,
4785  OrthancPluginPixelFormat format,
4786  uint32_t width,
4787  uint32_t height)
4788  {
4789  OrthancPluginImage* target = NULL;
4790 
4791  _OrthancPluginCreateImage params;
4792  memset(&params, 0, sizeof(params));
4793  params.target = &target;
4794  params.format = format;
4795  params.width = width;
4796  params.height = height;
4797 
4798  if (context->InvokeService(context, _OrthancPluginService_CreateImage, &params) != OrthancPluginErrorCode_Success)
4799  {
4800  return NULL;
4801  }
4802  else
4803  {
4804  return target;
4805  }
4806  }
4807 
4808 
4827  OrthancPluginContext* context,
4828  OrthancPluginPixelFormat format,
4829  uint32_t width,
4830  uint32_t height,
4831  uint32_t pitch,
4832  void* buffer)
4833  {
4834  OrthancPluginImage* target = NULL;
4835 
4836  _OrthancPluginCreateImage params;
4837  memset(&params, 0, sizeof(params));
4838  params.target = &target;
4839  params.format = format;
4840  params.width = width;
4841  params.height = height;
4842  params.pitch = pitch;
4843  params.buffer = buffer;
4844 
4845  if (context->InvokeService(context, _OrthancPluginService_CreateImageAccessor, &params) != OrthancPluginErrorCode_Success)
4846  {
4847  return NULL;
4848  }
4849  else
4850  {
4851  return target;
4852  }
4853  }
4854 
4855 
4856 
4872  OrthancPluginContext* context,
4873  const void* buffer,
4874  uint32_t bufferSize,
4875  uint32_t frameIndex)
4876  {
4877  OrthancPluginImage* target = NULL;
4878 
4879  _OrthancPluginCreateImage params;
4880  memset(&params, 0, sizeof(params));
4881  params.target = &target;
4882  params.constBuffer = buffer;
4883  params.bufferSize = bufferSize;
4884  params.frameIndex = frameIndex;
4885 
4886  if (context->InvokeService(context, _OrthancPluginService_DecodeDicomImage, &params) != OrthancPluginErrorCode_Success)
4887  {
4888  return NULL;
4889  }
4890  else
4891  {
4892  return target;
4893  }
4894  }
4895 
4896 
4897 
4898  typedef struct
4899  {
4900  char** result;
4901  const void* buffer;
4902  uint32_t size;
4903  } _OrthancPluginComputeHash;
4904 
4917  ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeMd5(
4918  OrthancPluginContext* context,
4919  const void* buffer,
4920  uint32_t size)
4921  {
4922  char* result;
4923 
4924  _OrthancPluginComputeHash params;
4925  params.result = &result;
4926  params.buffer = buffer;
4927  params.size = size;
4928 
4929  if (context->InvokeService(context, _OrthancPluginService_ComputeMd5, &params) != OrthancPluginErrorCode_Success)
4930  {
4931  /* Error */
4932  return NULL;
4933  }
4934  else
4935  {
4936  return result;
4937  }
4938  }
4939 
4940 
4953  ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeSha1(
4954  OrthancPluginContext* context,
4955  const void* buffer,
4956  uint32_t size)
4957  {
4958  char* result;
4959 
4960  _OrthancPluginComputeHash params;
4961  params.result = &result;
4962  params.buffer = buffer;
4963  params.size = size;
4964 
4965  if (context->InvokeService(context, _OrthancPluginService_ComputeSha1, &params) != OrthancPluginErrorCode_Success)
4966  {
4967  /* Error */
4968  return NULL;
4969  }
4970  else
4971  {
4972  return result;
4973  }
4974  }
4975 
4976 
4977 
4978  typedef struct
4979  {
4981  const char* name;
4982  } _OrthancPluginLookupDictionary;
4983 
5000  OrthancPluginContext* context,
5002  const char* name)
5003  {
5004  _OrthancPluginLookupDictionary params;
5005  params.target = target;
5006  params.name = name;
5007  return context->InvokeService(context, _OrthancPluginService_LookupDictionary, &params);
5008  }
5009 
5010 
5011 
5012  typedef struct
5013  {
5014  OrthancPluginRestOutput* output;
5015  const char* answer;
5016  uint32_t answerSize;
5017  uint32_t headersCount;
5018  const char* const* headersKeys;
5019  const char* const* headersValues;
5020  } _OrthancPluginSendMultipartItem2;
5021 
5043  OrthancPluginContext* context,
5044  OrthancPluginRestOutput* output,
5045  const char* answer,
5046  uint32_t answerSize,
5047  uint32_t headersCount,
5048  const char* const* headersKeys,
5049  const char* const* headersValues)
5050  {
5051  _OrthancPluginSendMultipartItem2 params;
5052  params.output = output;
5053  params.answer = answer;
5054  params.answerSize = answerSize;
5055  params.headersCount = headersCount;
5056  params.headersKeys = headersKeys;
5057  params.headersValues = headersValues;
5058 
5059  return context->InvokeService(context, _OrthancPluginService_SendMultipartItem2, &params);
5060  }
5061 
5062 
5063  typedef struct
5064  {
5066  } _OrthancPluginIncomingHttpRequestFilter;
5067 
5081  OrthancPluginContext* context,
5083  {
5084  _OrthancPluginIncomingHttpRequestFilter params;
5085  params.callback = callback;
5086 
5087  return context->InvokeService(context, _OrthancPluginService_RegisterIncomingHttpRequestFilter, &params);
5088  }
5089 
5090 
5091 
5092  typedef struct
5093  {
5094  OrthancPluginMemoryBuffer* answerBody;
5095  OrthancPluginMemoryBuffer* answerHeaders;
5096  uint16_t* httpStatus;
5097  OrthancPluginHttpMethod method;
5098  const char* url;
5099  uint32_t headersCount;
5100  const char* const* headersKeys;
5101  const char* const* headersValues;
5102  const char* body;
5103  uint32_t bodySize;
5104  const char* username;
5105  const char* password;
5106  uint32_t timeout;
5107  const char* certificateFile;
5108  const char* certificateKeyFile;
5109  const char* certificateKeyPassword;
5110  uint8_t pkcs11;
5111  } _OrthancPluginCallHttpClient2;
5112 
5113 
5114 
5153  OrthancPluginContext* context,
5154  OrthancPluginMemoryBuffer* answerBody,
5155  OrthancPluginMemoryBuffer* answerHeaders,
5156  uint16_t* httpStatus,
5157  OrthancPluginHttpMethod method,
5158  const char* url,
5159  uint32_t headersCount,
5160  const char* const* headersKeys,
5161  const char* const* headersValues,
5162  const char* body,
5163  uint32_t bodySize,
5164  const char* username,
5165  const char* password,
5166  uint32_t timeout,
5167  const char* certificateFile,
5168  const char* certificateKeyFile,
5169  const char* certificateKeyPassword,
5170  uint8_t pkcs11)
5171  {
5172  _OrthancPluginCallHttpClient2 params;
5173  memset(&params, 0, sizeof(params));
5174 
5175  params.answerBody = answerBody;
5176  params.answerHeaders = answerHeaders;
5177  params.httpStatus = httpStatus;
5178  params.method = method;
5179  params.url = url;
5180  params.headersCount = headersCount;
5181  params.headersKeys = headersKeys;
5182  params.headersValues = headersValues;
5183  params.body = body;
5184  params.bodySize = bodySize;
5185  params.username = username;
5186  params.password = password;
5187  params.timeout = timeout;
5188  params.certificateFile = certificateFile;
5189  params.certificateKeyFile = certificateKeyFile;
5190  params.certificateKeyPassword = certificateKeyPassword;
5191  params.pkcs11 = pkcs11;
5192 
5193  return context->InvokeService(context, _OrthancPluginService_CallHttpClient2, &params);
5194  }
5195 
5196 
5207  ORTHANC_PLUGIN_INLINE char* OrthancPluginGenerateUuid(
5208  OrthancPluginContext* context)
5209  {
5210  char* result;
5211 
5212  _OrthancPluginRetrieveDynamicString params;
5213  params.result = &result;
5214  params.argument = NULL;
5215 
5216  if (context->InvokeService(context, _OrthancPluginService_GenerateUuid, &params) != OrthancPluginErrorCode_Success)
5217  {
5218  /* Error */
5219  return NULL;
5220  }
5221  else
5222  {
5223  return result;
5224  }
5225  }
5226 
5227 
5228 
5229 
5230  typedef struct
5231  {
5232  OrthancPluginFindCallback callback;
5233  } _OrthancPluginFindCallback;
5234 
5247  OrthancPluginContext* context,
5248  OrthancPluginFindCallback callback)
5249  {
5250  _OrthancPluginFindCallback params;
5251  params.callback = callback;
5252 
5253  return context->InvokeService(context, _OrthancPluginService_RegisterFindCallback, &params);
5254  }
5255 
5256 
5257  typedef struct
5258  {
5259  OrthancPluginFindAnswers *answers;
5260  const OrthancPluginFindQuery *query;
5261  const void *dicom;
5262  uint32_t size;
5263  uint32_t index;
5264  uint32_t *resultUint32;
5265  uint16_t *resultGroup;
5266  uint16_t *resultElement;
5267  char **resultString;
5268  } _OrthancPluginFindOperation;
5269 
5286  OrthancPluginContext* context,
5287  OrthancPluginFindAnswers* answers,
5288  const void* dicom,
5289  uint32_t size)
5290  {
5291  _OrthancPluginFindOperation params;
5292  memset(&params, 0, sizeof(params));
5293  params.answers = answers;
5294  params.dicom = dicom;
5295  params.size = size;
5296 
5297  return context->InvokeService(context, _OrthancPluginService_FindAddAnswer, &params);
5298  }
5299 
5300 
5315  OrthancPluginContext* context,
5316  OrthancPluginFindAnswers* answers)
5317  {
5318  _OrthancPluginFindOperation params;
5319  memset(&params, 0, sizeof(params));
5320  params.answers = answers;
5321 
5322  return context->InvokeService(context, _OrthancPluginService_FindMarkIncomplete, &params);
5323  }
5324 
5325 
5326 
5338  ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFindQuerySize(
5339  OrthancPluginContext* context,
5340  const OrthancPluginFindQuery* query)
5341  {
5342  uint32_t count = 0;
5343 
5344  _OrthancPluginFindOperation params;
5345  memset(&params, 0, sizeof(params));
5346  params.query = query;
5347  params.resultUint32 = &count;
5348 
5349  if (context->InvokeService(context, _OrthancPluginService_GetFindQuerySize, &params) != OrthancPluginErrorCode_Success)
5350  {
5351  /* Error */
5352  return 0;
5353  }
5354  else
5355  {
5356  return count;
5357  }
5358  }
5359 
5360 
5376  OrthancPluginContext* context,
5377  uint16_t* group,
5378  uint16_t* element,
5379  const OrthancPluginFindQuery* query,
5380  uint32_t index)
5381  {
5382  _OrthancPluginFindOperation params;
5383  memset(&params, 0, sizeof(params));
5384  params.query = query;
5385  params.index = index;
5386  params.resultGroup = group;
5387  params.resultElement = element;
5388 
5389  return context->InvokeService(context, _OrthancPluginService_GetFindQueryTag, &params);
5390  }
5391 
5392 
5406  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetFindQueryTagName(
5407  OrthancPluginContext* context,
5408  const OrthancPluginFindQuery* query,
5409  uint32_t index)
5410  {
5411  char* result;
5412 
5413  _OrthancPluginFindOperation params;
5414  memset(&params, 0, sizeof(params));
5415  params.query = query;
5416  params.index = index;
5417  params.resultString = &result;
5418 
5419  if (context->InvokeService(context, _OrthancPluginService_GetFindQueryTagName, &params) != OrthancPluginErrorCode_Success)
5420  {
5421  /* Error */
5422  return NULL;
5423  }
5424  else
5425  {
5426  return result;
5427  }
5428  }
5429 
5430 
5444  ORTHANC_PLUGIN_INLINE char* OrthancPluginGetFindQueryValue(
5445  OrthancPluginContext* context,
5446  const OrthancPluginFindQuery* query,
5447  uint32_t index)
5448  {
5449  char* result;
5450 
5451  _OrthancPluginFindOperation params;
5452  memset(&params, 0, sizeof(params));
5453  params.query = query;
5454  params.index = index;
5455  params.resultString = &result;
5456 
5457  if (context->InvokeService(context, _OrthancPluginService_GetFindQueryValue, &params) != OrthancPluginErrorCode_Success)
5458  {
5459  /* Error */
5460  return NULL;
5461  }
5462  else
5463  {
5464  return result;
5465  }
5466  }
5467 
5468 
5469 
5470 
5471  typedef struct
5472  {
5473  OrthancPluginMoveCallback callback;
5474  OrthancPluginGetMoveSize getMoveSize;
5475  OrthancPluginApplyMove applyMove;
5476  OrthancPluginFreeMove freeMove;
5477  } _OrthancPluginMoveCallback;
5478 
5493  OrthancPluginContext* context,
5494  OrthancPluginMoveCallback callback,
5495  OrthancPluginGetMoveSize getMoveSize,
5496  OrthancPluginApplyMove applyMove,
5497  OrthancPluginFreeMove freeMove)
5498  {
5499  _OrthancPluginMoveCallback params;
5500  params.callback = callback;
5501  params.getMoveSize = getMoveSize;
5502  params.applyMove = applyMove;
5503  params.freeMove = freeMove;
5504 
5505  return context->InvokeService(context, _OrthancPluginService_RegisterMoveCallback, &params);
5506  }
5507 
5508 
5509 
5510  typedef struct
5511  {
5512  OrthancPluginFindMatcher** target;
5513  const void* query;
5514  uint32_t size;
5515  } _OrthancPluginCreateFindMatcher;
5516 
5517 
5532  OrthancPluginContext* context,
5533  const void* query,
5534  uint32_t size)
5535  {
5536  OrthancPluginFindMatcher* target = NULL;
5537 
5538  _OrthancPluginCreateFindMatcher params;
5539  memset(&params, 0, sizeof(params));
5540  params.target = &target;
5541  params.query = query;
5542  params.size = size;
5543 
5544  if (context->InvokeService(context, _OrthancPluginService_CreateFindMatcher, &params) != OrthancPluginErrorCode_Success)
5545  {
5546  return NULL;
5547  }
5548  else
5549  {
5550  return target;
5551  }
5552  }
5553 
5554 
5555  typedef struct
5556  {
5557  OrthancPluginFindMatcher* matcher;
5558  } _OrthancPluginFreeFindMatcher;
5559 
5569  ORTHANC_PLUGIN_INLINE void OrthancPluginFreeFindMatcher(
5570  OrthancPluginContext* context,
5571  OrthancPluginFindMatcher* matcher)
5572  {
5573  _OrthancPluginFreeFindMatcher params;
5574  params.matcher = matcher;
5575 
5576  context->InvokeService(context, _OrthancPluginService_FreeFindMatcher, &params);
5577  }
5578 
5579 
5580  typedef struct
5581  {
5582  const OrthancPluginFindMatcher* matcher;
5583  const void* dicom;
5584  uint32_t size;
5585  int32_t* isMatch;
5586  } _OrthancPluginFindMatcherIsMatch;
5587 
5602  ORTHANC_PLUGIN_INLINE int32_t OrthancPluginFindMatcherIsMatch(
5603  OrthancPluginContext* context,
5604  const OrthancPluginFindMatcher* matcher,
5605  const void* dicom,
5606  uint32_t size)
5607  {
5608  int32_t isMatch = 0;
5609 
5610  _OrthancPluginFindMatcherIsMatch params;
5611  params.matcher = matcher;
5612  params.dicom = dicom;
5613  params.size = size;
5614  params.isMatch = &isMatch;
5615 
5616  if (context->InvokeService(context, _OrthancPluginService_FindMatcherIsMatch, &params) == OrthancPluginErrorCode_Success)
5617  {
5618  return isMatch;
5619  }
5620  else
5621  {
5622  /* Error: Assume non-match */
5623  return 0;
5624  }
5625  }
5626 
5627 
5628  typedef struct
5629  {
5631  } _OrthancPluginIncomingHttpRequestFilter2;
5632 
5645  OrthancPluginContext* context,
5647  {
5648  _OrthancPluginIncomingHttpRequestFilter2 params;
5649  params.callback = callback;
5650 
5651  return context->InvokeService(context, _OrthancPluginService_RegisterIncomingHttpRequestFilter2, &params);
5652  }
5653 
5654 #ifdef __cplusplus
5655 }
5656 #endif
5657 
5658 
Definition: OrthancCPlugin.h:697
const char * OrthancPluginGetInstanceRemoteAet(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the AET of a DICOM instance.
Definition: OrthancCPlugin.h:2275
Definition: OrthancCPlugin.h:798
int OrthancPluginHasInstanceMetadata(OrthancPluginContext *context, OrthancPluginDicomInstance *instance, const char *metadata)
Check whether a DICOM instance is associated with some metadata.
Definition: OrthancCPlugin.h:2454
struct _OrthancPluginFindQuery_t OrthancPluginFindQuery
Opaque structure to an object that represents a C-Find query.
Definition: OrthancCPlugin.h:895
OrthancPluginChangeType
Definition: OrthancCPlugin.h:654
Definition: OrthancCPlugin.h:234
void OrthancPluginSendHttpStatusCode(OrthancPluginContext *context, OrthancPluginRestOutput *output, uint16_t status)
Send a HTTP status code.
Definition: OrthancCPlugin.h:2138
struct _OrthancPluginRestOutput_t OrthancPluginRestOutput
Opaque structure that represents the HTTP connection to the client application.
Definition: OrthancCPlugin.h:848
void OrthancPluginSetHttpHeader(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *key, const char *value)
Set some HTTP header.
Definition: OrthancCPlugin.h:2239
Definition: OrthancCPlugin.h:720
void(* OrthancPluginFreeMove)(void *moveDriver)
Callback to free one C-Move driver.
Definition: OrthancCPlugin.h:1214
Definition: OrthancCPlugin.h:267
void OrthancPluginLogInfo(OrthancPluginContext *context, const char *message)
Log an information.
Definition: OrthancCPlugin.h:1416
OrthancPluginErrorCode OrthancPluginRegisterDecodeImageCallback(OrthancPluginContext *context, OrthancPluginDecodeImageCallback callback)
Register a callback to handle the decoding of DICOM images.
Definition: OrthancCPlugin.h:4745
Definition: OrthancCPlugin.h:799
The parameters of a REST request.
Definition: OrthancCPlugin.h:326
void OrthancPluginRedirect(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *redirection)
Redirect a REST request.
Definition: OrthancCPlugin.h:1921
OrthancPluginContentType
Definition: OrthancCPlugin.h:623
OrthancPluginErrorCode OrthancPluginRestApiDeleteAfterPlugins(OrthancPluginContext *context, const char *uri)
Make a DELETE call to the REST API, as tainted by the plugins.
Definition: OrthancCPlugin.h:1826
Definition: OrthancCPlugin.h:640
Definition: OrthancCPlugin.h:719
Definition: OrthancCPlugin.h:814
const char * OrthancPluginGetInstanceData(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the data of a DICOM file.
Definition: OrthancCPlugin.h:2341
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:3523
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:3615
int OrthancPluginCheckVersion(OrthancPluginContext *context)
Check the compatibility of the plugin wrt. the version of its hosting Orthanc.
Definition: OrthancCPlugin.h:1279
Definition: OrthancCPlugin.h:259
Definition: OrthancCPlugin.h:204
Definition: OrthancCPlugin.h:257
OrthancPluginInstanceOrigin
Definition: OrthancCPlugin.h:809
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:4530
Definition: OrthancCPlugin.h:717
OrthancPluginErrorCode OrthancPluginRegisterWorklistCallback(OrthancPluginContext *context, OrthancPluginWorklistCallback callback)
Register a callback to handle modality worklists requests.
Definition: OrthancCPlugin.h:4494
int64_t OrthancPluginGetInstanceSize(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the size of a DICOM file.
Definition: OrthancCPlugin.h:2308
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:4259
Definition: OrthancCPlugin.h:282
Graylevel, unsigned 16bpp image.
Definition: OrthancCPlugin.h:555
Definition: OrthancCPlugin.h:669
Definition: OrthancCPlugin.h:226
const char *const * headersValues
The values of the HTTP headers.
Definition: OrthancCPlugin.h:386
Definition: OrthancCPlugin.h:269
Definition: OrthancCPlugin.h:271
const char *const * headersKeys
The keys of the HTTP headers (always converted to low-case).
Definition: OrthancCPlugin.h:381
Definition: OrthancCPlugin.h:255
OrthancPluginCreateDicomFlags
Definition: OrthancCPlugin.h:781
char * OrthancPluginComputeSha1(OrthancPluginContext *context, const void *buffer, uint32_t size)
Compute a SHA-1 hash.
Definition: OrthancCPlugin.h:4953
Definition: OrthancCPlugin.h:273
OrthancPluginPixelFormat
Definition: OrthancCPlugin.h:539
Definition: OrthancCPlugin.h:815
uint32_t getCount
For a GET request, the number of GET parameters.
Definition: OrthancCPlugin.h:346
Definition: OrthancCPlugin.h:581
void OrthancPluginRegisterStorageArea(OrthancPluginContext *context, OrthancPluginStorageCreate create, OrthancPluginStorageRead read, OrthancPluginStorageRemove remove)
Register a custom storage area.
Definition: OrthancCPlugin.h:2540
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:1035
OrthancPluginErrorCode OrthancPluginGetDicomForInstance(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *instanceId)
Retrieve a DICOM instance using its Orthanc identifier.
Definition: OrthancCPlugin.h:1639
OrthancPluginImageFormat
Definition: OrthancCPlugin.h:694
OrthancPluginErrorCode OrthancPluginWorklistGetDicomQuery(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const OrthancPluginWorklistQuery *query)
Retrieve the worklist query as a DICOM file.
Definition: OrthancCPlugin.h:4637
Definition: OrthancCPlugin.h:212
Definition: OrthancCPlugin.h:295
void OrthancPluginFreeString(OrthancPluginContext *context, char *str)
Free a string.
Definition: OrthancCPlugin.h:1255
Definition: OrthancCPlugin.h:279
const char * OrthancPluginGetFontName(OrthancPluginContext *context, uint32_t fontIndex)
Return the name of a font.
Definition: OrthancCPlugin.h:3895
Definition: OrthancCPlugin.h:232
Definition: OrthancCPlugin.h:285
Definition: OrthancCPlugin.h:277
Definition: OrthancCPlugin.h:314
void(* OrthancPluginFree)(void *buffer)
Signature of a function to free dynamic memory.
Definition: OrthancCPlugin.h:962
Definition: OrthancCPlugin.h:223
char * OrthancPluginComputeMd5(OrthancPluginContext *context, const void *buffer, uint32_t size)
Compute an MD5 hash.
Definition: OrthancCPlugin.h:4917
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:3820
Definition: OrthancCPlugin.h:280
Definition: OrthancCPlugin.h:663
OrthancPluginErrorCode OrthancPluginStorageAreaRead(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, OrthancPluginStorageArea *storageArea, const char *uuid, OrthancPluginContentType type)
Read a file from the storage area.
Definition: OrthancCPlugin.h:4074
uint32_t OrthancPluginGetFontsCount(OrthancPluginContext *context)
Return the number of available fonts.
Definition: OrthancCPlugin.h:3855
char * OrthancPluginGetConfigurationPath(OrthancPluginContext *context)
Return the path to the configuration file(s).
Definition: OrthancCPlugin.h:2637
uint32_t(* OrthancPluginGetMoveSize)(void *moveDriver)
Callback to read the size of a C-Move driver.
Definition: OrthancCPlugin.h:1187
Definition: OrthancCPlugin.h:221
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:5152
void OrthancPluginRegisterOnChangeCallback(OrthancPluginContext *context, OrthancPluginOnChangeCallback callback)
Register a callback to monitor changes.
Definition: OrthancCPlugin.h:2679
Color image in RGBA32 format.
Definition: OrthancCPlugin.h:579
Definition: OrthancCPlugin.h:765
OrthancPluginDicomToJsonFlags
Definition: OrthancCPlugin.h:762
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:2184
Definition: OrthancCPlugin.h:681
char * OrthancPluginGenerateUuid(OrthancPluginContext *context)
Generate an UUID.
Definition: OrthancCPlugin.h:5207
void OrthancPluginAnswerBuffer(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *answer, uint32_t answerSize, const char *mimeType)
Answer to a REST request.
Definition: OrthancCPlugin.h:1541
Definition: OrthancCPlugin.h:657
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:4871
Definition: OrthancCPlugin.h:256
OrthancPluginDicomToJsonFormat
Definition: OrthancCPlugin.h:747
OrthancPluginErrorCode OrthancPluginLookupDictionary(OrthancPluginContext *context, OrthancPluginDictionaryEntry *target, const char *name)
Get information about the given DICOM tag.
Definition: OrthancCPlugin.h:4999
Definition: OrthancCPlugin.h:749
OrthancPluginErrorCode OrthancPluginRegisterErrorCode(OrthancPluginContext *context, int32_t code, uint16_t httpStatus, const char *message)
Declare a custom error code for this plugin.
Definition: OrthancCPlugin.h:4150
Definition: OrthancCPlugin.h:237
uint16_t group
Definition: OrthancCPlugin.h:1238
void * OrthancPluginGetImageBuffer(OrthancPluginContext *context, const OrthancPluginImage *image)
Return a pointer to the content of an image.
Definition: OrthancCPlugin.h:3393
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:1062
Definition: OrthancCPlugin.h:710
uint32_t minMultiplicity
Definition: OrthancCPlugin.h:1241
Definition: OrthancCPlugin.h:751
Definition: OrthancCPlugin.h:722
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:2492
Definition: OrthancCPlugin.h:696
Definition: OrthancCPlugin.h:249
struct _OrthancPluginStorageArea_t OrthancPluginStorageArea
Opaque structure that represents the storage area that is actually used by Orthanc.
Definition: OrthancCPlugin.h:871
Definition: OrthancCPlugin.h:241
Definition: OrthancCPlugin.h:625
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:5375
Definition: OrthancCPlugin.h:661
Color image in RGB48 format.
Definition: OrthancCPlugin.h:589
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:1887
uint32_t OrthancPluginGetExpectedDatabaseVersion(OrthancPluginContext *context)
Get the expected version of the database schema.
Definition: OrthancCPlugin.h:2925
Definition: OrthancCPlugin.h:272
Graylevel 8bpp image.
Definition: OrthancCPlugin.h:547
Definition: OrthancCPlugin.h:270
Definition: OrthancCPlugin.h:215
OrthancPluginResourceType
Definition: OrthancCPlugin.h:637
OrthancPluginHttpMethod
Definition: OrthancCPlugin.h:311
Definition: OrthancCPlugin.h:231
uint32_t OrthancPluginGetImageHeight(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the height of an image.
Definition: OrthancCPlugin.h:3324
OrthancPluginValueRepresentation
Definition: OrthancCPlugin.h:708
char * OrthancPluginGetConfiguration(OrthancPluginContext *context)
Return the content of the configuration file(s).
Definition: OrthancCPlugin.h:2958
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:3222
OrthancPluginImage * OrthancPluginUncompressImage(OrthancPluginContext *context, const void *data, uint32_t size, OrthancPluginImageFormat format)
Decode a compressed image.
Definition: OrthancCPlugin.h:3436
Definition: OrthancCPlugin.h:275
Definition: OrthancCPlugin.h:712
Definition: OrthancCPlugin.h:218
Definition: OrthancCPlugin.h:642
OrthancPluginErrorCode(* OrthancPluginRestCallback)(OrthancPluginRestOutput *output, const char *url, const OrthancPluginHttpRequest *request)
Signature of a callback function that answers to a REST request.
Definition: OrthancCPlugin.h:919
Definition: OrthancCPlugin.h:266
Definition: OrthancCPlugin.h:682
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:1093
Definition: OrthancCPlugin.h:715
Definition: OrthancCPlugin.h:283
char * OrthancPluginGetOrthancDirectory(OrthancPluginContext *context)
Return the directory containing the Orthanc.
Definition: OrthancCPlugin.h:2602
Definition: OrthancCPlugin.h:236
Definition: OrthancCPlugin.h:684
OrthancPluginErrorCode OrthancPluginFindAddAnswer(OrthancPluginContext *context, OrthancPluginFindAnswers *answers, const void *dicom, uint32_t size)
Add one answer to some C-Find request.
Definition: OrthancCPlugin.h:5285
Definition: OrthancCPlugin.h:734
Definition: OrthancCPlugin.h:258
Color image in RGB24 format.
Definition: OrthancCPlugin.h:571
OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter2(OrthancPluginContext *context, OrthancPluginIncomingHttpRequestFilter2 callback)
Register a callback to filter incoming HTTP requests.
Definition: OrthancCPlugin.h:5644
OrthancPluginErrorCode OrthancPluginWorklistMarkIncomplete(OrthancPluginContext *context, OrthancPluginWorklistAnswers *answers)
Mark the set of worklist answers as incomplete.
Definition: OrthancCPlugin.h:4560
Graylevel, signed 16bpp image.
Definition: OrthancCPlugin.h:563
An entry in the dictionary of DICOM tags.
Definition: OrthancCPlugin.h:1236
Definition: OrthancCPlugin.h:268
Definition: OrthancCPlugin.h:208
Definition: OrthancCPlugin.h:656
OrthancPluginCompressionType
Definition: OrthancCPlugin.h:679
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:3745
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:4456
Definition: OrthancCPlugin.h:768
OrthancPluginPixelFormat OrthancPluginGetImagePixelFormat(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the pixel format of an image.
Definition: OrthancCPlugin.h:3258
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:3980
uint32_t OrthancPluginGetImagePitch(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the pitch of an image.
Definition: OrthancCPlugin.h:3359
Definition: OrthancCPlugin.h:626
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:1598
Definition: OrthancCPlugin.h:288
Definition: OrthancCPlugin.h:294
struct _OrthancPluginWorklistAnswers_t OrthancPluginWorklistAnswers
Opaque structure to an object that represents the answers to a C-Find query for worklists.
Definition: OrthancCPlugin.h:887
uint32_t maxMultiplicity
Definition: OrthancCPlugin.h:1242
OrthancPluginErrorCode OrthancPluginRegisterFindCallback(OrthancPluginContext *context, OrthancPluginFindCallback callback)
Register a callback to handle C-Find requests.
Definition: OrthancCPlugin.h:5246
Definition: OrthancCPlugin.h:287
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:951
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:4349
uint32_t OrthancPluginGetCommandLineArgumentsCount(OrthancPluginContext *context)
Get the number of command-line arguments.
Definition: OrthancCPlugin.h:2858
Definition: OrthancCPlugin.h:239
void OrthancPluginSendUnauthorized(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *realm)
Signal that a REST request is not authorized.
Definition: OrthancCPlugin.h:2161
Definition: OrthancCPlugin.h:210
Definition: OrthancCPlugin.h:264
Definition: OrthancCPlugin.h:252
void OrthancPluginFreeFindMatcher(OrthancPluginContext *context, OrthancPluginFindMatcher *matcher)
Free a C-Find matcher.
Definition: OrthancCPlugin.h:5569
Definition: OrthancCPlugin.h:284
void OrthancPluginLogError(OrthancPluginContext *context, const char *message)
Log an error.
Definition: OrthancCPlugin.h:1384
Definition: OrthancCPlugin.h:229
struct _OrthancPluginWorklistQuery_t OrthancPluginWorklistQuery
Opaque structure to an object that represents a C-Find query for worklists.
Definition: OrthancCPlugin.h:879
OrthancPluginFindMatcher * OrthancPluginCreateFindMatcher(OrthancPluginContext *context, const void *query, uint32_t size)
Create a C-Find matcher.
Definition: OrthancCPlugin.h:5531
void * data
The content of the buffer.
Definition: OrthancCPlugin.h:833
uint32_t OrthancPluginGetFontSize(OrthancPluginContext *context, uint32_t fontIndex)
Return the size of a font.
Definition: OrthancCPlugin.h:3927
void OrthancPluginExtendOrthancExplorer(OrthancPluginContext *context, const char *javascript)
Extend the JavaScript code of Orthanc Explorer.
Definition: OrthancCPlugin.h:2754
Definition: OrthancCPlugin.h:813
OrthancPluginErrorCode OrthancPluginRestApiGet(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri)
Make a GET call to the built-in Orthanc REST API.
Definition: OrthancCPlugin.h:1672
const char * OrthancPluginGetErrorDescription(OrthancPluginContext *context, OrthancPluginErrorCode error)
Get the description of a given error code.
Definition: OrthancCPlugin.h:3169
OrthancPluginErrorCode(* OrthancPluginFindCallback)(OrthancPluginFindAnswers *answers, const OrthancPluginFindQuery *query, const char *issuerAet, const char *calledAet)
Callback to handle incoming C-Find SCP requests.
Definition: OrthancCPlugin.h:1120
uint32_t headersCount
The number of HTTP headers.
Definition: OrthancCPlugin.h:376
Definition: OrthancCPlugin.h:662
Definition: OrthancCPlugin.h:767
void OrthancPluginFreeMemoryBuffer(OrthancPluginContext *context, OrthancPluginMemoryBuffer *buffer)
Free a memory buffer.
Definition: OrthancCPlugin.h:1368
OrthancPluginErrorCode(* OrthancPluginStorageCreate)(const char *uuid, const void *content, int64_t size, OrthancPluginContentType type)
Callback for writing to the storage area.
Definition: OrthancCPlugin.h:978
Definition: OrthancCPlugin.h:728
OrthancPluginErrorCode OrthancPluginRestApiDelete(OrthancPluginContext *context, const char *uri)
Make a DELETE call to the built-in Orthanc REST API.
Definition: OrthancCPlugin.h:1803
Definition: OrthancCPlugin.h:732
Definition: OrthancCPlugin.h:641
OrthancPluginErrorCode OrthancPluginReadFile(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *path)
Read a file.
Definition: OrthancCPlugin.h:3107
Definition: OrthancCPlugin.h:721
Definition: OrthancCPlugin.h:800
Definition: OrthancCPlugin.h:315
OrthancPluginImage * OrthancPluginCreateImage(OrthancPluginContext *context, OrthancPluginPixelFormat format, uint32_t width, uint32_t height)
Create an image.
Definition: OrthancCPlugin.h:4783
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:5406
Definition: OrthancCPlugin.h:723
Definition: OrthancCPlugin.h:244
char * OrthancPluginGetOrthancPath(OrthancPluginContext *context)
Return the path to the Orthanc executable.
Definition: OrthancCPlugin.h:2572
char * OrthancPluginGetGlobalProperty(OrthancPluginContext *context, int32_t property, const char *defaultValue)
Get the value of a global property.
Definition: OrthancCPlugin.h:2788
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:5042
OrthancPluginErrorCode(* OrthancPluginStorageRemove)(const char *uuid, OrthancPluginContentType type)
Callback for removing a file from the storage area.
Definition: OrthancCPlugin.h:1016
Definition: OrthancCPlugin.h:750
Definition: OrthancCPlugin.h:253
Definition: OrthancCPlugin.h:291
Definition: OrthancCPlugin.h:313
Definition: OrthancCPlugin.h:664
OrthancPluginErrorCode OrthancPluginReconstructMainDicomTags(OrthancPluginContext *context, OrthancPluginStorageArea *storageArea, OrthancPluginResourceType level)
Reconstruct the main DICOM tags.
Definition: OrthancCPlugin.h:4305
char * OrthancPluginGetCommandLineArgument(OrthancPluginContext *context, uint32_t argument)
Get the value of a command-line argument.
Definition: OrthancCPlugin.h:2892
OrthancPluginErrorCode OrthancPluginHttpGet(OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *url, const char *username, const char *password)
Issue a HTTP GET call.
Definition: OrthancCPlugin.h:3667
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:4826
Definition: OrthancCPlugin.h:261
OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter(OrthancPluginContext *context, OrthancPluginIncomingHttpRequestFilter callback)
Register a callback to filter incoming HTTP requests.
Definition: OrthancCPlugin.h:5080
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:4398
const char *const * getValues
For a GET request, the values of the GET parameters.
Definition: OrthancCPlugin.h:356
Definition: OrthancCPlugin.h:735
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:940
char * OrthancPluginGetInstanceSimplifiedJson(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the DICOM tag hierarchy as a JSON file (with simplification).
Definition: OrthancCPlugin.h:2415
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:3070
Definition: OrthancCPlugin.h:254
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:4712
Definition: OrthancCPlugin.h:247
Definition: OrthancCPlugin.h:698
Definition: OrthancCPlugin.h:209
const char * body
For a PUT or POST request, the content of the body.
Definition: OrthancCPlugin.h:361
Definition: OrthancCPlugin.h:260
Definition: OrthancCPlugin.h:216
void OrthancPluginRegisterRestCallbackNoLock(OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback callback)
Register a REST callback, without locking.
Definition: OrthancCPlugin.h:1481
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:1163
Definition: OrthancCPlugin.h:667
struct _OrthancPluginImage_t OrthancPluginImage
Opaque structure that represents an image that is uncompressed in memory.
Definition: OrthancCPlugin.h:863
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:1851
OrthancPluginErrorCode OrthancPluginStartMultipartAnswer(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *subType, const char *contentType)
Start an HTTP multipart answer.
Definition: OrthancCPlugin.h:2999
Definition: OrthancCPlugin.h:201
Definition: OrthancCPlugin.h:227
Definition: OrthancCPlugin.h:220
struct _OrthancPluginFindAnswers_t OrthancPluginFindAnswers
Opaque structure to an object that represents the answers to a C-Find query for worklists.
Definition: OrthancCPlugin.h:903
Definition: OrthancCPlugin.h:797
Definition: OrthancCPlugin.h:292
Definition: OrthancCPlugin.h:263
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:5444
void OrthancPluginSetRootUri(OrthancPluginContext *context, const char *uri)
Set the URI where the plugin provides its Web interface.
Definition: OrthancCPlugin.h:2710
OrthancPluginErrorCode OrthancPluginStorageAreaRemove(OrthancPluginContext *context, OrthancPluginStorageArea *storageArea, const char *uuid, OrthancPluginContentType type)
Remove a file from the storage area.
Definition: OrthancCPlugin.h:4111
Definition: OrthancCPlugin.h:727
Definition: OrthancCPlugin.h:668
const char *const * getKeys
For a GET request, the keys of the GET parameters.
Definition: OrthancCPlugin.h:351
Definition: OrthancCPlugin.h:730
Definition: OrthancCPlugin.h:659
char * OrthancPluginLookupPatient(OrthancPluginContext *context, const char *patientID)
Look for a patient.
Definition: OrthancCPlugin.h:1953
OrthancPluginInstanceOrigin OrthancPluginGetInstanceOrigin(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the origin of a DICOM file.
Definition: OrthancCPlugin.h:4663
Definition: OrthancCPlugin.h:731
void OrthancPluginFreeImage(OrthancPluginContext *context, OrthancPluginImage *image)
Free an image.
Definition: OrthancCPlugin.h:3478
OrthancPluginValueRepresentation vr
Definition: OrthancCPlugin.h:1240
uint16_t element
Definition: OrthancCPlugin.h:1239
char * OrthancPluginLookupInstance(OrthancPluginContext *context, const char *sopInstanceUID)
Look for an instance.
Definition: OrthancCPlugin.h:2093
Definition: OrthancCPlugin.h:666
OrthancPluginErrorCode OrthancPluginSetGlobalProperty(OrthancPluginContext *context, int32_t property, const char *value)
Set the value of a global property.
Definition: OrthancCPlugin.h:2827
Definition: OrthancCPlugin.h:233
Definition: OrthancCPlugin.h:627
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:3028
const char *const * groups
The matched values for the groups of the regular expression.
Definition: OrthancCPlugin.h:341
OrthancPluginErrorCode OrthancPluginWriteFile(OrthancPluginContext *context, const char *path, const void *data, uint32_t size)
Write a file.
Definition: OrthancCPlugin.h:3138
Definition: OrthancCPlugin.h:262
OrthancPluginErrorCode(* OrthancPluginStorageRead)(void **content, int64_t *size, const char *uuid, OrthancPluginContentType type)
Callback for reading from the storage area.
Definition: OrthancCPlugin.h:998
Definition: OrthancCPlugin.h:265
char * OrthancPluginLookupStudy(OrthancPluginContext *context, const char *studyUID)
Look for a study.
Definition: OrthancCPlugin.h:1988
uint32_t size
The number of bytes in the buffer.
Definition: OrthancCPlugin.h:838
Graylevel, floating-point 32bpp image.
Definition: OrthancCPlugin.h:605
Definition: OrthancCPlugin.h:811
OrthancPluginErrorCode OrthancPluginRegisterMoveCallback(OrthancPluginContext *context, OrthancPluginMoveCallback callback, OrthancPluginGetMoveSize getMoveSize, OrthancPluginApplyMove applyMove, OrthancPluginFreeMove freeMove)
Register a callback to handle C-Move requests.
Definition: OrthancCPlugin.h:5492
Definition: OrthancCPlugin.h:245
struct _OrthancPluginDicomInstance_t OrthancPluginDicomInstance
Opaque structure that represents a DICOM instance received by Orthanc.
Definition: OrthancCPlugin.h:855
uint32_t groupsCount
The number of groups of the regular expression.
Definition: OrthancCPlugin.h:336
Definition: OrthancCPlugin.h:246
Definition: OrthancCPlugin.h:643
void OrthancPluginLogWarning(OrthancPluginContext *context, const char *message)
Log a warning.
Definition: OrthancCPlugin.h:1400
Definition: OrthancCPlugin.h:716
Definition: OrthancCPlugin.h:251
Definition: OrthancCPlugin.h:736
OrthancPluginIdentifierConstraint
Definition: OrthancCPlugin.h:795
uint32_t bodySize
For a PUT or POST request, the number of bytes of the body.
Definition: OrthancCPlugin.h:366
Definition: OrthancCPlugin.h:316
void OrthancPluginSetCookie(OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *cookie, const char *value)
Set a cookie.
Definition: OrthancCPlugin.h:2214
Definition: OrthancCPlugin.h:658
Definition: OrthancCPlugin.h:726
char * OrthancPluginGetInstanceJson(OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
Get the DICOM tag hierarchy as a JSON file.
Definition: OrthancCPlugin.h:2377
void OrthancPluginSetDescription(OrthancPluginContext *context, const char *description)
Set a description for this plugin.
Definition: OrthancCPlugin.h:2732
Definition: OrthancCPlugin.h:293
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:1739
void OrthancPluginRegisterOnStoredInstanceCallback(OrthancPluginContext *context, OrthancPluginOnStoredInstanceCallback callback)
Register a callback for received instances.
Definition: OrthancCPlugin.h:1509
Definition: OrthancCPlugin.h:660
Definition: OrthancCPlugin.h:729
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:4206
Definition: OrthancCPlugin.h:248
Definition: OrthancCPlugin.h:213
Definition: OrthancCPlugin.h:733
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:3704
Definition: OrthancCPlugin.h:713
OrthancPluginErrorCode OrthancPluginFindMarkIncomplete(OrthancPluginContext *context, OrthancPluginFindAnswers *answers)
Mark the set of C-Find answers as incomplete.
Definition: OrthancCPlugin.h:5314
Graylevel, unsigned 32bpp image.
Definition: OrthancCPlugin.h:597
void OrthancPluginRegisterRestCallback(OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback callback)
Register a REST callback.
Definition: OrthancCPlugin.h:1447
char * OrthancPluginLookupStudyWithAccessionNumber(OrthancPluginContext *context, const char *accessionNumber)
Look for a study, using the accession number.
Definition: OrthancCPlugin.h:2023
Definition: OrthancCPlugin.h:725
Definition: OrthancCPlugin.h:711
Definition: OrthancCPlugin.h:205
Definition: OrthancCPlugin.h:639
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:1702
Definition: OrthancCPlugin.h:812
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:930
Definition: OrthancCPlugin.h:286
Definition: OrthancCPlugin.h:206
Definition: OrthancCPlugin.h:211
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:1774
Definition: OrthancCPlugin.h:203
Definition: OrthancCPlugin.h:228
Definition: OrthancCPlugin.h:665
Definition: OrthancCPlugin.h:683
Definition: OrthancCPlugin.h:238
OrthancPluginErrorCode(* OrthancPluginApplyMove)(void *moveDriver)
Callback to apply one C-Move suboperation.
Definition: OrthancCPlugin.h:1201
OrthancPluginHttpMethod method
The HTTP method.
Definition: OrthancCPlugin.h:331
Definition: OrthancCPlugin.h:281
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:4032
OrthancPluginErrorCode OrthancPluginHttpDelete(OrthancPluginContext *context, const char *url, const char *username, const char *password)
Issue a HTTP DELETE call.
Definition: OrthancCPlugin.h:3782
A memory buffer allocated by the core system of Orthanc.
Definition: OrthancCPlugin.h:828
uint32_t OrthancPluginGetFindQuerySize(OrthancPluginContext *context, const OrthancPluginFindQuery *query)
Get the number of tags in a C-Find query.
Definition: OrthancCPlugin.h:5338
Color image in BGRA32 format.
Definition: OrthancCPlugin.h:613
Definition: OrthancCPlugin.h:718
Definition: OrthancCPlugin.h:766
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:5602
Definition: OrthancCPlugin.h:724
char * OrthancPluginLookupSeries(OrthancPluginContext *context, const char *seriesUID)
Look for a series.
Definition: OrthancCPlugin.h:2058
Definition: OrthancCPlugin.h:207
Definition: OrthancCPlugin.h:714
Definition: OrthancCPlugin.h:274
int32_t OrthancPluginWorklistIsMatch(OrthancPluginContext *context, const OrthancPluginWorklistQuery *query, const void *dicom, uint32_t size)
Test whether a worklist matches the query.
Definition: OrthancCPlugin.h:4598
uint32_t OrthancPluginGetImageWidth(OrthancPluginContext *context, const OrthancPluginImage *image)
Return the width of an image.
Definition: OrthancCPlugin.h:3291
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:3568
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:911
Definition: OrthancCPlugin.h:230