annotate Plugins/Include/OrthancCPlugin.h @ 1418:efc448de0899

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 23 Jun 2015 09:50:08 +0200
parents d371a66972a4
children 7b7d597a190c
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.
1041
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
11 * The plugin must:
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
12 * - Check its compatibility with the Orthanc version using
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
13 * ::OrthancPluginCheckVersion().
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
14 * - Store the context pointer so that it can use the plugin
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
15 * services of Orthanc.
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
16 * - Register all its REST callbacks using ::OrthancPluginRegisterRestCallback().
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
17 * - Register all its callbacks for received instances using ::OrthancPluginRegisterOnStoredInstanceCallback().
1135
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
18 * - Possibly register a custom storage area using ::OrthancPluginRegisterStorageArea().
1309
8f4487d8f79e new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1303
diff changeset
19 * - Possibly register a custom database back-end area using ::OrthancPluginRegisterDatabaseBackend().
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
20 * -# <tt>void OrthancPluginFinalize()</tt>:
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
21 * This function is invoked by Orthanc during its shutdown. The plugin
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
22 * must free all its memory.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
23 * -# <tt>const char* OrthancPluginGetName()</tt>:
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
24 * The plugin must return a short string to identify itself.
1041
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
25 * -# <tt>const char* OrthancPluginGetVersion()</tt>:
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
26 * The plugin must return a string containing its version number.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
27 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
28 * 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
29 * from being loaded twice.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
30 *
1187
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1177
diff changeset
31 * The various callbacks are guaranteed to be executed in mutual
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1177
diff changeset
32 * exclusion since Orthanc 0.8.5.
906
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
33 **/
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
34
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
35
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
36
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
37 /**
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
38 * @defgroup CInterface C Interface
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
39 * @brief The C interface to create Orthanc plugins.
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
40 *
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
41 * These functions must be used to create C plugins for Orthanc.
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
42 **/
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
43
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
44
906
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
45
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 /**
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 * Orthanc - A Lightweight, RESTful DICOM Store
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1282
diff changeset
48 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1282
diff changeset
49 * Department, University Hospital of Liege, Belgium
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 *
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 * This program is free software: you can redistribute it and/or
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 * modify it under the terms of the GNU General Public License as
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 * published by the Free Software Foundation, either version 3 of the
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 * License, or (at your option) any later version.
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 *
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 * In addition, as a special exception, the copyright holders of this
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 * program give permission to link the code of its release with the
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 * OpenSSL project's "OpenSSL" library (or with modified versions of it
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 * that use the same license as the "OpenSSL" library), and distribute
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 * the linked executables. You must obey the GNU General Public License
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 * 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
62 * modify file(s) with this exception, you may extend this exception to
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 * 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
64 * 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
65 * version. If you delete this exception statement from all source files
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 * in the program, then also delete it here.
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 *
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 * 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
69 * WITHOUT ANY WARRANTY; without even the implied warranty of
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 * General Public License for more details.
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 *
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 * You should have received a copy of the GNU General Public License
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 **/
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
906
cbc0ea03dffe sample plugin configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 904
diff changeset
78
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 #pragma once
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
82 #include <stdio.h>
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
83 #include <string.h>
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
84
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 #ifdef WIN32
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 #define ORTHANC_PLUGINS_API __declspec(dllexport)
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 #else
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 #define ORTHANC_PLUGINS_API
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 #endif
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
1039
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
91 #define ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER 0
1407
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
92 #define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER 9
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
93 #define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 0
1039
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
94
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
96
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 ** Check that function inlining is properly supported. The use of
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
99 ** inlining is required, to avoid the duplication of object code
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
100 ** between two compilation modules that would use the Orthanc Plugin
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
101 ** API.
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
102 ********************************************************************/
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
103
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
104 /* 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
105 automatically and that your compiler is known to properly support
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
106 inlining, uncomment the following #define and adapt the definition
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
107 of "static inline". */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
108
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
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
111 #ifndef ORTHANC_PLUGIN_INLINE
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
112 # if __STDC_VERSION__ >= 199901L
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
113 /* 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
114 # define ORTHANC_PLUGIN_INLINE static inline
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
115 # elif defined(__cplusplus)
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
116 /* This is C++ */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
117 # define ORTHANC_PLUGIN_INLINE static inline
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
118 # elif defined(__GNUC__)
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
119 /* This is GCC running in C89 mode */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
120 # define ORTHANC_PLUGIN_INLINE static __inline
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
121 # elif defined(_MSC_VER)
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
122 /* This is Visual Studio running in C89 mode */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
123 # define ORTHANC_PLUGIN_INLINE static __inline
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
124 # else
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
125 # 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
126 # endif
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
127 #endif
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
128
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
129
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
130
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
131 /********************************************************************
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
132 ** Inclusion of standard libraries.
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
1322
f497a72d9f71 fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1313
diff changeset
135 /**
f497a72d9f71 fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1313
diff changeset
136 * For Microsoft Visual Studio, a compatibility "stdint.h" can be
f497a72d9f71 fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1313
diff changeset
137 * downloaded at the following URL:
f497a72d9f71 fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1313
diff changeset
138 * https://orthanc.googlecode.com/hg/Resources/ThirdParty/VisualStudio/stdint.h
f497a72d9f71 fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1313
diff changeset
139 **/
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
140 #include <stdint.h>
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
141
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 #include <stdlib.h>
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
145
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
146 /********************************************************************
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
147 ** Definition of the Orthanc Plugin API.
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
148 ********************************************************************/
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
149
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
150 /** @{ */
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
151
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 #ifdef __cplusplus
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 extern "C"
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 {
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 #endif
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
157 /**
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
158 * Forward declaration of one of the mandatory functions for Orthanc
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
159 * plugins.
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
160 **/
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
161 ORTHANC_PLUGINS_API const char* OrthancPluginGetName();
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
162
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
163
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
164 /**
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
165 * The various HTTP methods for a REST call.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
166 **/
894
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
167 typedef enum
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
168 {
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
169 OrthancPluginHttpMethod_Get = 1, /*!< GET request */
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
170 OrthancPluginHttpMethod_Post = 2, /*!< POST request */
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
171 OrthancPluginHttpMethod_Put = 3, /*!< PUT request */
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
172 OrthancPluginHttpMethod_Delete = 4 /*!< DELETE request */
896
c4053ac5db04 better plugni api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 894
diff changeset
173 } OrthancPluginHttpMethod;
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
175
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 * @brief The parameters of a REST request.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
178 **/
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
179 typedef struct
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
180 {
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
181 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
182 * @brief The HTTP method.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
183 **/
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
184 OrthancPluginHttpMethod method;
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
185
907
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 * @brief The number of groups of the regular expression.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
188 **/
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
189 uint32_t groupsCount;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
190
907
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 * @brief The matched values for the groups of the regular expression.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
193 **/
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
194 const char* const* groups;
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
195
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 * @brief For a GET request, the number of GET parameters.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
198 **/
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
199 uint32_t getCount;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
200
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
201 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
202 * @brief For a GET request, the keys of the GET parameters.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
203 **/
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
204 const char* const* getKeys;
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
205
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
206 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
207 * @brief For a GET request, the values of the GET parameters.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
208 **/
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
209 const char* const* getValues;
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
210
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
211 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
212 * @brief For a PUT or POST request, the content of the body.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
213 **/
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
214 const char* body;
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
215
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
216 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
217 * @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
218 **/
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
219 uint32_t bodySize;
1041
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
220
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
221
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
222 /* --------------------------------------------------
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
223 New in version 0.8.1
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
224 -------------------------------------------------- */
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
225
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
226 /**
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
227 * @brief The number of HTTP headers.
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
228 **/
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
229 uint32_t headersCount;
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
230
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
231 /**
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
232 * @brief The keys of the HTTP headers (always converted to low-case).
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
233 **/
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
234 const char* const* headersKeys;
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
235
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
236 /**
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
237 * @brief The values of the HTTP headers.
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
238 **/
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
239 const char* const* headersValues;
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
240
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
241 } OrthancPluginHttpRequest;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
242
1041
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
243
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
244 typedef enum
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 {
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
246 /* Generic services */
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
247 _OrthancPluginService_LogInfo = 1,
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
248 _OrthancPluginService_LogWarning = 2,
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
249 _OrthancPluginService_LogError = 3,
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
250 _OrthancPluginService_GetOrthancPath = 4,
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
251 _OrthancPluginService_GetOrthancDirectory = 5,
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
252 _OrthancPluginService_GetConfigurationPath = 6,
1249
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
253 _OrthancPluginService_SetPluginProperty = 7,
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
254 _OrthancPluginService_GetGlobalProperty = 8,
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
255 _OrthancPluginService_SetGlobalProperty = 9,
1280
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
256 _OrthancPluginService_GetCommandLineArgumentsCount = 10,
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
257 _OrthancPluginService_GetCommandLineArgument = 11,
1407
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
258 _OrthancPluginService_GetExpectedDatabaseVersion = 12,
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
259
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
260 /* Registration of callbacks */
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
261 _OrthancPluginService_RegisterRestCallback = 1000,
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
262 _OrthancPluginService_RegisterOnStoredInstanceCallback = 1001,
1135
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
263 _OrthancPluginService_RegisterStorageArea = 1002,
1177
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
264 _OrthancPluginService_RegisterOnChangeCallback = 1003,
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
265
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
266 /* Sending answers to REST calls */
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
267 _OrthancPluginService_AnswerBuffer = 2000,
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
268 _OrthancPluginService_CompressAndAnswerPngImage = 2001,
993
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
269 _OrthancPluginService_Redirect = 2002,
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
270 _OrthancPluginService_SendHttpStatusCode = 2003,
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
271 _OrthancPluginService_SendUnauthorized = 2004,
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
272 _OrthancPluginService_SendMethodNotAllowed = 2005,
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
273 _OrthancPluginService_SetCookie = 2006,
1137
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
274 _OrthancPluginService_SetHttpHeader = 2007,
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
275
912
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
276 /* Access to the Orthanc database and API */
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
277 _OrthancPluginService_GetDicomForInstance = 3000,
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
278 _OrthancPluginService_RestApiGet = 3001,
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
279 _OrthancPluginService_RestApiPost = 3002,
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
280 _OrthancPluginService_RestApiDelete = 3003,
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
281 _OrthancPluginService_RestApiPut = 3004,
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
282 _OrthancPluginService_LookupPatient = 3005,
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
283 _OrthancPluginService_LookupStudy = 3006,
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
284 _OrthancPluginService_LookupSeries = 3007,
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
285 _OrthancPluginService_LookupInstance = 3008,
1069
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
286 _OrthancPluginService_LookupStudyWithAccessionNumber = 3009,
1282
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
287 _OrthancPluginService_RestApiGetAfterPlugins = 3010,
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
288 _OrthancPluginService_RestApiPostAfterPlugins = 3011,
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
289 _OrthancPluginService_RestApiDeleteAfterPlugins = 3012,
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
290 _OrthancPluginService_RestApiPutAfterPlugins = 3013,
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
291
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
292 /* Access to DICOM instances */
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
293 _OrthancPluginService_GetInstanceRemoteAet = 4000,
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
294 _OrthancPluginService_GetInstanceSize = 4001,
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
295 _OrthancPluginService_GetInstanceData = 4002,
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
296 _OrthancPluginService_GetInstanceJson = 4003,
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
297 _OrthancPluginService_GetInstanceSimplifiedJson = 4004,
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
298 _OrthancPluginService_HasInstanceMetadata = 4005,
1309
8f4487d8f79e new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1303
diff changeset
299 _OrthancPluginService_GetInstanceMetadata = 4006,
8f4487d8f79e new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1303
diff changeset
300
8f4487d8f79e new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1303
diff changeset
301 /* Services for plugins implementing a database back-end */
8f4487d8f79e new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1303
diff changeset
302 _OrthancPluginService_RegisterDatabaseBackend = 5000,
8f4487d8f79e new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1303
diff changeset
303 _OrthancPluginService_DatabaseAnswer = 5001
8f4487d8f79e new files for custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1303
diff changeset
304
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
305 } _OrthancPluginService;
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
306
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
307
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
308 typedef enum
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
309 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
310 _OrthancPluginProperty_Description = 1,
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
311 _OrthancPluginProperty_RootUri = 2,
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
312 _OrthancPluginProperty_OrthancExplorer = 3
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
313 } _OrthancPluginProperty;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
314
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
315
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
316
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
317 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
318 * 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
319 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
320 typedef enum
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
321 {
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
322 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
323 * @brief Graylevel 8bpp image.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
324 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
325 * 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
326 * one byte.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
327 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
328 OrthancPluginPixelFormat_Grayscale8 = 1,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
329
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
330 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
331 * @brief Graylevel, unsigned 16bpp image.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
332 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
333 * 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
334 * two bytes.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
335 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
336 OrthancPluginPixelFormat_Grayscale16 = 2,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
337
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
338 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
339 * @brief Graylevel, signed 16bpp image.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
340 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
341 * 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
342 * bytes.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
343 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
344 OrthancPluginPixelFormat_SignedGrayscale16 = 3,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
345
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
346 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
347 * @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
348 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
349 * 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
350 * 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
351 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
352 OrthancPluginPixelFormat_RGB24 = 4,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
353
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
354 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
355 * @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
356 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
357 * 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
358 * 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
359 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
360 OrthancPluginPixelFormat_RGBA32 = 5
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
361 } OrthancPluginPixelFormat;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
362
894
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
363
1135
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
364
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
365 /**
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
366 * The content types that are supported by Orthanc plugins.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
367 **/
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
368 typedef enum
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
369 {
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
370 OrthancPluginContentType_Unknown = 0, /*!< Unknown content type */
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
371 OrthancPluginContentType_Dicom = 1, /*!< DICOM */
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
372 OrthancPluginContentType_DicomAsJson = 2 /*!< JSON summary of a DICOM file */
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
373 } OrthancPluginContentType;
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
374
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
375
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
376
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
377 /**
1177
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
378 * The supported type of DICOM resources.
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
379 **/
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
380 typedef enum
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
381 {
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
382 OrthancPluginResourceType_Patient = 0, /*!< Patient */
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
383 OrthancPluginResourceType_Study = 1, /*!< Study */
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
384 OrthancPluginResourceType_Series = 2, /*!< Series */
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
385 OrthancPluginResourceType_Instance = 3 /*!< Instance */
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
386 } OrthancPluginResourceType;
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
387
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
388
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
389
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
390 /**
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
391 * The supported type of changes that can happen to DICOM resources.
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
392 **/
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
393 typedef enum
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
394 {
1198
1169528a9a5f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1189
diff changeset
395 OrthancPluginChangeType_CompletedSeries = 0, /*!< Series is now complete */
1169528a9a5f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1189
diff changeset
396 OrthancPluginChangeType_Deleted = 1, /*!< Deleted resource */
1169528a9a5f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1189
diff changeset
397 OrthancPluginChangeType_NewChildInstance = 2, /*!< A new instance was added to this resource */
1169528a9a5f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1189
diff changeset
398 OrthancPluginChangeType_NewInstance = 3, /*!< New instance received */
1169528a9a5f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1189
diff changeset
399 OrthancPluginChangeType_NewPatient = 4, /*!< New patient created */
1169528a9a5f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1189
diff changeset
400 OrthancPluginChangeType_NewSeries = 5, /*!< New series created */
1169528a9a5f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1189
diff changeset
401 OrthancPluginChangeType_NewStudy = 6, /*!< New study created */
1169528a9a5f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1189
diff changeset
402 OrthancPluginChangeType_StablePatient = 7, /*!< Timeout: No new instance in this patient */
1169528a9a5f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1189
diff changeset
403 OrthancPluginChangeType_StableSeries = 8, /*!< Timeout: No new instance in this series */
1169528a9a5f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1189
diff changeset
404 OrthancPluginChangeType_StableStudy = 9 /*!< Timeout: No new instance in this study */
1177
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
405 } OrthancPluginChangeType;
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
406
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
407
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
408
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
409 /**
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
410 * @brief A memory buffer allocated by the core system of Orthanc.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
411 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
412 * A memory buffer allocated by the core system of Orthanc. When the
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
413 * 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
414 * call to ::OrthancPluginFreeMemoryBuffer().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
415 **/
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
416 typedef struct
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
417 {
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
418 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
419 * @brief The content of the buffer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
420 **/
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
421 void* data;
907
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 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
424 * @brief The number of bytes in the buffer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
425 **/
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
426 uint32_t size;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
427 } OrthancPluginMemoryBuffer;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
428
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
429
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
430
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
431
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
432 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
433 * @brief Opaque structure that represents the HTTP connection to the client application.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
434 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
435 typedef struct _OrthancPluginRestOutput_t OrthancPluginRestOutput;
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
436
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
437
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
438
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
439 /**
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
440 * @brief Opaque structure that represents a DICOM instance received by Orthanc.
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
441 **/
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
442 typedef struct _OrthancPluginDicomInstance_t OrthancPluginDicomInstance;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
443
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
444
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
445
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
446 /**
908
e078ea944089 refactoring HttpOutput
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 907
diff changeset
447 * @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
448 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
449 typedef int32_t (*OrthancPluginRestCallback) (
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
450 OrthancPluginRestOutput* output,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
451 const char* url,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
452 const OrthancPluginHttpRequest* request);
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
453
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
454
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
455
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
456 /**
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
457 * @brief Signature of a callback function that is triggered when Orthanc receives a DICOM instance.
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
458 **/
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
459 typedef int32_t (*OrthancPluginOnStoredInstanceCallback) (
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
460 OrthancPluginDicomInstance* instance,
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
461 const char* instanceId);
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
462
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
463
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
464
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
465 /**
1177
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
466 * @brief Signature of a callback function that is triggered when a change happens to some DICOM resource.
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
467 **/
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
468 typedef int32_t (*OrthancPluginOnChangeCallback) (
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
469 OrthancPluginChangeType changeType,
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
470 OrthancPluginResourceType resourceType,
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
471 const char* resourceId);
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
472
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
473
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
474
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
475 /**
1135
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
476 * @brief Signature of a function to free dynamic memory.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
477 **/
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
478 typedef void (*OrthancPluginFree) (void* buffer);
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
479
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
480
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
481
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
482 /**
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
483 * @brief Callback for writing to the storage area.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
484 *
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
485 * Signature of a callback function that is triggered when Orthanc writes a file to the storage area.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
486 *
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
487 * @param uuid The UUID of the file.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
488 * @param content The content of the file.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
489 * @param size The size of the file.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
490 * @param type The content type corresponding to this file.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
491 * @return 0 if success, other value if error.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
492 **/
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
493 typedef int32_t (*OrthancPluginStorageCreate) (
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
494 const char* uuid,
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
495 const void* content,
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
496 int64_t size,
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
497 OrthancPluginContentType type);
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
498
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
499
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
500
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
501 /**
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
502 * @brief Callback for reading from the storage area.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
503 *
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
504 * Signature of a callback function that is triggered when Orthanc reads a file from the storage area.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
505 *
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
506 * @param content The content of the file (output).
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
507 * @param size The size of the file (output).
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
508 * @param uuid The UUID of the file of interest.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
509 * @param type The content type corresponding to this file.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
510 * @return 0 if success, other value if error.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
511 **/
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
512 typedef int32_t (*OrthancPluginStorageRead) (
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
513 void** content,
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
514 int64_t* size,
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
515 const char* uuid,
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
516 OrthancPluginContentType type);
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
517
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
518
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
519
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
520 /**
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
521 * @brief Callback for removing a file from the storage area.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
522 *
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
523 * Signature of a callback function that is triggered when Orthanc deletes a file from the storage area.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
524 *
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
525 * @param uuid The UUID of the file to be removed.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
526 * @param type The content type corresponding to this file.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
527 * @return 0 if success, other value if error.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
528 **/
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
529 typedef int32_t (*OrthancPluginStorageRemove) (
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
530 const char* uuid,
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
531 OrthancPluginContentType type);
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
532
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
533
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
534
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
535 /**
1297
501432928727 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1295
diff changeset
536 * @brief Data structure that contains information about the Orthanc core.
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
537 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
538 typedef struct _OrthancPluginContext_t
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
539 {
1135
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
540 void* pluginsManager;
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
541 const char* orthancVersion;
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
542 OrthancPluginFree Free;
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
543 int32_t (*InvokeService) (struct _OrthancPluginContext_t* context,
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
544 _OrthancPluginService service,
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
545 const void* params);
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
546 } OrthancPluginContext;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
547
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
549
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
550 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
551 * @brief Free a string.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
552 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
553 * Free a string that was allocated by the core system of Orthanc.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
554 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
555 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
556 * @param str The string to be freed.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
557 **/
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
558 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeString(
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
559 OrthancPluginContext* context,
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
560 char* str)
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
561 {
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
562 if (str != NULL)
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
563 {
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
564 context->Free(str);
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
565 }
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
566 }
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
567
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
568
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
569 /**
1041
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
570 * @brief Check the compatibility of the plugin wrt. the version of its hosting Orthanc.
1039
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
571 *
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
572 * This function checks whether the version of this C header is
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
573 * compatible with the current version of Orthanc. The result of
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
574 * this function should always be checked in the
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
575 * OrthancPluginInitialize() entry point of the plugin.
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
576 *
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
577 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
578 * @return 1 if and only if the versions are compatible. If the
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
579 * result is 0, the initialization of the plugin should fail.
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
580 **/
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
581 ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersion(
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
582 OrthancPluginContext* context)
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
583 {
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
584 int major, minor, revision;
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
585
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
586 /* Assume compatibility with the mainline */
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
587 if (!strcmp(context->orthancVersion, "mainline"))
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
588 {
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
589 return 1;
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
590 }
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
591
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
592 /* Parse the version of the Orthanc core */
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
593 if (
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
594 #ifdef _MSC_VER
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
595 sscanf_s
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
596 #else
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
597 sscanf
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
598 #endif
1303
bba8a47922d1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1297
diff changeset
599 (context->orthancVersion, "%4d.%4d.%4d", &major, &minor, &revision) != 3)
1039
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
600 {
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
601 return 0;
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
602 }
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
603
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
604 /* Check the major number of the version */
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
605
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
606 if (major > ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER)
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
607 {
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
608 return 1;
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
609 }
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
610
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
611 if (major < ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER)
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
612 {
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
613 return 0;
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
614 }
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
615
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
616 /* Check the minor number of the version */
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
617
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
618 if (minor > ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER)
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
619 {
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
620 return 1;
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
621 }
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
622
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
623 if (minor < ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER)
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
624 {
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
625 return 0;
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
626 }
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
627
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
628 /* Check the revision number of the version */
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
629
1040
d06186cdc502 check plugin version in samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1039
diff changeset
630 if (revision >= ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER)
1039
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
631 {
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
632 return 1;
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
633 }
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
634 else
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
635 {
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
636 return 0;
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
637 }
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
638 }
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
639
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
640
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1037
diff changeset
641 /**
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
642 * @brief Free a memory buffer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
643 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
644 * 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
645 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
646 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
647 * @param buffer The memory buffer to release.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
648 **/
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
649 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeMemoryBuffer(
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
650 OrthancPluginContext* context,
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
651 OrthancPluginMemoryBuffer* buffer)
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
652 {
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
653 context->Free(buffer->data);
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
654 }
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
655
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
656
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
657 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
658 * @brief Log an error.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
659 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
660 * Log an error message using the Orthanc logging system.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
661 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
662 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
663 * @param message The message to be logged.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
664 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
665 ORTHANC_PLUGIN_INLINE void OrthancPluginLogError(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
666 OrthancPluginContext* context,
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
667 const char* message)
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
668 {
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
669 context->InvokeService(context, _OrthancPluginService_LogError, message);
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
670 }
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
671
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
672
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
673 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
674 * @brief Log a warning.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
675 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
676 * Log a warning message using the Orthanc logging system.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
677 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
678 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
679 * @param message The message to be logged.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
680 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
681 ORTHANC_PLUGIN_INLINE void OrthancPluginLogWarning(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
682 OrthancPluginContext* context,
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
683 const char* message)
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
684 {
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
685 context->InvokeService(context, _OrthancPluginService_LogWarning, message);
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
686 }
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
687
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
688
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
689 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
690 * @brief Log an information.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
691 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
692 * Log an information message using the Orthanc logging system.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
693 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
694 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
695 * @param message The message to be logged.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
696 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
697 ORTHANC_PLUGIN_INLINE void OrthancPluginLogInfo(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
698 OrthancPluginContext* context,
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
699 const char* message)
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
700 {
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
701 context->InvokeService(context, _OrthancPluginService_LogInfo, message);
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
702 }
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
703
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
704
913
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
705
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
706 typedef struct
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
707 {
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
708 const char* pathRegularExpression;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
709 OrthancPluginRestCallback callback;
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
710 } _OrthancPluginRestCallback;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
711
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
712 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
713 * @brief Register a REST callback.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
714 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
715 * This function registers a REST callback against a regular
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
716 * expression for a URI. This function must be called during the
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
717 * initialization of the plugin, i.e. inside the
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
718 * OrthancPluginInitialize() public function.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
719 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
720 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
721 * @param pathRegularExpression Regular expression for the URI. May contain groups.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
722 * @param callback The callback function to handle the REST call.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
723 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
724 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallback(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
725 OrthancPluginContext* context,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
726 const char* pathRegularExpression,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
727 OrthancPluginRestCallback callback)
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
728 {
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
729 _OrthancPluginRestCallback params;
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
730 params.pathRegularExpression = pathRegularExpression;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
731 params.callback = callback;
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
732 context->InvokeService(context, _OrthancPluginService_RegisterRestCallback, &params);
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
733 }
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
734
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
735
913
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
736
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
737 typedef struct
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
738 {
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
739 OrthancPluginOnStoredInstanceCallback callback;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
740 } _OrthancPluginOnStoredInstanceCallback;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
741
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
742 /**
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
743 * @brief Register a callback for received instances.
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
744 *
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
745 * This function registers a callback function that is called
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
746 * whenever a new DICOM instance is stored into the Orthanc core.
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
747 *
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
748 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
749 * @param callback The callback function.
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
750 **/
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
751 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnStoredInstanceCallback(
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
752 OrthancPluginContext* context,
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
753 OrthancPluginOnStoredInstanceCallback callback)
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
754 {
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
755 _OrthancPluginOnStoredInstanceCallback params;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
756 params.callback = callback;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
757
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
758 context->InvokeService(context, _OrthancPluginService_RegisterOnStoredInstanceCallback, &params);
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
759 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
760
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
761
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
762
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
763 typedef struct
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
764 {
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
765 OrthancPluginRestOutput* output;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
766 const char* answer;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
767 uint32_t answerSize;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
768 const char* mimeType;
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
769 } _OrthancPluginAnswerBuffer;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
770
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
771 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
772 * @brief Answer to a REST request.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
773 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
774 * 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
775 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
776 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
777 * @param output The HTTP connection to the client application.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
778 * @param answer Pointer to the memory buffer containing the answer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
779 * @param answerSize Number of bytes of the answer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
780 * @param mimeType The MIME type of the answer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
781 **/
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
782 ORTHANC_PLUGIN_INLINE void OrthancPluginAnswerBuffer(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
783 OrthancPluginContext* context,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
784 OrthancPluginRestOutput* output,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
785 const char* answer,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
786 uint32_t answerSize,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
787 const char* mimeType)
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
788 {
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
789 _OrthancPluginAnswerBuffer params;
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
790 params.output = output;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
791 params.answer = answer;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
792 params.answerSize = answerSize;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
793 params.mimeType = mimeType;
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
794 context->InvokeService(context, _OrthancPluginService_AnswerBuffer, &params);
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
795 }
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
796
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
797
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
798 typedef struct
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
799 {
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
800 OrthancPluginRestOutput* output;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
801 OrthancPluginPixelFormat format;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
802 uint32_t width;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
803 uint32_t height;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
804 uint32_t pitch;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
805 const void* buffer;
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
806 } _OrthancPluginCompressAndAnswerPngImage;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
807
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
808 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
809 * @brief Answer to a REST request with a PNG image.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
810 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
811 * This function answers to a REST request with a PNG image. The
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
812 * parameters of this function describe a memory buffer that
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
813 * contains an uncompressed image. The image will be automatically compressed
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
814 * as a PNG image by the core system of Orthanc.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
815 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
816 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
817 * @param output The HTTP connection to the client application.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
818 * @param format The memory layout of the uncompressed image.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
819 * @param width The width of the image.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
820 * @param height The height of the image.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
821 * @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
822 * between 2 successive lines of the image in the memory buffer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
823 * @param buffer The memory buffer containing the uncompressed image.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
824 **/
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
825 ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerPngImage(
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
826 OrthancPluginContext* context,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
827 OrthancPluginRestOutput* output,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
828 OrthancPluginPixelFormat format,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
829 uint32_t width,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
830 uint32_t height,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
831 uint32_t pitch,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
832 const void* buffer)
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
833 {
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
834 _OrthancPluginCompressAndAnswerPngImage params;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
835 params.output = output;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
836 params.format = format;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
837 params.width = width;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
838 params.height = height;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
839 params.pitch = pitch;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
840 params.buffer = buffer;
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
841 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
842 }
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
843
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
844
913
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
845
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
846 typedef struct
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
847 {
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
848 OrthancPluginMemoryBuffer* target;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
849 const char* instanceId;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
850 } _OrthancPluginGetDicomForInstance;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
851
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
852 /**
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
853 * @brief Retrieve a DICOM instance using its Orthanc identifier.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
854 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
855 * Retrieve a DICOM instance using its Orthanc identifier. The DICOM
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
856 * file is stored into a newly allocated memory buffer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
857 *
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
858 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
859 * @param target The target memory buffer.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
860 * @param instanceId The Orthanc identifier of the DICOM instance of interest.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
861 * @return 0 if success, other value if error.
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
862 **/
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
863 ORTHANC_PLUGIN_INLINE int OrthancPluginGetDicomForInstance(
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
864 OrthancPluginContext* context,
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
865 OrthancPluginMemoryBuffer* target,
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
866 const char* instanceId)
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
867 {
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
868 _OrthancPluginGetDicomForInstance params;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
869 params.target = target;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
870 params.instanceId = instanceId;
907
9b8298234254 documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 906
diff changeset
871 return context->InvokeService(context, _OrthancPluginService_GetDicomForInstance, &params);
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
872 }
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
873
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
874
912
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
875
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
876 typedef struct
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
877 {
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
878 OrthancPluginMemoryBuffer* target;
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
879 const char* uri;
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
880 } _OrthancPluginRestApiGet;
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
881
913
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
882 /**
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
883 * @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
884 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
885 * 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
886 * 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
887 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
888 * @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
889 * @param target The target memory buffer.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
890 * @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
891 * @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
892 **/
912
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
893 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiGet(
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
894 OrthancPluginContext* context,
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
895 OrthancPluginMemoryBuffer* target,
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
896 const char* uri)
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
897 {
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
898 _OrthancPluginRestApiGet params;
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
899 params.target = target;
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
900 params.uri = uri;
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
901 return context->InvokeService(context, _OrthancPluginService_RestApiGet, &params);
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
902 }
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
903
dcb2469f00f4 PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 908
diff changeset
904
913
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
905
1282
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
906 /**
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
907 * @brief Make a GET call to the REST API, as tainted by the plugins.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
908 *
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
909 * Make a GET call to the Orthanc REST API, after all the plugins
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
910 * are applied. In other words, if some plugin overrides or adds the
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
911 * called URI to the built-in Orthanc REST API, this call will
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
912 * return the result provided by this plugin. The result to the
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
913 * query is stored into a newly allocated memory buffer.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
914 *
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
915 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
916 * @param target The target memory buffer.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
917 * @param uri The URI in the built-in Orthanc API.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
918 * @return 0 if success, other value if error.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
919 **/
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
920 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiGetAfterPlugins(
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
921 OrthancPluginContext* context,
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
922 OrthancPluginMemoryBuffer* target,
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
923 const char* uri)
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
924 {
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
925 _OrthancPluginRestApiGet params;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
926 params.target = target;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
927 params.uri = uri;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
928 return context->InvokeService(context, _OrthancPluginService_RestApiGetAfterPlugins, &params);
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
929 }
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
930
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
931
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
932
913
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
933 typedef struct
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
934 {
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
935 OrthancPluginMemoryBuffer* target;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
936 const char* uri;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
937 const char* body;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
938 uint32_t bodySize;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
939 } _OrthancPluginRestApiPostPut;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
940
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
941 /**
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
942 * @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
943 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
944 * 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
945 * 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
946 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
947 * @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
948 * @param target The target memory buffer.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
949 * @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
950 * @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
951 * @param bodySize The size of the body.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
952 * @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
953 **/
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
954 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiPost(
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
955 OrthancPluginContext* context,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
956 OrthancPluginMemoryBuffer* target,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
957 const char* uri,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
958 const char* body,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
959 uint32_t bodySize)
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
960 {
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
961 _OrthancPluginRestApiPostPut params;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
962 params.target = target;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
963 params.uri = uri;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
964 params.body = body;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
965 params.bodySize = bodySize;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
966 return context->InvokeService(context, _OrthancPluginService_RestApiPost, &params);
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
967 }
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
968
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
969
1282
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
970 /**
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
971 * @brief Make a POST call to the REST API, as tainted by the plugins.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
972 *
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
973 * Make a POST call to the Orthanc REST API, after all the plugins
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
974 * are applied. In other words, if some plugin overrides or adds the
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
975 * called URI to the built-in Orthanc REST API, this call will
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
976 * return the result provided by this plugin. The result to the
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
977 * query is stored into a newly allocated memory buffer.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
978 *
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
979 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
980 * @param target The target memory buffer.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
981 * @param uri The URI in the built-in Orthanc API.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
982 * @param body The body of the POST request.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
983 * @param bodySize The size of the body.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
984 * @return 0 if success, other value if error.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
985 **/
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
986 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiPostAfterPlugins(
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
987 OrthancPluginContext* context,
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
988 OrthancPluginMemoryBuffer* target,
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
989 const char* uri,
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
990 const char* body,
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
991 uint32_t bodySize)
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
992 {
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
993 _OrthancPluginRestApiPostPut params;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
994 params.target = target;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
995 params.uri = uri;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
996 params.body = body;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
997 params.bodySize = bodySize;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
998 return context->InvokeService(context, _OrthancPluginService_RestApiPostAfterPlugins, &params);
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
999 }
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1000
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1001
913
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1002
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1003 /**
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1004 * @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
1005 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1006 * 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
1007 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1008 * @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
1009 * @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
1010 * @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
1011 **/
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1012 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiDelete(
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1013 OrthancPluginContext* context,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1014 const char* uri)
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1015 {
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1016 return context->InvokeService(context, _OrthancPluginService_RestApiDelete, uri);
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1017 }
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1018
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1019
1282
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1020 /**
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1021 * @brief Make a DELETE call to the REST API, as tainted by the plugins.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1022 *
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1023 * Make a DELETE call to the Orthanc REST API, after all the plugins
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1024 * are applied. In other words, if some plugin overrides or adds the
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1025 * called URI to the built-in Orthanc REST API, this call will
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1026 * return the result provided by this plugin.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1027 *
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1028 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1029 * @param uri The URI to delete in the built-in Orthanc API.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1030 * @return 0 if success, other value if error.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1031 **/
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1032 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiDeleteAfterPlugins(
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1033 OrthancPluginContext* context,
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1034 const char* uri)
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1035 {
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1036 return context->InvokeService(context, _OrthancPluginService_RestApiDeleteAfterPlugins, uri);
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1037 }
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1038
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1039
913
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1040
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1041 /**
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1042 * @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
1043 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1044 * 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
1045 * 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
1046 *
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1047 * @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
1048 * @param target The target memory buffer.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1049 * @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
1050 * @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
1051 * @param bodySize The size of the body.
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1052 * @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
1053 **/
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1054 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiPut(
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1055 OrthancPluginContext* context,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1056 OrthancPluginMemoryBuffer* target,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1057 const char* uri,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1058 const char* body,
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1059 uint32_t bodySize)
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1060 {
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1061 _OrthancPluginRestApiPostPut params;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1062 params.target = target;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1063 params.uri = uri;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1064 params.body = body;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1065 params.bodySize = bodySize;
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1066 return context->InvokeService(context, _OrthancPluginService_RestApiPut, &params);
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1067 }
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1068
3e43de893d88 POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
1069
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1070
1282
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1071 /**
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1072 * @brief Make a PUT call to the REST API, as tainted by the plugins.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1073 *
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1074 * Make a PUT call to the Orthanc REST API, after all the plugins
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1075 * are applied. In other words, if some plugin overrides or adds the
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1076 * called URI to the built-in Orthanc REST API, this call will
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1077 * return the result provided by this plugin. The result to the
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1078 * query is stored into a newly allocated memory buffer.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1079 *
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1080 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1081 * @param target The target memory buffer.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1082 * @param uri The URI in the built-in Orthanc API.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1083 * @param body The body of the PUT request.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1084 * @param bodySize The size of the body.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1085 * @return 0 if success, other value if error.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1086 **/
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1087 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiPutAfterPlugins(
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1088 OrthancPluginContext* context,
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1089 OrthancPluginMemoryBuffer* target,
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1090 const char* uri,
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1091 const char* body,
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1092 uint32_t bodySize)
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1093 {
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1094 _OrthancPluginRestApiPostPut params;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1095 params.target = target;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1096 params.uri = uri;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1097 params.body = body;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1098 params.bodySize = bodySize;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1099 return context->InvokeService(context, _OrthancPluginService_RestApiPutAfterPlugins, &params);
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1100 }
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1101
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1102
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
1103
993
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1104 typedef struct
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1105 {
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1106 OrthancPluginRestOutput* output;
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1107 const char* argument;
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1108 } _OrthancPluginOutputPlusArgument;
993
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1109
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1110 /**
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1111 * @brief Redirect a REST request.
993
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1112 *
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1113 * 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
1114 * to another URI using HTTP status 301.
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1115 *
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1116 * @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
1117 * @param output The HTTP connection to the client application.
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1118 * @param redirection Where to redirect.
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1119 **/
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1120 ORTHANC_PLUGIN_INLINE void OrthancPluginRedirect(
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1121 OrthancPluginContext* context,
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1122 OrthancPluginRestOutput* output,
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1123 const char* redirection)
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1124 {
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1125 _OrthancPluginOutputPlusArgument params;
993
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1126 params.output = output;
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1127 params.argument = redirection;
993
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1128 context->InvokeService(context, _OrthancPluginService_Redirect, &params);
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1129 }
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1130
501880d76474 improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
1131
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1132
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1133 typedef struct
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1134 {
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1135 char** result;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1136 const char* argument;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1137 } _OrthancPluginRetrieveDynamicString;
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1138
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1139 /**
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1140 * @brief Look for a patient.
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1141 *
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1142 * Look for a patient stored in Orthanc, using its Patient ID tag (0x0010, 0x0020).
1069
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1143 * This function uses the database index to run as fast as possible (it does not loop
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1144 * over all the stored patients).
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1145 *
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1146 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1147 * @param patientID The Patient ID of interest.
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1148 * @return The NULL value if the patient is non-existent, or a string containing the
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1149 * Orthanc ID of the patient. This string must be freed by OrthancPluginFreeString().
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1150 **/
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1151 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupPatient(
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1152 OrthancPluginContext* context,
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1153 const char* patientID)
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1154 {
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1155 char* result;
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1156
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1157 _OrthancPluginRetrieveDynamicString params;
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1158 params.result = &result;
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1159 params.argument = patientID;
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1160
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1161 if (context->InvokeService(context, _OrthancPluginService_LookupPatient, &params))
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1162 {
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1163 /* Error */
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1164 return NULL;
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1165 }
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1166 else
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1167 {
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1168 return result;
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1169 }
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1170 }
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1171
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1172
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1173 /**
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1174 * @brief Look for a study.
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1175 *
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1176 * Look for a study stored in Orthanc, using its Study Instance UID tag (0x0020, 0x000d).
1069
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1177 * This function uses the database index to run as fast as possible (it does not loop
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1178 * over all the stored studies).
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1179 *
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1180 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1181 * @param studyUID The Study Instance UID of interest.
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1182 * @return The NULL value if the study is non-existent, or a string containing the
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1183 * Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1184 **/
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1185 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudy(
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1186 OrthancPluginContext* context,
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1187 const char* studyUID)
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1188 {
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1189 char* result;
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1190
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1191 _OrthancPluginRetrieveDynamicString params;
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1192 params.result = &result;
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1193 params.argument = studyUID;
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1194
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1195 if (context->InvokeService(context, _OrthancPluginService_LookupStudy, &params))
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1196 {
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1197 /* Error */
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1198 return NULL;
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1199 }
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1200 else
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1201 {
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1202 return result;
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1203 }
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1204 }
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1205
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1206
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1207 /**
1069
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1208 * @brief Look for a study, using the accession number.
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1209 *
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1210 * Look for a study stored in Orthanc, using its Accession Number tag (0x0008, 0x0050).
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1211 * This function uses the database index to run as fast as possible (it does not loop
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1212 * over all the stored studies).
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1213 *
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1214 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1215 * @param accessionNumber The Accession Number of interest.
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1216 * @return The NULL value if the study is non-existent, or a string containing the
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1217 * Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1218 **/
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1219 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudyWithAccessionNumber(
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1220 OrthancPluginContext* context,
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1221 const char* accessionNumber)
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1222 {
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1223 char* result;
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1224
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1225 _OrthancPluginRetrieveDynamicString params;
1069
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1226 params.result = &result;
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1227 params.argument = accessionNumber;
1069
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1228
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1229 if (context->InvokeService(context, _OrthancPluginService_LookupStudyWithAccessionNumber, &params))
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1230 {
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1231 /* Error */
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1232 return NULL;
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1233 }
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1234 else
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1235 {
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1236 return result;
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1237 }
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1238 }
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1239
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1240
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1241 /**
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1242 * @brief Look for a series.
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1243 *
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1244 * Look for a series stored in Orthanc, using its Series Instance UID tag (0x0020, 0x000e).
1069
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1245 * This function uses the database index to run as fast as possible (it does not loop
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1246 * over all the stored series).
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1247 *
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1248 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1249 * @param seriesUID The Series Instance UID of interest.
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1250 * @return The NULL value if the series is non-existent, or a string containing the
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1251 * Orthanc ID of the series. This string must be freed by OrthancPluginFreeString().
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1252 **/
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1253 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupSeries(
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1254 OrthancPluginContext* context,
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1255 const char* seriesUID)
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1256 {
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1257 char* result;
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1258
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1259 _OrthancPluginRetrieveDynamicString params;
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1260 params.result = &result;
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1261 params.argument = seriesUID;
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1262
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1263 if (context->InvokeService(context, _OrthancPluginService_LookupSeries, &params))
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1264 {
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1265 /* Error */
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1266 return NULL;
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1267 }
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1268 else
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1269 {
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1270 return result;
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1271 }
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1272 }
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1273
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1274
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1275 /**
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1276 * @brief Look for an instance.
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1277 *
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1278 * Look for an instance stored in Orthanc, using its SOP Instance UID tag (0x0008, 0x0018).
1069
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1279 * This function uses the database index to run as fast as possible (it does not loop
a91b4900f06a plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1068
diff changeset
1280 * over all the stored instances).
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1281 *
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1282 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1283 * @param sopInstanceUID The SOP Instance UID of interest.
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1284 * @return The NULL value if the instance is non-existent, or a string containing the
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1285 * Orthanc ID of the instance. This string must be freed by OrthancPluginFreeString().
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1286 **/
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1287 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupInstance(
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1288 OrthancPluginContext* context,
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1289 const char* sopInstanceUID)
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1290 {
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1291 char* result;
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1292
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1293 _OrthancPluginRetrieveDynamicString params;
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1294 params.result = &result;
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1295 params.argument = sopInstanceUID;
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1296
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1297 if (context->InvokeService(context, _OrthancPluginService_LookupInstance, &params))
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1298 {
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1299 /* Error */
1037
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1300 return NULL;
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1301 }
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1302 else
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1303 {
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1304 return result;
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1305 }
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1306 }
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1307
6208ab500ffd LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1027
diff changeset
1308
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1309
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1310 typedef struct
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1311 {
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1312 OrthancPluginRestOutput* output;
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1313 uint16_t status;
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1314 } _OrthancPluginSendHttpStatusCode;
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1315
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1316 /**
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1317 * @brief Send a HTTP status code.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1318 *
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1319 * This function answers to a REST request by sending a HTTP status
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1320 * code (such as "400 - Bad Request"). Note that:
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1321 * - Successful requests (status 200) must use ::OrthancPluginAnswerBuffer().
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1322 * - Redirections (status 301) must use ::OrthancPluginRedirect().
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1323 * - Unauthorized access (status 401) must use ::OrthancPluginSendUnauthorized().
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1324 * - Methods not allowed (status 405) must use ::OrthancPluginSendMethodNotAllowed().
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1325 *
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1326 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1327 * @param output The HTTP connection to the client application.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1328 * @param status The HTTP status code to be sent.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1329 **/
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1330 ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatusCode(
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1331 OrthancPluginContext* context,
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1332 OrthancPluginRestOutput* output,
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1333 uint16_t status)
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1334 {
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1335 _OrthancPluginSendHttpStatusCode params;
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1336 params.output = output;
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1337 params.status = status;
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1338 context->InvokeService(context, _OrthancPluginService_SendHttpStatusCode, &params);
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1339 }
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1340
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1341
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1342 /**
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1343 * @brief Signal that a REST request is not authorized.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1344 *
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1345 * This function answers to a REST request by signaling that it is
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1346 * not authorized.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1347 *
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1348 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1349 * @param output The HTTP connection to the client application.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1350 * @param realm The realm for the authorization process.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1351 **/
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1352 ORTHANC_PLUGIN_INLINE void OrthancPluginSendUnauthorized(
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1353 OrthancPluginContext* context,
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1354 OrthancPluginRestOutput* output,
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1355 const char* realm)
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1356 {
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1357 _OrthancPluginOutputPlusArgument params;
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1358 params.output = output;
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1359 params.argument = realm;
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1360 context->InvokeService(context, _OrthancPluginService_SendUnauthorized, &params);
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1361 }
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1362
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1363
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1364 /**
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1365 * @brief Signal that this URI does not support this HTTP method.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1366 *
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1367 * This function answers to a REST request by signaling that the
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1368 * queried URI does not support this method.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1369 *
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1370 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1371 * @param output The HTTP connection to the client application.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1372 * @param allowedMethods The allowed methods for this URI (e.g. "GET,POST" after a PUT or a POST request).
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1373 **/
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1374 ORTHANC_PLUGIN_INLINE void OrthancPluginSendMethodNotAllowed(
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1375 OrthancPluginContext* context,
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1376 OrthancPluginRestOutput* output,
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1377 const char* allowedMethods)
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1378 {
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1379 _OrthancPluginOutputPlusArgument params;
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1380 params.output = output;
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1381 params.argument = allowedMethods;
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1382 context->InvokeService(context, _OrthancPluginService_SendMethodNotAllowed, &params);
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1383 }
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1384
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1385
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1386 typedef struct
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1387 {
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1388 OrthancPluginRestOutput* output;
1137
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1389 const char* key;
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1390 const char* value;
1137
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1391 } _OrthancPluginSetHttpHeader;
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1392
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1393 /**
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1394 * @brief Set a cookie.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1395 *
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1396 * This function sets a cookie in the HTTP client.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1397 *
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1398 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1399 * @param output The HTTP connection to the client application.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1400 * @param cookie The cookie to be set.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1401 * @param value The value of the cookie.
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1402 **/
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1403 ORTHANC_PLUGIN_INLINE void OrthancPluginSetCookie(
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1404 OrthancPluginContext* context,
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1405 OrthancPluginRestOutput* output,
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1406 const char* cookie,
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1407 const char* value)
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1408 {
1137
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1409 _OrthancPluginSetHttpHeader params;
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1410 params.output = output;
1137
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1411 params.key = cookie;
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1412 params.value = value;
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1413 context->InvokeService(context, _OrthancPluginService_SetCookie, &params);
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1414 }
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1415
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
1416
1137
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1417 /**
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1418 * @brief Set some HTTP header.
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1419 *
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1420 * This function sets a HTTP header in the HTTP answer.
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1421 *
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1422 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1423 * @param output The HTTP connection to the client application.
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1424 * @param key The HTTP header to be set.
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1425 * @param value The value of the HTTP header.
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1426 **/
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1427 ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpHeader(
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1428 OrthancPluginContext* context,
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1429 OrthancPluginRestOutput* output,
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1430 const char* key,
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1431 const char* value)
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1432 {
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1433 _OrthancPluginSetHttpHeader params;
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1434 params.output = output;
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1435 params.key = key;
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1436 params.value = value;
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1437 context->InvokeService(context, _OrthancPluginService_SetHttpHeader, &params);
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1438 }
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1439
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
1440
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1441 typedef struct
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1442 {
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1443 char** resultStringToFree;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1444 const char** resultString;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1445 int64_t* resultInt64;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1446 const char* key;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1447 OrthancPluginDicomInstance* instance;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1448 } _OrthancPluginAccessDicomInstance;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1449
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1450
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1451 /**
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1452 * @brief Get the AET of a DICOM instance.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1453 *
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1454 * This function returns the Application Entity Title (AET) of the
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1455 * DICOM modality from which a DICOM instance originates.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1456 *
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1457 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1458 * @param instance The instance of interest.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1459 * @return The AET if success, NULL if error.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1460 **/
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1461 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceRemoteAet(
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1462 OrthancPluginContext* context,
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1463 OrthancPluginDicomInstance* instance)
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1464 {
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1465 const char* result;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1466
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1467 _OrthancPluginAccessDicomInstance params;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1468 memset(&params, 0, sizeof(params));
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1469 params.resultString = &result;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1470 params.instance = instance;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1471
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1472 if (context->InvokeService(context, _OrthancPluginService_GetInstanceRemoteAet, &params))
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1473 {
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1474 /* Error */
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1475 return NULL;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1476 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1477 else
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1478 {
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1479 return result;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1480 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1481 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1482
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1483
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1484 /**
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1485 * @brief Get the size of a DICOM file.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1486 *
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1487 * This function returns the number of bytes of the given DICOM instance.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1488 *
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1489 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1490 * @param instance The instance of interest.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1491 * @return The size of the file, -1 in case of error.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1492 **/
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1493 ORTHANC_PLUGIN_INLINE int64_t OrthancPluginGetInstanceSize(
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1494 OrthancPluginContext* context,
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1495 OrthancPluginDicomInstance* instance)
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1496 {
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1497 int64_t size;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1498
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1499 _OrthancPluginAccessDicomInstance params;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1500 memset(&params, 0, sizeof(params));
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1501 params.resultInt64 = &size;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1502 params.instance = instance;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1503
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1504 if (context->InvokeService(context, _OrthancPluginService_GetInstanceSize, &params))
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1505 {
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1506 /* Error */
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1507 return -1;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1508 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1509 else
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1510 {
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1511 return size;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1512 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1513 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1514
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1515
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1516 /**
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1517 * @brief Get the data of a DICOM file.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1518 *
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1519 * This function returns a pointer to the content of the given DICOM instance.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1520 *
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1521 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1522 * @param instance The instance of interest.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1523 * @return The pointer to the DICOM data, NULL in case of error.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1524 **/
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1525 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceData(
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1526 OrthancPluginContext* context,
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1527 OrthancPluginDicomInstance* instance)
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1528 {
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1529 const char* result;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1530
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1531 _OrthancPluginAccessDicomInstance params;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1532 memset(&params, 0, sizeof(params));
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1533 params.resultString = &result;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1534 params.instance = instance;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1535
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1536 if (context->InvokeService(context, _OrthancPluginService_GetInstanceData, &params))
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1537 {
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1538 /* Error */
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1539 return NULL;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1540 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1541 else
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1542 {
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1543 return result;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1544 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1545 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1546
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1547
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1548 /**
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1549 * @brief Get the DICOM tag hierarchy as a JSON file.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1550 *
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1551 * This function returns a pointer to a newly created string
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1552 * containing a JSON file. This JSON file encodes the tag hierarchy
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1553 * of the given DICOM instance.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1554 *
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1555 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1556 * @param instance The instance of interest.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1557 * @return The NULL value in case of error, or a string containing the JSON file.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1558 * This string must be freed by OrthancPluginFreeString().
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1559 **/
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1560 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceJson(
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1561 OrthancPluginContext* context,
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1562 OrthancPluginDicomInstance* instance)
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1563 {
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1564 char* result;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1565
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1566 _OrthancPluginAccessDicomInstance params;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1567 memset(&params, 0, sizeof(params));
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1568 params.resultStringToFree = &result;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1569 params.instance = instance;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1570
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1571 if (context->InvokeService(context, _OrthancPluginService_GetInstanceJson, &params))
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1572 {
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1573 /* Error */
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1574 return NULL;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1575 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1576 else
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1577 {
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1578 return result;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1579 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1580 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1581
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1582
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1583 /**
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1584 * @brief Get the DICOM tag hierarchy as a JSON file (with simplification).
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1585 *
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1586 * This function returns a pointer to a newly created string
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1587 * containing a JSON file. This JSON file encodes the tag hierarchy
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1588 * of the given DICOM instance. In contrast with
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1589 * ::OrthancPluginGetInstanceJson(), the returned JSON file is in
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1590 * its simplified version.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1591 *
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1592 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1593 * @param instance The instance of interest.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1594 * @return The NULL value in case of error, or a string containing the JSON file.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1595 * This string must be freed by OrthancPluginFreeString().
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1596 **/
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1597 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceSimplifiedJson(
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1598 OrthancPluginContext* context,
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1599 OrthancPluginDicomInstance* instance)
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1600 {
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1601 char* result;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1602
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1603 _OrthancPluginAccessDicomInstance params;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1604 memset(&params, 0, sizeof(params));
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1605 params.resultStringToFree = &result;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1606 params.instance = instance;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1607
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1608 if (context->InvokeService(context, _OrthancPluginService_GetInstanceSimplifiedJson, &params))
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1609 {
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1610 /* Error */
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1611 return NULL;
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1612 }
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1613 else
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1614 {
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1615 return result;
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1616 }
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1617 }
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1618
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1619
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1620 /**
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1621 * @brief Check whether a DICOM instance is associated with some metadata.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1622 *
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1623 * This function checks whether the DICOM instance of interest is
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1624 * associated with some metadata. As of Orthanc 0.8.1, in the
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1625 * callbacks registered by
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1626 * ::OrthancPluginRegisterOnStoredInstanceCallback(), the only
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1627 * possibly available metadata are "ReceptionDate", "RemoteAET" and
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1628 * "IndexInSeries".
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1629 *
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1630 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1631 * @param instance The instance of interest.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1632 * @param metadata The metadata of interest.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1633 * @return 1 if the metadata is present, 0 if it is absent, -1 in case of error.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1634 **/
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1635 ORTHANC_PLUGIN_INLINE int OrthancPluginHasInstanceMetadata(
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1636 OrthancPluginContext* context,
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1637 OrthancPluginDicomInstance* instance,
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1638 const char* metadata)
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1639 {
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1640 int64_t result;
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1641
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1642 _OrthancPluginAccessDicomInstance params;
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1643 memset(&params, 0, sizeof(params));
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1644 params.resultInt64 = &result;
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1645 params.instance = instance;
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1646 params.key = metadata;
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1647
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1648 if (context->InvokeService(context, _OrthancPluginService_HasInstanceMetadata, &params))
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1649 {
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1650 /* Error */
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1651 return -1;
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1652 }
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1653 else
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1654 {
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1655 return (result != 0);
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1656 }
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1657 }
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1658
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1659
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1660 /**
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1661 * @brief Get the value of some metadata associated with a given DICOM instance.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1662 *
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1663 * This functions returns the value of some metadata that is associated with the DICOM instance of interest.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1664 * Before calling this function, the existence of the metadata must have been checked with
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1665 * ::OrthancPluginHasInstanceMetadata().
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1666 *
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1667 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1668 * @param instance The instance of interest.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1669 * @param metadata The metadata of interest.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1670 * @return The metadata value if success, NULL if error.
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1671 **/
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1672 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceMetadata(
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1673 OrthancPluginContext* context,
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1674 OrthancPluginDicomInstance* instance,
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1675 const char* metadata)
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1676 {
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1677 const char* result;
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1678
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1679 _OrthancPluginAccessDicomInstance params;
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1680 memset(&params, 0, sizeof(params));
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1681 params.resultString = &result;
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1682 params.instance = instance;
1068
f54a9c6fea5d documentation of plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
1683 params.key = metadata;
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1684
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1685 if (context->InvokeService(context, _OrthancPluginService_GetInstanceMetadata, &params))
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1686 {
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
1687 /* Error */
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1688 return NULL;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1689 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1690 else
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1691 {
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1692 return result;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1693 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1694 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1695
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1696
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
1697
1135
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1698 typedef struct
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1699 {
1295
50632b89e294 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
1700 OrthancPluginStorageCreate create;
50632b89e294 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
1701 OrthancPluginStorageRead read;
50632b89e294 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
1702 OrthancPluginStorageRemove remove;
50632b89e294 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
1703 OrthancPluginFree free;
1135
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1704 } _OrthancPluginRegisterStorageArea;
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1705
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1706 /**
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1707 * @brief Register a custom storage area.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1708 *
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1709 * This function registers a custom storage area, to replace the
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1710 * built-in way Orthanc stores its files on the filesystem. This
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1711 * function must be called during the initialization of the plugin,
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1712 * i.e. inside the OrthancPluginInitialize() public function.
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1713 *
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1714 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1141
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
1715 * @param create The callback function to store a file on the custom storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
1716 * @param read The callback function to read a file from the custom storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
1717 * @param remove The callback function to remove a file from the custom storage area.
1135
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1718 **/
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1719 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterStorageArea(
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1720 OrthancPluginContext* context,
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1721 OrthancPluginStorageCreate create,
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1722 OrthancPluginStorageRead read,
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1723 OrthancPluginStorageRemove remove)
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1724 {
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1725 _OrthancPluginRegisterStorageArea params;
1295
50632b89e294 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
1726 params.create = create;
50632b89e294 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
1727 params.read = read;
50632b89e294 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
1728 params.remove = remove;
1136
208dc67b9bab sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
1729
208dc67b9bab sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
1730 #ifdef __cplusplus
1295
50632b89e294 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
1731 params.free = ::free;
1136
208dc67b9bab sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
1732 #else
1295
50632b89e294 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
1733 params.free = free;
1136
208dc67b9bab sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
1734 #endif
208dc67b9bab sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
1735
1135
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1736 context->InvokeService(context, _OrthancPluginService_RegisterStorageArea, &params);
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1737 }
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1738
67c3c1e4a6e0 index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1069
diff changeset
1739
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1740
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1741 /**
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1742 * @brief Return the path to the Orthanc executable.
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1743 *
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1744 * This function returns the path to the Orthanc executable.
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1745 *
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1746 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1747 * @return NULL in the case of an error, or a newly allocated string
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1748 * containing the path. This string must be freed by
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1749 * OrthancPluginFreeString().
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1750 **/
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1751 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancPath(OrthancPluginContext* context)
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1752 {
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1753 char* result;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1754
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1755 _OrthancPluginRetrieveDynamicString params;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1756 params.result = &result;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1757 params.argument = NULL;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1758
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1759 if (context->InvokeService(context, _OrthancPluginService_GetOrthancPath, &params))
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1760 {
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1761 /* Error */
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1762 return NULL;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1763 }
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1764 else
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1765 {
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1766 return result;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1767 }
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1768 }
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1769
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1770
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1771 /**
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1772 * @brief Return the directory containing the Orthanc.
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1773 *
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1774 * This function returns the path to the directory containing the Orthanc executable.
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1775 *
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1776 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1777 * @return NULL in the case of an error, or a newly allocated string
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1778 * containing the path. This string must be freed by
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1779 * OrthancPluginFreeString().
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1780 **/
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1781 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancDirectory(OrthancPluginContext* context)
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1782 {
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1783 char* result;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1784
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1785 _OrthancPluginRetrieveDynamicString params;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1786 params.result = &result;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1787 params.argument = NULL;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1788
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1789 if (context->InvokeService(context, _OrthancPluginService_GetOrthancDirectory, &params))
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1790 {
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1791 /* Error */
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1792 return NULL;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1793 }
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1794 else
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1795 {
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1796 return result;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1797 }
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1798 }
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1799
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1800
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1801 /**
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1802 * @brief Return the path to the configuration file.
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1803 *
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1804 * This function returns the path to the configuration file that was
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1805 * specified when starting Orthanc.
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1806 *
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1807 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1808 * @return NULL in the case of an error, or a newly allocated string
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1809 * containing the path. This string must be freed by
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1810 * OrthancPluginFreeString().
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1811 **/
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1812 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfigurationPath(OrthancPluginContext* context)
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1813 {
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1814 char* result;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1815
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1816 _OrthancPluginRetrieveDynamicString params;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1817 params.result = &result;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1818 params.argument = NULL;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1819
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1820 if (context->InvokeService(context, _OrthancPluginService_GetConfigurationPath, &params))
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1821 {
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1822 /* Error */
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1823 return NULL;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1824 }
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1825 else
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1826 {
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1827 return result;
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1828 }
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1829 }
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1830
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1831
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1141
diff changeset
1832
1177
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1833 typedef struct
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1834 {
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1835 OrthancPluginOnChangeCallback callback;
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1836 } _OrthancPluginOnChangeCallback;
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1837
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1838 /**
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1839 * @brief Register a callback to monitor changes.
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1840 *
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1841 * This function registers a callback function that is called
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1842 * whenever a change happens to some DICOM resource.
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1843 *
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1844 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1845 * @param callback The callback function.
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1846 **/
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1847 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnChangeCallback(
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1848 OrthancPluginContext* context,
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1849 OrthancPluginOnChangeCallback callback)
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1850 {
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1851 _OrthancPluginOnChangeCallback params;
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1852 params.callback = callback;
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1853
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1854 context->InvokeService(context, _OrthancPluginService_RegisterOnChangeCallback, &params);
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1855 }
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1856
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1857
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1858
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1859 typedef struct
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1860 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1861 const char* plugin;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1862 _OrthancPluginProperty property;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1863 const char* value;
1249
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1864 } _OrthancPluginSetPluginProperty;
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1865
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1866
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1867 /**
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1868 * @brief Set the URI where the plugin provides its Web interface.
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1869 *
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1870 * For plugins that come with a Web interface, this function
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1871 * declares the entry path where to find this interface. This
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1872 * information is notably used in the "Plugins" page of Orthanc
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1873 * Explorer.
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1874 *
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1875 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1876 * @param uri The root URI for this plugin.
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1877 **/
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1878 ORTHANC_PLUGIN_INLINE void OrthancPluginSetRootUri(
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1879 OrthancPluginContext* context,
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1880 const char* uri)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1881 {
1249
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1882 _OrthancPluginSetPluginProperty params;
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1883 params.plugin = OrthancPluginGetName();
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1884 params.property = _OrthancPluginProperty_RootUri;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1885 params.value = uri;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1886
1249
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1887 context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1888 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1889
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1890
1233
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1891 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1892 * @brief Set a description for this plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1893 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1894 * Set a description for this plugin. It is displayed in the
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1895 * "Plugins" page of Orthanc Explorer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1896 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1897 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1898 * @param description The description.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1899 **/
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1900 ORTHANC_PLUGIN_INLINE void OrthancPluginSetDescription(
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1901 OrthancPluginContext* context,
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1902 const char* description)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1903 {
1249
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1904 _OrthancPluginSetPluginProperty params;
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1905 params.plugin = OrthancPluginGetName();
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1906 params.property = _OrthancPluginProperty_Description;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1907 params.value = description;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1908
1249
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1909 context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1910 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1911
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1912
1233
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1913 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1914 * @brief Extend the JavaScript code of Orthanc Explorer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1915 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1916 * Add JavaScript code to customize the default behavior of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1917 * Explorer. This can for instance be used to add new buttons.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1918 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1919 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1920 * @param javascript The custom JavaScript code.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
1921 **/
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1922 ORTHANC_PLUGIN_INLINE void OrthancPluginExtendOrthancExplorer(
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1923 OrthancPluginContext* context,
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1924 const char* javascript)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1925 {
1249
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1926 _OrthancPluginSetPluginProperty params;
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1927 params.plugin = OrthancPluginGetName();
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1928 params.property = _OrthancPluginProperty_OrthancExplorer;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1929 params.value = javascript;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1930
1249
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1931 context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1198
diff changeset
1932 }
1177
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
1933
1249
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1934
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1935 typedef struct
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1936 {
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1937 char** result;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1938 int32_t property;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1939 const char* value;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1940 } _OrthancPluginGlobalProperty;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1941
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1942
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1943 /**
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1944 * @brief Get the value of a global property.
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1945 *
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1946 * Get the value of a global property that is stored in the Orthanc database. Global
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1947 * properties whose index is below 1024 are reserved by Orthanc.
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1948 *
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1949 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1950 * @param property The global property of interest.
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1951 * @param defaultValue The value to return, if the global property is unset.
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1952 * @return The value of the global property, or NULL in the case of an error. This
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1953 * string must be freed by OrthancPluginFreeString().
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1954 **/
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1955 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetGlobalProperty(
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1956 OrthancPluginContext* context,
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1957 int32_t property,
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1958 const char* defaultValue)
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1959 {
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1960 char* result;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1961
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1962 _OrthancPluginGlobalProperty params;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1963 params.result = &result;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1964 params.property = property;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1965 params.value = defaultValue;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1966
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1967 if (context->InvokeService(context, _OrthancPluginService_GetGlobalProperty, &params))
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1968 {
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1969 /* Error */
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1970 return NULL;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1971 }
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1972 else
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1973 {
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1974 return result;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1975 }
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1976 }
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1977
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1978
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1979 /**
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1980 * @brief Set the value of a global property.
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1981 *
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1982 * Set the value of a global property into the Orthanc
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1983 * database. Setting a global property can be used by plugins to
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1984 * save their internal parameters. Plugins are only allowed to set
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1985 * properties whose index are above or equal to 1024 (properties
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1986 * below 1024 are read-only and reserved by Orthanc).
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1987 *
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1988 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1989 * @param property The global property of interest.
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1990 * @param value The value to be set in the global property.
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1991 * @return 0 if success, -1 in case of error.
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1992 **/
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1993 ORTHANC_PLUGIN_INLINE int32_t OrthancPluginSetGlobalProperty(
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1994 OrthancPluginContext* context,
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1995 int32_t property,
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1996 const char* value)
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1997 {
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1998 _OrthancPluginGlobalProperty params;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
1999 params.result = NULL;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2000 params.property = property;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2001 params.value = value;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2002
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2003 if (context->InvokeService(context, _OrthancPluginService_SetGlobalProperty, &params))
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2004 {
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2005 /* Error */
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2006 return -1;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2007 }
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2008 else
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2009 {
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2010 return 0;
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2011 }
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2012 }
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2013
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2014
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
2015
1280
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2016 typedef struct
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2017 {
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2018 int32_t *resultInt32;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2019 uint32_t *resultUint32;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2020 int64_t *resultInt64;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2021 uint64_t *resultUint64;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2022 } _OrthancPluginReturnSingleValue;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2023
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2024 /**
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2025 * @brief Get the number of command-line arguments.
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2026 *
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2027 * Retrieve the number of command-line arguments that were used to launch Orthanc.
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2028 *
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2029 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2030 * @return The number of arguments.
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2031 **/
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2032 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetCommandLineArgumentsCount(
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2033 OrthancPluginContext* context)
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2034 {
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2035 uint32_t count = 0;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2036
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2037 _OrthancPluginReturnSingleValue params;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2038 memset(&params, 0, sizeof(params));
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2039 params.resultUint32 = &count;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2040
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2041 if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgumentsCount, &params))
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2042 {
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2043 /* Error */
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2044 return 0;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2045 }
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2046 else
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2047 {
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2048 return count;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2049 }
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2050 }
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2051
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2052
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2053
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2054 /**
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2055 * @brief Get the value of a command-line argument.
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2056 *
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2057 * Get the value of one of the command-line arguments that were used
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2058 * to launch Orthanc. The number of available arguments can be
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2059 * retrieved by OrthancPluginGetCommandLineArgumentsCount().
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2060 *
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2061 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2062 * @param argument The index of the argument.
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2063 * @return The value of the argument, or NULL in the case of an error. This
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2064 * string must be freed by OrthancPluginFreeString().
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2065 **/
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2066 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetCommandLineArgument(
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2067 OrthancPluginContext* context,
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2068 uint32_t argument)
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2069 {
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2070 char* result;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2071
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2072 _OrthancPluginGlobalProperty params;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2073 params.result = &result;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2074 params.property = (int32_t) argument;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2075 params.value = NULL;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2076
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2077 if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgument, &params))
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2078 {
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2079 /* Error */
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2080 return NULL;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2081 }
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2082 else
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2083 {
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2084 return result;
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2085 }
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2086 }
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2087
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
2088
1407
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2089 /**
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2090 * @brief Get the expected version of the database schema.
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2091 *
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2092 * Retrieve the expected version of the database schema.
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2093 *
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2094 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2095 * @return The version.
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2096 **/
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2097 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetExpectedDatabaseVersion(
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2098 OrthancPluginContext* context)
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2099 {
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2100 uint32_t count = 0;
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2101
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2102 _OrthancPluginReturnSingleValue params;
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2103 memset(&params, 0, sizeof(params));
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2104 params.resultUint32 = &count;
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2105
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2106 if (context->InvokeService(context, _OrthancPluginService_GetExpectedDatabaseVersion, &params))
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2107 {
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2108 /* Error */
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2109 return 0;
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2110 }
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2111 else
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2112 {
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2113 return count;
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2114 }
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2115 }
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2116
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2117
d371a66972a4 OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1322
diff changeset
2118
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2119 #ifdef __cplusplus
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2120 }
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2121 #endif
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
2122
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
2123
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
2124 /** @} */
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
2125