annotate Resources/Orthanc/Sdk-1.0.0/orthanc/OrthancCPlugin.h @ 9:ad4d62a9422d

back to mainline
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 19 May 2023 13:32:58 +0200
parents 3f1cf4a8e31f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * \mainpage
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * This C/C++ SDK allows external developers to create plugins that
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * can be loaded into Orthanc to extend its functionality. Each
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * Orthanc plugin must expose 4 public functions with the following
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * signatures:
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * -# <tt>int32_t OrthancPluginInitialize(const OrthancPluginContext* context)</tt>:
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * This function is invoked by Orthanc when it loads the plugin on startup.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * The plugin must:
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * - Check its compatibility with the Orthanc version using
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * ::OrthancPluginCheckVersion().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * - Store the context pointer so that it can use the plugin
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * services of Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * - Register all its REST callbacks using ::OrthancPluginRegisterRestCallback().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * - Possibly register its callback for received DICOM instances using ::OrthancPluginRegisterOnStoredInstanceCallback().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * - Possibly register its callback for changes to the DICOM store using ::OrthancPluginRegisterOnChangeCallback().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * - Possibly register a custom storage area using ::OrthancPluginRegisterStorageArea().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * - Possibly register a custom database back-end area using OrthancPluginRegisterDatabaseBackendV2().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * - Possibly register a handler for C-Find SCP against DICOM worklists using OrthancPluginRegisterWorklistCallback().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * - Possibly register a custom decoder for DICOM images using OrthancPluginRegisterDecodeImageCallback().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * -# <tt>void OrthancPluginFinalize()</tt>:
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This function is invoked by Orthanc during its shutdown. The plugin
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * must free all its memory.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * -# <tt>const char* OrthancPluginGetName()</tt>:
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * The plugin must return a short string to identify itself.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * -# <tt>const char* OrthancPluginGetVersion()</tt>:
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * The plugin must return a string containing its version number.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 * The name and the version of a plugin is only used to prevent it
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 * from being loaded twice. Note that, in C++, it is mandatory to
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 * declare these functions within an <tt>extern "C"</tt> section.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 * To ensure multi-threading safety, the various REST callbacks are
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 * guaranteed to be executed in mutual exclusion since Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 * 0.8.5. If this feature is undesired (notably when developing
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 * high-performance plugins handling simultaneous requests), use
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 * ::OrthancPluginRegisterRestCallbackNoLock().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 * @defgroup Images Images and compression
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 * @brief Functions to deal with images and compressed buffers.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 * @defgroup REST REST
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 * @brief Functions to answer REST requests in a callback.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 * @defgroup Callbacks Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 * @brief Functions to register and manage callbacks by the plugins.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 * @defgroup Worklists Worklists
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 * @brief Functions to register and manage worklists.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 * @defgroup Orthanc Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 * @brief Functions to access the content of the Orthanc server.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 * @defgroup Toolbox Toolbox
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 * @brief Generic functions to help with the creation of plugins.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 * Orthanc - A Lightweight, RESTful DICOM Store
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 * Department, University Hospital of Liege, Belgium
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 * This program is free software: you can redistribute it and/or
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 * modify it under the terms of the GNU General Public License as
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 * published by the Free Software Foundation, either version 3 of the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 * License, or (at your option) any later version.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 * In addition, as a special exception, the copyright holders of this
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 * program give permission to link the code of its release with the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 * OpenSSL project's "OpenSSL" library (or with modified versions of it
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 * that use the same license as the "OpenSSL" library), and distribute
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 * the linked executables. You must obey the GNU General Public License
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 * in all respects for all of the code used other than "OpenSSL". If you
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 * modify file(s) with this exception, you may extend this exception to
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 * your version of the file(s), but you are not obligated to do so. If
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 * you do not wish to do so, delete this exception statement from your
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 * version. If you delete this exception statement from all source files
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 * in the program, then also delete it here.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 * This program is distributed in the hope that it will be useful, but
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 * WITHOUT ANY WARRANTY; without even the implied warranty of
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 * General Public License for more details.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 * You should have received a copy of the GNU General Public License
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 #pragma once
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 #include <stdio.h>
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 #include <string.h>
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 #ifdef WIN32
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 #define ORTHANC_PLUGINS_API __declspec(dllexport)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 #else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 #define ORTHANC_PLUGINS_API
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 #endif
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 #define ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER 1
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 #define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER 0
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 #define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 0
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 /********************************************************************
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 ** Check that function inlining is properly supported. The use of
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 ** inlining is required, to avoid the duplication of object code
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 ** between two compilation modules that would use the Orthanc Plugin
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 ** API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 ********************************************************************/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 /* If the auto-detection of the "inline" keyword below does not work
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 automatically and that your compiler is known to properly support
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 inlining, uncomment the following #define and adapt the definition
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 of "static inline". */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 /* #define ORTHANC_PLUGIN_INLINE static inline */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 #ifndef ORTHANC_PLUGIN_INLINE
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 # if __STDC_VERSION__ >= 199901L
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 /* This is C99 or above: http://predef.sourceforge.net/prestd.html */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 # define ORTHANC_PLUGIN_INLINE static inline
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 # elif defined(__cplusplus)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 /* This is C++ */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 # define ORTHANC_PLUGIN_INLINE static inline
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 # elif defined(__GNUC__)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 /* This is GCC running in C89 mode */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 # define ORTHANC_PLUGIN_INLINE static __inline
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 # elif defined(_MSC_VER)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 /* This is Visual Studio running in C89 mode */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 # define ORTHANC_PLUGIN_INLINE static __inline
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 # else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 # error Your compiler is not known to support the "inline" keyword
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 # endif
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 #endif
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 /********************************************************************
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 ** Inclusion of standard libraries.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 ********************************************************************/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 * For Microsoft Visual Studio, a compatibility "stdint.h" can be
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 * downloaded at the following URL:
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 * https://orthanc.googlecode.com/hg/Resources/ThirdParty/VisualStudio/stdint.h
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 #include <stdint.h>
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 #include <stdlib.h>
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 /********************************************************************
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 ** Definition of the Orthanc Plugin API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 ********************************************************************/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 /** @{ */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 #ifdef __cplusplus
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 extern "C"
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 #endif
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 * The various error codes that can be returned by the Orthanc core.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 OrthancPluginErrorCode_InternalError = -1 /*!< Internal error */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 OrthancPluginErrorCode_Success = 0 /*!< Success */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 OrthancPluginErrorCode_Plugin = 1 /*!< Error encountered within the plugin engine */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 OrthancPluginErrorCode_NotImplemented = 2 /*!< Not implemented yet */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 OrthancPluginErrorCode_ParameterOutOfRange = 3 /*!< Parameter out of range */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 OrthancPluginErrorCode_NotEnoughMemory = 4 /*!< Not enough memory */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 OrthancPluginErrorCode_BadParameterType = 5 /*!< Bad type for a parameter */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 OrthancPluginErrorCode_BadSequenceOfCalls = 6 /*!< Bad sequence of calls */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 OrthancPluginErrorCode_InexistentItem = 7 /*!< Accessing an inexistent item */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 OrthancPluginErrorCode_BadRequest = 8 /*!< Bad request */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 OrthancPluginErrorCode_NetworkProtocol = 9 /*!< Error in the network protocol */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 OrthancPluginErrorCode_SystemCommand = 10 /*!< Error while calling a system command */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 OrthancPluginErrorCode_Database = 11 /*!< Error with the database engine */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 OrthancPluginErrorCode_UriSyntax = 12 /*!< Badly formatted URI */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 OrthancPluginErrorCode_InexistentFile = 13 /*!< Inexistent file */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 OrthancPluginErrorCode_CannotWriteFile = 14 /*!< Cannot write to file */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 OrthancPluginErrorCode_BadFileFormat = 15 /*!< Bad file format */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 OrthancPluginErrorCode_Timeout = 16 /*!< Timeout */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 OrthancPluginErrorCode_UnknownResource = 17 /*!< Unknown resource */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 OrthancPluginErrorCode_IncompatibleDatabaseVersion = 18 /*!< Incompatible version of the database */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 OrthancPluginErrorCode_FullStorage = 19 /*!< The file storage is full */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 OrthancPluginErrorCode_CorruptedFile = 20 /*!< Corrupted file (e.g. inconsistent MD5 hash) */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 OrthancPluginErrorCode_InexistentTag = 21 /*!< Inexistent tag */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 OrthancPluginErrorCode_ReadOnly = 22 /*!< Cannot modify a read-only data structure */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 OrthancPluginErrorCode_IncompatibleImageFormat = 23 /*!< Incompatible format of the images */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 OrthancPluginErrorCode_IncompatibleImageSize = 24 /*!< Incompatible size of the images */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 OrthancPluginErrorCode_SharedLibrary = 25 /*!< Error while using a shared library (plugin) */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 OrthancPluginErrorCode_UnknownPluginService = 26 /*!< Plugin invoking an unknown service */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 OrthancPluginErrorCode_UnknownDicomTag = 27 /*!< Unknown DICOM tag */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 OrthancPluginErrorCode_BadJson = 28 /*!< Cannot parse a JSON document */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 OrthancPluginErrorCode_Unauthorized = 29 /*!< Bad credentials were provided to an HTTP request */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 OrthancPluginErrorCode_BadFont = 30 /*!< Badly formatted font file */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 OrthancPluginErrorCode_DatabasePlugin = 31 /*!< The plugin implementing a custom database back-end does not fulfill the proper interface */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 OrthancPluginErrorCode_StorageAreaPlugin = 32 /*!< Error in the plugin implementing a custom storage area */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 OrthancPluginErrorCode_EmptyRequest = 33 /*!< The request is empty */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 OrthancPluginErrorCode_NotAcceptable = 34 /*!< Cannot send a response which is acceptable according to the Accept HTTP header */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 OrthancPluginErrorCode_SQLiteNotOpened = 1000 /*!< SQLite: The database is not opened */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 OrthancPluginErrorCode_SQLiteAlreadyOpened = 1001 /*!< SQLite: Connection is already open */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 OrthancPluginErrorCode_SQLiteCannotOpen = 1002 /*!< SQLite: Unable to open the database */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 OrthancPluginErrorCode_SQLiteStatementAlreadyUsed = 1003 /*!< SQLite: This cached statement is already being referred to */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 OrthancPluginErrorCode_SQLiteExecute = 1004 /*!< SQLite: Cannot execute a command */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 OrthancPluginErrorCode_SQLiteRollbackWithoutTransaction = 1005 /*!< SQLite: Rolling back a nonexistent transaction (have you called Begin()?) */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 OrthancPluginErrorCode_SQLiteCommitWithoutTransaction = 1006 /*!< SQLite: Committing a nonexistent transaction */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 OrthancPluginErrorCode_SQLiteRegisterFunction = 1007 /*!< SQLite: Unable to register a function */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 OrthancPluginErrorCode_SQLiteFlush = 1008 /*!< SQLite: Unable to flush the database */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 OrthancPluginErrorCode_SQLiteCannotRun = 1009 /*!< SQLite: Cannot run a cached statement */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 OrthancPluginErrorCode_SQLiteCannotStep = 1010 /*!< SQLite: Cannot step over a cached statement */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 OrthancPluginErrorCode_SQLiteBindOutOfRange = 1011 /*!< SQLite: Bing a value while out of range (serious error) */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 OrthancPluginErrorCode_SQLitePrepareStatement = 1012 /*!< SQLite: Cannot prepare a cached statement */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 OrthancPluginErrorCode_SQLiteTransactionAlreadyStarted = 1013 /*!< SQLite: Beginning the same transaction twice */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 OrthancPluginErrorCode_SQLiteTransactionCommit = 1014 /*!< SQLite: Failure when committing the transaction */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 OrthancPluginErrorCode_SQLiteTransactionBegin = 1015 /*!< SQLite: Cannot start a transaction */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 OrthancPluginErrorCode_DirectoryOverFile = 2000 /*!< The directory to be created is already occupied by a regular file */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 OrthancPluginErrorCode_FileStorageCannotWrite = 2001 /*!< Unable to create a subdirectory or a file in the file storage */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 OrthancPluginErrorCode_DirectoryExpected = 2002 /*!< The specified path does not point to a directory */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 OrthancPluginErrorCode_HttpPortInUse = 2003 /*!< The TCP port of the HTTP server is already in use */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 OrthancPluginErrorCode_DicomPortInUse = 2004 /*!< The TCP port of the DICOM server is already in use */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 OrthancPluginErrorCode_BadHttpStatusInRest = 2005 /*!< This HTTP status is not allowed in a REST API */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 OrthancPluginErrorCode_RegularFileExpected = 2006 /*!< The specified path does not point to a regular file */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 OrthancPluginErrorCode_PathToExecutable = 2007 /*!< Unable to get the path to the executable */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 OrthancPluginErrorCode_MakeDirectory = 2008 /*!< Cannot create a directory */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 OrthancPluginErrorCode_BadApplicationEntityTitle = 2009 /*!< An application entity title (AET) cannot be empty or be longer than 16 characters */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 OrthancPluginErrorCode_NoCFindHandler = 2010 /*!< No request handler factory for DICOM C-FIND SCP */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 OrthancPluginErrorCode_NoCMoveHandler = 2011 /*!< No request handler factory for DICOM C-MOVE SCP */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 OrthancPluginErrorCode_NoCStoreHandler = 2012 /*!< No request handler factory for DICOM C-STORE SCP */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 OrthancPluginErrorCode_NoApplicationEntityFilter = 2013 /*!< No application entity filter */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 OrthancPluginErrorCode_NoSopClassOrInstance = 2014 /*!< DicomUserConnection: Unable to find the SOP class and instance */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 OrthancPluginErrorCode_NoPresentationContext = 2015 /*!< DicomUserConnection: No acceptable presentation context for modality */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 OrthancPluginErrorCode_DicomFindUnavailable = 2016 /*!< DicomUserConnection: The C-FIND command is not supported by the remote SCP */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 OrthancPluginErrorCode_DicomMoveUnavailable = 2017 /*!< DicomUserConnection: The C-MOVE command is not supported by the remote SCP */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 OrthancPluginErrorCode_CannotStoreInstance = 2018 /*!< Cannot store an instance */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 OrthancPluginErrorCode_CreateDicomNotString = 2019 /*!< Only string values are supported when creating DICOM instances */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 OrthancPluginErrorCode_CreateDicomOverrideTag = 2020 /*!< Trying to override a value inherited from a parent module */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 OrthancPluginErrorCode_CreateDicomUseContent = 2021 /*!< Use \"Content\" to inject an image into a new DICOM instance */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 OrthancPluginErrorCode_CreateDicomNoPayload = 2022 /*!< No payload is present for one instance in the series */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 OrthancPluginErrorCode_CreateDicomUseDataUriScheme = 2023 /*!< The payload of the DICOM instance must be specified according to Data URI scheme */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 OrthancPluginErrorCode_CreateDicomBadParent = 2024 /*!< Trying to attach a new DICOM instance to an inexistent resource */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 OrthancPluginErrorCode_CreateDicomParentIsInstance = 2025 /*!< Trying to attach a new DICOM instance to an instance (must be a series, study or patient) */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 OrthancPluginErrorCode_CreateDicomParentEncoding = 2026 /*!< Unable to get the encoding of the parent resource */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 OrthancPluginErrorCode_UnknownModality = 2027 /*!< Unknown modality */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 OrthancPluginErrorCode_BadJobOrdering = 2028 /*!< Bad ordering of filters in a job */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 OrthancPluginErrorCode_JsonToLuaTable = 2029 /*!< Cannot convert the given JSON object to a Lua table */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 OrthancPluginErrorCode_CannotCreateLua = 2030 /*!< Cannot create the Lua context */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 OrthancPluginErrorCode_CannotExecuteLua = 2031 /*!< Cannot execute a Lua command */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 OrthancPluginErrorCode_LuaAlreadyExecuted = 2032 /*!< Arguments cannot be pushed after the Lua function is executed */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 OrthancPluginErrorCode_LuaBadOutput = 2033 /*!< The Lua function does not give the expected number of outputs */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 OrthancPluginErrorCode_NotLuaPredicate = 2034 /*!< The Lua function is not a predicate (only true/false outputs allowed) */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 OrthancPluginErrorCode_LuaReturnsNoString = 2035 /*!< The Lua function does not return a string */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 OrthancPluginErrorCode_StorageAreaAlreadyRegistered = 2036 /*!< Another plugin has already registered a custom storage area */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 OrthancPluginErrorCode_DatabaseBackendAlreadyRegistered = 2037 /*!< Another plugin has already registered a custom database back-end */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 OrthancPluginErrorCode_DatabaseNotInitialized = 2038 /*!< Plugin trying to call the database during its initialization */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 OrthancPluginErrorCode_SslDisabled = 2039 /*!< Orthanc has been built without SSL support */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 OrthancPluginErrorCode_CannotOrderSlices = 2040 /*!< Unable to order the slices of the series */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 OrthancPluginErrorCode_NoWorklistHandler = 2041 /*!< No request handler factory for DICOM C-Find Modality SCP */,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 _OrthancPluginErrorCode_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 } OrthancPluginErrorCode;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 * Forward declaration of one of the mandatory functions for Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 * plugins.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 ORTHANC_PLUGINS_API const char* OrthancPluginGetName();
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 * The various HTTP methods for a REST call.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 OrthancPluginHttpMethod_Get = 1, /*!< GET request */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 OrthancPluginHttpMethod_Post = 2, /*!< POST request */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 OrthancPluginHttpMethod_Put = 3, /*!< PUT request */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 OrthancPluginHttpMethod_Delete = 4, /*!< DELETE request */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 _OrthancPluginHttpMethod_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 } OrthancPluginHttpMethod;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 * @brief The parameters of a REST request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 * @brief The HTTP method.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315 OrthancPluginHttpMethod method;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 * @brief The number of groups of the regular expression.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 uint32_t groupsCount;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 * @brief The matched values for the groups of the regular expression.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 const char* const* groups;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 * @brief For a GET request, the number of GET parameters.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 uint32_t getCount;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 * @brief For a GET request, the keys of the GET parameters.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 const char* const* getKeys;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 * @brief For a GET request, the values of the GET parameters.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 const char* const* getValues;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343 * @brief For a PUT or POST request, the content of the body.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345 const char* body;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348 * @brief For a PUT or POST request, the number of bytes of the body.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 uint32_t bodySize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 /* --------------------------------------------------
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 New in version 0.8.1
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 -------------------------------------------------- */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 * @brief The number of HTTP headers.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 uint32_t headersCount;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 * @brief The keys of the HTTP headers (always converted to low-case).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 const char* const* headersKeys;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 * @brief The values of the HTTP headers.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370 const char* const* headersValues;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 } OrthancPluginHttpRequest;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 /* Generic services */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 _OrthancPluginService_LogInfo = 1,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 _OrthancPluginService_LogWarning = 2,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 _OrthancPluginService_LogError = 3,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 _OrthancPluginService_GetOrthancPath = 4,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 _OrthancPluginService_GetOrthancDirectory = 5,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 _OrthancPluginService_GetConfigurationPath = 6,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 _OrthancPluginService_SetPluginProperty = 7,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 _OrthancPluginService_GetGlobalProperty = 8,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 _OrthancPluginService_SetGlobalProperty = 9,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 _OrthancPluginService_GetCommandLineArgumentsCount = 10,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 _OrthancPluginService_GetCommandLineArgument = 11,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 _OrthancPluginService_GetExpectedDatabaseVersion = 12,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 _OrthancPluginService_GetConfiguration = 13,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 _OrthancPluginService_BufferCompression = 14,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 _OrthancPluginService_ReadFile = 15,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393 _OrthancPluginService_WriteFile = 16,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 _OrthancPluginService_GetErrorDescription = 17,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 _OrthancPluginService_CallHttpClient = 18,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396 _OrthancPluginService_RegisterErrorCode = 19,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 _OrthancPluginService_RegisterDictionaryTag = 20,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 _OrthancPluginService_DicomBufferToJson = 21,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 _OrthancPluginService_DicomInstanceToJson = 22,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 _OrthancPluginService_CreateDicom = 23,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 _OrthancPluginService_ComputeMd5 = 24,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 _OrthancPluginService_ComputeSha1 = 25,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 _OrthancPluginService_LookupDictionary = 26,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405 /* Registration of callbacks */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 _OrthancPluginService_RegisterRestCallback = 1000,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407 _OrthancPluginService_RegisterOnStoredInstanceCallback = 1001,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 _OrthancPluginService_RegisterStorageArea = 1002,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 _OrthancPluginService_RegisterOnChangeCallback = 1003,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 _OrthancPluginService_RegisterRestCallbackNoLock = 1004,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411 _OrthancPluginService_RegisterWorklistCallback = 1005,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 _OrthancPluginService_RegisterDecodeImageCallback = 1006,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414 /* Sending answers to REST calls */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 _OrthancPluginService_AnswerBuffer = 2000,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 _OrthancPluginService_CompressAndAnswerPngImage = 2001, /* Unused as of Orthanc 0.9.4 */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417 _OrthancPluginService_Redirect = 2002,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 _OrthancPluginService_SendHttpStatusCode = 2003,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 _OrthancPluginService_SendUnauthorized = 2004,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420 _OrthancPluginService_SendMethodNotAllowed = 2005,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 _OrthancPluginService_SetCookie = 2006,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 _OrthancPluginService_SetHttpHeader = 2007,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423 _OrthancPluginService_StartMultipartAnswer = 2008,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424 _OrthancPluginService_SendMultipartItem = 2009,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425 _OrthancPluginService_SendHttpStatus = 2010,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426 _OrthancPluginService_CompressAndAnswerImage = 2011,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 _OrthancPluginService_SendMultipartItem2 = 2012,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 /* Access to the Orthanc database and API */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430 _OrthancPluginService_GetDicomForInstance = 3000,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431 _OrthancPluginService_RestApiGet = 3001,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432 _OrthancPluginService_RestApiPost = 3002,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 _OrthancPluginService_RestApiDelete = 3003,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 _OrthancPluginService_RestApiPut = 3004,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435 _OrthancPluginService_LookupPatient = 3005,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436 _OrthancPluginService_LookupStudy = 3006,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 _OrthancPluginService_LookupSeries = 3007,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 _OrthancPluginService_LookupInstance = 3008,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439 _OrthancPluginService_LookupStudyWithAccessionNumber = 3009,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440 _OrthancPluginService_RestApiGetAfterPlugins = 3010,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441 _OrthancPluginService_RestApiPostAfterPlugins = 3011,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 _OrthancPluginService_RestApiDeleteAfterPlugins = 3012,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443 _OrthancPluginService_RestApiPutAfterPlugins = 3013,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444 _OrthancPluginService_ReconstructMainDicomTags = 3014,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445 _OrthancPluginService_RestApiGet2 = 3015,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 /* Access to DICOM instances */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 _OrthancPluginService_GetInstanceRemoteAet = 4000,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449 _OrthancPluginService_GetInstanceSize = 4001,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
450 _OrthancPluginService_GetInstanceData = 4002,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
451 _OrthancPluginService_GetInstanceJson = 4003,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
452 _OrthancPluginService_GetInstanceSimplifiedJson = 4004,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453 _OrthancPluginService_HasInstanceMetadata = 4005,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 _OrthancPluginService_GetInstanceMetadata = 4006,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455 _OrthancPluginService_GetInstanceOrigin = 4007,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 /* Services for plugins implementing a database back-end */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 _OrthancPluginService_RegisterDatabaseBackend = 5000,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459 _OrthancPluginService_DatabaseAnswer = 5001,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460 _OrthancPluginService_RegisterDatabaseBackendV2 = 5002,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461 _OrthancPluginService_StorageAreaCreate = 5003,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 _OrthancPluginService_StorageAreaRead = 5004,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463 _OrthancPluginService_StorageAreaRemove = 5005,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465 /* Primitives for handling images */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466 _OrthancPluginService_GetImagePixelFormat = 6000,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467 _OrthancPluginService_GetImageWidth = 6001,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468 _OrthancPluginService_GetImageHeight = 6002,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469 _OrthancPluginService_GetImagePitch = 6003,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
470 _OrthancPluginService_GetImageBuffer = 6004,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
471 _OrthancPluginService_UncompressImage = 6005,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472 _OrthancPluginService_FreeImage = 6006,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
473 _OrthancPluginService_CompressImage = 6007,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
474 _OrthancPluginService_ConvertPixelFormat = 6008,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
475 _OrthancPluginService_GetFontsCount = 6009,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476 _OrthancPluginService_GetFontInfo = 6010,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477 _OrthancPluginService_DrawText = 6011,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 _OrthancPluginService_CreateImage = 6012,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
479 _OrthancPluginService_CreateImageAccessor = 6013,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
480 _OrthancPluginService_DecodeDicomImage = 6014,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
481
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482 /* Primitives for handling worklists */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
483 _OrthancPluginService_WorklistAddAnswer = 7000,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 _OrthancPluginService_WorklistMarkIncomplete = 7001,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
485 _OrthancPluginService_WorklistIsMatch = 7002,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486 _OrthancPluginService_WorklistGetDicomQuery = 7003,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488 _OrthancPluginService_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489 } _OrthancPluginService;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
490
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
491
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
492 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
494 _OrthancPluginProperty_Description = 1,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
495 _OrthancPluginProperty_RootUri = 2,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
496 _OrthancPluginProperty_OrthancExplorer = 3,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
497
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
498 _OrthancPluginProperty_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499 } _OrthancPluginProperty;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
500
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
501
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
503 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
504 * The memory layout of the pixels of an image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
505 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
506 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
507 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
508 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
509 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
510 * @brief Graylevel 8bpp image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
511 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
512 * The image is graylevel. Each pixel is unsigned and stored in
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
513 * one byte.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
515 OrthancPluginPixelFormat_Grayscale8 = 1,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
517 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
518 * @brief Graylevel, unsigned 16bpp image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
519 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
520 * The image is graylevel. Each pixel is unsigned and stored in
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
521 * two bytes.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
522 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
523 OrthancPluginPixelFormat_Grayscale16 = 2,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
524
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
525 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
526 * @brief Graylevel, signed 16bpp image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
528 * The image is graylevel. Each pixel is signed and stored in two
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
529 * bytes.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
530 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
531 OrthancPluginPixelFormat_SignedGrayscale16 = 3,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
532
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
533 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
534 * @brief Color image in RGB24 format.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
535 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
536 * This format describes a color image. The pixels are stored in 3
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
537 * consecutive bytes. The memory layout is RGB.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
538 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
539 OrthancPluginPixelFormat_RGB24 = 4,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
540
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
541 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
542 * @brief Color image in RGBA32 format.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
543 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
544 * This format describes a color image. The pixels are stored in 4
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
545 * consecutive bytes. The memory layout is RGBA.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
546 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
547 OrthancPluginPixelFormat_RGBA32 = 5,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
549 OrthancPluginPixelFormat_Unknown = 6, /*!< Unknown pixel format */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
550
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
551 _OrthancPluginPixelFormat_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
552 } OrthancPluginPixelFormat;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
554
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
555
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
556 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
557 * The content types that are supported by Orthanc plugins.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
558 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
559 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
560 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
561 OrthancPluginContentType_Unknown = 0, /*!< Unknown content type */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
562 OrthancPluginContentType_Dicom = 1, /*!< DICOM */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
563 OrthancPluginContentType_DicomAsJson = 2, /*!< JSON summary of a DICOM file */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
565 _OrthancPluginContentType_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
566 } OrthancPluginContentType;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
567
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
569
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571 * The supported types of DICOM resources.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 OrthancPluginResourceType_Patient = 0, /*!< Patient */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576 OrthancPluginResourceType_Study = 1, /*!< Study */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
577 OrthancPluginResourceType_Series = 2, /*!< Series */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
578 OrthancPluginResourceType_Instance = 3, /*!< Instance */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579 OrthancPluginResourceType_None = 4, /*!< Unavailable resource type */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
581 _OrthancPluginResourceType_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 } OrthancPluginResourceType;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
584
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
585
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
586 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
587 * The supported types of changes that can happen to DICOM resources.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
588 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
589 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
590 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
591 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
592 OrthancPluginChangeType_CompletedSeries = 0, /*!< Series is now complete */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
593 OrthancPluginChangeType_Deleted = 1, /*!< Deleted resource */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
594 OrthancPluginChangeType_NewChildInstance = 2, /*!< A new instance was added to this resource */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595 OrthancPluginChangeType_NewInstance = 3, /*!< New instance received */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596 OrthancPluginChangeType_NewPatient = 4, /*!< New patient created */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
597 OrthancPluginChangeType_NewSeries = 5, /*!< New series created */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
598 OrthancPluginChangeType_NewStudy = 6, /*!< New study created */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
599 OrthancPluginChangeType_StablePatient = 7, /*!< Timeout: No new instance in this patient */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
600 OrthancPluginChangeType_StableSeries = 8, /*!< Timeout: No new instance in this series */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
601 OrthancPluginChangeType_StableStudy = 9, /*!< Timeout: No new instance in this study */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
602 OrthancPluginChangeType_OrthancStarted = 10, /*!< Orthanc has started */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
603 OrthancPluginChangeType_OrthancStopped = 11, /*!< Orthanc is stopping */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
604 OrthancPluginChangeType_UpdatedAttachment = 12, /*!< Some user-defined attachment has changed for this resource */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
605 OrthancPluginChangeType_UpdatedMetadata = 13, /*!< Some user-defined metadata has changed for this resource */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
606
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
607 _OrthancPluginChangeType_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
608 } OrthancPluginChangeType;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
610
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
611 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
612 * The compression algorithms that are supported by the Orthanc core.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
613 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
614 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
615 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
616 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
617 OrthancPluginCompressionType_Zlib = 0, /*!< Standard zlib compression */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
618 OrthancPluginCompressionType_ZlibWithSize = 1, /*!< zlib, prefixed with uncompressed size (uint64_t) */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
619 OrthancPluginCompressionType_Gzip = 2, /*!< Standard gzip compression */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
620 OrthancPluginCompressionType_GzipWithSize = 3, /*!< gzip, prefixed with uncompressed size (uint64_t) */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
621
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
622 _OrthancPluginCompressionType_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
623 } OrthancPluginCompressionType;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
624
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
625
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
627 * The image formats that are supported by the Orthanc core.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
628 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
629 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
630 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
631 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
632 OrthancPluginImageFormat_Png = 0, /*!< Image compressed using PNG */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
633 OrthancPluginImageFormat_Jpeg = 1, /*!< Image compressed using JPEG */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
634 OrthancPluginImageFormat_Dicom = 2, /*!< Image compressed using DICOM */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
635
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
636 _OrthancPluginImageFormat_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
637 } OrthancPluginImageFormat;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
638
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
639
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
640 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
641 * The value representations present in the DICOM standard (version 2013).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
642 * @ingroup Toolbox
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
643 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
644 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
645 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
646 OrthancPluginValueRepresentation_AE = 1, /*!< Application Entity */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
647 OrthancPluginValueRepresentation_AS = 2, /*!< Age String */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
648 OrthancPluginValueRepresentation_AT = 3, /*!< Attribute Tag */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
649 OrthancPluginValueRepresentation_CS = 4, /*!< Code String */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
650 OrthancPluginValueRepresentation_DA = 5, /*!< Date */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
651 OrthancPluginValueRepresentation_DS = 6, /*!< Decimal String */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
652 OrthancPluginValueRepresentation_DT = 7, /*!< Date Time */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653 OrthancPluginValueRepresentation_FD = 8, /*!< Floating Point Double */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
654 OrthancPluginValueRepresentation_FL = 9, /*!< Floating Point Single */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
655 OrthancPluginValueRepresentation_IS = 10, /*!< Integer String */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
656 OrthancPluginValueRepresentation_LO = 11, /*!< Long String */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
657 OrthancPluginValueRepresentation_LT = 12, /*!< Long Text */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
658 OrthancPluginValueRepresentation_OB = 13, /*!< Other Byte String */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
659 OrthancPluginValueRepresentation_OF = 14, /*!< Other Float String */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
660 OrthancPluginValueRepresentation_OW = 15, /*!< Other Word String */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
661 OrthancPluginValueRepresentation_PN = 16, /*!< Person Name */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
662 OrthancPluginValueRepresentation_SH = 17, /*!< Short String */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
663 OrthancPluginValueRepresentation_SL = 18, /*!< Signed Long */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
664 OrthancPluginValueRepresentation_SQ = 19, /*!< Sequence of Items */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
665 OrthancPluginValueRepresentation_SS = 20, /*!< Signed Short */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
666 OrthancPluginValueRepresentation_ST = 21, /*!< Short Text */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
667 OrthancPluginValueRepresentation_TM = 22, /*!< Time */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
668 OrthancPluginValueRepresentation_UI = 23, /*!< Unique Identifier (UID) */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669 OrthancPluginValueRepresentation_UL = 24, /*!< Unsigned Long */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670 OrthancPluginValueRepresentation_UN = 25, /*!< Unknown */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671 OrthancPluginValueRepresentation_US = 26, /*!< Unsigned Short */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
672 OrthancPluginValueRepresentation_UT = 27, /*!< Unlimited Text */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674 _OrthancPluginValueRepresentation_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675 } OrthancPluginValueRepresentation;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
678 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679 * The possible output formats for a DICOM-to-JSON conversion.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
680 * @ingroup Toolbox
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681 * @see OrthancPluginDicomToJson()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
682 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
684 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
685 OrthancPluginDicomToJsonFormat_Full = 1, /*!< Full output, with most details */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
686 OrthancPluginDicomToJsonFormat_Short = 2, /*!< Tags output as hexadecimal numbers */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
687 OrthancPluginDicomToJsonFormat_Human = 3, /*!< Human-readable JSON */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
688
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689 _OrthancPluginDicomToJsonFormat_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
690 } OrthancPluginDicomToJsonFormat;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
691
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
692
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
693 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694 * Flags to customize a DICOM-to-JSON conversion. By default, binary
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
695 * tags are formatted using Data URI scheme.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
696 * @ingroup Toolbox
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
697 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
700 OrthancPluginDicomToJsonFlags_IncludeBinary = (1 << 0), /*!< Include the binary tags */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
701 OrthancPluginDicomToJsonFlags_IncludePrivateTags = (1 << 1), /*!< Include the private tags */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
702 OrthancPluginDicomToJsonFlags_IncludeUnknownTags = (1 << 2), /*!< Include the tags unknown by the dictionary */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
703 OrthancPluginDicomToJsonFlags_IncludePixelData = (1 << 3), /*!< Include the pixel data */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
704 OrthancPluginDicomToJsonFlags_ConvertBinaryToAscii = (1 << 4), /*!< Output binary tags as-is, dropping non-ASCII */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
705 OrthancPluginDicomToJsonFlags_ConvertBinaryToNull = (1 << 5), /*!< Signal binary tags as null values */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
706
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
707 _OrthancPluginDicomToJsonFlags_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
708 } OrthancPluginDicomToJsonFlags;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
709
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
710
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
711 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
712 * Flags to the creation of a DICOM file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
713 * @ingroup Toolbox
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
714 * @see OrthancPluginCreateDicom()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
717 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
718 OrthancPluginCreateDicomFlags_DecodeDataUriScheme = (1 << 0), /*!< Decode fields encoded using data URI scheme */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
719 OrthancPluginCreateDicomFlags_GenerateIdentifiers = (1 << 1), /*!< Automatically generate DICOM identifiers */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
720
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721 _OrthancPluginCreateDicomFlags_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
722 } OrthancPluginCreateDicomFlags;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
723
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
724
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
725 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
726 * The constraints on the DICOM identifiers that must be supported
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
727 * by the database plugins.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
728 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
729 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
730 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
731 OrthancPluginIdentifierConstraint_Equal = 1, /*!< Equal */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
732 OrthancPluginIdentifierConstraint_SmallerOrEqual = 2, /*!< Less or equal */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
733 OrthancPluginIdentifierConstraint_GreaterOrEqual = 3, /*!< More or equal */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
734 OrthancPluginIdentifierConstraint_Wildcard = 4, /*!< Case-sensitive wildcard matching (with * and ?) */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
735
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
736 _OrthancPluginIdentifierConstraint_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
737 } OrthancPluginIdentifierConstraint;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
738
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
739
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
740 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
741 * The origin of a DICOM instance that has been received by Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
742 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
743 typedef enum
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
744 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
745 OrthancPluginInstanceOrigin_Unknown = 1, /*!< Unknown origin */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
746 OrthancPluginInstanceOrigin_DicomProtocol = 2, /*!< Instance received through DICOM protocol */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
747 OrthancPluginInstanceOrigin_RestApi = 3, /*!< Instance received through REST API of Orthanc */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
748 OrthancPluginInstanceOrigin_Plugin = 4, /*!< Instance added to Orthanc by a plugin */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
749 OrthancPluginInstanceOrigin_Lua = 5, /*!< Instance added to Orthanc by a Lua script */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
750
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
751 _OrthancPluginInstanceOrigin_INTERNAL = 0x7fffffff
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
752 } OrthancPluginInstanceOrigin;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
753
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
754
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756 * @brief A memory buffer allocated by the core system of Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
758 * A memory buffer allocated by the core system of Orthanc. When the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759 * content of the buffer is not useful anymore, it must be free by a
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
760 * call to ::OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
761 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
762 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
764 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
765 * @brief The content of the buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
766 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767 void* data;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
768
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
769 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
770 * @brief The number of bytes in the buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
771 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
772 uint32_t size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773 } OrthancPluginMemoryBuffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
774
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
775
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
776
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
777
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
778 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
779 * @brief Opaque structure that represents the HTTP connection to the client application.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
780 * @ingroup Callback
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
781 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
782 typedef struct _OrthancPluginRestOutput_t OrthancPluginRestOutput;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
783
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
784
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
785
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
786 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
787 * @brief Opaque structure that represents a DICOM instance received by Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
788 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
789 typedef struct _OrthancPluginDicomInstance_t OrthancPluginDicomInstance;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
790
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
791
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
792
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
793 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
794 * @brief Opaque structure that represents an image that is uncompressed in memory.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
795 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
796 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
797 typedef struct _OrthancPluginImage_t OrthancPluginImage;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
798
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
799
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
800
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
801 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
802 * @brief Opaque structure that represents the storage area that is actually used by Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
803 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
804 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
805 typedef struct _OrthancPluginStorageArea_t OrthancPluginStorageArea;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
806
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
807
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
808
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
809 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
810 * @brief Opaque structure to an object that represents a C-Find query.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
811 * @ingroup Worklists
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
812 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
813 typedef struct _OrthancPluginWorklistQuery_t OrthancPluginWorklistQuery;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
814
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
815
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
816
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
817 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
818 * @brief Opaque structure to an object that represents the answers to a C-Find query.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
819 * @ingroup Worklists
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
820 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
821 typedef struct _OrthancPluginWorklistAnswers_t OrthancPluginWorklistAnswers;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
822
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
823
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
824
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
825 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
826 * @brief Signature of a callback function that answers to a REST request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
827 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
828 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
829 typedef OrthancPluginErrorCode (*OrthancPluginRestCallback) (
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
830 OrthancPluginRestOutput* output,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
831 const char* url,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
832 const OrthancPluginHttpRequest* request);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
833
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
834
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
835
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
836 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
837 * @brief Signature of a callback function that is triggered when Orthanc receives a DICOM instance.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
838 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
839 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
840 typedef OrthancPluginErrorCode (*OrthancPluginOnStoredInstanceCallback) (
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
841 OrthancPluginDicomInstance* instance,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
842 const char* instanceId);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
843
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
844
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
845
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
846 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
847 * @brief Signature of a callback function that is triggered when a change happens to some DICOM resource.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
848 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
849 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
850 typedef OrthancPluginErrorCode (*OrthancPluginOnChangeCallback) (
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
851 OrthancPluginChangeType changeType,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
852 OrthancPluginResourceType resourceType,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
853 const char* resourceId);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
854
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
855
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
856
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
857 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
858 * @brief Signature of a callback function to decode a DICOM instance as an image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
859 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
860 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
861 typedef OrthancPluginErrorCode (*OrthancPluginDecodeImageCallback) (
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
862 OrthancPluginImage** target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
863 const void* dicom,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
864 const uint32_t size,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
865 uint32_t frameIndex);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
866
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
867
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
868
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
869 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
870 * @brief Signature of a function to free dynamic memory.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
871 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
872 typedef void (*OrthancPluginFree) (void* buffer);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
873
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
874
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
875
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
876 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
877 * @brief Callback for writing to the storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
878 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
879 * Signature of a callback function that is triggered when Orthanc writes a file to the storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
880 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
881 * @param uuid The UUID of the file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
882 * @param content The content of the file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
883 * @param size The size of the file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
884 * @param type The content type corresponding to this file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
885 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
886 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
887 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
888 typedef OrthancPluginErrorCode (*OrthancPluginStorageCreate) (
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
889 const char* uuid,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
890 const void* content,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
891 int64_t size,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
892 OrthancPluginContentType type);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
893
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
894
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
895
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
896 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
897 * @brief Callback for reading from the storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
898 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
899 * Signature of a callback function that is triggered when Orthanc reads a file from the storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
900 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
901 * @param content The content of the file (output).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
902 * @param size The size of the file (output).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
903 * @param uuid The UUID of the file of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
904 * @param type The content type corresponding to this file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
905 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
906 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
907 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
908 typedef OrthancPluginErrorCode (*OrthancPluginStorageRead) (
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
909 void** content,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
910 int64_t* size,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
911 const char* uuid,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
912 OrthancPluginContentType type);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
913
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
914
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
915
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
916 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
917 * @brief Callback for removing a file from the storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
918 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
919 * Signature of a callback function that is triggered when Orthanc deletes a file from the storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
920 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
921 * @param uuid The UUID of the file to be removed.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
922 * @param type The content type corresponding to this file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
923 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
924 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
925 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
926 typedef OrthancPluginErrorCode (*OrthancPluginStorageRemove) (
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
927 const char* uuid,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
928 OrthancPluginContentType type);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
929
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
930
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
931
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
932 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
933 * @brief Callback to handle the C-Find SCP requests received by Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
934 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
935 * Signature of a callback function that is triggered when Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
936 * receives a C-Find SCP request against modality worklists.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
937 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
938 * @param answers The target structure where answers must be stored.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
939 * @param query The worklist query.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
940 * @param remoteAet The Application Entity Title (AET) of the modality from which the request originates.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
941 * @param calledAet The Application Entity Title (AET) of the modality that is called by the request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
942 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
943 * @ingroup Worklists
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
944 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
945 typedef OrthancPluginErrorCode (*OrthancPluginWorklistCallback) (
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
946 OrthancPluginWorklistAnswers* answers,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
947 const OrthancPluginWorklistQuery* query,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
948 const char* remoteAet,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
949 const char* calledAet);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
950
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
951
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
952
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
953 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
954 * @brief Data structure that contains information about the Orthanc core.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
955 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
956 typedef struct _OrthancPluginContext_t
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
957 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
958 void* pluginsManager;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
959 const char* orthancVersion;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
960 OrthancPluginFree Free;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
961 OrthancPluginErrorCode (*InvokeService) (struct _OrthancPluginContext_t* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
962 _OrthancPluginService service,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
963 const void* params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
964 } OrthancPluginContext;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
965
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
966
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
967
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
968 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
969 * @brief An entry in the dictionary of DICOM tags.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
970 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
971 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
972 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
973 uint16_t group; /*!< The group of the tag */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
974 uint16_t element; /*!< The element of the tag */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
975 OrthancPluginValueRepresentation vr; /*!< The value representation of the tag */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
976 uint32_t minMultiplicity; /*!< The minimum multiplicity of the tag */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
977 uint32_t maxMultiplicity; /*!< The maximum multiplicity of the tag (0 means arbitrary) */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
978 } OrthancPluginDictionaryEntry;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
979
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
980
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
981
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
982 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
983 * @brief Free a string.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
984 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
985 * Free a string that was allocated by the core system of Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
986 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
987 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
988 * @param str The string to be freed.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
989 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
990 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeString(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
991 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
992 char* str)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
993 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
994 if (str != NULL)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
995 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
996 context->Free(str);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
997 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
998 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
999
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1000
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1001 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1002 * @brief Check the compatibility of the plugin wrt. the version of its hosting Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1003 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1004 * This function checks whether the version of this C header is
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1005 * compatible with the current version of Orthanc. The result of
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1006 * this function should always be checked in the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1007 * OrthancPluginInitialize() entry point of the plugin.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1008 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1009 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1010 * @return 1 if and only if the versions are compatible. If the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1011 * result is 0, the initialization of the plugin should fail.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1012 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1013 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1014 ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersion(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1015 OrthancPluginContext* context)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1016 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1017 int major, minor, revision;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1018
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1019 if (sizeof(int32_t) != sizeof(OrthancPluginErrorCode) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1020 sizeof(int32_t) != sizeof(OrthancPluginHttpMethod) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1021 sizeof(int32_t) != sizeof(_OrthancPluginService) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1022 sizeof(int32_t) != sizeof(_OrthancPluginProperty) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1023 sizeof(int32_t) != sizeof(OrthancPluginPixelFormat) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1024 sizeof(int32_t) != sizeof(OrthancPluginContentType) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1025 sizeof(int32_t) != sizeof(OrthancPluginResourceType) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1026 sizeof(int32_t) != sizeof(OrthancPluginChangeType) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1027 sizeof(int32_t) != sizeof(OrthancPluginCompressionType) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1028 sizeof(int32_t) != sizeof(OrthancPluginImageFormat) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1029 sizeof(int32_t) != sizeof(OrthancPluginValueRepresentation) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1030 sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFormat) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1031 sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFlags) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1032 sizeof(int32_t) != sizeof(OrthancPluginCreateDicomFlags) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1033 sizeof(int32_t) != sizeof(OrthancPluginIdentifierConstraint) ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1034 sizeof(int32_t) != sizeof(OrthancPluginInstanceOrigin))
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1035 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1036 /* Mismatch in the size of the enumerations */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1037 return 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1038 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1039
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1040 /* Assume compatibility with the mainline */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1041 if (!strcmp(context->orthancVersion, "mainline"))
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1042 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1043 return 1;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1044 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1045
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1046 /* Parse the version of the Orthanc core */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1047 if (
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1048 #ifdef _MSC_VER
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1049 sscanf_s
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1050 #else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1051 sscanf
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1052 #endif
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1053 (context->orthancVersion, "%4d.%4d.%4d", &major, &minor, &revision) != 3)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1054 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1055 return 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1056 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1057
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1058 /* Check the major number of the version */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1059
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1060 if (major > ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1061 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1062 return 1;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1063 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1064
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1065 if (major < ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1066 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1067 return 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1068 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1069
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1070 /* Check the minor number of the version */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1071
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1072 if (minor > ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1073 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1074 return 1;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1075 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1076
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1077 if (minor < ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1078 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1079 return 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1080 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1081
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1082 /* Check the revision number of the version */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1083
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1084 if (revision >= ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1085 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1086 return 1;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1087 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1088 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1089 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1090 return 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1091 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1092 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1093
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1094
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1095 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1096 * @brief Free a memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1097 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1098 * Free a memory buffer that was allocated by the core system of Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1099 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1100 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1101 * @param buffer The memory buffer to release.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1102 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1103 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeMemoryBuffer(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1104 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1105 OrthancPluginMemoryBuffer* buffer)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1106 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1107 context->Free(buffer->data);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1108 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1109
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1110
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1111 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1112 * @brief Log an error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1113 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1114 * Log an error message using the Orthanc logging system.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1115 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1116 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1117 * @param message The message to be logged.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1118 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1119 ORTHANC_PLUGIN_INLINE void OrthancPluginLogError(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1120 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1121 const char* message)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1122 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1123 context->InvokeService(context, _OrthancPluginService_LogError, message);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1124 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1125
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1126
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1127 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1128 * @brief Log a warning.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1129 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1130 * Log a warning message using the Orthanc logging system.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1131 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1132 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1133 * @param message The message to be logged.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1134 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1135 ORTHANC_PLUGIN_INLINE void OrthancPluginLogWarning(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1136 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1137 const char* message)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1138 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1139 context->InvokeService(context, _OrthancPluginService_LogWarning, message);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1140 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1141
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1142
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1143 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1144 * @brief Log an information.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1145 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1146 * Log an information message using the Orthanc logging system.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1147 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1148 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1149 * @param message The message to be logged.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1150 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1151 ORTHANC_PLUGIN_INLINE void OrthancPluginLogInfo(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1152 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1153 const char* message)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1154 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1155 context->InvokeService(context, _OrthancPluginService_LogInfo, message);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1156 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1157
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1158
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1159
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1160 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1161 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1162 const char* pathRegularExpression;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1163 OrthancPluginRestCallback callback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1164 } _OrthancPluginRestCallback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1165
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1166 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1167 * @brief Register a REST callback.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1168 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1169 * This function registers a REST callback against a regular
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1170 * expression for a URI. This function must be called during the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1171 * initialization of the plugin, i.e. inside the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1172 * OrthancPluginInitialize() public function.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1173 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1174 * Each REST callback is guaranteed to run in mutual exclusion.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1175 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1176 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1177 * @param pathRegularExpression Regular expression for the URI. May contain groups.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1178 * @param callback The callback function to handle the REST call.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1179 * @see OrthancPluginRegisterRestCallbackNoLock()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1180 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1181 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1182 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallback(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1183 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1184 const char* pathRegularExpression,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1185 OrthancPluginRestCallback callback)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1186 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1187 _OrthancPluginRestCallback params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1188 params.pathRegularExpression = pathRegularExpression;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1189 params.callback = callback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1190 context->InvokeService(context, _OrthancPluginService_RegisterRestCallback, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1191 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1192
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1193
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1194
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1195 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1196 * @brief Register a REST callback, without locking.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1197 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1198 * This function registers a REST callback against a regular
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1199 * expression for a URI. This function must be called during the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1200 * initialization of the plugin, i.e. inside the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1201 * OrthancPluginInitialize() public function.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1202 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1203 * Contrarily to OrthancPluginRegisterRestCallback(), the callback
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1204 * will NOT be invoked in mutual exclusion. This can be useful for
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1205 * high-performance plugins that must handle concurrent requests
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1206 * (Orthanc uses a pool of threads, one thread being assigned to
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1207 * each incoming HTTP request). Of course, it is up to the plugin to
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1208 * implement the required locking mechanisms.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1209 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1210 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1211 * @param pathRegularExpression Regular expression for the URI. May contain groups.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1212 * @param callback The callback function to handle the REST call.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1213 * @see OrthancPluginRegisterRestCallback()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1214 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1215 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1216 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallbackNoLock(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1217 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1218 const char* pathRegularExpression,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1219 OrthancPluginRestCallback callback)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1220 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1221 _OrthancPluginRestCallback params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1222 params.pathRegularExpression = pathRegularExpression;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1223 params.callback = callback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1224 context->InvokeService(context, _OrthancPluginService_RegisterRestCallbackNoLock, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1225 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1226
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1227
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1228
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1229 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1230 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1231 OrthancPluginOnStoredInstanceCallback callback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1232 } _OrthancPluginOnStoredInstanceCallback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1233
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1234 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1235 * @brief Register a callback for received instances.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1236 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1237 * This function registers a callback function that is called
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1238 * whenever a new DICOM instance is stored into the Orthanc core.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1239 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1240 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1241 * @param callback The callback function.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1242 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1243 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1244 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnStoredInstanceCallback(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1245 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1246 OrthancPluginOnStoredInstanceCallback callback)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1247 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1248 _OrthancPluginOnStoredInstanceCallback params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1249 params.callback = callback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1250
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1251 context->InvokeService(context, _OrthancPluginService_RegisterOnStoredInstanceCallback, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1252 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1253
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1254
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1255
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1256 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1257 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1258 OrthancPluginRestOutput* output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1259 const char* answer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1260 uint32_t answerSize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1261 const char* mimeType;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1262 } _OrthancPluginAnswerBuffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1263
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1264 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1265 * @brief Answer to a REST request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1266 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1267 * This function answers to a REST request with the content of a memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1268 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1269 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1270 * @param output The HTTP connection to the client application.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1271 * @param answer Pointer to the memory buffer containing the answer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1272 * @param answerSize Number of bytes of the answer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1273 * @param mimeType The MIME type of the answer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1274 * @ingroup REST
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1275 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1276 ORTHANC_PLUGIN_INLINE void OrthancPluginAnswerBuffer(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1277 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1278 OrthancPluginRestOutput* output,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1279 const char* answer,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1280 uint32_t answerSize,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1281 const char* mimeType)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1282 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1283 _OrthancPluginAnswerBuffer params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1284 params.output = output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1285 params.answer = answer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1286 params.answerSize = answerSize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1287 params.mimeType = mimeType;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1288 context->InvokeService(context, _OrthancPluginService_AnswerBuffer, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1289 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1290
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1291
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1292 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1293 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1294 OrthancPluginRestOutput* output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1295 OrthancPluginPixelFormat format;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1296 uint32_t width;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1297 uint32_t height;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1298 uint32_t pitch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1299 const void* buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1300 } _OrthancPluginCompressAndAnswerPngImage;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1301
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1302 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1303 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1304 OrthancPluginRestOutput* output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1305 OrthancPluginImageFormat imageFormat;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1306 OrthancPluginPixelFormat pixelFormat;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1307 uint32_t width;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1308 uint32_t height;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1309 uint32_t pitch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1310 const void* buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1311 uint8_t quality;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1312 } _OrthancPluginCompressAndAnswerImage;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1313
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1314
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1315 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1316 * @brief Answer to a REST request with a PNG image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1317 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1318 * This function answers to a REST request with a PNG image. The
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1319 * parameters of this function describe a memory buffer that
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1320 * contains an uncompressed image. The image will be automatically compressed
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1321 * as a PNG image by the core system of Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1322 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1323 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1324 * @param output The HTTP connection to the client application.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1325 * @param format The memory layout of the uncompressed image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1326 * @param width The width of the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1327 * @param height The height of the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1328 * @param pitch The pitch of the image (i.e. the number of bytes
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1329 * between 2 successive lines of the image in the memory buffer).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1330 * @param buffer The memory buffer containing the uncompressed image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1331 * @ingroup REST
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1332 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1333 ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerPngImage(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1334 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1335 OrthancPluginRestOutput* output,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1336 OrthancPluginPixelFormat format,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1337 uint32_t width,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1338 uint32_t height,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1339 uint32_t pitch,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1340 const void* buffer)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1341 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1342 _OrthancPluginCompressAndAnswerImage params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1343 params.output = output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1344 params.imageFormat = OrthancPluginImageFormat_Png;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1345 params.pixelFormat = format;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1346 params.width = width;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1347 params.height = height;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1348 params.pitch = pitch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1349 params.buffer = buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1350 params.quality = 0; /* No quality for PNG */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1351 context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1352 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1353
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1354
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1355
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1356 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1357 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1358 OrthancPluginMemoryBuffer* target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1359 const char* instanceId;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1360 } _OrthancPluginGetDicomForInstance;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1361
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1362 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1363 * @brief Retrieve a DICOM instance using its Orthanc identifier.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1364 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1365 * Retrieve a DICOM instance using its Orthanc identifier. The DICOM
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1366 * file is stored into a newly allocated memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1367 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1368 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1369 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1370 * @param instanceId The Orthanc identifier of the DICOM instance of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1371 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1372 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1373 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1374 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginGetDicomForInstance(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1375 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1376 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1377 const char* instanceId)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1378 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1379 _OrthancPluginGetDicomForInstance params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1380 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1381 params.instanceId = instanceId;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1382 return context->InvokeService(context, _OrthancPluginService_GetDicomForInstance, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1383 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1384
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1385
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1386
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1387 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1388 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1389 OrthancPluginMemoryBuffer* target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1390 const char* uri;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1391 } _OrthancPluginRestApiGet;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1392
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1393 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1394 * @brief Make a GET call to the built-in Orthanc REST API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1395 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1396 * Make a GET call to the built-in Orthanc REST API. The result to
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1397 * the query is stored into a newly allocated memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1398 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1399 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1400 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1401 * @param uri The URI in the built-in Orthanc API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1402 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1403 * @see OrthancPluginRestApiGetAfterPlugins
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1404 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1405 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1406 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiGet(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1407 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1408 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1409 const char* uri)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1410 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1411 _OrthancPluginRestApiGet params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1412 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1413 params.uri = uri;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1414 return context->InvokeService(context, _OrthancPluginService_RestApiGet, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1415 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1416
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1417
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1418
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1419 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1420 * @brief Make a GET call to the REST API, as tainted by the plugins.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1421 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1422 * Make a GET call to the Orthanc REST API, after all the plugins
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1423 * are applied. In other words, if some plugin overrides or adds the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1424 * called URI to the built-in Orthanc REST API, this call will
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1425 * return the result provided by this plugin. The result to the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1426 * query is stored into a newly allocated memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1427 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1428 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1429 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1430 * @param uri The URI in the built-in Orthanc API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1431 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1432 * @see OrthancPluginRestApiGet
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1433 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1434 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1435 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiGetAfterPlugins(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1436 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1437 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1438 const char* uri)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1439 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1440 _OrthancPluginRestApiGet params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1441 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1442 params.uri = uri;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1443 return context->InvokeService(context, _OrthancPluginService_RestApiGetAfterPlugins, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1444 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1445
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1446
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1447
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1448 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1449 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1450 OrthancPluginMemoryBuffer* target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1451 const char* uri;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1452 const char* body;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1453 uint32_t bodySize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1454 } _OrthancPluginRestApiPostPut;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1455
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1456 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1457 * @brief Make a POST call to the built-in Orthanc REST API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1458 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1459 * Make a POST call to the built-in Orthanc REST API. The result to
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1460 * the query is stored into a newly allocated memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1461 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1462 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1463 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1464 * @param uri The URI in the built-in Orthanc API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1465 * @param body The body of the POST request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1466 * @param bodySize The size of the body.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1467 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1468 * @see OrthancPluginRestApiPostAfterPlugins
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1469 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1470 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1471 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPost(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1472 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1473 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1474 const char* uri,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1475 const char* body,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1476 uint32_t bodySize)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1477 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1478 _OrthancPluginRestApiPostPut params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1479 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1480 params.uri = uri;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1481 params.body = body;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1482 params.bodySize = bodySize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1483 return context->InvokeService(context, _OrthancPluginService_RestApiPost, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1484 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1485
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1486
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1487 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1488 * @brief Make a POST call to the REST API, as tainted by the plugins.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1489 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1490 * Make a POST call to the Orthanc REST API, after all the plugins
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1491 * are applied. In other words, if some plugin overrides or adds the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1492 * called URI to the built-in Orthanc REST API, this call will
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1493 * return the result provided by this plugin. The result to the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1494 * query is stored into a newly allocated memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1495 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1496 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1497 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1498 * @param uri The URI in the built-in Orthanc API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1499 * @param body The body of the POST request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1500 * @param bodySize The size of the body.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1501 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1502 * @see OrthancPluginRestApiPost
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1503 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1504 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1505 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPostAfterPlugins(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1506 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1507 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1508 const char* uri,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1509 const char* body,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1510 uint32_t bodySize)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1511 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1512 _OrthancPluginRestApiPostPut params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1513 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1514 params.uri = uri;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1515 params.body = body;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1516 params.bodySize = bodySize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1517 return context->InvokeService(context, _OrthancPluginService_RestApiPostAfterPlugins, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1518 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1519
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1520
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1521
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1522 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1523 * @brief Make a DELETE call to the built-in Orthanc REST API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1524 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1525 * Make a DELETE call to the built-in Orthanc REST API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1526 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1527 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1528 * @param uri The URI to delete in the built-in Orthanc API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1529 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1530 * @see OrthancPluginRestApiDeleteAfterPlugins
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1531 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1532 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1533 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiDelete(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1534 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1535 const char* uri)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1536 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1537 return context->InvokeService(context, _OrthancPluginService_RestApiDelete, uri);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1538 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1539
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1540
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1541 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1542 * @brief Make a DELETE call to the REST API, as tainted by the plugins.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1543 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1544 * Make a DELETE call to the Orthanc REST API, after all the plugins
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1545 * are applied. In other words, if some plugin overrides or adds the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1546 * called URI to the built-in Orthanc REST API, this call will
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1547 * return the result provided by this plugin.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1548 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1549 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1550 * @param uri The URI to delete in the built-in Orthanc API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1551 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1552 * @see OrthancPluginRestApiDelete
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1553 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1554 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1555 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiDeleteAfterPlugins(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1556 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1557 const char* uri)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1558 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1559 return context->InvokeService(context, _OrthancPluginService_RestApiDeleteAfterPlugins, uri);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1560 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1561
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1562
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1563
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1564 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1565 * @brief Make a PUT call to the built-in Orthanc REST API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1566 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1567 * Make a PUT call to the built-in Orthanc REST API. The result to
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1568 * the query is stored into a newly allocated memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1569 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1570 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1571 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1572 * @param uri The URI in the built-in Orthanc API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1573 * @param body The body of the PUT request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1574 * @param bodySize The size of the body.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1575 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1576 * @see OrthancPluginRestApiPutAfterPlugins
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1577 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1578 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1579 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPut(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1580 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1581 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1582 const char* uri,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1583 const char* body,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1584 uint32_t bodySize)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1585 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1586 _OrthancPluginRestApiPostPut params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1587 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1588 params.uri = uri;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1589 params.body = body;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1590 params.bodySize = bodySize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1591 return context->InvokeService(context, _OrthancPluginService_RestApiPut, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1592 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1593
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1594
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1595
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1596 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1597 * @brief Make a PUT call to the REST API, as tainted by the plugins.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1598 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1599 * Make a PUT call to the Orthanc REST API, after all the plugins
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1600 * are applied. In other words, if some plugin overrides or adds the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1601 * called URI to the built-in Orthanc REST API, this call will
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1602 * return the result provided by this plugin. The result to the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1603 * query is stored into a newly allocated memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1604 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1605 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1606 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1607 * @param uri The URI in the built-in Orthanc API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1608 * @param body The body of the PUT request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1609 * @param bodySize The size of the body.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1610 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1611 * @see OrthancPluginRestApiPut
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1612 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1613 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1614 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPutAfterPlugins(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1615 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1616 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1617 const char* uri,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1618 const char* body,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1619 uint32_t bodySize)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1620 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1621 _OrthancPluginRestApiPostPut params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1622 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1623 params.uri = uri;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1624 params.body = body;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1625 params.bodySize = bodySize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1626 return context->InvokeService(context, _OrthancPluginService_RestApiPutAfterPlugins, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1627 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1628
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1629
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1630
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1631 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1632 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1633 OrthancPluginRestOutput* output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1634 const char* argument;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1635 } _OrthancPluginOutputPlusArgument;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1636
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1637 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1638 * @brief Redirect a REST request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1639 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1640 * This function answers to a REST request by redirecting the user
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1641 * to another URI using HTTP status 301.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1642 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1643 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1644 * @param output The HTTP connection to the client application.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1645 * @param redirection Where to redirect.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1646 * @ingroup REST
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1647 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1648 ORTHANC_PLUGIN_INLINE void OrthancPluginRedirect(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1649 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1650 OrthancPluginRestOutput* output,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1651 const char* redirection)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1652 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1653 _OrthancPluginOutputPlusArgument params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1654 params.output = output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1655 params.argument = redirection;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1656 context->InvokeService(context, _OrthancPluginService_Redirect, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1657 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1658
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1659
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1660
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1661 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1662 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1663 char** result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1664 const char* argument;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1665 } _OrthancPluginRetrieveDynamicString;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1666
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1667 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1668 * @brief Look for a patient.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1669 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1670 * Look for a patient stored in Orthanc, using its Patient ID tag (0x0010, 0x0020).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1671 * This function uses the database index to run as fast as possible (it does not loop
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1672 * over all the stored patients).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1673 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1674 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1675 * @param patientID The Patient ID of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1676 * @return The NULL value if the patient is non-existent, or a string containing the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1677 * Orthanc ID of the patient. This string must be freed by OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1678 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1679 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1680 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupPatient(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1681 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1682 const char* patientID)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1683 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1684 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1685
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1686 _OrthancPluginRetrieveDynamicString params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1687 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1688 params.argument = patientID;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1689
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1690 if (context->InvokeService(context, _OrthancPluginService_LookupPatient, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1691 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1692 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1693 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1694 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1695 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1696 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1697 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1698 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1699 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1700
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1701
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1702 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1703 * @brief Look for a study.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1704 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1705 * Look for a study stored in Orthanc, using its Study Instance UID tag (0x0020, 0x000d).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1706 * This function uses the database index to run as fast as possible (it does not loop
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1707 * over all the stored studies).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1708 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1709 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1710 * @param studyUID The Study Instance UID of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1711 * @return The NULL value if the study is non-existent, or a string containing the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1712 * Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1713 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1714 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1715 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudy(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1716 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1717 const char* studyUID)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1718 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1719 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1720
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1721 _OrthancPluginRetrieveDynamicString params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1722 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1723 params.argument = studyUID;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1724
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1725 if (context->InvokeService(context, _OrthancPluginService_LookupStudy, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1726 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1727 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1728 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1729 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1730 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1731 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1732 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1733 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1734 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1735
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1736
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1737 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1738 * @brief Look for a study, using the accession number.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1739 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1740 * Look for a study stored in Orthanc, using its Accession Number tag (0x0008, 0x0050).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1741 * This function uses the database index to run as fast as possible (it does not loop
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1742 * over all the stored studies).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1743 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1744 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1745 * @param accessionNumber The Accession Number of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1746 * @return The NULL value if the study is non-existent, or a string containing the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1747 * Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1748 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1749 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1750 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudyWithAccessionNumber(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1751 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1752 const char* accessionNumber)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1753 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1754 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1755
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1756 _OrthancPluginRetrieveDynamicString params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1757 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1758 params.argument = accessionNumber;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1759
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1760 if (context->InvokeService(context, _OrthancPluginService_LookupStudyWithAccessionNumber, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1761 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1762 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1763 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1764 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1765 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1766 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1767 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1768 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1769 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1770
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1771
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1772 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1773 * @brief Look for a series.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1774 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1775 * Look for a series stored in Orthanc, using its Series Instance UID tag (0x0020, 0x000e).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1776 * This function uses the database index to run as fast as possible (it does not loop
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1777 * over all the stored series).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1778 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1779 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1780 * @param seriesUID The Series Instance UID of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1781 * @return The NULL value if the series is non-existent, or a string containing the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1782 * Orthanc ID of the series. This string must be freed by OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1783 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1784 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1785 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupSeries(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1786 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1787 const char* seriesUID)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1788 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1789 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1790
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1791 _OrthancPluginRetrieveDynamicString params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1792 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1793 params.argument = seriesUID;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1794
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1795 if (context->InvokeService(context, _OrthancPluginService_LookupSeries, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1796 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1797 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1798 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1799 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1800 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1801 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1802 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1803 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1804 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1805
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1806
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1807 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1808 * @brief Look for an instance.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1809 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1810 * Look for an instance stored in Orthanc, using its SOP Instance UID tag (0x0008, 0x0018).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1811 * This function uses the database index to run as fast as possible (it does not loop
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1812 * over all the stored instances).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1813 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1814 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1815 * @param sopInstanceUID The SOP Instance UID of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1816 * @return The NULL value if the instance is non-existent, or a string containing the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1817 * Orthanc ID of the instance. This string must be freed by OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1818 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1819 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1820 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupInstance(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1821 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1822 const char* sopInstanceUID)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1823 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1824 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1825
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1826 _OrthancPluginRetrieveDynamicString params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1827 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1828 params.argument = sopInstanceUID;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1829
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1830 if (context->InvokeService(context, _OrthancPluginService_LookupInstance, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1831 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1832 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1833 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1834 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1835 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1836 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1837 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1838 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1839 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1840
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1841
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1842
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1843 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1844 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1845 OrthancPluginRestOutput* output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1846 uint16_t status;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1847 } _OrthancPluginSendHttpStatusCode;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1848
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1849 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1850 * @brief Send a HTTP status code.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1851 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1852 * This function answers to a REST request by sending a HTTP status
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1853 * code (such as "400 - Bad Request"). Note that:
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1854 * - Successful requests (status 200) must use ::OrthancPluginAnswerBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1855 * - Redirections (status 301) must use ::OrthancPluginRedirect().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1856 * - Unauthorized access (status 401) must use ::OrthancPluginSendUnauthorized().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1857 * - Methods not allowed (status 405) must use ::OrthancPluginSendMethodNotAllowed().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1858 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1859 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1860 * @param output The HTTP connection to the client application.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1861 * @param status The HTTP status code to be sent.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1862 * @ingroup REST
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1863 * @see OrthancPluginSendHttpStatus()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1864 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1865 ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatusCode(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1866 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1867 OrthancPluginRestOutput* output,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1868 uint16_t status)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1869 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1870 _OrthancPluginSendHttpStatusCode params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1871 params.output = output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1872 params.status = status;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1873 context->InvokeService(context, _OrthancPluginService_SendHttpStatusCode, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1874 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1875
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1876
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1877 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1878 * @brief Signal that a REST request is not authorized.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1879 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1880 * This function answers to a REST request by signaling that it is
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1881 * not authorized.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1882 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1883 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1884 * @param output The HTTP connection to the client application.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1885 * @param realm The realm for the authorization process.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1886 * @ingroup REST
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1887 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1888 ORTHANC_PLUGIN_INLINE void OrthancPluginSendUnauthorized(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1889 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1890 OrthancPluginRestOutput* output,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1891 const char* realm)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1892 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1893 _OrthancPluginOutputPlusArgument params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1894 params.output = output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1895 params.argument = realm;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1896 context->InvokeService(context, _OrthancPluginService_SendUnauthorized, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1897 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1898
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1899
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1900 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1901 * @brief Signal that this URI does not support this HTTP method.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1902 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1903 * This function answers to a REST request by signaling that the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1904 * queried URI does not support this method.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1905 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1906 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1907 * @param output The HTTP connection to the client application.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1908 * @param allowedMethods The allowed methods for this URI (e.g. "GET,POST" after a PUT or a POST request).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1909 * @ingroup REST
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1910 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1911 ORTHANC_PLUGIN_INLINE void OrthancPluginSendMethodNotAllowed(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1912 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1913 OrthancPluginRestOutput* output,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1914 const char* allowedMethods)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1915 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1916 _OrthancPluginOutputPlusArgument params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1917 params.output = output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1918 params.argument = allowedMethods;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1919 context->InvokeService(context, _OrthancPluginService_SendMethodNotAllowed, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1920 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1921
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1922
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1923 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1924 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1925 OrthancPluginRestOutput* output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1926 const char* key;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1927 const char* value;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1928 } _OrthancPluginSetHttpHeader;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1929
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1930 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1931 * @brief Set a cookie.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1932 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1933 * This function sets a cookie in the HTTP client.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1934 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1935 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1936 * @param output The HTTP connection to the client application.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1937 * @param cookie The cookie to be set.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1938 * @param value The value of the cookie.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1939 * @ingroup REST
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1940 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1941 ORTHANC_PLUGIN_INLINE void OrthancPluginSetCookie(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1942 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1943 OrthancPluginRestOutput* output,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1944 const char* cookie,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1945 const char* value)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1946 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1947 _OrthancPluginSetHttpHeader params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1948 params.output = output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1949 params.key = cookie;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1950 params.value = value;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1951 context->InvokeService(context, _OrthancPluginService_SetCookie, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1952 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1953
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1954
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1955 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1956 * @brief Set some HTTP header.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1957 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1958 * This function sets a HTTP header in the HTTP answer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1959 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1960 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1961 * @param output The HTTP connection to the client application.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1962 * @param key The HTTP header to be set.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1963 * @param value The value of the HTTP header.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1964 * @ingroup REST
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1965 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1966 ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpHeader(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1967 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1968 OrthancPluginRestOutput* output,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1969 const char* key,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1970 const char* value)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1971 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1972 _OrthancPluginSetHttpHeader params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1973 params.output = output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1974 params.key = key;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1975 params.value = value;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1976 context->InvokeService(context, _OrthancPluginService_SetHttpHeader, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1977 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1978
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1979
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1980 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1981 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1982 char** resultStringToFree;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1983 const char** resultString;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1984 int64_t* resultInt64;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1985 const char* key;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1986 OrthancPluginDicomInstance* instance;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1987 OrthancPluginInstanceOrigin* resultOrigin; /* New in Orthanc 0.9.5 SDK */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1988 } _OrthancPluginAccessDicomInstance;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1989
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1990
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1991 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1992 * @brief Get the AET of a DICOM instance.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1993 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1994 * This function returns the Application Entity Title (AET) of the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1995 * DICOM modality from which a DICOM instance originates.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1996 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1997 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1998 * @param instance The instance of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1999 * @return The AET if success, NULL if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2000 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2001 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2002 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceRemoteAet(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2003 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2004 OrthancPluginDicomInstance* instance)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2005 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2006 const char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2007
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2008 _OrthancPluginAccessDicomInstance params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2009 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2010 params.resultString = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2011 params.instance = instance;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2012
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2013 if (context->InvokeService(context, _OrthancPluginService_GetInstanceRemoteAet, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2014 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2015 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2016 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2017 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2018 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2019 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2020 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2021 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2022 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2023
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2024
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2025 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2026 * @brief Get the size of a DICOM file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2027 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2028 * This function returns the number of bytes of the given DICOM instance.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2029 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2030 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2031 * @param instance The instance of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2032 * @return The size of the file, -1 in case of error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2033 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2034 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2035 ORTHANC_PLUGIN_INLINE int64_t OrthancPluginGetInstanceSize(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2036 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2037 OrthancPluginDicomInstance* instance)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2038 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2039 int64_t size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2040
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2041 _OrthancPluginAccessDicomInstance params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2042 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2043 params.resultInt64 = &size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2044 params.instance = instance;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2045
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2046 if (context->InvokeService(context, _OrthancPluginService_GetInstanceSize, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2047 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2048 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2049 return -1;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2050 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2051 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2052 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2053 return size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2054 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2055 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2056
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2057
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2058 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2059 * @brief Get the data of a DICOM file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2060 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2061 * This function returns a pointer to the content of the given DICOM instance.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2062 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2063 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2064 * @param instance The instance of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2065 * @return The pointer to the DICOM data, NULL in case of error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2066 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2067 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2068 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceData(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2069 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2070 OrthancPluginDicomInstance* instance)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2071 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2072 const char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2073
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2074 _OrthancPluginAccessDicomInstance params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2075 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2076 params.resultString = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2077 params.instance = instance;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2078
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2079 if (context->InvokeService(context, _OrthancPluginService_GetInstanceData, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2080 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2081 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2082 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2083 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2084 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2085 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2086 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2087 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2088 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2089
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2090
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2091 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2092 * @brief Get the DICOM tag hierarchy as a JSON file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2093 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2094 * This function returns a pointer to a newly created string
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2095 * containing a JSON file. This JSON file encodes the tag hierarchy
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2096 * of the given DICOM instance.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2097 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2098 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2099 * @param instance The instance of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2100 * @return The NULL value in case of error, or a string containing the JSON file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2101 * This string must be freed by OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2102 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2103 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2104 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceJson(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2105 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2106 OrthancPluginDicomInstance* instance)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2107 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2108 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2109
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2110 _OrthancPluginAccessDicomInstance params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2111 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2112 params.resultStringToFree = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2113 params.instance = instance;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2114
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2115 if (context->InvokeService(context, _OrthancPluginService_GetInstanceJson, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2116 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2117 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2118 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2119 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2120 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2121 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2122 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2123 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2124 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2125
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2126
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2127 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2128 * @brief Get the DICOM tag hierarchy as a JSON file (with simplification).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2129 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2130 * This function returns a pointer to a newly created string
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2131 * containing a JSON file. This JSON file encodes the tag hierarchy
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2132 * of the given DICOM instance. In contrast with
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2133 * ::OrthancPluginGetInstanceJson(), the returned JSON file is in
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2134 * its simplified version.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2135 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2136 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2137 * @param instance The instance of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2138 * @return The NULL value in case of error, or a string containing the JSON file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2139 * This string must be freed by OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2140 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2141 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2142 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceSimplifiedJson(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2143 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2144 OrthancPluginDicomInstance* instance)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2145 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2146 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2147
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2148 _OrthancPluginAccessDicomInstance params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2149 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2150 params.resultStringToFree = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2151 params.instance = instance;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2152
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2153 if (context->InvokeService(context, _OrthancPluginService_GetInstanceSimplifiedJson, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2154 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2155 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2156 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2157 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2158 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2159 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2160 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2161 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2162 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2163
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2164
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2165 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2166 * @brief Check whether a DICOM instance is associated with some metadata.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2167 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2168 * This function checks whether the DICOM instance of interest is
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2169 * associated with some metadata. As of Orthanc 0.8.1, in the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2170 * callbacks registered by
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2171 * ::OrthancPluginRegisterOnStoredInstanceCallback(), the only
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2172 * possibly available metadata are "ReceptionDate", "RemoteAET" and
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2173 * "IndexInSeries".
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2174 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2175 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2176 * @param instance The instance of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2177 * @param metadata The metadata of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2178 * @return 1 if the metadata is present, 0 if it is absent, -1 in case of error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2179 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2180 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2181 ORTHANC_PLUGIN_INLINE int OrthancPluginHasInstanceMetadata(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2182 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2183 OrthancPluginDicomInstance* instance,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2184 const char* metadata)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2185 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2186 int64_t result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2187
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2188 _OrthancPluginAccessDicomInstance params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2189 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2190 params.resultInt64 = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2191 params.instance = instance;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2192 params.key = metadata;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2193
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2194 if (context->InvokeService(context, _OrthancPluginService_HasInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2195 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2196 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2197 return -1;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2198 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2199 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2200 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2201 return (result != 0);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2202 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2203 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2204
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2205
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2206 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2207 * @brief Get the value of some metadata associated with a given DICOM instance.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2208 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2209 * This functions returns the value of some metadata that is associated with the DICOM instance of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2210 * Before calling this function, the existence of the metadata must have been checked with
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2211 * ::OrthancPluginHasInstanceMetadata().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2212 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2213 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2214 * @param instance The instance of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2215 * @param metadata The metadata of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2216 * @return The metadata value if success, NULL if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2217 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2218 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2219 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceMetadata(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2220 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2221 OrthancPluginDicomInstance* instance,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2222 const char* metadata)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2223 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2224 const char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2225
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2226 _OrthancPluginAccessDicomInstance params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2227 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2228 params.resultString = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2229 params.instance = instance;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2230 params.key = metadata;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2231
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2232 if (context->InvokeService(context, _OrthancPluginService_GetInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2233 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2234 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2235 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2236 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2237 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2238 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2239 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2240 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2241 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2242
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2243
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2244
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2245 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2246 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2247 OrthancPluginStorageCreate create;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2248 OrthancPluginStorageRead read;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2249 OrthancPluginStorageRemove remove;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2250 OrthancPluginFree free;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2251 } _OrthancPluginRegisterStorageArea;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2252
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2253 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2254 * @brief Register a custom storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2255 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2256 * This function registers a custom storage area, to replace the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2257 * built-in way Orthanc stores its files on the filesystem. This
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2258 * function must be called during the initialization of the plugin,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2259 * i.e. inside the OrthancPluginInitialize() public function.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2260 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2261 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2262 * @param create The callback function to store a file on the custom storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2263 * @param read The callback function to read a file from the custom storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2264 * @param remove The callback function to remove a file from the custom storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2265 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2266 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2267 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterStorageArea(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2268 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2269 OrthancPluginStorageCreate create,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2270 OrthancPluginStorageRead read,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2271 OrthancPluginStorageRemove remove)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2272 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2273 _OrthancPluginRegisterStorageArea params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2274 params.create = create;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2275 params.read = read;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2276 params.remove = remove;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2277
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2278 #ifdef __cplusplus
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2279 params.free = ::free;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2280 #else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2281 params.free = free;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2282 #endif
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2283
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2284 context->InvokeService(context, _OrthancPluginService_RegisterStorageArea, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2285 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2286
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2287
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2288
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2289 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2290 * @brief Return the path to the Orthanc executable.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2291 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2292 * This function returns the path to the Orthanc executable.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2293 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2294 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2295 * @return NULL in the case of an error, or a newly allocated string
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2296 * containing the path. This string must be freed by
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2297 * OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2298 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2299 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancPath(OrthancPluginContext* context)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2300 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2301 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2302
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2303 _OrthancPluginRetrieveDynamicString params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2304 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2305 params.argument = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2306
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2307 if (context->InvokeService(context, _OrthancPluginService_GetOrthancPath, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2308 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2309 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2310 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2311 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2312 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2313 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2314 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2315 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2316 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2317
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2318
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2319 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2320 * @brief Return the directory containing the Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2321 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2322 * This function returns the path to the directory containing the Orthanc executable.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2323 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2324 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2325 * @return NULL in the case of an error, or a newly allocated string
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2326 * containing the path. This string must be freed by
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2327 * OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2328 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2329 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancDirectory(OrthancPluginContext* context)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2330 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2331 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2332
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2333 _OrthancPluginRetrieveDynamicString params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2334 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2335 params.argument = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2336
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2337 if (context->InvokeService(context, _OrthancPluginService_GetOrthancDirectory, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2338 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2339 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2340 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2341 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2342 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2343 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2344 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2345 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2346 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2347
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2348
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2349 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2350 * @brief Return the path to the configuration file(s).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2351 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2352 * This function returns the path to the configuration file(s) that
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2353 * was specified when starting Orthanc. Since version 0.9.1, this
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2354 * path can refer to a folder that stores a set of configuration
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2355 * files. This function is deprecated in favor of
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2356 * OrthancPluginGetConfiguration().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2357 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2358 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2359 * @return NULL in the case of an error, or a newly allocated string
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2360 * containing the path. This string must be freed by
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2361 * OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2362 * @see OrthancPluginGetConfiguration()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2363 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2364 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfigurationPath(OrthancPluginContext* context)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2365 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2366 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2367
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2368 _OrthancPluginRetrieveDynamicString params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2369 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2370 params.argument = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2371
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2372 if (context->InvokeService(context, _OrthancPluginService_GetConfigurationPath, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2373 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2374 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2375 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2376 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2377 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2378 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2379 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2380 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2381 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2382
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2383
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2384
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2385 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2386 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2387 OrthancPluginOnChangeCallback callback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2388 } _OrthancPluginOnChangeCallback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2389
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2390 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2391 * @brief Register a callback to monitor changes.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2392 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2393 * This function registers a callback function that is called
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2394 * whenever a change happens to some DICOM resource.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2395 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2396 * @warning If your change callback has to call the REST API of
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2397 * Orthanc, you should make these calls in a separate thread (with
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2398 * the events passing through a message queue). Otherwise, this
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2399 * could result in deadlocks in the presence of other plugins or Lua
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2400 * script.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2401 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2402 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2403 * @param callback The callback function.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2404 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2405 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2406 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnChangeCallback(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2407 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2408 OrthancPluginOnChangeCallback callback)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2409 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2410 _OrthancPluginOnChangeCallback params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2411 params.callback = callback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2412
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2413 context->InvokeService(context, _OrthancPluginService_RegisterOnChangeCallback, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2414 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2415
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2416
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2417
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2418 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2419 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2420 const char* plugin;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2421 _OrthancPluginProperty property;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2422 const char* value;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2423 } _OrthancPluginSetPluginProperty;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2424
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2425
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2426 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2427 * @brief Set the URI where the plugin provides its Web interface.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2428 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2429 * For plugins that come with a Web interface, this function
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2430 * declares the entry path where to find this interface. This
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2431 * information is notably used in the "Plugins" page of Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2432 * Explorer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2433 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2434 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2435 * @param uri The root URI for this plugin.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2436 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2437 ORTHANC_PLUGIN_INLINE void OrthancPluginSetRootUri(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2438 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2439 const char* uri)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2440 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2441 _OrthancPluginSetPluginProperty params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2442 params.plugin = OrthancPluginGetName();
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2443 params.property = _OrthancPluginProperty_RootUri;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2444 params.value = uri;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2445
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2446 context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2447 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2448
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2449
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2450 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2451 * @brief Set a description for this plugin.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2452 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2453 * Set a description for this plugin. It is displayed in the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2454 * "Plugins" page of Orthanc Explorer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2455 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2456 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2457 * @param description The description.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2458 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2459 ORTHANC_PLUGIN_INLINE void OrthancPluginSetDescription(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2460 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2461 const char* description)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2462 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2463 _OrthancPluginSetPluginProperty params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2464 params.plugin = OrthancPluginGetName();
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2465 params.property = _OrthancPluginProperty_Description;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2466 params.value = description;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2467
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2468 context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2469 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2470
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2471
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2472 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2473 * @brief Extend the JavaScript code of Orthanc Explorer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2474 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2475 * Add JavaScript code to customize the default behavior of Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2476 * Explorer. This can for instance be used to add new buttons.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2477 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2478 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2479 * @param javascript The custom JavaScript code.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2480 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2481 ORTHANC_PLUGIN_INLINE void OrthancPluginExtendOrthancExplorer(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2482 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2483 const char* javascript)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2484 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2485 _OrthancPluginSetPluginProperty params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2486 params.plugin = OrthancPluginGetName();
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2487 params.property = _OrthancPluginProperty_OrthancExplorer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2488 params.value = javascript;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2489
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2490 context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2491 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2492
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2493
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2494 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2495 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2496 char** result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2497 int32_t property;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2498 const char* value;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2499 } _OrthancPluginGlobalProperty;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2500
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2501
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2502 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2503 * @brief Get the value of a global property.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2504 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2505 * Get the value of a global property that is stored in the Orthanc database. Global
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2506 * properties whose index is below 1024 are reserved by Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2507 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2508 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2509 * @param property The global property of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2510 * @param defaultValue The value to return, if the global property is unset.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2511 * @return The value of the global property, or NULL in the case of an error. This
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2512 * string must be freed by OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2513 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2514 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2515 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetGlobalProperty(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2516 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2517 int32_t property,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2518 const char* defaultValue)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2519 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2520 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2521
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2522 _OrthancPluginGlobalProperty params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2523 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2524 params.property = property;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2525 params.value = defaultValue;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2526
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2527 if (context->InvokeService(context, _OrthancPluginService_GetGlobalProperty, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2528 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2529 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2530 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2531 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2532 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2533 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2534 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2535 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2536 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2537
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2538
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2539 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2540 * @brief Set the value of a global property.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2541 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2542 * Set the value of a global property into the Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2543 * database. Setting a global property can be used by plugins to
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2544 * save their internal parameters. Plugins are only allowed to set
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2545 * properties whose index are above or equal to 1024 (properties
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2546 * below 1024 are read-only and reserved by Orthanc).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2547 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2548 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2549 * @param property The global property of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2550 * @param value The value to be set in the global property.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2551 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2552 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2553 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2554 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginSetGlobalProperty(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2555 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2556 int32_t property,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2557 const char* value)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2558 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2559 _OrthancPluginGlobalProperty params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2560 params.result = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2561 params.property = property;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2562 params.value = value;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2563
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2564 return context->InvokeService(context, _OrthancPluginService_SetGlobalProperty, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2565 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2566
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2567
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2568
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2569 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2570 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2571 int32_t *resultInt32;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2572 uint32_t *resultUint32;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2573 int64_t *resultInt64;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2574 uint64_t *resultUint64;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2575 } _OrthancPluginReturnSingleValue;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2576
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2577 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2578 * @brief Get the number of command-line arguments.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2579 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2580 * Retrieve the number of command-line arguments that were used to launch Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2581 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2582 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2583 * @return The number of arguments.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2584 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2585 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetCommandLineArgumentsCount(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2586 OrthancPluginContext* context)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2587 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2588 uint32_t count = 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2589
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2590 _OrthancPluginReturnSingleValue params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2591 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2592 params.resultUint32 = &count;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2593
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2594 if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgumentsCount, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2595 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2596 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2597 return 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2598 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2599 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2600 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2601 return count;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2602 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2603 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2604
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2605
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2606
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2607 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2608 * @brief Get the value of a command-line argument.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2609 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2610 * Get the value of one of the command-line arguments that were used
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2611 * to launch Orthanc. The number of available arguments can be
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2612 * retrieved by OrthancPluginGetCommandLineArgumentsCount().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2613 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2614 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2615 * @param argument The index of the argument.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2616 * @return The value of the argument, or NULL in the case of an error. This
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2617 * string must be freed by OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2618 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2619 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetCommandLineArgument(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2620 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2621 uint32_t argument)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2622 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2623 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2624
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2625 _OrthancPluginGlobalProperty params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2626 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2627 params.property = (int32_t) argument;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2628 params.value = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2629
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2630 if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgument, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2631 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2632 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2633 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2634 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2635 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2636 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2637 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2638 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2639 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2640
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2641
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2642 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2643 * @brief Get the expected version of the database schema.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2644 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2645 * Retrieve the expected version of the database schema.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2646 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2647 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2648 * @return The version.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2649 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2650 * @deprecated Please instead use IDatabaseBackend::UpgradeDatabase()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2651 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2652 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetExpectedDatabaseVersion(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2653 OrthancPluginContext* context)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2654 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2655 uint32_t count = 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2656
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2657 _OrthancPluginReturnSingleValue params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2658 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2659 params.resultUint32 = &count;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2660
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2661 if (context->InvokeService(context, _OrthancPluginService_GetExpectedDatabaseVersion, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2662 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2663 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2664 return 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2665 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2666 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2667 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2668 return count;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2669 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2670 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2671
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2672
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2673
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2674 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2675 * @brief Return the content of the configuration file(s).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2676 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2677 * This function returns the content of the configuration that is
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2678 * used by Orthanc, formatted as a JSON string.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2679 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2680 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2681 * @return NULL in the case of an error, or a newly allocated string
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2682 * containing the configuration. This string must be freed by
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2683 * OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2684 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2685 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfiguration(OrthancPluginContext* context)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2686 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2687 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2688
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2689 _OrthancPluginRetrieveDynamicString params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2690 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2691 params.argument = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2692
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2693 if (context->InvokeService(context, _OrthancPluginService_GetConfiguration, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2694 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2695 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2696 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2697 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2698 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2699 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2700 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2701 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2702 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2703
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2704
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2705
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2706 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2707 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2708 OrthancPluginRestOutput* output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2709 const char* subType;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2710 const char* contentType;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2711 } _OrthancPluginStartMultipartAnswer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2712
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2713 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2714 * @brief Start an HTTP multipart answer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2715 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2716 * Initiates a HTTP multipart answer, as the result of a REST request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2717 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2718 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2719 * @param output The HTTP connection to the client application.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2720 * @param subType The sub-type of the multipart answer ("mixed" or "related").
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2721 * @param contentType The MIME type of the items in the multipart answer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2722 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2723 * @see OrthancPluginSendMultipartItem(), OrthancPluginSendMultipartItem2()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2724 * @ingroup REST
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2725 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2726 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStartMultipartAnswer(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2727 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2728 OrthancPluginRestOutput* output,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2729 const char* subType,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2730 const char* contentType)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2731 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2732 _OrthancPluginStartMultipartAnswer params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2733 params.output = output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2734 params.subType = subType;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2735 params.contentType = contentType;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2736 return context->InvokeService(context, _OrthancPluginService_StartMultipartAnswer, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2737 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2738
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2739
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2740 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2741 * @brief Send an item as a part of some HTTP multipart answer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2742 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2743 * This function sends an item as a part of some HTTP multipart
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2744 * answer that was initiated by OrthancPluginStartMultipartAnswer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2745 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2746 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2747 * @param output The HTTP connection to the client application.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2748 * @param answer Pointer to the memory buffer containing the item.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2749 * @param answerSize Number of bytes of the item.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2750 * @return 0 if success, or the error code if failure (this notably happens
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2751 * if the connection is closed by the client).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2752 * @see OrthancPluginSendMultipartItem2()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2753 * @ingroup REST
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2754 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2755 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginSendMultipartItem(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2756 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2757 OrthancPluginRestOutput* output,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2758 const char* answer,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2759 uint32_t answerSize)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2760 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2761 _OrthancPluginAnswerBuffer params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2762 params.output = output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2763 params.answer = answer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2764 params.answerSize = answerSize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2765 params.mimeType = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2766 return context->InvokeService(context, _OrthancPluginService_SendMultipartItem, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2767 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2768
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2769
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2770
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2771 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2772 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2773 OrthancPluginMemoryBuffer* target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2774 const void* source;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2775 uint32_t size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2776 OrthancPluginCompressionType compression;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2777 uint8_t uncompress;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2778 } _OrthancPluginBufferCompression;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2779
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2780
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2781 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2782 * @brief Compress or decompress a buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2783 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2784 * This function compresses or decompresses a buffer, using the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2785 * version of the zlib library that is used by the Orthanc core.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2786 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2787 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2788 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2789 * @param source The source buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2790 * @param size The size in bytes of the source buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2791 * @param compression The compression algorithm.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2792 * @param uncompress If set to "0", the buffer must be compressed.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2793 * If set to "1", the buffer must be uncompressed.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2794 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2795 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2796 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2797 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginBufferCompression(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2798 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2799 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2800 const void* source,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2801 uint32_t size,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2802 OrthancPluginCompressionType compression,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2803 uint8_t uncompress)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2804 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2805 _OrthancPluginBufferCompression params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2806 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2807 params.source = source;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2808 params.size = size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2809 params.compression = compression;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2810 params.uncompress = uncompress;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2811
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2812 return context->InvokeService(context, _OrthancPluginService_BufferCompression, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2813 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2814
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2815
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2816
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2817 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2818 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2819 OrthancPluginMemoryBuffer* target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2820 const char* path;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2821 } _OrthancPluginReadFile;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2822
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2823 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2824 * @brief Read a file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2825 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2826 * Read the content of a file on the filesystem, and returns it into
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2827 * a newly allocated memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2828 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2829 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2830 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2831 * @param path The path of the file to be read.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2832 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2833 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2834 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginReadFile(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2835 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2836 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2837 const char* path)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2838 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2839 _OrthancPluginReadFile params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2840 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2841 params.path = path;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2842 return context->InvokeService(context, _OrthancPluginService_ReadFile, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2843 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2844
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2845
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2846
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2847 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2848 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2849 const char* path;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2850 const void* data;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2851 uint32_t size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2852 } _OrthancPluginWriteFile;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2853
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2854 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2855 * @brief Write a file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2856 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2857 * Write the content of a memory buffer to the filesystem.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2858 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2859 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2860 * @param path The path of the file to be written.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2861 * @param data The content of the memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2862 * @param size The size of the memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2863 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2864 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2865 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginWriteFile(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2866 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2867 const char* path,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2868 const void* data,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2869 uint32_t size)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2870 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2871 _OrthancPluginWriteFile params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2872 params.path = path;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2873 params.data = data;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2874 params.size = size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2875 return context->InvokeService(context, _OrthancPluginService_WriteFile, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2876 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2877
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2878
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2879
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2880 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2881 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2882 const char** target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2883 OrthancPluginErrorCode error;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2884 } _OrthancPluginGetErrorDescription;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2885
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2886 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2887 * @brief Get the description of a given error code.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2888 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2889 * This function returns the description of a given error code.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2890 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2891 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2892 * @param error The error code of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2893 * @return The error description. This is a statically-allocated
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2894 * string, do not free it.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2895 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2896 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetErrorDescription(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2897 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2898 OrthancPluginErrorCode error)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2899 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2900 const char* result = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2901
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2902 _OrthancPluginGetErrorDescription params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2903 params.target = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2904 params.error = error;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2905
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2906 if (context->InvokeService(context, _OrthancPluginService_GetErrorDescription, &params) != OrthancPluginErrorCode_Success ||
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2907 result == NULL)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2908 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2909 return "Unknown error code";
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2910 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2911 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2912 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2913 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2914 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2915 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2916
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2917
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2918
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2919 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2920 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2921 OrthancPluginRestOutput* output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2922 uint16_t status;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2923 const char* body;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2924 uint32_t bodySize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2925 } _OrthancPluginSendHttpStatus;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2926
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2927 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2928 * @brief Send a HTTP status, with a custom body.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2929 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2930 * This function answers to a HTTP request by sending a HTTP status
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2931 * code (such as "400 - Bad Request"), together with a body
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2932 * describing the error. The body will only be returned if the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2933 * configuration option "HttpDescribeErrors" of Orthanc is set to "true".
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2934 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2935 * Note that:
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2936 * - Successful requests (status 200) must use ::OrthancPluginAnswerBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2937 * - Redirections (status 301) must use ::OrthancPluginRedirect().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2938 * - Unauthorized access (status 401) must use ::OrthancPluginSendUnauthorized().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2939 * - Methods not allowed (status 405) must use ::OrthancPluginSendMethodNotAllowed().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2940 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2941 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2942 * @param output The HTTP connection to the client application.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2943 * @param status The HTTP status code to be sent.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2944 * @param body The body of the answer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2945 * @param bodySize The size of the body.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2946 * @see OrthancPluginSendHttpStatusCode()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2947 * @ingroup REST
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2948 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2949 ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatus(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2950 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2951 OrthancPluginRestOutput* output,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2952 uint16_t status,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2953 const char* body,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2954 uint32_t bodySize)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2955 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2956 _OrthancPluginSendHttpStatus params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2957 params.output = output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2958 params.status = status;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2959 params.body = body;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2960 params.bodySize = bodySize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2961 context->InvokeService(context, _OrthancPluginService_SendHttpStatus, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2962 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2963
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2964
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2965
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2966 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2967 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2968 const OrthancPluginImage* image;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2969 uint32_t* resultUint32;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2970 OrthancPluginPixelFormat* resultPixelFormat;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2971 void** resultBuffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2972 } _OrthancPluginGetImageInfo;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2973
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2974
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2975 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2976 * @brief Return the pixel format of an image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2977 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2978 * This function returns the type of memory layout for the pixels of the given image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2979 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2980 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2981 * @param image The image of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2982 * @return The pixel format.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2983 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2984 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2985 ORTHANC_PLUGIN_INLINE OrthancPluginPixelFormat OrthancPluginGetImagePixelFormat(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2986 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2987 const OrthancPluginImage* image)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2988 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2989 OrthancPluginPixelFormat target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2990
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2991 _OrthancPluginGetImageInfo params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2992 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2993 params.image = image;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2994 params.resultPixelFormat = &target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2995
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2996 if (context->InvokeService(context, _OrthancPluginService_GetImagePixelFormat, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2997 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2998 return OrthancPluginPixelFormat_Unknown;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2999 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3000 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3001 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3002 return (OrthancPluginPixelFormat) target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3003 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3004 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3005
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3006
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3007
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3008 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3009 * @brief Return the width of an image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3010 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3011 * This function returns the width of the given image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3012 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3013 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3014 * @param image The image of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3015 * @return The width.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3016 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3017 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3018 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageWidth(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3019 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3020 const OrthancPluginImage* image)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3021 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3022 uint32_t width;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3023
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3024 _OrthancPluginGetImageInfo params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3025 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3026 params.image = image;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3027 params.resultUint32 = &width;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3028
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3029 if (context->InvokeService(context, _OrthancPluginService_GetImageWidth, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3030 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3031 return 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3032 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3033 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3034 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3035 return width;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3036 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3037 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3038
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3039
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3040
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3041 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3042 * @brief Return the height of an image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3043 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3044 * This function returns the height of the given image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3045 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3046 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3047 * @param image The image of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3048 * @return The height.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3049 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3050 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3051 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageHeight(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3052 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3053 const OrthancPluginImage* image)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3054 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3055 uint32_t height;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3056
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3057 _OrthancPluginGetImageInfo params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3058 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3059 params.image = image;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3060 params.resultUint32 = &height;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3061
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3062 if (context->InvokeService(context, _OrthancPluginService_GetImageHeight, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3063 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3064 return 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3065 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3066 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3067 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3068 return height;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3069 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3070 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3071
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3072
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3073
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3074 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3075 * @brief Return the pitch of an image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3076 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3077 * This function returns the pitch of the given image. The pitch is
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3078 * defined as the number of bytes between 2 successive lines of the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3079 * image in the memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3080 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3081 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3082 * @param image The image of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3083 * @return The pitch.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3084 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3085 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3086 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImagePitch(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3087 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3088 const OrthancPluginImage* image)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3089 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3090 uint32_t pitch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3091
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3092 _OrthancPluginGetImageInfo params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3093 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3094 params.image = image;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3095 params.resultUint32 = &pitch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3096
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3097 if (context->InvokeService(context, _OrthancPluginService_GetImagePitch, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3098 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3099 return 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3100 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3101 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3102 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3103 return pitch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3104 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3105 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3106
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3107
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3108
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3109 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3110 * @brief Return a pointer to the content of an image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3111 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3112 * This function returns a pointer to the memory buffer that
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3113 * contains the pixels of the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3114 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3115 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3116 * @param image The image of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3117 * @return The pointer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3118 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3119 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3120 ORTHANC_PLUGIN_INLINE void* OrthancPluginGetImageBuffer(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3121 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3122 const OrthancPluginImage* image)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3123 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3124 void* target = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3125
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3126 _OrthancPluginGetImageInfo params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3127 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3128 params.resultBuffer = &target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3129 params.image = image;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3130
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3131 if (context->InvokeService(context, _OrthancPluginService_GetImageBuffer, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3132 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3133 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3134 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3135 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3136 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3137 return target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3138 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3139 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3140
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3141
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3142 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3143 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3144 OrthancPluginImage** target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3145 const void* data;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3146 uint32_t size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3147 OrthancPluginImageFormat format;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3148 } _OrthancPluginUncompressImage;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3149
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3150
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3151 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3152 * @brief Decode a compressed image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3153 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3154 * This function decodes a compressed image from a memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3155 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3156 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3157 * @param data Pointer to a memory buffer containing the compressed image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3158 * @param size Size of the memory buffer containing the compressed image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3159 * @param format The file format of the compressed image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3160 * @return The uncompressed image. It must be freed with OrthancPluginFreeImage().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3161 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3162 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3163 ORTHANC_PLUGIN_INLINE OrthancPluginImage *OrthancPluginUncompressImage(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3164 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3165 const void* data,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3166 uint32_t size,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3167 OrthancPluginImageFormat format)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3168 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3169 OrthancPluginImage* target = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3170
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3171 _OrthancPluginUncompressImage params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3172 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3173 params.target = &target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3174 params.data = data;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3175 params.size = size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3176 params.format = format;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3177
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3178 if (context->InvokeService(context, _OrthancPluginService_UncompressImage, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3179 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3180 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3181 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3182 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3183 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3184 return target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3185 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3186 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3187
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3188
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3189
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3190
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3191 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3192 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3193 OrthancPluginImage* image;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3194 } _OrthancPluginFreeImage;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3195
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3196 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3197 * @brief Free an image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3198 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3199 * This function frees an image that was decoded with OrthancPluginUncompressImage().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3200 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3201 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3202 * @param image The image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3203 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3204 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3205 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeImage(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3206 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3207 OrthancPluginImage* image)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3208 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3209 _OrthancPluginFreeImage params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3210 params.image = image;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3211
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3212 context->InvokeService(context, _OrthancPluginService_FreeImage, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3213 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3214
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3215
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3216
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3217
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3218 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3219 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3220 OrthancPluginMemoryBuffer* target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3221 OrthancPluginImageFormat imageFormat;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3222 OrthancPluginPixelFormat pixelFormat;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3223 uint32_t width;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3224 uint32_t height;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3225 uint32_t pitch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3226 const void* buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3227 uint8_t quality;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3228 } _OrthancPluginCompressImage;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3229
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3230
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3231 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3232 * @brief Encode a PNG image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3233 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3234 * This function compresses the given memory buffer containing an
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3235 * image using the PNG specification, and stores the result of the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3236 * compression into a newly allocated memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3237 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3238 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3239 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3240 * @param format The memory layout of the uncompressed image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3241 * @param width The width of the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3242 * @param height The height of the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3243 * @param pitch The pitch of the image (i.e. the number of bytes
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3244 * between 2 successive lines of the image in the memory buffer).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3245 * @param buffer The memory buffer containing the uncompressed image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3246 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3247 * @see OrthancPluginCompressAndAnswerPngImage()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3248 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3249 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3250 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCompressPngImage(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3251 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3252 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3253 OrthancPluginPixelFormat format,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3254 uint32_t width,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3255 uint32_t height,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3256 uint32_t pitch,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3257 const void* buffer)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3258 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3259 _OrthancPluginCompressImage params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3260 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3261 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3262 params.imageFormat = OrthancPluginImageFormat_Png;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3263 params.pixelFormat = format;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3264 params.width = width;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3265 params.height = height;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3266 params.pitch = pitch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3267 params.buffer = buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3268 params.quality = 0; /* Unused for PNG */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3269
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3270 return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3271 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3272
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3273
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3274 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3275 * @brief Encode a JPEG image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3276 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3277 * This function compresses the given memory buffer containing an
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3278 * image using the JPEG specification, and stores the result of the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3279 * compression into a newly allocated memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3280 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3281 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3282 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3283 * @param format The memory layout of the uncompressed image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3284 * @param width The width of the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3285 * @param height The height of the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3286 * @param pitch The pitch of the image (i.e. the number of bytes
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3287 * between 2 successive lines of the image in the memory buffer).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3288 * @param buffer The memory buffer containing the uncompressed image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3289 * @param quality The quality of the JPEG encoding, between 1 (worst
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3290 * quality, best compression) and 100 (best quality, worst
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3291 * compression).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3292 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3293 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3294 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3295 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCompressJpegImage(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3296 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3297 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3298 OrthancPluginPixelFormat format,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3299 uint32_t width,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3300 uint32_t height,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3301 uint32_t pitch,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3302 const void* buffer,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3303 uint8_t quality)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3304 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3305 _OrthancPluginCompressImage params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3306 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3307 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3308 params.imageFormat = OrthancPluginImageFormat_Jpeg;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3309 params.pixelFormat = format;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3310 params.width = width;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3311 params.height = height;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3312 params.pitch = pitch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3313 params.buffer = buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3314 params.quality = quality;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3315
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3316 return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3317 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3318
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3319
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3320
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3321 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3322 * @brief Answer to a REST request with a JPEG image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3323 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3324 * This function answers to a REST request with a JPEG image. The
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3325 * parameters of this function describe a memory buffer that
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3326 * contains an uncompressed image. The image will be automatically compressed
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3327 * as a JPEG image by the core system of Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3328 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3329 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3330 * @param output The HTTP connection to the client application.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3331 * @param format The memory layout of the uncompressed image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3332 * @param width The width of the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3333 * @param height The height of the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3334 * @param pitch The pitch of the image (i.e. the number of bytes
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3335 * between 2 successive lines of the image in the memory buffer).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3336 * @param buffer The memory buffer containing the uncompressed image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3337 * @param quality The quality of the JPEG encoding, between 1 (worst
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3338 * quality, best compression) and 100 (best quality, worst
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3339 * compression).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3340 * @ingroup REST
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3341 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3342 ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerJpegImage(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3343 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3344 OrthancPluginRestOutput* output,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3345 OrthancPluginPixelFormat format,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3346 uint32_t width,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3347 uint32_t height,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3348 uint32_t pitch,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3349 const void* buffer,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3350 uint8_t quality)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3351 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3352 _OrthancPluginCompressAndAnswerImage params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3353 params.output = output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3354 params.imageFormat = OrthancPluginImageFormat_Jpeg;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3355 params.pixelFormat = format;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3356 params.width = width;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3357 params.height = height;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3358 params.pitch = pitch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3359 params.buffer = buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3360 params.quality = quality;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3361 context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3362 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3363
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3364
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3365
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3366
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3367 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3368 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3369 OrthancPluginMemoryBuffer* target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3370 OrthancPluginHttpMethod method;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3371 const char* url;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3372 const char* username;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3373 const char* password;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3374 const char* body;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3375 uint32_t bodySize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3376 } _OrthancPluginCallHttpClient;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3377
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3378
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3379 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3380 * @brief Issue a HTTP GET call.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3381 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3382 * Make a HTTP GET call to the given URL. The result to the query is
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3383 * stored into a newly allocated memory buffer. Favor
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3384 * OrthancPluginRestApiGet() if calling the built-in REST API of the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3385 * Orthanc instance that hosts this plugin.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3386 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3387 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3388 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3389 * @param url The URL of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3390 * @param username The username (can be <tt>NULL</tt> if no password protection).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3391 * @param password The password (can be <tt>NULL</tt> if no password protection).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3392 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3393 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3394 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginHttpGet(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3395 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3396 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3397 const char* url,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3398 const char* username,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3399 const char* password)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3400 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3401 _OrthancPluginCallHttpClient params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3402 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3403
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3404 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3405 params.method = OrthancPluginHttpMethod_Get;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3406 params.url = url;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3407 params.username = username;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3408 params.password = password;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3409
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3410 return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3411 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3412
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3413
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3414 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3415 * @brief Issue a HTTP POST call.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3416 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3417 * Make a HTTP POST call to the given URL. The result to the query
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3418 * is stored into a newly allocated memory buffer. Favor
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3419 * OrthancPluginRestApiPost() if calling the built-in REST API of
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3420 * the Orthanc instance that hosts this plugin.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3421 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3422 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3423 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3424 * @param url The URL of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3425 * @param body The content of the body of the request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3426 * @param bodySize The size of the body of the request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3427 * @param username The username (can be <tt>NULL</tt> if no password protection).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3428 * @param password The password (can be <tt>NULL</tt> if no password protection).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3429 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3430 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3431 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginHttpPost(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3432 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3433 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3434 const char* url,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3435 const char* body,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3436 uint32_t bodySize,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3437 const char* username,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3438 const char* password)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3439 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3440 _OrthancPluginCallHttpClient params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3441 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3442
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3443 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3444 params.method = OrthancPluginHttpMethod_Post;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3445 params.url = url;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3446 params.body = body;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3447 params.bodySize = bodySize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3448 params.username = username;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3449 params.password = password;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3450
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3451 return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3452 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3453
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3454
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3455 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3456 * @brief Issue a HTTP PUT call.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3457 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3458 * Make a HTTP PUT call to the given URL. The result to the query is
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3459 * stored into a newly allocated memory buffer. Favor
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3460 * OrthancPluginRestApiPut() if calling the built-in REST API of the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3461 * Orthanc instance that hosts this plugin.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3462 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3463 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3464 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3465 * @param url The URL of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3466 * @param body The content of the body of the request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3467 * @param bodySize The size of the body of the request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3468 * @param username The username (can be <tt>NULL</tt> if no password protection).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3469 * @param password The password (can be <tt>NULL</tt> if no password protection).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3470 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3471 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3472 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginHttpPut(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3473 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3474 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3475 const char* url,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3476 const char* body,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3477 uint32_t bodySize,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3478 const char* username,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3479 const char* password)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3480 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3481 _OrthancPluginCallHttpClient params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3482 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3483
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3484 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3485 params.method = OrthancPluginHttpMethod_Put;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3486 params.url = url;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3487 params.body = body;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3488 params.bodySize = bodySize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3489 params.username = username;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3490 params.password = password;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3491
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3492 return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3493 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3494
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3495
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3496 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3497 * @brief Issue a HTTP DELETE call.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3498 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3499 * Make a HTTP DELETE call to the given URL. Favor
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3500 * OrthancPluginRestApiDelete() if calling the built-in REST API of
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3501 * the Orthanc instance that hosts this plugin.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3502 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3503 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3504 * @param url The URL of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3505 * @param username The username (can be <tt>NULL</tt> if no password protection).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3506 * @param password The password (can be <tt>NULL</tt> if no password protection).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3507 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3508 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3509 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginHttpDelete(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3510 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3511 const char* url,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3512 const char* username,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3513 const char* password)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3514 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3515 _OrthancPluginCallHttpClient params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3516 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3517
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3518 params.method = OrthancPluginHttpMethod_Delete;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3519 params.url = url;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3520 params.username = username;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3521 params.password = password;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3522
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3523 return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3524 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3525
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3526
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3527
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3528 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3529 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3530 OrthancPluginImage** target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3531 const OrthancPluginImage* source;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3532 OrthancPluginPixelFormat targetFormat;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3533 } _OrthancPluginConvertPixelFormat;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3534
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3535
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3536 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3537 * @brief Change the pixel format of an image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3538 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3539 * This function creates a new image, changing the memory layout of the pixels.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3540 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3541 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3542 * @param source The source image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3543 * @param targetFormat The target pixel format.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3544 * @return The resulting image. It must be freed with OrthancPluginFreeImage().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3545 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3546 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3547 ORTHANC_PLUGIN_INLINE OrthancPluginImage *OrthancPluginConvertPixelFormat(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3548 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3549 const OrthancPluginImage* source,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3550 OrthancPluginPixelFormat targetFormat)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3551 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3552 OrthancPluginImage* target = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3553
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3554 _OrthancPluginConvertPixelFormat params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3555 params.target = &target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3556 params.source = source;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3557 params.targetFormat = targetFormat;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3558
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3559 if (context->InvokeService(context, _OrthancPluginService_ConvertPixelFormat, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3560 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3561 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3562 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3563 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3564 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3565 return target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3566 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3567 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3568
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3569
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3570
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3571 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3572 * @brief Return the number of available fonts.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3573 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3574 * This function returns the number of fonts that are built in the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3575 * Orthanc core. These fonts can be used to draw texts on images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3576 * through OrthancPluginDrawText().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3577 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3578 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3579 * @return The number of fonts.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3580 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3581 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3582 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontsCount(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3583 OrthancPluginContext* context)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3584 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3585 uint32_t count = 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3586
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3587 _OrthancPluginReturnSingleValue params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3588 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3589 params.resultUint32 = &count;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3590
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3591 if (context->InvokeService(context, _OrthancPluginService_GetFontsCount, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3592 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3593 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3594 return 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3595 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3596 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3597 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3598 return count;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3599 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3600 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3601
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3602
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3603
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3604
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3605 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3606 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3607 uint32_t fontIndex; /* in */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3608 const char** name; /* out */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3609 uint32_t* size; /* out */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3610 } _OrthancPluginGetFontInfo;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3611
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3612 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3613 * @brief Return the name of a font.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3614 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3615 * This function returns the name of a font that is built in the Orthanc core.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3616 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3617 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3618 * @param fontIndex The index of the font. This value must be less than OrthancPluginGetFontsCount().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3619 * @return The font name. This is a statically-allocated string, do not free it.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3620 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3621 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3622 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetFontName(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3623 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3624 uint32_t fontIndex)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3625 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3626 const char* result = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3627
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3628 _OrthancPluginGetFontInfo params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3629 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3630 params.name = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3631 params.fontIndex = fontIndex;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3632
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3633 if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3634 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3635 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3636 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3637 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3638 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3639 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3640 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3641 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3642
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3643
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3644 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3645 * @brief Return the size of a font.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3646 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3647 * This function returns the size of a font that is built in the Orthanc core.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3648 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3649 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3650 * @param fontIndex The index of the font. This value must be less than OrthancPluginGetFontsCount().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3651 * @return The font size.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3652 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3653 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3654 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontSize(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3655 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3656 uint32_t fontIndex)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3657 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3658 uint32_t result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3659
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3660 _OrthancPluginGetFontInfo params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3661 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3662 params.size = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3663 params.fontIndex = fontIndex;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3664
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3665 if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3666 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3667 return 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3668 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3669 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3670 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3671 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3672 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3673 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3674
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3675
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3676
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3677 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3678 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3679 OrthancPluginImage* image;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3680 uint32_t fontIndex;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3681 const char* utf8Text;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3682 int32_t x;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3683 int32_t y;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3684 uint8_t r;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3685 uint8_t g;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3686 uint8_t b;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3687 } _OrthancPluginDrawText;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3688
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3689
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3690 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3691 * @brief Draw text on an image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3692 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3693 * This function draws some text on some image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3694 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3695 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3696 * @param image The image upon which to draw the text.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3697 * @param fontIndex The index of the font. This value must be less than OrthancPluginGetFontsCount().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3698 * @param utf8Text The text to be drawn, encoded as an UTF-8 zero-terminated string.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3699 * @param x The X position of the text over the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3700 * @param y The Y position of the text over the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3701 * @param r The value of the red color channel of the text.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3702 * @param g The value of the green color channel of the text.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3703 * @param b The value of the blue color channel of the text.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3704 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3705 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3706 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3707 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginDrawText(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3708 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3709 OrthancPluginImage* image,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3710 uint32_t fontIndex,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3711 const char* utf8Text,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3712 int32_t x,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3713 int32_t y,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3714 uint8_t r,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3715 uint8_t g,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3716 uint8_t b)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3717 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3718 _OrthancPluginDrawText params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3719 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3720 params.image = image;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3721 params.fontIndex = fontIndex;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3722 params.utf8Text = utf8Text;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3723 params.x = x;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3724 params.y = y;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3725 params.r = r;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3726 params.g = g;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3727 params.b = b;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3728
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3729 return context->InvokeService(context, _OrthancPluginService_DrawText, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3730 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3731
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3732
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3733
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3734 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3735 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3736 OrthancPluginStorageArea* storageArea;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3737 const char* uuid;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3738 const void* content;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3739 uint64_t size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3740 OrthancPluginContentType type;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3741 } _OrthancPluginStorageAreaCreate;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3742
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3743
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3744 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3745 * @brief Create a file inside the storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3746 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3747 * This function creates a new file inside the storage area that is
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3748 * currently used by Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3749 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3750 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3751 * @param storageArea The storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3752 * @param uuid The identifier of the file to be created.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3753 * @param content The content to store in the newly created file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3754 * @param size The size of the content.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3755 * @param type The type of the file content.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3756 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3757 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3758 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3759 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStorageAreaCreate(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3760 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3761 OrthancPluginStorageArea* storageArea,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3762 const char* uuid,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3763 const void* content,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3764 uint64_t size,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3765 OrthancPluginContentType type)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3766 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3767 _OrthancPluginStorageAreaCreate params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3768 params.storageArea = storageArea;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3769 params.uuid = uuid;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3770 params.content = content;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3771 params.size = size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3772 params.type = type;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3773
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3774 return context->InvokeService(context, _OrthancPluginService_StorageAreaCreate, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3775 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3776
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3777
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3778 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3779 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3780 OrthancPluginMemoryBuffer* target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3781 OrthancPluginStorageArea* storageArea;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3782 const char* uuid;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3783 OrthancPluginContentType type;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3784 } _OrthancPluginStorageAreaRead;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3785
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3786
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3787 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3788 * @brief Read a file from the storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3789 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3790 * This function reads the content of a given file from the storage
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3791 * area that is currently used by Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3792 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3793 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3794 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3795 * @param storageArea The storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3796 * @param uuid The identifier of the file to be read.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3797 * @param type The type of the file content.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3798 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3799 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3800 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3801 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStorageAreaRead(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3802 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3803 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3804 OrthancPluginStorageArea* storageArea,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3805 const char* uuid,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3806 OrthancPluginContentType type)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3807 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3808 _OrthancPluginStorageAreaRead params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3809 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3810 params.storageArea = storageArea;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3811 params.uuid = uuid;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3812 params.type = type;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3813
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3814 return context->InvokeService(context, _OrthancPluginService_StorageAreaRead, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3815 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3816
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3817
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3818 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3819 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3820 OrthancPluginStorageArea* storageArea;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3821 const char* uuid;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3822 OrthancPluginContentType type;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3823 } _OrthancPluginStorageAreaRemove;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3824
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3825 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3826 * @brief Remove a file from the storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3827 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3828 * This function removes a given file from the storage area that is
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3829 * currently used by Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3830 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3831 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3832 * @param storageArea The storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3833 * @param uuid The identifier of the file to be removed.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3834 * @param type The type of the file content.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3835 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3836 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3837 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3838 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStorageAreaRemove(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3839 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3840 OrthancPluginStorageArea* storageArea,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3841 const char* uuid,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3842 OrthancPluginContentType type)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3843 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3844 _OrthancPluginStorageAreaRemove params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3845 params.storageArea = storageArea;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3846 params.uuid = uuid;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3847 params.type = type;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3848
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3849 return context->InvokeService(context, _OrthancPluginService_StorageAreaRemove, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3850 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3851
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3852
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3853
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3854 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3855 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3856 OrthancPluginErrorCode* target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3857 int32_t code;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3858 uint16_t httpStatus;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3859 const char* message;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3860 } _OrthancPluginRegisterErrorCode;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3861
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3862 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3863 * @brief Declare a custom error code for this plugin.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3864 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3865 * This function declares a custom error code that can be generated
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3866 * by this plugin. This declaration is used to enrich the body of
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3867 * the HTTP answer in the case of an error, and to set the proper
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3868 * HTTP status code.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3869 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3870 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3871 * @param code The error code that is internal to this plugin.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3872 * @param httpStatus The HTTP status corresponding to this error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3873 * @param message The description of the error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3874 * @return The error code that has been assigned inside the Orthanc core.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3875 * @ingroup Toolbox
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3876 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3877 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterErrorCode(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3878 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3879 int32_t code,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3880 uint16_t httpStatus,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3881 const char* message)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3882 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3883 OrthancPluginErrorCode target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3884
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3885 _OrthancPluginRegisterErrorCode params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3886 params.target = &target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3887 params.code = code;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3888 params.httpStatus = httpStatus;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3889 params.message = message;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3890
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3891 if (context->InvokeService(context, _OrthancPluginService_RegisterErrorCode, &params) == OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3892 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3893 return target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3894 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3895 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3896 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3897 /* There was an error while assigned the error. Use a generic code. */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3898 return OrthancPluginErrorCode_Plugin;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3899 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3900 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3901
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3902
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3903
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3904 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3905 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3906 uint16_t group;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3907 uint16_t element;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3908 OrthancPluginValueRepresentation vr;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3909 const char* name;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3910 uint32_t minMultiplicity;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3911 uint32_t maxMultiplicity;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3912 } _OrthancPluginRegisterDictionaryTag;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3913
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3914 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3915 * @brief Register a new tag into the DICOM dictionary.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3916 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3917 * This function declares a new tag in the dictionary of DICOM tags
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3918 * that are known to Orthanc. This function should be used in the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3919 * OrthancPluginInitialize() callback.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3920 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3921 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3922 * @param group The group of the tag.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3923 * @param element The element of the tag.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3924 * @param vr The value representation of the tag.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3925 * @param name The nickname of the tag.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3926 * @param minMultiplicity The minimum multiplicity of the tag (must be above 0).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3927 * @param maxMultiplicity The maximum multiplicity of the tag. A value of 0 means
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3928 * an arbitrary multiplicity ("<tt>n</tt>").
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3929 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3930 * @ingroup Toolbox
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3931 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3932 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterDictionaryTag(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3933 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3934 uint16_t group,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3935 uint16_t element,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3936 OrthancPluginValueRepresentation vr,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3937 const char* name,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3938 uint32_t minMultiplicity,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3939 uint32_t maxMultiplicity)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3940 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3941 _OrthancPluginRegisterDictionaryTag params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3942 params.group = group;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3943 params.element = element;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3944 params.vr = vr;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3945 params.name = name;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3946 params.minMultiplicity = minMultiplicity;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3947 params.maxMultiplicity = maxMultiplicity;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3948
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3949 return context->InvokeService(context, _OrthancPluginService_RegisterDictionaryTag, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3950 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3951
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3952
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3953
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3954
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3955 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3956 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3957 OrthancPluginStorageArea* storageArea;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3958 OrthancPluginResourceType level;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3959 } _OrthancPluginReconstructMainDicomTags;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3960
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3961 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3962 * @brief Reconstruct the main DICOM tags.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3963 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3964 * This function requests the Orthanc core to reconstruct the main
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3965 * DICOM tags of all the resources of the given type. This function
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3966 * can only be used as a part of the upgrade of a custom database
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3967 * back-end
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3968 * (cf. OrthancPlugins::IDatabaseBackend::UpgradeDatabase). A
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3969 * database transaction will be automatically setup.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3970 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3971 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3972 * @param storageArea The storage area.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3973 * @param level The type of the resources of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3974 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3975 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3976 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3977 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginReconstructMainDicomTags(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3978 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3979 OrthancPluginStorageArea* storageArea,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3980 OrthancPluginResourceType level)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3981 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3982 _OrthancPluginReconstructMainDicomTags params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3983 params.level = level;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3984 params.storageArea = storageArea;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3985
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3986 return context->InvokeService(context, _OrthancPluginService_ReconstructMainDicomTags, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3987 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3988
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3989
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3990 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3991 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3992 char** result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3993 const char* instanceId;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3994 const char* buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3995 uint32_t size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3996 OrthancPluginDicomToJsonFormat format;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3997 OrthancPluginDicomToJsonFlags flags;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3998 uint32_t maxStringLength;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3999 } _OrthancPluginDicomToJson;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4000
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4001
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4002 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4003 * @brief Format a DICOM memory buffer as a JSON string.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4004 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4005 * This function takes as input a memory buffer containing a DICOM
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4006 * file, and outputs a JSON string representing the tags of this
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4007 * DICOM file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4008 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4009 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4010 * @param buffer The memory buffer containing the DICOM file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4011 * @param size The size of the memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4012 * @param format The output format.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4013 * @param flags Flags governing the output.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4014 * @param maxStringLength The maximum length of a field. Too long fields will
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4015 * be output as "null". The 0 value means no maximum length.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4016 * @return The NULL value if the case of an error, or the JSON
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4017 * string. This string must be freed by OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4018 * @ingroup Toolbox
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4019 * @see OrthancPluginDicomInstanceToJson
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4020 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4021 ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomBufferToJson(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4022 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4023 const char* buffer,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4024 uint32_t size,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4025 OrthancPluginDicomToJsonFormat format,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4026 OrthancPluginDicomToJsonFlags flags,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4027 uint32_t maxStringLength)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4028 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4029 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4030
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4031 _OrthancPluginDicomToJson params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4032 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4033 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4034 params.buffer = buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4035 params.size = size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4036 params.format = format;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4037 params.flags = flags;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4038 params.maxStringLength = maxStringLength;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4039
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4040 if (context->InvokeService(context, _OrthancPluginService_DicomBufferToJson, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4041 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4042 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4043 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4044 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4045 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4046 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4047 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4048 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4049 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4050
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4051
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4052 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4053 * @brief Format a DICOM instance as a JSON string.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4054 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4055 * This function formats a DICOM instance that is stored in Orthanc,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4056 * and outputs a JSON string representing the tags of this DICOM
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4057 * instance.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4058 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4059 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4060 * @param instanceId The Orthanc identifier of the instance.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4061 * @param format The output format.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4062 * @param flags Flags governing the output.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4063 * @param maxStringLength The maximum length of a field. Too long fields will
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4064 * be output as "null". The 0 value means no maximum length.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4065 * @return The NULL value if the case of an error, or the JSON
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4066 * string. This string must be freed by OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4067 * @ingroup Toolbox
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4068 * @see OrthancPluginDicomInstanceToJson
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4069 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4070 ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomInstanceToJson(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4071 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4072 const char* instanceId,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4073 OrthancPluginDicomToJsonFormat format,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4074 OrthancPluginDicomToJsonFlags flags,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4075 uint32_t maxStringLength)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4076 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4077 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4078
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4079 _OrthancPluginDicomToJson params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4080 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4081 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4082 params.instanceId = instanceId;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4083 params.format = format;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4084 params.flags = flags;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4085 params.maxStringLength = maxStringLength;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4086
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4087 if (context->InvokeService(context, _OrthancPluginService_DicomInstanceToJson, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4088 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4089 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4090 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4091 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4092 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4093 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4094 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4095 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4096 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4097
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4098
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4099 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4100 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4101 OrthancPluginMemoryBuffer* target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4102 const char* uri;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4103 uint32_t headersCount;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4104 const char* const* headersKeys;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4105 const char* const* headersValues;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4106 int32_t afterPlugins;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4107 } _OrthancPluginRestApiGet2;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4108
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4109 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4110 * @brief Make a GET call to the Orthanc REST API, with custom HTTP headers.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4111 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4112 * Make a GET call to the Orthanc REST API with extended
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4113 * parameters. The result to the query is stored into a newly
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4114 * allocated memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4115 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4116 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4117 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4118 * @param uri The URI in the built-in Orthanc API.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4119 * @param headersCount The number of HTTP headers.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4120 * @param headersKeys Array containing the keys of the HTTP headers.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4121 * @param headersValues Array containing the values of the HTTP headers.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4122 * @param afterPlugins If 0, the built-in API of Orthanc is used.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4123 * If 1, the API is tainted by the plugins.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4124 * @return 0 if success, or the error code if failure.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4125 * @see OrthancPluginRestApiGet, OrthancPluginRestApiGetAfterPlugins
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4126 * @ingroup Orthanc
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4127 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4128 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiGet2(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4129 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4130 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4131 const char* uri,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4132 uint32_t headersCount,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4133 const char* const* headersKeys,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4134 const char* const* headersValues,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4135 int32_t afterPlugins)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4136 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4137 _OrthancPluginRestApiGet2 params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4138 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4139 params.uri = uri;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4140 params.headersCount = headersCount;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4141 params.headersKeys = headersKeys;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4142 params.headersValues = headersValues;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4143 params.afterPlugins = afterPlugins;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4144
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4145 return context->InvokeService(context, _OrthancPluginService_RestApiGet2, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4146 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4147
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4148
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4149
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4150 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4151 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4152 OrthancPluginWorklistCallback callback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4153 } _OrthancPluginWorklistCallback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4154
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4155 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4156 * @brief Register a callback to handle modality worklists requests.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4157 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4158 * This function registers a callback to handle C-Find SCP requests
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4159 * on modality worklists.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4160 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4161 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4162 * @param callback The callback.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4163 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4164 * @ingroup Worklists
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4165 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4166 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterWorklistCallback(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4167 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4168 OrthancPluginWorklistCallback callback)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4169 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4170 _OrthancPluginWorklistCallback params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4171 params.callback = callback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4172
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4173 return context->InvokeService(context, _OrthancPluginService_RegisterWorklistCallback, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4174 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4175
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4176
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4177
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4178 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4179 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4180 OrthancPluginWorklistAnswers* answers;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4181 const OrthancPluginWorklistQuery* query;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4182 const void* dicom;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4183 uint32_t size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4184 } _OrthancPluginWorklistAnswersOperation;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4185
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4186 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4187 * @brief Add one answer to some modality worklist request.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4188 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4189 * This function adds one worklist (encoded as a DICOM file) to the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4190 * set of answers corresponding to some C-Find SCP request against
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4191 * modality worklists.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4192 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4193 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4194 * @param answers The set of answers.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4195 * @param query The worklist query, as received by the callback.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4196 * @param dicom The worklist to answer, encoded as a DICOM file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4197 * @param size The size of the DICOM file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4198 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4199 * @ingroup Worklists
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4200 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4201 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginWorklistAddAnswer(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4202 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4203 OrthancPluginWorklistAnswers* answers,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4204 const OrthancPluginWorklistQuery* query,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4205 const void* dicom,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4206 uint32_t size)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4207 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4208 _OrthancPluginWorklistAnswersOperation params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4209 params.answers = answers;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4210 params.query = query;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4211 params.dicom = dicom;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4212 params.size = size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4213
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4214 return context->InvokeService(context, _OrthancPluginService_WorklistAddAnswer, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4215 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4216
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4217
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4218 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4219 * @brief Mark the set of worklist answers as incomplete.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4220 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4221 * This function marks as incomplete the set of answers
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4222 * corresponding to some C-Find SCP request against modality
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4223 * worklists. This must be used if canceling the handling of a
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4224 * request when too many answers are to be returned.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4225 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4226 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4227 * @param answers The set of answers.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4228 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4229 * @ingroup Worklists
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4230 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4231 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginWorklistMarkIncomplete(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4232 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4233 OrthancPluginWorklistAnswers* answers)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4234 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4235 _OrthancPluginWorklistAnswersOperation params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4236 params.answers = answers;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4237 params.query = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4238 params.dicom = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4239 params.size = 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4240
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4241 return context->InvokeService(context, _OrthancPluginService_WorklistMarkIncomplete, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4242 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4243
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4244
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4245 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4246 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4247 const OrthancPluginWorklistQuery* query;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4248 const void* dicom;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4249 uint32_t size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4250 int32_t* isMatch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4251 OrthancPluginMemoryBuffer* target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4252 } _OrthancPluginWorklistQueryOperation;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4253
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4254 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4255 * @brief Test whether a worklist matches the query.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4256 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4257 * This function checks whether one worklist (encoded as a DICOM
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4258 * file) matches the C-Find SCP query against modality
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4259 * worklists. This function must be called before adding the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4260 * worklist as an answer through OrthancPluginWorklistAddAnswer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4261 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4262 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4263 * @param query The worklist query, as received by the callback.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4264 * @param dicom The worklist to answer, encoded as a DICOM file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4265 * @param size The size of the DICOM file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4266 * @return 1 if the worklist matches the query, 0 otherwise.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4267 * @ingroup Worklists
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4268 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4269 ORTHANC_PLUGIN_INLINE int32_t OrthancPluginWorklistIsMatch(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4270 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4271 const OrthancPluginWorklistQuery* query,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4272 const void* dicom,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4273 uint32_t size)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4274 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4275 int32_t isMatch = 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4276
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4277 _OrthancPluginWorklistQueryOperation params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4278 params.query = query;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4279 params.dicom = dicom;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4280 params.size = size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4281 params.isMatch = &isMatch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4282 params.target = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4283
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4284 if (context->InvokeService(context, _OrthancPluginService_WorklistIsMatch, &params) == OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4285 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4286 return isMatch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4287 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4288 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4289 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4290 /* Error: Assume non-match */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4291 return 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4292 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4293 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4294
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4295
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4296 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4297 * @brief Retrieve the worklist query as a DICOM file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4298 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4299 * This function retrieves the DICOM file that underlies a C-Find
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4300 * SCP query against modality worklists.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4301 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4302 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4303 * @param target Memory buffer where to store the DICOM file. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4304 * @param query The worklist query, as received by the callback.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4305 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4306 * @ingroup Worklists
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4307 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4308 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginWorklistGetDicomQuery(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4309 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4310 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4311 const OrthancPluginWorklistQuery* query)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4312 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4313 _OrthancPluginWorklistQueryOperation params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4314 params.query = query;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4315 params.dicom = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4316 params.size = 0;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4317 params.isMatch = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4318 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4319
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4320 return context->InvokeService(context, _OrthancPluginService_WorklistGetDicomQuery, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4321 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4322
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4323
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4324 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4325 * @brief Get the origin of a DICOM file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4326 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4327 * This function returns the origin of a DICOM instance that has been received by Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4328 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4329 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4330 * @param instance The instance of interest.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4331 * @return The origin of the instance.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4332 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4333 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4334 ORTHANC_PLUGIN_INLINE OrthancPluginInstanceOrigin OrthancPluginGetInstanceOrigin(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4335 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4336 OrthancPluginDicomInstance* instance)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4337 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4338 OrthancPluginInstanceOrigin origin;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4339
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4340 _OrthancPluginAccessDicomInstance params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4341 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4342 params.resultOrigin = &origin;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4343 params.instance = instance;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4344
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4345 if (context->InvokeService(context, _OrthancPluginService_GetInstanceOrigin, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4346 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4347 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4348 return OrthancPluginInstanceOrigin_Unknown;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4349 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4350 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4351 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4352 return origin;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4353 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4354 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4355
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4356
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4357 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4358 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4359 OrthancPluginMemoryBuffer* target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4360 const char* json;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4361 const OrthancPluginImage* pixelData;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4362 OrthancPluginCreateDicomFlags flags;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4363 } _OrthancPluginCreateDicom;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4364
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4365 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4366 * @brief Create a DICOM instance from a JSON string and an image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4367 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4368 * This function takes as input a string containing a JSON file
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4369 * describing the content of a DICOM instance. As an output, it
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4370 * writes the corresponding DICOM instance to a newly allocated
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4371 * memory buffer. Additionally, an image to be encoded within the
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4372 * DICOM instance can also be provided.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4373 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4374 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4375 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4376 * @param json The input JSON file.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4377 * @param pixelData The image. Can be NULL, if the pixel data is encoded inside the JSON with the data URI scheme.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4378 * @param flags Flags governing the output.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4379 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4380 * @ingroup Toolbox
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4381 * @see OrthancPluginDicomBufferToJson
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4382 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4383 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCreateDicom(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4384 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4385 OrthancPluginMemoryBuffer* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4386 const char* json,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4387 const OrthancPluginImage* pixelData,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4388 OrthancPluginCreateDicomFlags flags)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4389 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4390 _OrthancPluginCreateDicom params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4391 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4392 params.json = json;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4393 params.pixelData = pixelData;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4394 params.flags = flags;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4395
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4396 return context->InvokeService(context, _OrthancPluginService_CreateDicom, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4397 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4398
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4399
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4400 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4401 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4402 OrthancPluginDecodeImageCallback callback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4403 } _OrthancPluginDecodeImageCallback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4404
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4405 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4406 * @brief Register a callback to handle the decoding of DICOM images.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4407 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4408 * This function registers a custom callback to the decoding of
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4409 * DICOM images, replacing the built-in decoder of Orthanc.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4410 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4411 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4412 * @param callback The callback.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4413 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4414 * @ingroup Callbacks
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4415 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4416 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterDecodeImageCallback(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4417 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4418 OrthancPluginDecodeImageCallback callback)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4419 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4420 _OrthancPluginDecodeImageCallback params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4421 params.callback = callback;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4422
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4423 return context->InvokeService(context, _OrthancPluginService_RegisterDecodeImageCallback, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4424 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4425
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4426
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4427
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4428 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4429 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4430 OrthancPluginImage** target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4431 OrthancPluginPixelFormat format;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4432 uint32_t width;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4433 uint32_t height;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4434 uint32_t pitch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4435 void* buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4436 const void* constBuffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4437 uint32_t bufferSize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4438 uint32_t frameIndex;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4439 } _OrthancPluginCreateImage;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4440
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4441
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4442 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4443 * @brief Create an image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4444 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4445 * This function creates an image of given size and format.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4446 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4447 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4448 * @param format The format of the pixels.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4449 * @param width The width of the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4450 * @param height The height of the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4451 * @return The newly allocated image. It must be freed with OrthancPluginFreeImage().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4452 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4453 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4454 ORTHANC_PLUGIN_INLINE OrthancPluginImage* OrthancPluginCreateImage(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4455 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4456 OrthancPluginPixelFormat format,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4457 uint32_t width,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4458 uint32_t height)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4459 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4460 OrthancPluginImage* target = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4461
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4462 _OrthancPluginCreateImage params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4463 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4464 params.target = &target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4465 params.format = format;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4466 params.width = width;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4467 params.height = height;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4468
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4469 if (context->InvokeService(context, _OrthancPluginService_CreateImage, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4470 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4471 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4472 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4473 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4474 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4475 return target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4476 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4477 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4478
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4479
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4480 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4481 * @brief Create an image pointing to a memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4482 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4483 * This function creates an image whose content points to a memory
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4484 * buffer managed by the plugin. Note that the buffer is directly
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4485 * accessed, no memory is allocated and no data is copied.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4486 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4487 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4488 * @param format The format of the pixels.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4489 * @param width The width of the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4490 * @param height The height of the image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4491 * @param pitch The pitch of the image (i.e. the number of bytes
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4492 * between 2 successive lines of the image in the memory buffer).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4493 * @param buffer The memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4494 * @return The newly allocated image. It must be freed with OrthancPluginFreeImage().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4495 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4496 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4497 ORTHANC_PLUGIN_INLINE OrthancPluginImage* OrthancPluginCreateImageAccessor(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4498 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4499 OrthancPluginPixelFormat format,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4500 uint32_t width,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4501 uint32_t height,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4502 uint32_t pitch,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4503 void* buffer)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4504 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4505 OrthancPluginImage* target = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4506
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4507 _OrthancPluginCreateImage params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4508 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4509 params.target = &target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4510 params.format = format;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4511 params.width = width;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4512 params.height = height;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4513 params.pitch = pitch;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4514 params.buffer = buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4515
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4516 if (context->InvokeService(context, _OrthancPluginService_CreateImageAccessor, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4517 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4518 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4519 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4520 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4521 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4522 return target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4523 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4524 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4525
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4526
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4527
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4528 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4529 * @brief Decode one frame from a DICOM instance.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4530 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4531 * This function decodes one frame of a DICOM image that is stored
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4532 * in a memory buffer. This function will give the same result as
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4533 * OrthancPluginUncompressImage() for single-frame DICOM images.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4534 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4535 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4536 * @param buffer Pointer to a memory buffer containing the DICOM image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4537 * @param bufferSize Size of the memory buffer containing the DICOM image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4538 * @param frameIndex The index of the frame of interest in a multi-frame image.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4539 * @return The uncompressed image. It must be freed with OrthancPluginFreeImage().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4540 * @ingroup Images
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4541 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4542 ORTHANC_PLUGIN_INLINE OrthancPluginImage* OrthancPluginDecodeDicomImage(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4543 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4544 const void* buffer,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4545 uint32_t bufferSize,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4546 uint32_t frameIndex)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4547 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4548 OrthancPluginImage* target = NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4549
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4550 _OrthancPluginCreateImage params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4551 memset(&params, 0, sizeof(params));
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4552 params.target = &target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4553 params.constBuffer = buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4554 params.bufferSize = bufferSize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4555 params.frameIndex = frameIndex;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4556
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4557 if (context->InvokeService(context, _OrthancPluginService_DecodeDicomImage, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4558 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4559 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4560 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4561 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4562 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4563 return target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4564 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4565 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4566
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4567
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4568
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4569 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4570 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4571 char** result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4572 const void* buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4573 uint32_t size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4574 } _OrthancPluginComputeHash;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4575
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4576 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4577 * @brief Compute an MD5 hash.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4578 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4579 * This functions computes the MD5 cryptographic hash of the given memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4580 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4581 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4582 * @param buffer The source memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4583 * @param size The size in bytes of the source buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4584 * @return The NULL value in case of error, or a string containing the cryptographic hash.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4585 * This string must be freed by OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4586 * @ingroup Toolbox
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4587 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4588 ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeMd5(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4589 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4590 const void* buffer,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4591 uint32_t size)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4592 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4593 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4594
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4595 _OrthancPluginComputeHash params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4596 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4597 params.buffer = buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4598 params.size = size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4599
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4600 if (context->InvokeService(context, _OrthancPluginService_ComputeMd5, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4601 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4602 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4603 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4604 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4605 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4606 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4607 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4608 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4609 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4610
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4611
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4612 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4613 * @brief Compute a SHA-1 hash.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4614 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4615 * This functions computes the SHA-1 cryptographic hash of the given memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4616 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4617 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4618 * @param buffer The source memory buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4619 * @param size The size in bytes of the source buffer.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4620 * @return The NULL value in case of error, or a string containing the cryptographic hash.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4621 * This string must be freed by OrthancPluginFreeString().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4622 * @ingroup Toolbox
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4623 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4624 ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeSha1(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4625 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4626 const void* buffer,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4627 uint32_t size)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4628 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4629 char* result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4630
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4631 _OrthancPluginComputeHash params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4632 params.result = &result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4633 params.buffer = buffer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4634 params.size = size;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4635
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4636 if (context->InvokeService(context, _OrthancPluginService_ComputeSha1, &params) != OrthancPluginErrorCode_Success)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4637 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4638 /* Error */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4639 return NULL;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4640 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4641 else
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4642 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4643 return result;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4644 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4645 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4646
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4647
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4648
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4649 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4650 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4651 OrthancPluginDictionaryEntry* target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4652 const char* name;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4653 } _OrthancPluginLookupDictionary;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4654
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4655 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4656 * @brief Get information about the given DICOM tag.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4657 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4658 * This functions makes a lookup in the dictionary of DICOM tags
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4659 * that are known to Orthanc, and returns information about this
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4660 * tag. The tag can be specified using its human-readable name
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4661 * (e.g. "PatientName") or a set of two hexadecimal numbers
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4662 * (e.g. "0010-0020").
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4663 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4664 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4665 * @param target Where to store the information about the tag.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4666 * @param name The name of the DICOM tag.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4667 * @return 0 if success, other value if error.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4668 * @ingroup Toolbox
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4669 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4670 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginLookupDictionary(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4671 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4672 OrthancPluginDictionaryEntry* target,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4673 const char* name)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4674 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4675 _OrthancPluginLookupDictionary params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4676 params.target = target;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4677 params.name = name;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4678 return context->InvokeService(context, _OrthancPluginService_LookupDictionary, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4679 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4680
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4681
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4682
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4683 typedef struct
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4684 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4685 OrthancPluginRestOutput* output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4686 const char* answer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4687 uint32_t answerSize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4688 uint32_t headersCount;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4689 const char* const* headersKeys;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4690 const char* const* headersValues;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4691 } _OrthancPluginSendMultipartItem2;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4692
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4693 /**
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4694 * @brief Send an item as a part of some HTTP multipart answer, with custom headers.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4695 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4696 * This function sends an item as a part of some HTTP multipart
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4697 * answer that was initiated by OrthancPluginStartMultipartAnswer(). In addition to
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4698 * OrthancPluginSendMultipartItem(), this function will set HTTP header associated
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4699 * with the item.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4700 *
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4701 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4702 * @param output The HTTP connection to the client application.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4703 * @param answer Pointer to the memory buffer containing the item.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4704 * @param answerSize Number of bytes of the item.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4705 * @param headersCount The number of HTTP headers.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4706 * @param headersKeys Array containing the keys of the HTTP headers.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4707 * @param headersValues Array containing the values of the HTTP headers.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4708 * @return 0 if success, or the error code if failure (this notably happens
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4709 * if the connection is closed by the client).
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4710 * @see OrthancPluginSendMultipartItem()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4711 * @ingroup REST
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4712 **/
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4713 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginSendMultipartItem2(
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4714 OrthancPluginContext* context,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4715 OrthancPluginRestOutput* output,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4716 const char* answer,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4717 uint32_t answerSize,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4718 uint32_t headersCount,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4719 const char* const* headersKeys,
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4720 const char* const* headersValues)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4721 {
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4722 _OrthancPluginSendMultipartItem2 params;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4723 params.output = output;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4724 params.answer = answer;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4725 params.answerSize = answerSize;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4726 params.headersCount = headersCount;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4727 params.headersKeys = headersKeys;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4728 params.headersValues = headersValues;
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4729
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4730 return context->InvokeService(context, _OrthancPluginService_SendMultipartItem2, &params);
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4731 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4732
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4733
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4734 #ifdef __cplusplus
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4735 }
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4736 #endif
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4737
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4738
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4739 /** @} */
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4740