annotate Plugins/OrthancCPlugin/OrthancCPlugin.h @ 993:501880d76474 plugins

improvements to GDCM plugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 02 Jul 2014 14:41:57 +0200
parents 3e43de893d88
children ab6a51f075fd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
906
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
1 /**
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
2 * \mainpage
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
3 *
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
4 * This C/C++ SDK allows external developers to create plugins that
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
5 * can be loaded into Orthanc to extend its functionality. Each
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
6 * Orthanc plugin must expose 4 public functions with the following
906
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
7 * signatures:
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
8 *
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
9 * -# <tt>int32_t OrthancPluginInitialize(const OrthancPluginContext* context)</tt>:
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
10 * This function is invoked by Orthanc when it loads the plugin on startup.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
11 * The plugin must store the context pointer so that it can use the plugin
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
12 * services of Orthanc. It must also register all its callbacks using
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
13 * ::OrthancPluginRegisterRestCallback().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
14 * -# <tt>void OrthancPluginFinalize()</tt>:
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
15 * This function is invoked by Orthanc during its shutdown. The plugin
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
16 * must free all its memory.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
17 * -# <tt>const char* OrthancPluginGetName()</tt>:
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
18 * The plugin must return a short string to identify itself.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
19 * -# <tt>const char* OrthancPluginGetVersion()</tt>
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
20 * The plugin must return a string containing its version number.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
21 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
22 * The name and the version of a plugin is only used to prevent it
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
23 * from being loaded twice.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
24 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
25 *
906
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
26 **/
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
27
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
28
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
29
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
30 /**
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
31 * @defgroup CInterface C Interface
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
32 * @brief The C interface to create Orthanc plugins.
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
33 *
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
34 * These functions must be used to create C plugins for Orthanc.
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
35 **/
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
36
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
37
906
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
38
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 /**
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 * Orthanc - A Lightweight, RESTful DICOM Store
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 * Belgium
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 *
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 * This program is free software: you can redistribute it and/or
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 * modify it under the terms of the GNU General Public License as
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 * published by the Free Software Foundation, either version 3 of the
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 * License, or (at your option) any later version.
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 *
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 * In addition, as a special exception, the copyright holders of this
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 * program give permission to link the code of its release with the
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 * OpenSSL project's "OpenSSL" library (or with modified versions of it
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 * that use the same license as the "OpenSSL" library), and distribute
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 * the linked executables. You must obey the GNU General Public License
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 * in all respects for all of the code used other than "OpenSSL". If you
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 * modify file(s) with this exception, you may extend this exception to
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 * your version of the file(s), but you are not obligated to do so. If
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 * you do not wish to do so, delete this exception statement from your
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 * version. If you delete this exception statement from all source files
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 * in the program, then also delete it here.
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 *
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 * This program is distributed in the hope that it will be useful, but
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 * WITHOUT ANY WARRANTY; without even the implied warranty of
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 * General Public License for more details.
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 *
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 * You should have received a copy of the GNU General Public License
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 **/
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
906
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
71
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 #pragma once
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
75 #include <stdio.h>
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
76 #include <string.h>
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
77
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 #ifdef WIN32
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 #define ORTHANC_PLUGINS_API __declspec(dllexport)
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 #else
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 #define ORTHANC_PLUGINS_API
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 #endif
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
85
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
86 /********************************************************************
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
87 ** Check that function inlining is properly supported. The use of
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
88 ** inlining is required, to avoid the duplication of object code
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
89 ** between two compilation modules that would use the Orthanc Plugin
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
90 ** API.
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
91 ********************************************************************/
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
92
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
93 /* If the auto-detection of the "inline" keyword below does not work
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
94 automatically and that your compiler is known to properly support
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
95 inlining, uncomment the following #define and adapt the definition
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
96 of "static inline". */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
97
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
98 /* #define ORTHANC_PLUGIN_INLINE static inline */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
99
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
100 #ifndef ORTHANC_PLUGIN_INLINE
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
101 # if __STDC_VERSION__ >= 199901L
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
102 /* This is C99 or above: http://predef.sourceforge.net/prestd.html */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
103 # define ORTHANC_PLUGIN_INLINE static inline
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
104 # elif defined(__cplusplus)
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
105 /* This is C++ */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
106 # define ORTHANC_PLUGIN_INLINE static inline
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
107 # elif defined(__GNUC__)
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
108 /* This is GCC running in C89 mode */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
109 # define ORTHANC_PLUGIN_INLINE static __inline
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
110 # elif defined(_MSC_VER)
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
111 /* This is Visual Studio running in C89 mode */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
112 # define ORTHANC_PLUGIN_INLINE static __inline
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
113 # else
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
114 # error Your compiler is not known to support the "inline" keyword
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
115 # endif
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
116 #endif
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
117
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
118
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
119
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
120 /********************************************************************
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
121 ** Inclusion of standard libraries.
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
122 ********************************************************************/
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
123
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
124 #ifdef _MSC_VER
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
125 #include "../../Resources/VisualStudio/stdint.h"
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
126 #else
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
127 #include <stdint.h>
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
128 #endif
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
129
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 #include <stdlib.h>
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
133
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
134 /********************************************************************
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
135 ** Definition of the Orthanc Plugin API.
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
136 ********************************************************************/
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
137
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
138 /** @{ */
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
139
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 #ifdef __cplusplus
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 extern "C"
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 {
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 #endif
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
145 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
146 * The various HTTP methods for a REST call.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
147 **/
894
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
148 typedef enum
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
149 {
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
150 OrthancPluginHttpMethod_Get = 1, /*!< GET request */
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
151 OrthancPluginHttpMethod_Post = 2, /*!< POST request */
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
152 OrthancPluginHttpMethod_Put = 3, /*!< PUT request */
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
153 OrthancPluginHttpMethod_Delete = 4 /*!< DELETE request */
896
c4053ac5db04 better plugni api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 894
diff changeset
154 } OrthancPluginHttpMethod;
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
156
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
157 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
158 * @brief The parameters of a REST request.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
159 **/
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
160 typedef struct
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
161 {
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
162 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
163 * @brief The HTTP method.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
164 **/
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
165 OrthancPluginHttpMethod method;
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
166
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
167 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
168 * @brief The number of groups of the regular expression.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
169 **/
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
170 uint32_t groupsCount;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
171
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
172 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
173 * @brief The matched values for the groups of the regular expression.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
174 **/
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
175 const char* const* groups;
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
176
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
177 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
178 * @brief For a GET request, the number of GET parameters.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
179 **/
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
180 uint32_t getCount;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
181
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
182 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
183 * @brief For a GET request, the keys of the GET parameters.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
184 **/
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
185 const char* const* getKeys;
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
186
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
187 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
188 * @brief For a GET request, the values of the GET parameters.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
189 **/
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
190 const char* const* getValues;
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
191
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
192 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
193 * @brief For a PUT or POST request, the content of the body.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
194 **/
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
195 const char* body;
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
196
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
197 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
198 * @brief For a PUT or POST request, the number of bytes of the body.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
199 **/
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
200 uint32_t bodySize;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
201 } OrthancPluginHttpRequest;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
202
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
203 typedef enum
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 {
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
205 /* Generic services */
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
206 _OrthancPluginService_LogInfo = 1,
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
207 _OrthancPluginService_LogWarning = 2,
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
208 _OrthancPluginService_LogError = 3,
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
209
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
210 /* Registration of callbacks */
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
211 _OrthancPluginService_RegisterRestCallback = 1000,
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
212
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
213 /* Sending answers to REST calls */
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
214 _OrthancPluginService_AnswerBuffer = 2000,
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
215 _OrthancPluginService_CompressAndAnswerPngImage = 2001,
993
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
216 _OrthancPluginService_Redirect = 2002,
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
217
912
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
218 /* Access to the Orthanc database and API */
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
219 _OrthancPluginService_GetDicomForInstance = 3000,
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
220 _OrthancPluginService_RestApiGet = 3001,
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
221 _OrthancPluginService_RestApiPost = 3002,
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
222 _OrthancPluginService_RestApiDelete = 3003,
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
223 _OrthancPluginService_RestApiPut = 3004
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
224 } _OrthancPluginService;
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
225
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
226
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
227
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
228 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
229 * The memory layout of the pixels of an image.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
230 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
231 typedef enum
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
232 {
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
233 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
234 * @brief Graylevel 8bpp image.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
235 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
236 * The image is graylevel. Each pixel is unsigned and stored in
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
237 * one byte.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
238 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
239 OrthancPluginPixelFormat_Grayscale8 = 1,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
240
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
241 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
242 * @brief Graylevel, unsigned 16bpp image.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
243 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
244 * The image is graylevel. Each pixel is unsigned and stored in
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
245 * two bytes.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
246 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
247 OrthancPluginPixelFormat_Grayscale16 = 2,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
248
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
249 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
250 * @brief Graylevel, signed 16bpp image.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
251 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
252 * The image is graylevel. Each pixel is signed and stored in two
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
253 * bytes.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
254 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
255 OrthancPluginPixelFormat_SignedGrayscale16 = 3,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
256
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
257 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
258 * @brief Color image in RGB24 format.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
259 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
260 * This format describes a color image. The pixels are stored in 3
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
261 * consecutive bytes. The memory layout is RGB.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
262 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
263 OrthancPluginPixelFormat_RGB24 = 4,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
264
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
265 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
266 * @brief Color image in RGBA32 format.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
267 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
268 * This format describes a color image. The pixels are stored in 4
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
269 * consecutive bytes. The memory layout is RGBA.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
270 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
271 OrthancPluginPixelFormat_RGBA32 = 5
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
272 } OrthancPluginPixelFormat;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
273
894
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
274
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
275 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
276 * @brief A memory buffer allocated by the core system of Orthanc.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
277 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
278 * A memory buffer allocated by the core system of Orthanc. When the
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
279 * content of the buffer is not useful anymore, it must be free by a
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
280 * call to ::OrthancPluginFreeMemoryBuffer().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
281 **/
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
282 typedef struct
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
283 {
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
284 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
285 * @brief The content of the buffer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
286 **/
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
287 void* data;
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
288
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
289 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
290 * @brief The number of bytes in the buffer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
291 **/
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
292 uint32_t size;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
293 } OrthancPluginMemoryBuffer;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
294
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
295
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
296
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
297
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
298 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
299 * @brief Opaque structure that represents the HTTP connection to the client application.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
300 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
301 typedef struct _OrthancPluginRestOutput_t OrthancPluginRestOutput;
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
302
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
303
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
304 /**
908
e078ea944089 refactoring HttpOutput
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 907
diff changeset
305 * @brief Signature of a callback function that answers to a REST request.
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
306 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
307 typedef int32_t (*OrthancPluginRestCallback) (
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
308 OrthancPluginRestOutput* output,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
309 const char* url,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
310 const OrthancPluginHttpRequest* request);
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
311
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
312
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
313 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
314 * @brief Opaque structure that contains information about the Orthanc core.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
315 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
316 typedef struct _OrthancPluginContext_t
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
317 {
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
318 void* pluginsManager;
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
319 const char* orthancVersion;
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
320 void (*Free) (void* buffer);
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
321 int32_t (*InvokeService) (struct _OrthancPluginContext_t* context,
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
322 _OrthancPluginService service,
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
323 const void* params);
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
324 } OrthancPluginContext;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
325
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
327
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
328 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
329 * @brief Free a string.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
330 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
331 * Free a string that was allocated by the core system of Orthanc.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
332 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
333 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
334 * @param str The string to be freed.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
335 **/
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
336 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeString(
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
337 OrthancPluginContext* context,
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
338 char* str)
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
339 {
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
340 context->Free(str);
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
341 }
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
342
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
343
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
344 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
345 * @brief Free a memory buffer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
346 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
347 * Free a memory buffer that was allocated by the core system of Orthanc.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
348 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
349 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
350 * @param buffer The memory buffer to release.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
351 **/
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
352 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeMemoryBuffer(
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
353 OrthancPluginContext* context,
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
354 OrthancPluginMemoryBuffer* buffer)
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
355 {
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
356 context->Free(buffer->data);
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
357 }
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
358
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
359
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
360 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
361 * @brief Log an error.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
362 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
363 * Log an error message using the Orthanc logging system.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
364 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
365 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
366 * @param message The message to be logged.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
367 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
368 ORTHANC_PLUGIN_INLINE void OrthancPluginLogError(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
369 OrthancPluginContext* context,
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
370 const char* message)
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
371 {
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
372 context->InvokeService(context, _OrthancPluginService_LogError, message);
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
373 }
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
374
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
375
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
376 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
377 * @brief Log a warning.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
378 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
379 * Log a warning message using the Orthanc logging system.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
380 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
381 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
382 * @param message The message to be logged.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
383 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
384 ORTHANC_PLUGIN_INLINE void OrthancPluginLogWarning(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
385 OrthancPluginContext* context,
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
386 const char* message)
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
387 {
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
388 context->InvokeService(context, _OrthancPluginService_LogWarning, message);
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
389 }
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
390
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
391
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
392 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
393 * @brief Log an information.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
394 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
395 * Log an information message using the Orthanc logging system.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
396 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
397 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
398 * @param message The message to be logged.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
399 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
400 ORTHANC_PLUGIN_INLINE void OrthancPluginLogInfo(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
401 OrthancPluginContext* context,
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
402 const char* message)
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
403 {
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
404 context->InvokeService(context, _OrthancPluginService_LogInfo, message);
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
405 }
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
406
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
407
913
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
408
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
409 typedef struct
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
410 {
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
411 const char* pathRegularExpression;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
412 OrthancPluginRestCallback callback;
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
413 } _OrthancPluginRestCallback;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
414
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
415 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
416 * @brief Register a REST callback.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
417 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
418 * This function registers a REST callback against a regular
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
419 * expression for a URI. This function must be called during the
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
420 * initialization of the plugin, i.e. inside the
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
421 * OrthancPluginInitialize() public function.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
422 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
423 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
424 * @param pathRegularExpression Regular expression for the URI. May contain groups.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
425 * @param callback The callback function to handle the REST call.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
426 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
427 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallback(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
428 OrthancPluginContext* context,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
429 const char* pathRegularExpression,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
430 OrthancPluginRestCallback callback)
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
431 {
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
432 _OrthancPluginRestCallback params;
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
433 params.pathRegularExpression = pathRegularExpression;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
434 params.callback = callback;
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
435 context->InvokeService(context, _OrthancPluginService_RegisterRestCallback, &params);
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
436 }
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
437
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
438
913
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
439
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
440 typedef struct
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
441 {
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
442 OrthancPluginRestOutput* output;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
443 const char* answer;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
444 uint32_t answerSize;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
445 const char* mimeType;
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
446 } _OrthancPluginAnswerBuffer;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
447
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
448 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
449 * @brief Answer to a REST request.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
450 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
451 * This function answers to a REST request with the content of a memory buffer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
452 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
453 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
454 * @param output The HTTP connection to the client application.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
455 * @param answer Pointer to the memory buffer containing the answer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
456 * @param answerSize Number of bytes of the answer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
457 * @param mimeType The MIME type of the answer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
458 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
459 ORTHANC_PLUGIN_INLINE void OrthancPluginAnswerBuffer(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
460 OrthancPluginContext* context,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
461 OrthancPluginRestOutput* output,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
462 const char* answer,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
463 uint32_t answerSize,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
464 const char* mimeType)
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
465 {
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
466 _OrthancPluginAnswerBuffer params;
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
467 params.output = output;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
468 params.answer = answer;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
469 params.answerSize = answerSize;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
470 params.mimeType = mimeType;
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
471 context->InvokeService(context, _OrthancPluginService_AnswerBuffer, &params);
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
472 }
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
473
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
474
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
475 typedef struct
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
476 {
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
477 OrthancPluginRestOutput* output;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
478 OrthancPluginPixelFormat format;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
479 uint32_t width;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
480 uint32_t height;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
481 uint32_t pitch;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
482 const void* buffer;
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
483 } _OrthancPluginCompressAndAnswerPngImage;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
484
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
485 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
486 * @brief Answer to a REST request with a PNG image.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
487 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
488 * This function answers to a REST request with a PNG image. The
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
489 * parameters of this function describe a memory buffer that
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
490 * contains an uncompressed image. The image will be automatically compressed
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
491 * as a PNG image by the core system of Orthanc.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
492 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
493 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
494 * @param output The HTTP connection to the client application.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
495 * @param format The memory layout of the uncompressed image.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
496 * @param width The width of the image.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
497 * @param height The height of the image.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
498 * @param pitch The pitch of the image (i.e. the number of bytes
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
499 * between 2 successive lines of the image in the memory buffer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
500 * @param buffer The memory buffer containing the uncompressed image.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
501 **/
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
502 ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerPngImage(
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
503 OrthancPluginContext* context,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
504 OrthancPluginRestOutput* output,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
505 OrthancPluginPixelFormat format,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
506 uint32_t width,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
507 uint32_t height,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
508 uint32_t pitch,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
509 const void* buffer)
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
510 {
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
511 _OrthancPluginCompressAndAnswerPngImage params;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
512 params.output = output;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
513 params.format = format;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
514 params.width = width;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
515 params.height = height;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
516 params.pitch = pitch;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
517 params.buffer = buffer;
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
518 context->InvokeService(context, _OrthancPluginService_CompressAndAnswerPngImage, &params);
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
519 }
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
520
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
521
913
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
522
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
523 typedef struct
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
524 {
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
525 OrthancPluginMemoryBuffer* target;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
526 const char* instanceId;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
527 } _OrthancPluginGetDicomForInstance;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
528
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
529 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
530 * @brief Retrieve a DICOM instance using its Orthanc identifier.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
531 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
532 * Retrieve a DICOM instance using its Orthanc identifier. The DICOM
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
533 * file is stored into a newly allocated memory buffer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
534 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
535 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
536 * @param target The target memory buffer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
537 * @param instanceId The Orthanc identifier of the DICOM instance of interest.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
538 * @return 0 if success, other value if error.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
539 **/
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
540 ORTHANC_PLUGIN_INLINE int OrthancPluginGetDicomForInstance(
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
541 OrthancPluginContext* context,
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
542 OrthancPluginMemoryBuffer* target,
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
543 const char* instanceId)
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
544 {
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
545 _OrthancPluginGetDicomForInstance params;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
546 params.target = target;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
547 params.instanceId = instanceId;
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
548 return context->InvokeService(context, _OrthancPluginService_GetDicomForInstance, &params);
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
549 }
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
550
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
551
912
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
552
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
553 typedef struct
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
554 {
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
555 OrthancPluginMemoryBuffer* target;
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
556 const char* uri;
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
557 } _OrthancPluginRestApiGet;
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
558
913
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
559 /**
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
560 * @brief Make a GET call to the built-in Orthanc REST API.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
561 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
562 * Make a GET call to the built-in Orthanc REST API. The result to
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
563 * the query is stored into a newly allocated memory buffer.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
564 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
565 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
566 * @param target The target memory buffer.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
567 * @param uri The URI in the built-in Orthanc API.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
568 * @return 0 if success, other value if error.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
569 **/
912
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
570 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiGet(
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
571 OrthancPluginContext* context,
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
572 OrthancPluginMemoryBuffer* target,
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
573 const char* uri)
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
574 {
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
575 _OrthancPluginRestApiGet params;
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
576 params.target = target;
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
577 params.uri = uri;
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
578 return context->InvokeService(context, _OrthancPluginService_RestApiGet, &params);
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
579 }
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
580
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
581
913
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
582
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
583 typedef struct
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
584 {
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
585 OrthancPluginMemoryBuffer* target;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
586 const char* uri;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
587 const char* body;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
588 uint32_t bodySize;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
589 } _OrthancPluginRestApiPostPut;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
590
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
591 /**
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
592 * @brief Make a POST call to the built-in Orthanc REST API.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
593 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
594 * Make a POST call to the built-in Orthanc REST API. The result to
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
595 * the query is stored into a newly allocated memory buffer.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
596 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
597 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
598 * @param target The target memory buffer.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
599 * @param uri The URI in the built-in Orthanc API.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
600 * @param body The body of the POST request.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
601 * @param bodySize The size of the body.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
602 * @return 0 if success, other value if error.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
603 **/
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
604 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiPost(
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
605 OrthancPluginContext* context,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
606 OrthancPluginMemoryBuffer* target,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
607 const char* uri,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
608 const char* body,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
609 uint32_t bodySize)
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
610 {
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
611 _OrthancPluginRestApiPostPut params;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
612 params.target = target;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
613 params.uri = uri;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
614 params.body = body;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
615 params.bodySize = bodySize;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
616 return context->InvokeService(context, _OrthancPluginService_RestApiPost, &params);
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
617 }
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
618
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
619
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
620
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
621 /**
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
622 * @brief Make a DELETE call to the built-in Orthanc REST API.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
623 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
624 * Make a DELETE call to the built-in Orthanc REST API.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
625 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
626 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
627 * @param uri The URI to delete in the built-in Orthanc API.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
628 * @return 0 if success, other value if error.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
629 **/
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
630 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiDelete(
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
631 OrthancPluginContext* context,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
632 const char* uri)
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
633 {
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
634 return context->InvokeService(context, _OrthancPluginService_RestApiDelete, uri);
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
635 }
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
636
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
637
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
638
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
639 /**
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
640 * @brief Make a PUT call to the built-in Orthanc REST API.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
641 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
642 * Make a PUT call to the built-in Orthanc REST API. The result to
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
643 * the query is stored into a newly allocated memory buffer.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
644 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
645 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
646 * @param target The target memory buffer.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
647 * @param uri The URI in the built-in Orthanc API.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
648 * @param body The body of the PUT request.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
649 * @param bodySize The size of the body.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
650 * @return 0 if success, other value if error.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
651 **/
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
652 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiPut(
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
653 OrthancPluginContext* context,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
654 OrthancPluginMemoryBuffer* target,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
655 const char* uri,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
656 const char* body,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
657 uint32_t bodySize)
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
658 {
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
659 _OrthancPluginRestApiPostPut params;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
660 params.target = target;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
661 params.uri = uri;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
662 params.body = body;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
663 params.bodySize = bodySize;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
664 return context->InvokeService(context, _OrthancPluginService_RestApiPut, &params);
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
665 }
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
666
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
667
993
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
668 typedef struct
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
669 {
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
670 OrthancPluginRestOutput* output;
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
671 const char* redirection;
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
672 } _OrthancPluginRedirect;
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
673
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
674 /**
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
675 * @brief Redirect a GET request.
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
676 *
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
677 * This function answers to a REST request by redirecting the user
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
678 * to another URI using HTTP status 301.
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
679 *
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
680 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
681 * @param output The HTTP connection to the client application.
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
682 * @param redirection Where to redirect.
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
683 **/
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
684 ORTHANC_PLUGIN_INLINE void OrthancPluginRedirect(
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
685 OrthancPluginContext* context,
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
686 OrthancPluginRestOutput* output,
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
687 const char* redirection)
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
688 {
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
689 _OrthancPluginRedirect params;
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
690 params.output = output;
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
691 params.redirection = redirection;
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
692 context->InvokeService(context, _OrthancPluginService_Redirect, &params);
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
693 }
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
694
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
695
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
696 #ifdef __cplusplus
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
697 }
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698 #endif
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
699
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
700
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
701 /** @} */
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
702