comparison Plugins/Include/orthanc/OrthancCPlugin.h @ 1601:6cccf1da35c6

groups in the plugin documentation
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 01 Sep 2015 12:42:49 +0200
parents 7151d63e6d81
children 292bce3f54ed
comparison
equal deleted inserted replaced
1600:7151d63e6d81 1601:6cccf1da35c6
37 **/ 37 **/
38 38
39 39
40 40
41 /** 41 /**
42 * @defgroup CInterface C Interface 42 * @defgroup Compression Compression
43 * @brief The C interface to create Orthanc plugins. 43 * @brief Functions to deal with images and compressed buffers.
44 * 44 *
45 * These functions must be used to create C plugins for Orthanc. 45 * @defgroup REST REST
46 * @brief Functions to answer REST requests in a callback.
47 *
48 * @defgroup Callbacks Callbacks
49 * @brief Functions to register and manage callbacks by the plugins.
50 *
51 * @defgroup Orthanc Orthanc
52 * @brief Functions to access the content of the Orthanc server.
53 **/
54
55
56
57 /**
58 * @defgroup Toolbox Toolbox
59 * @brief Generic functions to help with the creation of plugins.
46 **/ 60 **/
47 61
48 62
49 63
50 /** 64 /**
271 } OrthancPluginHttpMethod; 285 } OrthancPluginHttpMethod;
272 286
273 287
274 /** 288 /**
275 * @brief The parameters of a REST request. 289 * @brief The parameters of a REST request.
290 * @ingroup Callbacks
276 **/ 291 **/
277 typedef struct 292 typedef struct
278 { 293 {
279 /** 294 /**
280 * @brief The HTTP method. 295 * @brief The HTTP method.
435 450
436 451
437 452
438 /** 453 /**
439 * The memory layout of the pixels of an image. 454 * The memory layout of the pixels of an image.
455 * @ingroup Compression
440 **/ 456 **/
441 typedef enum 457 typedef enum
442 { 458 {
443 /** 459 /**
444 * @brief Graylevel 8bpp image. 460 * @brief Graylevel 8bpp image.
516 532
517 533
518 534
519 /** 535 /**
520 * The supported types of changes that can happen to DICOM resources. 536 * The supported types of changes that can happen to DICOM resources.
537 * @ingroup Callbacks
521 **/ 538 **/
522 typedef enum 539 typedef enum
523 { 540 {
524 OrthancPluginChangeType_CompletedSeries = 0, /*!< Series is now complete */ 541 OrthancPluginChangeType_CompletedSeries = 0, /*!< Series is now complete */
525 OrthancPluginChangeType_Deleted = 1, /*!< Deleted resource */ 542 OrthancPluginChangeType_Deleted = 1, /*!< Deleted resource */
536 } OrthancPluginChangeType; 553 } OrthancPluginChangeType;
537 554
538 555
539 /** 556 /**
540 * The compression algorithms that are supported by the Orthanc core. 557 * The compression algorithms that are supported by the Orthanc core.
558 * @ingroup Compression
541 **/ 559 **/
542 typedef enum 560 typedef enum
543 { 561 {
544 OrthancPluginCompressionType_Zlib = 0, /*!< Standard zlib compression */ 562 OrthancPluginCompressionType_Zlib = 0, /*!< Standard zlib compression */
545 OrthancPluginCompressionType_ZlibWithSize = 1, /*!< zlib, prefixed with uncompressed size (uint64_t) */ 563 OrthancPluginCompressionType_ZlibWithSize = 1, /*!< zlib, prefixed with uncompressed size (uint64_t) */
550 } OrthancPluginCompressionType; 568 } OrthancPluginCompressionType;
551 569
552 570
553 /** 571 /**
554 * The image formats that are supported by the Orthanc core. 572 * The image formats that are supported by the Orthanc core.
573 * @ingroup Compression
555 **/ 574 **/
556 typedef enum 575 typedef enum
557 { 576 {
558 OrthancPluginImageFormat_Png = 0, /*!< Image compressed using PNG */ 577 OrthancPluginImageFormat_Png = 0, /*!< Image compressed using PNG */
559 OrthancPluginImageFormat_Jpeg = 1, /*!< Image compressed using JPEG */ 578 OrthancPluginImageFormat_Jpeg = 1, /*!< Image compressed using JPEG */
586 605
587 606
588 607
589 /** 608 /**
590 * @brief Opaque structure that represents the HTTP connection to the client application. 609 * @brief Opaque structure that represents the HTTP connection to the client application.
610 * @ingroup Callback
591 **/ 611 **/
592 typedef struct _OrthancPluginRestOutput_t OrthancPluginRestOutput; 612 typedef struct _OrthancPluginRestOutput_t OrthancPluginRestOutput;
593 613
594 614
595 615
600 620
601 621
602 622
603 /** 623 /**
604 * @brief Opaque structure that represents a uncompressed image in memory. 624 * @brief Opaque structure that represents a uncompressed image in memory.
625 * @ingroup Compression
605 **/ 626 **/
606 typedef struct _OrthancPluginImage_t OrthancPluginImage; 627 typedef struct _OrthancPluginImage_t OrthancPluginImage;
607 628
608 629
609 630
610 /** 631 /**
611 * @brief Signature of a callback function that answers to a REST request. 632 * @brief Signature of a callback function that answers to a REST request.
633 * @ingroup Callbacks
612 **/ 634 **/
613 typedef int32_t (*OrthancPluginRestCallback) ( 635 typedef int32_t (*OrthancPluginRestCallback) (
614 OrthancPluginRestOutput* output, 636 OrthancPluginRestOutput* output,
615 const char* url, 637 const char* url,
616 const OrthancPluginHttpRequest* request); 638 const OrthancPluginHttpRequest* request);
617 639
618 640
619 641
620 /** 642 /**
621 * @brief Signature of a callback function that is triggered when Orthanc receives a DICOM instance. 643 * @brief Signature of a callback function that is triggered when Orthanc receives a DICOM instance.
644 * @ingroup Callbacks
622 **/ 645 **/
623 typedef int32_t (*OrthancPluginOnStoredInstanceCallback) ( 646 typedef int32_t (*OrthancPluginOnStoredInstanceCallback) (
624 OrthancPluginDicomInstance* instance, 647 OrthancPluginDicomInstance* instance,
625 const char* instanceId); 648 const char* instanceId);
626 649
627 650
628 651
629 /** 652 /**
630 * @brief Signature of a callback function that is triggered when a change happens to some DICOM resource. 653 * @brief Signature of a callback function that is triggered when a change happens to some DICOM resource.
654 * @ingroup Callbacks
631 **/ 655 **/
632 typedef int32_t (*OrthancPluginOnChangeCallback) ( 656 typedef int32_t (*OrthancPluginOnChangeCallback) (
633 OrthancPluginChangeType changeType, 657 OrthancPluginChangeType changeType,
634 OrthancPluginResourceType resourceType, 658 OrthancPluginResourceType resourceType,
635 const char* resourceId); 659 const char* resourceId);
651 * @param uuid The UUID of the file. 675 * @param uuid The UUID of the file.
652 * @param content The content of the file. 676 * @param content The content of the file.
653 * @param size The size of the file. 677 * @param size The size of the file.
654 * @param type The content type corresponding to this file. 678 * @param type The content type corresponding to this file.
655 * @return 0 if success, other value if error. 679 * @return 0 if success, other value if error.
680 * @ingroup Callbacks
656 **/ 681 **/
657 typedef int32_t (*OrthancPluginStorageCreate) ( 682 typedef int32_t (*OrthancPluginStorageCreate) (
658 const char* uuid, 683 const char* uuid,
659 const void* content, 684 const void* content,
660 int64_t size, 685 int64_t size,
670 * @param content The content of the file (output). 695 * @param content The content of the file (output).
671 * @param size The size of the file (output). 696 * @param size The size of the file (output).
672 * @param uuid The UUID of the file of interest. 697 * @param uuid The UUID of the file of interest.
673 * @param type The content type corresponding to this file. 698 * @param type The content type corresponding to this file.
674 * @return 0 if success, other value if error. 699 * @return 0 if success, other value if error.
700 * @ingroup Callbacks
675 **/ 701 **/
676 typedef int32_t (*OrthancPluginStorageRead) ( 702 typedef int32_t (*OrthancPluginStorageRead) (
677 void** content, 703 void** content,
678 int64_t* size, 704 int64_t* size,
679 const char* uuid, 705 const char* uuid,
687 * Signature of a callback function that is triggered when Orthanc deletes a file from the storage area. 713 * Signature of a callback function that is triggered when Orthanc deletes a file from the storage area.
688 * 714 *
689 * @param uuid The UUID of the file to be removed. 715 * @param uuid The UUID of the file to be removed.
690 * @param type The content type corresponding to this file. 716 * @param type The content type corresponding to this file.
691 * @return 0 if success, other value if error. 717 * @return 0 if success, other value if error.
718 * @ingroup Callbacks
692 **/ 719 **/
693 typedef int32_t (*OrthancPluginStorageRemove) ( 720 typedef int32_t (*OrthancPluginStorageRemove) (
694 const char* uuid, 721 const char* uuid,
695 OrthancPluginContentType type); 722 OrthancPluginContentType type);
696 723
739 * OrthancPluginInitialize() entry point of the plugin. 766 * OrthancPluginInitialize() entry point of the plugin.
740 * 767 *
741 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 768 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
742 * @return 1 if and only if the versions are compatible. If the 769 * @return 1 if and only if the versions are compatible. If the
743 * result is 0, the initialization of the plugin should fail. 770 * result is 0, the initialization of the plugin should fail.
771 * @ingroup Callbacks
744 **/ 772 **/
745 ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersion( 773 ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersion(
746 OrthancPluginContext* context) 774 OrthancPluginContext* context)
747 { 775 {
748 int major, minor, revision; 776 int major, minor, revision;
900 * 928 *
901 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 929 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
902 * @param pathRegularExpression Regular expression for the URI. May contain groups. 930 * @param pathRegularExpression Regular expression for the URI. May contain groups.
903 * @param callback The callback function to handle the REST call. 931 * @param callback The callback function to handle the REST call.
904 * @see OrthancPluginRegisterRestCallbackNoLock() 932 * @see OrthancPluginRegisterRestCallbackNoLock()
933 * @ingroup Callbacks
905 **/ 934 **/
906 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallback( 935 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallback(
907 OrthancPluginContext* context, 936 OrthancPluginContext* context,
908 const char* pathRegularExpression, 937 const char* pathRegularExpression,
909 OrthancPluginRestCallback callback) 938 OrthancPluginRestCallback callback)
933 * 962 *
934 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 963 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
935 * @param pathRegularExpression Regular expression for the URI. May contain groups. 964 * @param pathRegularExpression Regular expression for the URI. May contain groups.
936 * @param callback The callback function to handle the REST call. 965 * @param callback The callback function to handle the REST call.
937 * @see OrthancPluginRegisterRestCallback() 966 * @see OrthancPluginRegisterRestCallback()
967 * @ingroup Callbacks
938 **/ 968 **/
939 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallbackNoLock( 969 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallbackNoLock(
940 OrthancPluginContext* context, 970 OrthancPluginContext* context,
941 const char* pathRegularExpression, 971 const char* pathRegularExpression,
942 OrthancPluginRestCallback callback) 972 OrthancPluginRestCallback callback)
960 * This function registers a callback function that is called 990 * This function registers a callback function that is called
961 * whenever a new DICOM instance is stored into the Orthanc core. 991 * whenever a new DICOM instance is stored into the Orthanc core.
962 * 992 *
963 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 993 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
964 * @param callback The callback function. 994 * @param callback The callback function.
995 * @ingroup Callbacks
965 **/ 996 **/
966 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnStoredInstanceCallback( 997 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnStoredInstanceCallback(
967 OrthancPluginContext* context, 998 OrthancPluginContext* context,
968 OrthancPluginOnStoredInstanceCallback callback) 999 OrthancPluginOnStoredInstanceCallback callback)
969 { 1000 {
991 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1022 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
992 * @param output The HTTP connection to the client application. 1023 * @param output The HTTP connection to the client application.
993 * @param answer Pointer to the memory buffer containing the answer. 1024 * @param answer Pointer to the memory buffer containing the answer.
994 * @param answerSize Number of bytes of the answer. 1025 * @param answerSize Number of bytes of the answer.
995 * @param mimeType The MIME type of the answer. 1026 * @param mimeType The MIME type of the answer.
1027 * @ingroup REST
996 **/ 1028 **/
997 ORTHANC_PLUGIN_INLINE void OrthancPluginAnswerBuffer( 1029 ORTHANC_PLUGIN_INLINE void OrthancPluginAnswerBuffer(
998 OrthancPluginContext* context, 1030 OrthancPluginContext* context,
999 OrthancPluginRestOutput* output, 1031 OrthancPluginRestOutput* output,
1000 const char* answer, 1032 const char* answer,
1047 * @param width The width of the image. 1079 * @param width The width of the image.
1048 * @param height The height of the image. 1080 * @param height The height of the image.
1049 * @param pitch The pitch of the image (i.e. the number of bytes 1081 * @param pitch The pitch of the image (i.e. the number of bytes
1050 * between 2 successive lines of the image in the memory buffer). 1082 * between 2 successive lines of the image in the memory buffer).
1051 * @param buffer The memory buffer containing the uncompressed image. 1083 * @param buffer The memory buffer containing the uncompressed image.
1084 * @ingroup REST
1052 **/ 1085 **/
1053 ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerPngImage( 1086 ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerPngImage(
1054 OrthancPluginContext* context, 1087 OrthancPluginContext* context,
1055 OrthancPluginRestOutput* output, 1088 OrthancPluginRestOutput* output,
1056 OrthancPluginPixelFormat format, 1089 OrthancPluginPixelFormat format,
1087 * 1120 *
1088 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1121 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1089 * @param target The target memory buffer. 1122 * @param target The target memory buffer.
1090 * @param instanceId The Orthanc identifier of the DICOM instance of interest. 1123 * @param instanceId The Orthanc identifier of the DICOM instance of interest.
1091 * @return 0 if success, or the error code if failure. 1124 * @return 0 if success, or the error code if failure.
1125 * @ingroup Orthanc
1092 **/ 1126 **/
1093 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginGetDicomForInstance( 1127 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginGetDicomForInstance(
1094 OrthancPluginContext* context, 1128 OrthancPluginContext* context,
1095 OrthancPluginMemoryBuffer* target, 1129 OrthancPluginMemoryBuffer* target,
1096 const char* instanceId) 1130 const char* instanceId)
1117 * 1151 *
1118 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1152 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1119 * @param target The target memory buffer. 1153 * @param target The target memory buffer.
1120 * @param uri The URI in the built-in Orthanc API. 1154 * @param uri The URI in the built-in Orthanc API.
1121 * @return 0 if success, or the error code if failure. 1155 * @return 0 if success, or the error code if failure.
1156 * @ingroup Orthanc
1122 **/ 1157 **/
1123 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiGet( 1158 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiGet(
1124 OrthancPluginContext* context, 1159 OrthancPluginContext* context,
1125 OrthancPluginMemoryBuffer* target, 1160 OrthancPluginMemoryBuffer* target,
1126 const char* uri) 1161 const char* uri)
1144 * 1179 *
1145 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1180 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1146 * @param target The target memory buffer. 1181 * @param target The target memory buffer.
1147 * @param uri The URI in the built-in Orthanc API. 1182 * @param uri The URI in the built-in Orthanc API.
1148 * @return 0 if success, or the error code if failure. 1183 * @return 0 if success, or the error code if failure.
1184 * @ingroup Orthanc
1149 **/ 1185 **/
1150 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiGetAfterPlugins( 1186 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiGetAfterPlugins(
1151 OrthancPluginContext* context, 1187 OrthancPluginContext* context,
1152 OrthancPluginMemoryBuffer* target, 1188 OrthancPluginMemoryBuffer* target,
1153 const char* uri) 1189 const char* uri)
1178 * @param target The target memory buffer. 1214 * @param target The target memory buffer.
1179 * @param uri The URI in the built-in Orthanc API. 1215 * @param uri The URI in the built-in Orthanc API.
1180 * @param body The body of the POST request. 1216 * @param body The body of the POST request.
1181 * @param bodySize The size of the body. 1217 * @param bodySize The size of the body.
1182 * @return 0 if success, or the error code if failure. 1218 * @return 0 if success, or the error code if failure.
1219 * @ingroup Orthanc
1183 **/ 1220 **/
1184 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPost( 1221 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPost(
1185 OrthancPluginContext* context, 1222 OrthancPluginContext* context,
1186 OrthancPluginMemoryBuffer* target, 1223 OrthancPluginMemoryBuffer* target,
1187 const char* uri, 1224 const char* uri,
1210 * @param target The target memory buffer. 1247 * @param target The target memory buffer.
1211 * @param uri The URI in the built-in Orthanc API. 1248 * @param uri The URI in the built-in Orthanc API.
1212 * @param body The body of the POST request. 1249 * @param body The body of the POST request.
1213 * @param bodySize The size of the body. 1250 * @param bodySize The size of the body.
1214 * @return 0 if success, or the error code if failure. 1251 * @return 0 if success, or the error code if failure.
1252 * @ingroup Orthanc
1215 **/ 1253 **/
1216 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPostAfterPlugins( 1254 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPostAfterPlugins(
1217 OrthancPluginContext* context, 1255 OrthancPluginContext* context,
1218 OrthancPluginMemoryBuffer* target, 1256 OrthancPluginMemoryBuffer* target,
1219 const char* uri, 1257 const char* uri,
1236 * Make a DELETE call to the built-in Orthanc REST API. 1274 * Make a DELETE call to the built-in Orthanc REST API.
1237 * 1275 *
1238 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1276 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1239 * @param uri The URI to delete in the built-in Orthanc API. 1277 * @param uri The URI to delete in the built-in Orthanc API.
1240 * @return 0 if success, or the error code if failure. 1278 * @return 0 if success, or the error code if failure.
1279 * @ingroup Orthanc
1241 **/ 1280 **/
1242 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiDelete( 1281 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiDelete(
1243 OrthancPluginContext* context, 1282 OrthancPluginContext* context,
1244 const char* uri) 1283 const char* uri)
1245 { 1284 {
1256 * return the result provided by this plugin. 1295 * return the result provided by this plugin.
1257 * 1296 *
1258 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1297 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1259 * @param uri The URI to delete in the built-in Orthanc API. 1298 * @param uri The URI to delete in the built-in Orthanc API.
1260 * @return 0 if success, or the error code if failure. 1299 * @return 0 if success, or the error code if failure.
1300 * @ingroup Orthanc
1261 **/ 1301 **/
1262 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiDeleteAfterPlugins( 1302 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiDeleteAfterPlugins(
1263 OrthancPluginContext* context, 1303 OrthancPluginContext* context,
1264 const char* uri) 1304 const char* uri)
1265 { 1305 {
1278 * @param target The target memory buffer. 1318 * @param target The target memory buffer.
1279 * @param uri The URI in the built-in Orthanc API. 1319 * @param uri The URI in the built-in Orthanc API.
1280 * @param body The body of the PUT request. 1320 * @param body The body of the PUT request.
1281 * @param bodySize The size of the body. 1321 * @param bodySize The size of the body.
1282 * @return 0 if success, or the error code if failure. 1322 * @return 0 if success, or the error code if failure.
1323 * @ingroup Orthanc
1283 **/ 1324 **/
1284 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPut( 1325 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPut(
1285 OrthancPluginContext* context, 1326 OrthancPluginContext* context,
1286 OrthancPluginMemoryBuffer* target, 1327 OrthancPluginMemoryBuffer* target,
1287 const char* uri, 1328 const char* uri,
1311 * @param target The target memory buffer. 1352 * @param target The target memory buffer.
1312 * @param uri The URI in the built-in Orthanc API. 1353 * @param uri The URI in the built-in Orthanc API.
1313 * @param body The body of the PUT request. 1354 * @param body The body of the PUT request.
1314 * @param bodySize The size of the body. 1355 * @param bodySize The size of the body.
1315 * @return 0 if success, or the error code if failure. 1356 * @return 0 if success, or the error code if failure.
1357 * @ingroup Orthanc
1316 **/ 1358 **/
1317 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPutAfterPlugins( 1359 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPutAfterPlugins(
1318 OrthancPluginContext* context, 1360 OrthancPluginContext* context,
1319 OrthancPluginMemoryBuffer* target, 1361 OrthancPluginMemoryBuffer* target,
1320 const char* uri, 1362 const char* uri,
1344 * to another URI using HTTP status 301. 1386 * to another URI using HTTP status 301.
1345 * 1387 *
1346 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1388 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1347 * @param output The HTTP connection to the client application. 1389 * @param output The HTTP connection to the client application.
1348 * @param redirection Where to redirect. 1390 * @param redirection Where to redirect.
1391 * @ingroup REST
1349 **/ 1392 **/
1350 ORTHANC_PLUGIN_INLINE void OrthancPluginRedirect( 1393 ORTHANC_PLUGIN_INLINE void OrthancPluginRedirect(
1351 OrthancPluginContext* context, 1394 OrthancPluginContext* context,
1352 OrthancPluginRestOutput* output, 1395 OrthancPluginRestOutput* output,
1353 const char* redirection) 1396 const char* redirection)
1375 * 1418 *
1376 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1419 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1377 * @param patientID The Patient ID of interest. 1420 * @param patientID The Patient ID of interest.
1378 * @return The NULL value if the patient is non-existent, or a string containing the 1421 * @return The NULL value if the patient is non-existent, or a string containing the
1379 * Orthanc ID of the patient. This string must be freed by OrthancPluginFreeString(). 1422 * Orthanc ID of the patient. This string must be freed by OrthancPluginFreeString().
1423 * @ingroup Orthanc
1380 **/ 1424 **/
1381 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupPatient( 1425 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupPatient(
1382 OrthancPluginContext* context, 1426 OrthancPluginContext* context,
1383 const char* patientID) 1427 const char* patientID)
1384 { 1428 {
1409 * 1453 *
1410 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1454 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1411 * @param studyUID The Study Instance UID of interest. 1455 * @param studyUID The Study Instance UID of interest.
1412 * @return The NULL value if the study is non-existent, or a string containing the 1456 * @return The NULL value if the study is non-existent, or a string containing the
1413 * Orthanc ID of the study. This string must be freed by OrthancPluginFreeString(). 1457 * Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
1458 * @ingroup Orthanc
1414 **/ 1459 **/
1415 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudy( 1460 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudy(
1416 OrthancPluginContext* context, 1461 OrthancPluginContext* context,
1417 const char* studyUID) 1462 const char* studyUID)
1418 { 1463 {
1443 * 1488 *
1444 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1489 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1445 * @param accessionNumber The Accession Number of interest. 1490 * @param accessionNumber The Accession Number of interest.
1446 * @return The NULL value if the study is non-existent, or a string containing the 1491 * @return The NULL value if the study is non-existent, or a string containing the
1447 * Orthanc ID of the study. This string must be freed by OrthancPluginFreeString(). 1492 * Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
1493 * @ingroup Orthanc
1448 **/ 1494 **/
1449 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudyWithAccessionNumber( 1495 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudyWithAccessionNumber(
1450 OrthancPluginContext* context, 1496 OrthancPluginContext* context,
1451 const char* accessionNumber) 1497 const char* accessionNumber)
1452 { 1498 {
1477 * 1523 *
1478 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1524 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1479 * @param seriesUID The Series Instance UID of interest. 1525 * @param seriesUID The Series Instance UID of interest.
1480 * @return The NULL value if the series is non-existent, or a string containing the 1526 * @return The NULL value if the series is non-existent, or a string containing the
1481 * Orthanc ID of the series. This string must be freed by OrthancPluginFreeString(). 1527 * Orthanc ID of the series. This string must be freed by OrthancPluginFreeString().
1528 * @ingroup Orthanc
1482 **/ 1529 **/
1483 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupSeries( 1530 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupSeries(
1484 OrthancPluginContext* context, 1531 OrthancPluginContext* context,
1485 const char* seriesUID) 1532 const char* seriesUID)
1486 { 1533 {
1511 * 1558 *
1512 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1559 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1513 * @param sopInstanceUID The SOP Instance UID of interest. 1560 * @param sopInstanceUID The SOP Instance UID of interest.
1514 * @return The NULL value if the instance is non-existent, or a string containing the 1561 * @return The NULL value if the instance is non-existent, or a string containing the
1515 * Orthanc ID of the instance. This string must be freed by OrthancPluginFreeString(). 1562 * Orthanc ID of the instance. This string must be freed by OrthancPluginFreeString().
1563 * @ingroup Orthanc
1516 **/ 1564 **/
1517 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupInstance( 1565 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupInstance(
1518 OrthancPluginContext* context, 1566 OrthancPluginContext* context,
1519 const char* sopInstanceUID) 1567 const char* sopInstanceUID)
1520 { 1568 {
1554 * - Methods not allowed (status 405) must use ::OrthancPluginSendMethodNotAllowed(). 1602 * - Methods not allowed (status 405) must use ::OrthancPluginSendMethodNotAllowed().
1555 * 1603 *
1556 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1604 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1557 * @param output The HTTP connection to the client application. 1605 * @param output The HTTP connection to the client application.
1558 * @param status The HTTP status code to be sent. 1606 * @param status The HTTP status code to be sent.
1607 * @ingroup REST
1559 * @see OrthancPluginSendHttpStatus() 1608 * @see OrthancPluginSendHttpStatus()
1560 **/ 1609 **/
1561 ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatusCode( 1610 ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatusCode(
1562 OrthancPluginContext* context, 1611 OrthancPluginContext* context,
1563 OrthancPluginRestOutput* output, 1612 OrthancPluginRestOutput* output,
1577 * not authorized. 1626 * not authorized.
1578 * 1627 *
1579 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1628 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1580 * @param output The HTTP connection to the client application. 1629 * @param output The HTTP connection to the client application.
1581 * @param realm The realm for the authorization process. 1630 * @param realm The realm for the authorization process.
1631 * @ingroup REST
1582 **/ 1632 **/
1583 ORTHANC_PLUGIN_INLINE void OrthancPluginSendUnauthorized( 1633 ORTHANC_PLUGIN_INLINE void OrthancPluginSendUnauthorized(
1584 OrthancPluginContext* context, 1634 OrthancPluginContext* context,
1585 OrthancPluginRestOutput* output, 1635 OrthancPluginRestOutput* output,
1586 const char* realm) 1636 const char* realm)
1599 * queried URI does not support this method. 1649 * queried URI does not support this method.
1600 * 1650 *
1601 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1651 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1602 * @param output The HTTP connection to the client application. 1652 * @param output The HTTP connection to the client application.
1603 * @param allowedMethods The allowed methods for this URI (e.g. "GET,POST" after a PUT or a POST request). 1653 * @param allowedMethods The allowed methods for this URI (e.g. "GET,POST" after a PUT or a POST request).
1654 * @ingroup REST
1604 **/ 1655 **/
1605 ORTHANC_PLUGIN_INLINE void OrthancPluginSendMethodNotAllowed( 1656 ORTHANC_PLUGIN_INLINE void OrthancPluginSendMethodNotAllowed(
1606 OrthancPluginContext* context, 1657 OrthancPluginContext* context,
1607 OrthancPluginRestOutput* output, 1658 OrthancPluginRestOutput* output,
1608 const char* allowedMethods) 1659 const char* allowedMethods)
1628 * 1679 *
1629 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1680 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1630 * @param output The HTTP connection to the client application. 1681 * @param output The HTTP connection to the client application.
1631 * @param cookie The cookie to be set. 1682 * @param cookie The cookie to be set.
1632 * @param value The value of the cookie. 1683 * @param value The value of the cookie.
1684 * @ingroup REST
1633 **/ 1685 **/
1634 ORTHANC_PLUGIN_INLINE void OrthancPluginSetCookie( 1686 ORTHANC_PLUGIN_INLINE void OrthancPluginSetCookie(
1635 OrthancPluginContext* context, 1687 OrthancPluginContext* context,
1636 OrthancPluginRestOutput* output, 1688 OrthancPluginRestOutput* output,
1637 const char* cookie, 1689 const char* cookie,
1652 * 1704 *
1653 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1705 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1654 * @param output The HTTP connection to the client application. 1706 * @param output The HTTP connection to the client application.
1655 * @param key The HTTP header to be set. 1707 * @param key The HTTP header to be set.
1656 * @param value The value of the HTTP header. 1708 * @param value The value of the HTTP header.
1709 * @ingroup REST
1657 **/ 1710 **/
1658 ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpHeader( 1711 ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpHeader(
1659 OrthancPluginContext* context, 1712 OrthancPluginContext* context,
1660 OrthancPluginRestOutput* output, 1713 OrthancPluginRestOutput* output,
1661 const char* key, 1714 const char* key,
1686 * DICOM modality from which a DICOM instance originates. 1739 * DICOM modality from which a DICOM instance originates.
1687 * 1740 *
1688 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1741 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1689 * @param instance The instance of interest. 1742 * @param instance The instance of interest.
1690 * @return The AET if success, NULL if error. 1743 * @return The AET if success, NULL if error.
1744 * @ingroup Callbacks
1691 **/ 1745 **/
1692 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceRemoteAet( 1746 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceRemoteAet(
1693 OrthancPluginContext* context, 1747 OrthancPluginContext* context,
1694 OrthancPluginDicomInstance* instance) 1748 OrthancPluginDicomInstance* instance)
1695 { 1749 {
1718 * This function returns the number of bytes of the given DICOM instance. 1772 * This function returns the number of bytes of the given DICOM instance.
1719 * 1773 *
1720 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1774 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1721 * @param instance The instance of interest. 1775 * @param instance The instance of interest.
1722 * @return The size of the file, -1 in case of error. 1776 * @return The size of the file, -1 in case of error.
1777 * @ingroup Callbacks
1723 **/ 1778 **/
1724 ORTHANC_PLUGIN_INLINE int64_t OrthancPluginGetInstanceSize( 1779 ORTHANC_PLUGIN_INLINE int64_t OrthancPluginGetInstanceSize(
1725 OrthancPluginContext* context, 1780 OrthancPluginContext* context,
1726 OrthancPluginDicomInstance* instance) 1781 OrthancPluginDicomInstance* instance)
1727 { 1782 {
1750 * This function returns a pointer to the content of the given DICOM instance. 1805 * This function returns a pointer to the content of the given DICOM instance.
1751 * 1806 *
1752 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1807 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1753 * @param instance The instance of interest. 1808 * @param instance The instance of interest.
1754 * @return The pointer to the DICOM data, NULL in case of error. 1809 * @return The pointer to the DICOM data, NULL in case of error.
1810 * @ingroup Callbacks
1755 **/ 1811 **/
1756 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceData( 1812 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceData(
1757 OrthancPluginContext* context, 1813 OrthancPluginContext* context,
1758 OrthancPluginDicomInstance* instance) 1814 OrthancPluginDicomInstance* instance)
1759 { 1815 {
1785 * 1841 *
1786 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1842 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1787 * @param instance The instance of interest. 1843 * @param instance The instance of interest.
1788 * @return The NULL value in case of error, or a string containing the JSON file. 1844 * @return The NULL value in case of error, or a string containing the JSON file.
1789 * This string must be freed by OrthancPluginFreeString(). 1845 * This string must be freed by OrthancPluginFreeString().
1846 * @ingroup Callbacks
1790 **/ 1847 **/
1791 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceJson( 1848 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceJson(
1792 OrthancPluginContext* context, 1849 OrthancPluginContext* context,
1793 OrthancPluginDicomInstance* instance) 1850 OrthancPluginDicomInstance* instance)
1794 { 1851 {
1822 * 1879 *
1823 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1880 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1824 * @param instance The instance of interest. 1881 * @param instance The instance of interest.
1825 * @return The NULL value in case of error, or a string containing the JSON file. 1882 * @return The NULL value in case of error, or a string containing the JSON file.
1826 * This string must be freed by OrthancPluginFreeString(). 1883 * This string must be freed by OrthancPluginFreeString().
1884 * @ingroup Callbacks
1827 **/ 1885 **/
1828 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceSimplifiedJson( 1886 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceSimplifiedJson(
1829 OrthancPluginContext* context, 1887 OrthancPluginContext* context,
1830 OrthancPluginDicomInstance* instance) 1888 OrthancPluginDicomInstance* instance)
1831 { 1889 {
1860 * 1918 *
1861 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1919 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1862 * @param instance The instance of interest. 1920 * @param instance The instance of interest.
1863 * @param metadata The metadata of interest. 1921 * @param metadata The metadata of interest.
1864 * @return 1 if the metadata is present, 0 if it is absent, -1 in case of error. 1922 * @return 1 if the metadata is present, 0 if it is absent, -1 in case of error.
1923 * @ingroup Callbacks
1865 **/ 1924 **/
1866 ORTHANC_PLUGIN_INLINE int OrthancPluginHasInstanceMetadata( 1925 ORTHANC_PLUGIN_INLINE int OrthancPluginHasInstanceMetadata(
1867 OrthancPluginContext* context, 1926 OrthancPluginContext* context,
1868 OrthancPluginDicomInstance* instance, 1927 OrthancPluginDicomInstance* instance,
1869 const char* metadata) 1928 const char* metadata)
1897 * 1956 *
1898 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 1957 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1899 * @param instance The instance of interest. 1958 * @param instance The instance of interest.
1900 * @param metadata The metadata of interest. 1959 * @param metadata The metadata of interest.
1901 * @return The metadata value if success, NULL if error. 1960 * @return The metadata value if success, NULL if error.
1961 * @ingroup Callbacks
1902 **/ 1962 **/
1903 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceMetadata( 1963 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceMetadata(
1904 OrthancPluginContext* context, 1964 OrthancPluginContext* context,
1905 OrthancPluginDicomInstance* instance, 1965 OrthancPluginDicomInstance* instance,
1906 const char* metadata) 1966 const char* metadata)
1944 * 2004 *
1945 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 2005 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1946 * @param create The callback function to store a file on the custom storage area. 2006 * @param create The callback function to store a file on the custom storage area.
1947 * @param read The callback function to read a file from the custom storage area. 2007 * @param read The callback function to read a file from the custom storage area.
1948 * @param remove The callback function to remove a file from the custom storage area. 2008 * @param remove The callback function to remove a file from the custom storage area.
2009 * @ingroup Callbacks
1949 **/ 2010 **/
1950 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterStorageArea( 2011 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterStorageArea(
1951 OrthancPluginContext* context, 2012 OrthancPluginContext* context,
1952 OrthancPluginStorageCreate create, 2013 OrthancPluginStorageCreate create,
1953 OrthancPluginStorageRead read, 2014 OrthancPluginStorageRead read,
2076 * This function registers a callback function that is called 2137 * This function registers a callback function that is called
2077 * whenever a change happens to some DICOM resource. 2138 * whenever a change happens to some DICOM resource.
2078 * 2139 *
2079 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 2140 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
2080 * @param callback The callback function. 2141 * @param callback The callback function.
2142 * @ingroup Callbacks
2081 **/ 2143 **/
2082 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnChangeCallback( 2144 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnChangeCallback(
2083 OrthancPluginContext* context, 2145 OrthancPluginContext* context,
2084 OrthancPluginOnChangeCallback callback) 2146 OrthancPluginOnChangeCallback callback)
2085 { 2147 {
2184 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 2246 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
2185 * @param property The global property of interest. 2247 * @param property The global property of interest.
2186 * @param defaultValue The value to return, if the global property is unset. 2248 * @param defaultValue The value to return, if the global property is unset.
2187 * @return The value of the global property, or NULL in the case of an error. This 2249 * @return The value of the global property, or NULL in the case of an error. This
2188 * string must be freed by OrthancPluginFreeString(). 2250 * string must be freed by OrthancPluginFreeString().
2251 * @ingroup Orthanc
2189 **/ 2252 **/
2190 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetGlobalProperty( 2253 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetGlobalProperty(
2191 OrthancPluginContext* context, 2254 OrthancPluginContext* context,
2192 int32_t property, 2255 int32_t property,
2193 const char* defaultValue) 2256 const char* defaultValue)
2222 * 2285 *
2223 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 2286 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
2224 * @param property The global property of interest. 2287 * @param property The global property of interest.
2225 * @param value The value to be set in the global property. 2288 * @param value The value to be set in the global property.
2226 * @return 0 if success, or the error code if failure. 2289 * @return 0 if success, or the error code if failure.
2290 * @ingroup Orthanc
2227 **/ 2291 **/
2228 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginSetGlobalProperty( 2292 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginSetGlobalProperty(
2229 OrthancPluginContext* context, 2293 OrthancPluginContext* context,
2230 int32_t property, 2294 int32_t property,
2231 const char* value) 2295 const char* value)
2318 * 2382 *
2319 * Retrieve the expected version of the database schema. 2383 * Retrieve the expected version of the database schema.
2320 * 2384 *
2321 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 2385 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
2322 * @return The version. 2386 * @return The version.
2387 * @ingroup Callbacks
2323 **/ 2388 **/
2324 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetExpectedDatabaseVersion( 2389 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetExpectedDatabaseVersion(
2325 OrthancPluginContext* context) 2390 OrthancPluginContext* context)
2326 { 2391 {
2327 uint32_t count = 0; 2392 uint32_t count = 0;
2391 * @param output The HTTP connection to the client application. 2456 * @param output The HTTP connection to the client application.
2392 * @param subType The sub-type of the multipart answer ("mixed" or "related"). 2457 * @param subType The sub-type of the multipart answer ("mixed" or "related").
2393 * @param contentType The MIME type of the items in the multipart answer. 2458 * @param contentType The MIME type of the items in the multipart answer.
2394 * @return 0 if success, or the error code if failure. 2459 * @return 0 if success, or the error code if failure.
2395 * @see OrthancPluginSendMultipartItem() 2460 * @see OrthancPluginSendMultipartItem()
2461 * @ingroup REST
2396 **/ 2462 **/
2397 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStartMultipartAnswer( 2463 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStartMultipartAnswer(
2398 OrthancPluginContext* context, 2464 OrthancPluginContext* context,
2399 OrthancPluginRestOutput* output, 2465 OrthancPluginRestOutput* output,
2400 const char* subType, 2466 const char* subType,
2418 * @param output The HTTP connection to the client application. 2484 * @param output The HTTP connection to the client application.
2419 * @param answer Pointer to the memory buffer containing the item. 2485 * @param answer Pointer to the memory buffer containing the item.
2420 * @param answerSize Number of bytes of the item. 2486 * @param answerSize Number of bytes of the item.
2421 * @return 0 if success, or the error code if failure (this notably happens 2487 * @return 0 if success, or the error code if failure (this notably happens
2422 * if the connection is closed by the client). 2488 * if the connection is closed by the client).
2489 * @ingroup REST
2423 **/ 2490 **/
2424 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginSendMultipartItem( 2491 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginSendMultipartItem(
2425 OrthancPluginContext* context, 2492 OrthancPluginContext* context,
2426 OrthancPluginRestOutput* output, 2493 OrthancPluginRestOutput* output,
2427 const char* answer, 2494 const char* answer,
2459 * @param size The size in bytes of the source buffer. 2526 * @param size The size in bytes of the source buffer.
2460 * @param compression The compression algorithm. 2527 * @param compression The compression algorithm.
2461 * @param uncompress If set to "0", the buffer must be compressed. 2528 * @param uncompress If set to "0", the buffer must be compressed.
2462 * If set to "1", the buffer must be uncompressed. 2529 * If set to "1", the buffer must be uncompressed.
2463 * @return 0 if success, or the error code if failure. 2530 * @return 0 if success, or the error code if failure.
2531 * @ingroup Compression
2464 **/ 2532 **/
2465 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginBufferCompression( 2533 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginBufferCompression(
2466 OrthancPluginContext* context, 2534 OrthancPluginContext* context,
2467 OrthancPluginMemoryBuffer* target, 2535 OrthancPluginMemoryBuffer* target,
2468 const void* source, 2536 const void* source,
2610 * @param output The HTTP connection to the client application. 2678 * @param output The HTTP connection to the client application.
2611 * @param status The HTTP status code to be sent. 2679 * @param status The HTTP status code to be sent.
2612 * @param body The body of the answer. 2680 * @param body The body of the answer.
2613 * @param bodySize The size of the body. 2681 * @param bodySize The size of the body.
2614 * @see OrthancPluginSendHttpStatusCode() 2682 * @see OrthancPluginSendHttpStatusCode()
2683 * @ingroup REST
2615 **/ 2684 **/
2616 ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatus( 2685 ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatus(
2617 OrthancPluginContext* context, 2686 OrthancPluginContext* context,
2618 OrthancPluginRestOutput* output, 2687 OrthancPluginRestOutput* output,
2619 uint16_t status, 2688 uint16_t status,
2645 * This function returns the type of memory layout for the pixels of the given image. 2714 * This function returns the type of memory layout for the pixels of the given image.
2646 * 2715 *
2647 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 2716 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
2648 * @param image The image of interest. 2717 * @param image The image of interest.
2649 * @return The pixel format. 2718 * @return The pixel format.
2719 * @ingroup Compression
2650 **/ 2720 **/
2651 ORTHANC_PLUGIN_INLINE OrthancPluginPixelFormat OrthancPluginGetImagePixelFormat( 2721 ORTHANC_PLUGIN_INLINE OrthancPluginPixelFormat OrthancPluginGetImagePixelFormat(
2652 OrthancPluginContext* context, 2722 OrthancPluginContext* context,
2653 const OrthancPluginImage* image) 2723 const OrthancPluginImage* image)
2654 { 2724 {
2677 * This function returns the width of the given image. 2747 * This function returns the width of the given image.
2678 * 2748 *
2679 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 2749 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
2680 * @param image The image of interest. 2750 * @param image The image of interest.
2681 * @return The width. 2751 * @return The width.
2752 * @ingroup Compression
2682 **/ 2753 **/
2683 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageWidth( 2754 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageWidth(
2684 OrthancPluginContext* context, 2755 OrthancPluginContext* context,
2685 const OrthancPluginImage* image) 2756 const OrthancPluginImage* image)
2686 { 2757 {
2709 * This function returns the height of the given image. 2780 * This function returns the height of the given image.
2710 * 2781 *
2711 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 2782 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
2712 * @param image The image of interest. 2783 * @param image The image of interest.
2713 * @return The height. 2784 * @return The height.
2785 * @ingroup Compression
2714 **/ 2786 **/
2715 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageHeight( 2787 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageHeight(
2716 OrthancPluginContext* context, 2788 OrthancPluginContext* context,
2717 const OrthancPluginImage* image) 2789 const OrthancPluginImage* image)
2718 { 2790 {
2743 * image in the memory buffer. 2815 * image in the memory buffer.
2744 * 2816 *
2745 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 2817 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
2746 * @param image The image of interest. 2818 * @param image The image of interest.
2747 * @return The pitch. 2819 * @return The pitch.
2820 * @ingroup Compression
2748 **/ 2821 **/
2749 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImagePitch( 2822 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImagePitch(
2750 OrthancPluginContext* context, 2823 OrthancPluginContext* context,
2751 const OrthancPluginImage* image) 2824 const OrthancPluginImage* image)
2752 { 2825 {
2776 * contains the pixels of the image. 2849 * contains the pixels of the image.
2777 * 2850 *
2778 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 2851 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
2779 * @param image The image of interest. 2852 * @param image The image of interest.
2780 * @return The pointer. 2853 * @return The pointer.
2854 * @ingroup Compression
2781 **/ 2855 **/
2782 ORTHANC_PLUGIN_INLINE const void* OrthancPluginGetImageBuffer( 2856 ORTHANC_PLUGIN_INLINE const void* OrthancPluginGetImageBuffer(
2783 OrthancPluginContext* context, 2857 OrthancPluginContext* context,
2784 const OrthancPluginImage* image) 2858 const OrthancPluginImage* image)
2785 { 2859 {
2818 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 2892 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
2819 * @param data Pointer to a memory buffer containing the compressed image. 2893 * @param data Pointer to a memory buffer containing the compressed image.
2820 * @param size Size of the memory buffer containing the compressed image. 2894 * @param size Size of the memory buffer containing the compressed image.
2821 * @param format The file format of the compressed image. 2895 * @param format The file format of the compressed image.
2822 * @return The uncompressed image. It must be freed with OrthancPluginFreeImage(). 2896 * @return The uncompressed image. It must be freed with OrthancPluginFreeImage().
2897 * @ingroup Compression
2823 **/ 2898 **/
2824 ORTHANC_PLUGIN_INLINE OrthancPluginImage *OrthancPluginUncompressImage( 2899 ORTHANC_PLUGIN_INLINE OrthancPluginImage *OrthancPluginUncompressImage(
2825 OrthancPluginContext* context, 2900 OrthancPluginContext* context,
2826 const void* data, 2901 const void* data,
2827 uint32_t size, 2902 uint32_t size,
2852 * 2927 *
2853 * This function frees an image that was decoded with OrthancPluginUncompressImage(). 2928 * This function frees an image that was decoded with OrthancPluginUncompressImage().
2854 * 2929 *
2855 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). 2930 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
2856 * @param image The image. 2931 * @param image The image.
2932 * @ingroup Compression
2857 **/ 2933 **/
2858 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeImage( 2934 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeImage(
2859 OrthancPluginContext* context, 2935 OrthancPluginContext* context,
2860 OrthancPluginImage* image) 2936 OrthancPluginImage* image)
2861 { 2937 {
2881 uint8_t quality; 2957 uint8_t quality;
2882 } _OrthancPluginCompressImage; 2958 } _OrthancPluginCompressImage;
2883 2959
2884 2960
2885 /** 2961 /**
2886 * @brief Create a PNG image. 2962 * @brief Encode a PNG image.
2887 * 2963 *
2888 * This function compresses the given memory buffer containing an 2964 * This function compresses the given memory buffer containing an
2889 * image using the PNG specification, and stores the result of the 2965 * image using the PNG specification, and stores the result of the
2890 * compression into a newly allocated memory buffer. 2966 * compression into a newly allocated memory buffer.
2891 * 2967 *
2897 * @param pitch The pitch of the image (i.e. the number of bytes 2973 * @param pitch The pitch of the image (i.e. the number of bytes
2898 * between 2 successive lines of the image in the memory buffer). 2974 * between 2 successive lines of the image in the memory buffer).
2899 * @param buffer The memory buffer containing the uncompressed image. 2975 * @param buffer The memory buffer containing the uncompressed image.
2900 * @return 0 if success, or the error code if failure. 2976 * @return 0 if success, or the error code if failure.
2901 * @see OrthancPluginCompressAndAnswerPngImage() 2977 * @see OrthancPluginCompressAndAnswerPngImage()
2978 * @ingroup Compression
2902 **/ 2979 **/
2903 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCompressPngImage( 2980 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCompressPngImage(
2904 OrthancPluginContext* context, 2981 OrthancPluginContext* context,
2905 OrthancPluginMemoryBuffer* target, 2982 OrthancPluginMemoryBuffer* target,
2906 OrthancPluginPixelFormat format, 2983 OrthancPluginPixelFormat format,
2923 return context->InvokeService(context, _OrthancPluginService_CompressImage, &params); 3000 return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
2924 } 3001 }
2925 3002
2926 3003
2927 /** 3004 /**
2928 * @brief Create a JPEG image. 3005 * @brief Encode a JPEG image.
2929 * 3006 *
2930 * This function compresses the given memory buffer containing an 3007 * This function compresses the given memory buffer containing an
2931 * image using the JPEG specification, and stores the result of the 3008 * image using the JPEG specification, and stores the result of the
2932 * compression into a newly allocated memory buffer. 3009 * compression into a newly allocated memory buffer.
2933 * 3010 *
2941 * @param buffer The memory buffer containing the uncompressed image. 3018 * @param buffer The memory buffer containing the uncompressed image.
2942 * @param quality The quality of the JPEG encoding, between 1 (worst 3019 * @param quality The quality of the JPEG encoding, between 1 (worst
2943 * quality, best compression) and 100 (best quality, worst 3020 * quality, best compression) and 100 (best quality, worst
2944 * compression). 3021 * compression).
2945 * @return 0 if success, or the error code if failure. 3022 * @return 0 if success, or the error code if failure.
3023 * @ingroup Compression
2946 **/ 3024 **/
2947 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCompressJpegImage( 3025 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCompressJpegImage(
2948 OrthancPluginContext* context, 3026 OrthancPluginContext* context,
2949 OrthancPluginMemoryBuffer* target, 3027 OrthancPluginMemoryBuffer* target,
2950 OrthancPluginPixelFormat format, 3028 OrthancPluginPixelFormat format,
2987 * between 2 successive lines of the image in the memory buffer). 3065 * between 2 successive lines of the image in the memory buffer).
2988 * @param buffer The memory buffer containing the uncompressed image. 3066 * @param buffer The memory buffer containing the uncompressed image.
2989 * @param quality The quality of the JPEG encoding, between 1 (worst 3067 * @param quality The quality of the JPEG encoding, between 1 (worst
2990 * quality, best compression) and 100 (best quality, worst 3068 * quality, best compression) and 100 (best quality, worst
2991 * compression). 3069 * compression).
3070 * @ingroup REST
2992 **/ 3071 **/
2993 ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerJpegImage( 3072 ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerJpegImage(
2994 OrthancPluginContext* context, 3073 OrthancPluginContext* context,
2995 OrthancPluginRestOutput* output, 3074 OrthancPluginRestOutput* output,
2996 OrthancPluginPixelFormat format, 3075 OrthancPluginPixelFormat format,