annotate Resources/Orthanc/Sdk-1.12.0/orthanc/OrthancCPlugin.h @ 524:48aba35fe64e large-queries

merged BEGIN and SET TRANSACTION statements
author Alain Mazy <am@orthanc.team>
date Tue, 09 Jul 2024 16:30:52 +0200
parents 1938ba8fba35
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * \mainpage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * This C/C++ SDK allows external developers to create plugins that
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * can be loaded into Orthanc to extend its functionality. Each
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * Orthanc plugin must expose 4 public functions with the following
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * signatures:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * -# <tt>int32_t OrthancPluginInitialize(const OrthancPluginContext* context)</tt>:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * This function is invoked by Orthanc when it loads the plugin on startup.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * The plugin must:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * - Check its compatibility with the Orthanc version using
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * ::OrthancPluginCheckVersion().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * - Store the context pointer so that it can use the plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * services of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * - Register all its REST callbacks using ::OrthancPluginRegisterRestCallback().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * - Possibly register its callback for received DICOM instances using ::OrthancPluginRegisterOnStoredInstanceCallback().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * - Possibly register its callback for changes to the DICOM store using ::OrthancPluginRegisterOnChangeCallback().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * - Possibly register a custom storage area using ::OrthancPluginRegisterStorageArea2().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * - Possibly register a custom database back-end area using OrthancPluginRegisterDatabaseBackendV4().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * - Possibly register a handler for C-Find SCP using OrthancPluginRegisterFindCallback().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * - Possibly register a handler for C-Find SCP against DICOM worklists using OrthancPluginRegisterWorklistCallback().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * - Possibly register a handler for C-Move SCP using OrthancPluginRegisterMoveCallback().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * - Possibly register a custom decoder for DICOM images using OrthancPluginRegisterDecodeImageCallback().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * - Possibly register a callback to filter incoming HTTP requests using OrthancPluginRegisterIncomingHttpRequestFilter2().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * - Possibly register a callback to unserialize jobs using OrthancPluginRegisterJobsUnserializer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * - Possibly register a callback to refresh its metrics using OrthancPluginRegisterRefreshMetricsCallback().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * - Possibly register a callback to answer chunked HTTP transfers using ::OrthancPluginRegisterChunkedRestCallback().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * - Possibly register a callback for Storage Commitment SCP using ::OrthancPluginRegisterStorageCommitmentScpCallback().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * - Possibly register a callback to keep/discard/modify incoming DICOM instances using OrthancPluginRegisterReceivedInstanceCallback().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 * - Possibly register a custom transcoder for DICOM images using OrthancPluginRegisterTranscoderCallback().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 * - Possibly register a callback to discard instances received through DICOM C-STORE using OrthancPluginRegisterIncomingCStoreInstanceFilter().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 * - Possibly register a callback to branch a WebDAV virtual filesystem using OrthancPluginRegisterWebDavCollection().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 * -# <tt>void OrthancPluginFinalize()</tt>:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 * This function is invoked by Orthanc during its shutdown. The plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 * must free all its memory.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 * -# <tt>const char* OrthancPluginGetName()</tt>:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 * The plugin must return a short string to identify itself.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 * -# <tt>const char* OrthancPluginGetVersion()</tt>:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 * The plugin must return a string containing its version number.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 * The name and the version of a plugin is only used to prevent it
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 * from being loaded twice. Note that, in C++, it is mandatory to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 * declare these functions within an <tt>extern "C"</tt> section.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 * To ensure multi-threading safety, the various REST callbacks are
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 * guaranteed to be executed in mutual exclusion since Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 * 0.8.5. If this feature is undesired (notably when developing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 * high-performance plugins handling simultaneous requests), use
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 * ::OrthancPluginRegisterRestCallbackNoLock().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 * @defgroup Images Images and compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 * @brief Functions to deal with images and compressed buffers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 * @defgroup REST REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 * @brief Functions to answer REST requests in a callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 * @defgroup Callbacks Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 * @brief Functions to register and manage callbacks by the plugins.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 * @defgroup DicomCallbacks DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 * @brief Functions to register and manage DICOM callbacks (worklists, C-FIND, C-MOVE, storage commitment).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 * @defgroup Orthanc Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 * @brief Functions to access the content of the Orthanc server.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 * @defgroup DicomInstance DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 * @brief Functions to access DICOM images that are managed by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 * @defgroup Toolbox Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 * @brief Generic functions to help with the creation of plugins.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 * Orthanc - A Lightweight, RESTful DICOM Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 * Department, University Hospital of Liege, Belgium
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 * Copyright (C) 2017-2023 Osimis S.A., Belgium
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 * This program is free software: you can redistribute it and/or
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 * modify it under the terms of the GNU General Public License as
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 * published by the Free Software Foundation, either version 3 of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 * License, or (at your option) any later version.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 * This program is distributed in the hope that it will be useful, but
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 * WITHOUT ANY WARRANTY; without even the implied warranty of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 * General Public License for more details.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 * You should have received a copy of the GNU General Public License
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 #pragma once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 #include <stdio.h>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 #include <string.h>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 #ifdef WIN32
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 # define ORTHANC_PLUGINS_API __declspec(dllexport)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 #elif __GNUC__ >= 4
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 # define ORTHANC_PLUGINS_API __attribute__ ((visibility ("default")))
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 #else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 # define ORTHANC_PLUGINS_API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 #define ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER 1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 #define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER 12
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 #define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 #if !defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 #define ORTHANC_PLUGINS_VERSION_IS_ABOVE(major, minor, revision) \
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER > major || \
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER == major && \
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER > minor || \
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER == minor && \
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER >= revision))))
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 /********************************************************************
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 ** Check that function inlining is properly supported. The use of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 ** inlining is required, to avoid the duplication of object code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 ** between two compilation modules that would use the Orthanc Plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 ** API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 ********************************************************************/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 /* If the auto-detection of the "inline" keyword below does not work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 automatically and that your compiler is known to properly support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 inlining, uncomment the following #define and adapt the definition
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 of "static inline". */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 /* #define ORTHANC_PLUGIN_INLINE static inline */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 #ifndef ORTHANC_PLUGIN_INLINE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 # if __STDC_VERSION__ >= 199901L
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 /* This is C99 or above: http://predef.sourceforge.net/prestd.html */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 # define ORTHANC_PLUGIN_INLINE static inline
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 # elif defined(__cplusplus)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 /* This is C++ */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 # define ORTHANC_PLUGIN_INLINE static inline
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 # elif defined(__GNUC__)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 /* This is GCC running in C89 mode */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 # define ORTHANC_PLUGIN_INLINE static __inline
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 # elif defined(_MSC_VER)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 /* This is Visual Studio running in C89 mode */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 # define ORTHANC_PLUGIN_INLINE static __inline
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 # else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 # error Your compiler is not known to support the "inline" keyword
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 # endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 /********************************************************************
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 ** Inclusion of standard libraries.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 ********************************************************************/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 * For Microsoft Visual Studio, a compatibility "stdint.h" can be
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 * downloaded at the following URL:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 * https://hg.orthanc-server.com/orthanc/raw-file/tip/Resources/ThirdParty/VisualStudio/stdint.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 #include <stdint.h>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 #include <stdlib.h>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 /********************************************************************
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 ** Definition of the Orthanc Plugin API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 ********************************************************************/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 /** @{ */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 #ifdef __cplusplus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 extern "C"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 * The various error codes that can be returned by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 OrthancPluginErrorCode_InternalError = -1 /*!< Internal error */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 OrthancPluginErrorCode_Success = 0 /*!< Success */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 OrthancPluginErrorCode_Plugin = 1 /*!< Error encountered within the plugin engine */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 OrthancPluginErrorCode_NotImplemented = 2 /*!< Not implemented yet */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 OrthancPluginErrorCode_ParameterOutOfRange = 3 /*!< Parameter out of range */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 OrthancPluginErrorCode_NotEnoughMemory = 4 /*!< The server hosting Orthanc is running out of memory */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 OrthancPluginErrorCode_BadParameterType = 5 /*!< Bad type for a parameter */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 OrthancPluginErrorCode_BadSequenceOfCalls = 6 /*!< Bad sequence of calls */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 OrthancPluginErrorCode_InexistentItem = 7 /*!< Accessing an inexistent item */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 OrthancPluginErrorCode_BadRequest = 8 /*!< Bad request */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 OrthancPluginErrorCode_NetworkProtocol = 9 /*!< Error in the network protocol */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 OrthancPluginErrorCode_SystemCommand = 10 /*!< Error while calling a system command */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 OrthancPluginErrorCode_Database = 11 /*!< Error with the database engine */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 OrthancPluginErrorCode_UriSyntax = 12 /*!< Badly formatted URI */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 OrthancPluginErrorCode_InexistentFile = 13 /*!< Inexistent file */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 OrthancPluginErrorCode_CannotWriteFile = 14 /*!< Cannot write to file */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 OrthancPluginErrorCode_BadFileFormat = 15 /*!< Bad file format */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 OrthancPluginErrorCode_Timeout = 16 /*!< Timeout */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 OrthancPluginErrorCode_UnknownResource = 17 /*!< Unknown resource */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 OrthancPluginErrorCode_IncompatibleDatabaseVersion = 18 /*!< Incompatible version of the database */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 OrthancPluginErrorCode_FullStorage = 19 /*!< The file storage is full */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 OrthancPluginErrorCode_CorruptedFile = 20 /*!< Corrupted file (e.g. inconsistent MD5 hash) */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 OrthancPluginErrorCode_InexistentTag = 21 /*!< Inexistent tag */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 OrthancPluginErrorCode_ReadOnly = 22 /*!< Cannot modify a read-only data structure */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 OrthancPluginErrorCode_IncompatibleImageFormat = 23 /*!< Incompatible format of the images */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 OrthancPluginErrorCode_IncompatibleImageSize = 24 /*!< Incompatible size of the images */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 OrthancPluginErrorCode_SharedLibrary = 25 /*!< Error while using a shared library (plugin) */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 OrthancPluginErrorCode_UnknownPluginService = 26 /*!< Plugin invoking an unknown service */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 OrthancPluginErrorCode_UnknownDicomTag = 27 /*!< Unknown DICOM tag */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 OrthancPluginErrorCode_BadJson = 28 /*!< Cannot parse a JSON document */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 OrthancPluginErrorCode_Unauthorized = 29 /*!< Bad credentials were provided to an HTTP request */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 OrthancPluginErrorCode_BadFont = 30 /*!< Badly formatted font file */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 OrthancPluginErrorCode_DatabasePlugin = 31 /*!< The plugin implementing a custom database back-end does not fulfill the proper interface */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 OrthancPluginErrorCode_StorageAreaPlugin = 32 /*!< Error in the plugin implementing a custom storage area */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 OrthancPluginErrorCode_EmptyRequest = 33 /*!< The request is empty */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 OrthancPluginErrorCode_NotAcceptable = 34 /*!< Cannot send a response which is acceptable according to the Accept HTTP header */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 OrthancPluginErrorCode_NullPointer = 35 /*!< Cannot handle a NULL pointer */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 OrthancPluginErrorCode_DatabaseUnavailable = 36 /*!< The database is currently not available (probably a transient situation) */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 OrthancPluginErrorCode_CanceledJob = 37 /*!< This job was canceled */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 OrthancPluginErrorCode_BadGeometry = 38 /*!< Geometry error encountered in Stone */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 OrthancPluginErrorCode_SslInitialization = 39 /*!< Cannot initialize SSL encryption, check out your certificates */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 OrthancPluginErrorCode_DiscontinuedAbi = 40 /*!< Calling a function that has been removed from the Orthanc Framework */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 OrthancPluginErrorCode_BadRange = 41 /*!< Incorrect range request */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 OrthancPluginErrorCode_DatabaseCannotSerialize = 42 /*!< Database could not serialize access due to concurrent update, the transaction should be retried */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 OrthancPluginErrorCode_Revision = 43 /*!< A bad revision number was provided, which might indicate conflict between multiple writers */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 OrthancPluginErrorCode_MainDicomTagsMultiplyDefined = 44 /*!< A main DICOM Tag has been defined multiple times for the same resource level */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 OrthancPluginErrorCode_SQLiteNotOpened = 1000 /*!< SQLite: The database is not opened */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 OrthancPluginErrorCode_SQLiteAlreadyOpened = 1001 /*!< SQLite: Connection is already open */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 OrthancPluginErrorCode_SQLiteCannotOpen = 1002 /*!< SQLite: Unable to open the database */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 OrthancPluginErrorCode_SQLiteStatementAlreadyUsed = 1003 /*!< SQLite: This cached statement is already being referred to */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 OrthancPluginErrorCode_SQLiteExecute = 1004 /*!< SQLite: Cannot execute a command */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 OrthancPluginErrorCode_SQLiteRollbackWithoutTransaction = 1005 /*!< SQLite: Rolling back a nonexistent transaction (have you called Begin()?) */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 OrthancPluginErrorCode_SQLiteCommitWithoutTransaction = 1006 /*!< SQLite: Committing a nonexistent transaction */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 OrthancPluginErrorCode_SQLiteRegisterFunction = 1007 /*!< SQLite: Unable to register a function */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 OrthancPluginErrorCode_SQLiteFlush = 1008 /*!< SQLite: Unable to flush the database */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 OrthancPluginErrorCode_SQLiteCannotRun = 1009 /*!< SQLite: Cannot run a cached statement */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 OrthancPluginErrorCode_SQLiteCannotStep = 1010 /*!< SQLite: Cannot step over a cached statement */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 OrthancPluginErrorCode_SQLiteBindOutOfRange = 1011 /*!< SQLite: Bing a value while out of range (serious error) */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 OrthancPluginErrorCode_SQLitePrepareStatement = 1012 /*!< SQLite: Cannot prepare a cached statement */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 OrthancPluginErrorCode_SQLiteTransactionAlreadyStarted = 1013 /*!< SQLite: Beginning the same transaction twice */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 OrthancPluginErrorCode_SQLiteTransactionCommit = 1014 /*!< SQLite: Failure when committing the transaction */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 OrthancPluginErrorCode_SQLiteTransactionBegin = 1015 /*!< SQLite: Cannot start a transaction */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 OrthancPluginErrorCode_DirectoryOverFile = 2000 /*!< The directory to be created is already occupied by a regular file */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 OrthancPluginErrorCode_FileStorageCannotWrite = 2001 /*!< Unable to create a subdirectory or a file in the file storage */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 OrthancPluginErrorCode_DirectoryExpected = 2002 /*!< The specified path does not point to a directory */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 OrthancPluginErrorCode_HttpPortInUse = 2003 /*!< The TCP port of the HTTP server is privileged or already in use */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 OrthancPluginErrorCode_DicomPortInUse = 2004 /*!< The TCP port of the DICOM server is privileged or already in use */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 OrthancPluginErrorCode_BadHttpStatusInRest = 2005 /*!< This HTTP status is not allowed in a REST API */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 OrthancPluginErrorCode_RegularFileExpected = 2006 /*!< The specified path does not point to a regular file */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 OrthancPluginErrorCode_PathToExecutable = 2007 /*!< Unable to get the path to the executable */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 OrthancPluginErrorCode_MakeDirectory = 2008 /*!< Cannot create a directory */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 OrthancPluginErrorCode_BadApplicationEntityTitle = 2009 /*!< An application entity title (AET) cannot be empty or be longer than 16 characters */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 OrthancPluginErrorCode_NoCFindHandler = 2010 /*!< No request handler factory for DICOM C-FIND SCP */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 OrthancPluginErrorCode_NoCMoveHandler = 2011 /*!< No request handler factory for DICOM C-MOVE SCP */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 OrthancPluginErrorCode_NoCStoreHandler = 2012 /*!< No request handler factory for DICOM C-STORE SCP */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 OrthancPluginErrorCode_NoApplicationEntityFilter = 2013 /*!< No application entity filter */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 OrthancPluginErrorCode_NoSopClassOrInstance = 2014 /*!< DicomUserConnection: Unable to find the SOP class and instance */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 OrthancPluginErrorCode_NoPresentationContext = 2015 /*!< DicomUserConnection: No acceptable presentation context for modality */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 OrthancPluginErrorCode_DicomFindUnavailable = 2016 /*!< DicomUserConnection: The C-FIND command is not supported by the remote SCP */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 OrthancPluginErrorCode_DicomMoveUnavailable = 2017 /*!< DicomUserConnection: The C-MOVE command is not supported by the remote SCP */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 OrthancPluginErrorCode_CannotStoreInstance = 2018 /*!< Cannot store an instance */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 OrthancPluginErrorCode_CreateDicomNotString = 2019 /*!< Only string values are supported when creating DICOM instances */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 OrthancPluginErrorCode_CreateDicomOverrideTag = 2020 /*!< Trying to override a value inherited from a parent module */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 OrthancPluginErrorCode_CreateDicomUseContent = 2021 /*!< Use \"Content\" to inject an image into a new DICOM instance */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 OrthancPluginErrorCode_CreateDicomNoPayload = 2022 /*!< No payload is present for one instance in the series */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 OrthancPluginErrorCode_CreateDicomUseDataUriScheme = 2023 /*!< The payload of the DICOM instance must be specified according to Data URI scheme */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 OrthancPluginErrorCode_CreateDicomBadParent = 2024 /*!< Trying to attach a new DICOM instance to an inexistent resource */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 OrthancPluginErrorCode_CreateDicomParentIsInstance = 2025 /*!< Trying to attach a new DICOM instance to an instance (must be a series, study or patient) */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 OrthancPluginErrorCode_CreateDicomParentEncoding = 2026 /*!< Unable to get the encoding of the parent resource */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 OrthancPluginErrorCode_UnknownModality = 2027 /*!< Unknown modality */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 OrthancPluginErrorCode_BadJobOrdering = 2028 /*!< Bad ordering of filters in a job */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 OrthancPluginErrorCode_JsonToLuaTable = 2029 /*!< Cannot convert the given JSON object to a Lua table */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 OrthancPluginErrorCode_CannotCreateLua = 2030 /*!< Cannot create the Lua context */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 OrthancPluginErrorCode_CannotExecuteLua = 2031 /*!< Cannot execute a Lua command */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 OrthancPluginErrorCode_LuaAlreadyExecuted = 2032 /*!< Arguments cannot be pushed after the Lua function is executed */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 OrthancPluginErrorCode_LuaBadOutput = 2033 /*!< The Lua function does not give the expected number of outputs */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 OrthancPluginErrorCode_NotLuaPredicate = 2034 /*!< The Lua function is not a predicate (only true/false outputs allowed) */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 OrthancPluginErrorCode_LuaReturnsNoString = 2035 /*!< The Lua function does not return a string */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 OrthancPluginErrorCode_StorageAreaAlreadyRegistered = 2036 /*!< Another plugin has already registered a custom storage area */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 OrthancPluginErrorCode_DatabaseBackendAlreadyRegistered = 2037 /*!< Another plugin has already registered a custom database back-end */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 OrthancPluginErrorCode_DatabaseNotInitialized = 2038 /*!< Plugin trying to call the database during its initialization */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 OrthancPluginErrorCode_SslDisabled = 2039 /*!< Orthanc has been built without SSL support */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 OrthancPluginErrorCode_CannotOrderSlices = 2040 /*!< Unable to order the slices of the series */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305 OrthancPluginErrorCode_NoWorklistHandler = 2041 /*!< No request handler factory for DICOM C-Find Modality SCP */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 OrthancPluginErrorCode_AlreadyExistingTag = 2042 /*!< Cannot override the value of a tag that already exists */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 OrthancPluginErrorCode_NoStorageCommitmentHandler = 2043 /*!< No request handler factory for DICOM N-ACTION SCP (storage commitment) */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 OrthancPluginErrorCode_NoCGetHandler = 2044 /*!< No request handler factory for DICOM C-GET SCP */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 OrthancPluginErrorCode_UnsupportedMediaType = 3000 /*!< Unsupported media type */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 _OrthancPluginErrorCode_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 } OrthancPluginErrorCode;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 * Forward declaration of one of the mandatory functions for Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 * plugins.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 ORTHANC_PLUGINS_API const char* OrthancPluginGetName();
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 * The various HTTP methods for a REST call.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327 OrthancPluginHttpMethod_Get = 1, /*!< GET request */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 OrthancPluginHttpMethod_Post = 2, /*!< POST request */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 OrthancPluginHttpMethod_Put = 3, /*!< PUT request */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 OrthancPluginHttpMethod_Delete = 4, /*!< DELETE request */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332 _OrthancPluginHttpMethod_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 } OrthancPluginHttpMethod;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 * @brief The parameters of a REST request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343 * @brief The HTTP method.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345 OrthancPluginHttpMethod method;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348 * @brief The number of groups of the regular expression.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 uint32_t groupsCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 * @brief The matched values for the groups of the regular expression.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 const char* const* groups;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 * @brief For a GET request, the number of GET parameters.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 uint32_t getCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 * @brief For a GET request, the keys of the GET parameters.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 const char* const* getKeys;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 * @brief For a GET request, the values of the GET parameters.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370 const char* const* getValues;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373 * @brief For a PUT or POST request, the content of the body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 const void* body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 * @brief For a PUT or POST request, the number of bytes of the body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 uint32_t bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 /* --------------------------------------------------
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 New in version 0.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 -------------------------------------------------- */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 * @brief The number of HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 uint32_t headersCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393 * @brief The keys of the HTTP headers (always converted to low-case).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 const char* const* headersKeys;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 * @brief The values of the HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 const char* const* headersValues;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 } OrthancPluginHttpRequest;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407 /* Generic services */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 _OrthancPluginService_LogInfo = 1,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 _OrthancPluginService_LogWarning = 2,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 _OrthancPluginService_LogError = 3,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411 _OrthancPluginService_GetOrthancPath = 4,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 _OrthancPluginService_GetOrthancDirectory = 5,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413 _OrthancPluginService_GetConfigurationPath = 6,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414 _OrthancPluginService_SetPluginProperty = 7,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 _OrthancPluginService_GetGlobalProperty = 8,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 _OrthancPluginService_SetGlobalProperty = 9,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417 _OrthancPluginService_GetCommandLineArgumentsCount = 10,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 _OrthancPluginService_GetCommandLineArgument = 11,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 _OrthancPluginService_GetExpectedDatabaseVersion = 12,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420 _OrthancPluginService_GetConfiguration = 13,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 _OrthancPluginService_BufferCompression = 14,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 _OrthancPluginService_ReadFile = 15,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423 _OrthancPluginService_WriteFile = 16,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424 _OrthancPluginService_GetErrorDescription = 17,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425 _OrthancPluginService_CallHttpClient = 18,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426 _OrthancPluginService_RegisterErrorCode = 19,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 _OrthancPluginService_RegisterDictionaryTag = 20,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428 _OrthancPluginService_DicomBufferToJson = 21,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 _OrthancPluginService_DicomInstanceToJson = 22,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430 _OrthancPluginService_CreateDicom = 23,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431 _OrthancPluginService_ComputeMd5 = 24,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432 _OrthancPluginService_ComputeSha1 = 25,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 _OrthancPluginService_LookupDictionary = 26,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 _OrthancPluginService_CallHttpClient2 = 27,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435 _OrthancPluginService_GenerateUuid = 28,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436 _OrthancPluginService_RegisterPrivateDictionaryTag = 29,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 _OrthancPluginService_AutodetectMimeType = 30,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 _OrthancPluginService_SetMetricsValue = 31,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439 _OrthancPluginService_EncodeDicomWebJson = 32,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440 _OrthancPluginService_EncodeDicomWebXml = 33,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441 _OrthancPluginService_ChunkedHttpClient = 34, /* New in Orthanc 1.5.7 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 _OrthancPluginService_GetTagName = 35, /* New in Orthanc 1.5.7 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443 _OrthancPluginService_EncodeDicomWebJson2 = 36, /* New in Orthanc 1.7.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444 _OrthancPluginService_EncodeDicomWebXml2 = 37, /* New in Orthanc 1.7.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445 _OrthancPluginService_CreateMemoryBuffer = 38, /* New in Orthanc 1.7.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446 _OrthancPluginService_GenerateRestApiAuthorizationToken = 39, /* New in Orthanc 1.8.1 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 _OrthancPluginService_CreateMemoryBuffer64 = 40, /* New in Orthanc 1.9.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 _OrthancPluginService_CreateDicom2 = 41, /* New in Orthanc 1.9.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449 _OrthancPluginService_GetDatabaseServerIdentifier = 42, /* New in Orthanc 1.11.1 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
450
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
451 /* Registration of callbacks */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
452 _OrthancPluginService_RegisterRestCallback = 1000,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453 _OrthancPluginService_RegisterOnStoredInstanceCallback = 1001,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 _OrthancPluginService_RegisterStorageArea = 1002,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455 _OrthancPluginService_RegisterOnChangeCallback = 1003,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 _OrthancPluginService_RegisterRestCallbackNoLock = 1004,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 _OrthancPluginService_RegisterWorklistCallback = 1005,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 _OrthancPluginService_RegisterDecodeImageCallback = 1006,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459 _OrthancPluginService_RegisterIncomingHttpRequestFilter = 1007,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460 _OrthancPluginService_RegisterFindCallback = 1008,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461 _OrthancPluginService_RegisterMoveCallback = 1009,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 _OrthancPluginService_RegisterIncomingHttpRequestFilter2 = 1010,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463 _OrthancPluginService_RegisterRefreshMetricsCallback = 1011,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464 _OrthancPluginService_RegisterChunkedRestCallback = 1012, /* New in Orthanc 1.5.7 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465 _OrthancPluginService_RegisterStorageCommitmentScpCallback = 1013,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466 _OrthancPluginService_RegisterIncomingDicomInstanceFilter = 1014,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467 _OrthancPluginService_RegisterTranscoderCallback = 1015, /* New in Orthanc 1.7.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468 _OrthancPluginService_RegisterStorageArea2 = 1016, /* New in Orthanc 1.9.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469 _OrthancPluginService_RegisterIncomingCStoreInstanceFilter = 1017, /* New in Orthanc 1.10.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
470 _OrthancPluginService_RegisterReceivedInstanceCallback = 1018, /* New in Orthanc 1.10.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
471 _OrthancPluginService_RegisterWebDavCollection = 1019, /* New in Orthanc 1.10.1 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
473 /* Sending answers to REST calls */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
474 _OrthancPluginService_AnswerBuffer = 2000,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
475 _OrthancPluginService_CompressAndAnswerPngImage = 2001, /* Unused as of Orthanc 0.9.4 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476 _OrthancPluginService_Redirect = 2002,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477 _OrthancPluginService_SendHttpStatusCode = 2003,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 _OrthancPluginService_SendUnauthorized = 2004,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
479 _OrthancPluginService_SendMethodNotAllowed = 2005,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
480 _OrthancPluginService_SetCookie = 2006,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
481 _OrthancPluginService_SetHttpHeader = 2007,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482 _OrthancPluginService_StartMultipartAnswer = 2008,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
483 _OrthancPluginService_SendMultipartItem = 2009,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 _OrthancPluginService_SendHttpStatus = 2010,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
485 _OrthancPluginService_CompressAndAnswerImage = 2011,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486 _OrthancPluginService_SendMultipartItem2 = 2012,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487 _OrthancPluginService_SetHttpErrorDetails = 2013,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489 /* Access to the Orthanc database and API */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
490 _OrthancPluginService_GetDicomForInstance = 3000,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
491 _OrthancPluginService_RestApiGet = 3001,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
492 _OrthancPluginService_RestApiPost = 3002,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493 _OrthancPluginService_RestApiDelete = 3003,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
494 _OrthancPluginService_RestApiPut = 3004,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
495 _OrthancPluginService_LookupPatient = 3005,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
496 _OrthancPluginService_LookupStudy = 3006,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
497 _OrthancPluginService_LookupSeries = 3007,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
498 _OrthancPluginService_LookupInstance = 3008,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499 _OrthancPluginService_LookupStudyWithAccessionNumber = 3009,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
500 _OrthancPluginService_RestApiGetAfterPlugins = 3010,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
501 _OrthancPluginService_RestApiPostAfterPlugins = 3011,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502 _OrthancPluginService_RestApiDeleteAfterPlugins = 3012,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
503 _OrthancPluginService_RestApiPutAfterPlugins = 3013,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
504 _OrthancPluginService_ReconstructMainDicomTags = 3014,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
505 _OrthancPluginService_RestApiGet2 = 3015,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
506 _OrthancPluginService_CallRestApi = 3016, /* New in Orthanc 1.9.2 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
507
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
508 /* Access to DICOM instances */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
509 _OrthancPluginService_GetInstanceRemoteAet = 4000,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
510 _OrthancPluginService_GetInstanceSize = 4001,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
511 _OrthancPluginService_GetInstanceData = 4002,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
512 _OrthancPluginService_GetInstanceJson = 4003,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
513 _OrthancPluginService_GetInstanceSimplifiedJson = 4004,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514 _OrthancPluginService_HasInstanceMetadata = 4005,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
515 _OrthancPluginService_GetInstanceMetadata = 4006,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516 _OrthancPluginService_GetInstanceOrigin = 4007,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
517 _OrthancPluginService_GetInstanceTransferSyntaxUid = 4008,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
518 _OrthancPluginService_HasInstancePixelData = 4009,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
519 _OrthancPluginService_CreateDicomInstance = 4010, /* New in Orthanc 1.7.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
520 _OrthancPluginService_FreeDicomInstance = 4011, /* New in Orthanc 1.7.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
521 _OrthancPluginService_GetInstanceFramesCount = 4012, /* New in Orthanc 1.7.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
522 _OrthancPluginService_GetInstanceRawFrame = 4013, /* New in Orthanc 1.7.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
523 _OrthancPluginService_GetInstanceDecodedFrame = 4014, /* New in Orthanc 1.7.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
524 _OrthancPluginService_TranscodeDicomInstance = 4015, /* New in Orthanc 1.7.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
525 _OrthancPluginService_SerializeDicomInstance = 4016, /* New in Orthanc 1.7.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
526 _OrthancPluginService_GetInstanceAdvancedJson = 4017, /* New in Orthanc 1.7.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527 _OrthancPluginService_GetInstanceDicomWebJson = 4018, /* New in Orthanc 1.7.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
528 _OrthancPluginService_GetInstanceDicomWebXml = 4019, /* New in Orthanc 1.7.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
529
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
530 /* Services for plugins implementing a database back-end */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
531 _OrthancPluginService_RegisterDatabaseBackend = 5000, /* New in Orthanc 0.8.6 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
532 _OrthancPluginService_DatabaseAnswer = 5001,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
533 _OrthancPluginService_RegisterDatabaseBackendV2 = 5002, /* New in Orthanc 0.9.4 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
534 _OrthancPluginService_StorageAreaCreate = 5003,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
535 _OrthancPluginService_StorageAreaRead = 5004,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
536 _OrthancPluginService_StorageAreaRemove = 5005,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
537 _OrthancPluginService_RegisterDatabaseBackendV3 = 5006, /* New in Orthanc 1.9.2 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
538 _OrthancPluginService_RegisterDatabaseBackendV4 = 5007, /* New in Orthanc 1.12.0 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
539
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
540 /* Primitives for handling images */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
541 _OrthancPluginService_GetImagePixelFormat = 6000,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
542 _OrthancPluginService_GetImageWidth = 6001,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
543 _OrthancPluginService_GetImageHeight = 6002,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
544 _OrthancPluginService_GetImagePitch = 6003,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
545 _OrthancPluginService_GetImageBuffer = 6004,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
546 _OrthancPluginService_UncompressImage = 6005,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
547 _OrthancPluginService_FreeImage = 6006,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548 _OrthancPluginService_CompressImage = 6007,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
549 _OrthancPluginService_ConvertPixelFormat = 6008,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
550 _OrthancPluginService_GetFontsCount = 6009,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
551 _OrthancPluginService_GetFontInfo = 6010,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
552 _OrthancPluginService_DrawText = 6011,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553 _OrthancPluginService_CreateImage = 6012,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
554 _OrthancPluginService_CreateImageAccessor = 6013,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
555 _OrthancPluginService_DecodeDicomImage = 6014,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
556
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
557 /* Primitives for handling C-Find, C-Move and worklists */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
558 _OrthancPluginService_WorklistAddAnswer = 7000,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
559 _OrthancPluginService_WorklistMarkIncomplete = 7001,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
560 _OrthancPluginService_WorklistIsMatch = 7002,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
561 _OrthancPluginService_WorklistGetDicomQuery = 7003,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
562 _OrthancPluginService_FindAddAnswer = 7004,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
563 _OrthancPluginService_FindMarkIncomplete = 7005,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564 _OrthancPluginService_GetFindQuerySize = 7006,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
565 _OrthancPluginService_GetFindQueryTag = 7007,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
566 _OrthancPluginService_GetFindQueryTagName = 7008,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
567 _OrthancPluginService_GetFindQueryValue = 7009,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568 _OrthancPluginService_CreateFindMatcher = 7010,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
569 _OrthancPluginService_FreeFindMatcher = 7011,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570 _OrthancPluginService_FindMatcherIsMatch = 7012,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572 /* Primitives for accessing Orthanc Peers (new in 1.4.2) */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573 _OrthancPluginService_GetPeers = 8000,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574 _OrthancPluginService_FreePeers = 8001,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 _OrthancPluginService_GetPeersCount = 8003,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576 _OrthancPluginService_GetPeerName = 8004,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
577 _OrthancPluginService_GetPeerUrl = 8005,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
578 _OrthancPluginService_CallPeerApi = 8006,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579 _OrthancPluginService_GetPeerUserProperty = 8007,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
581 /* Primitives for handling jobs (new in 1.4.2) */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 _OrthancPluginService_CreateJob = 9000, /* Deprecated since SDK 1.11.3 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583 _OrthancPluginService_FreeJob = 9001,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
584 _OrthancPluginService_SubmitJob = 9002,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
585 _OrthancPluginService_RegisterJobsUnserializer = 9003,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
586 _OrthancPluginService_CreateJob2 = 9004, /* New in SDK 1.11.3 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
587
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
588 _OrthancPluginService_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
589 } _OrthancPluginService;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
590
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
591
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
592 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
593 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
594 _OrthancPluginProperty_Description = 1,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595 _OrthancPluginProperty_RootUri = 2,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596 _OrthancPluginProperty_OrthancExplorer = 3,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
597
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
598 _OrthancPluginProperty_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
599 } _OrthancPluginProperty;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
600
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
601
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
602
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
603 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
604 * The memory layout of the pixels of an image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
605 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
606 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
607 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
608 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
610 * @brief Graylevel 8bpp image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
611 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
612 * The image is graylevel. Each pixel is unsigned and stored in
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
613 * one byte.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
614 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
615 OrthancPluginPixelFormat_Grayscale8 = 1,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
616
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
617 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
618 * @brief Graylevel, unsigned 16bpp image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
619 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
620 * The image is graylevel. Each pixel is unsigned and stored in
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
621 * two bytes.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
622 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
623 OrthancPluginPixelFormat_Grayscale16 = 2,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
624
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
625 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626 * @brief Graylevel, signed 16bpp image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
627 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
628 * The image is graylevel. Each pixel is signed and stored in two
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
629 * bytes.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
630 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
631 OrthancPluginPixelFormat_SignedGrayscale16 = 3,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
632
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
633 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
634 * @brief Color image in RGB24 format.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
635 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
636 * This format describes a color image. The pixels are stored in 3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
637 * consecutive bytes. The memory layout is RGB.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
638 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
639 OrthancPluginPixelFormat_RGB24 = 4,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
640
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
641 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
642 * @brief Color image in RGBA32 format.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
643 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
644 * This format describes a color image. The pixels are stored in 4
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
645 * consecutive bytes. The memory layout is RGBA.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
646 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
647 OrthancPluginPixelFormat_RGBA32 = 5,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
648
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
649 OrthancPluginPixelFormat_Unknown = 6, /*!< Unknown pixel format */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
650
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
651 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
652 * @brief Color image in RGB48 format.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
654 * This format describes a color image. The pixels are stored in 6
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
655 * consecutive bytes. The memory layout is RRGGBB.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
656 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
657 OrthancPluginPixelFormat_RGB48 = 7,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
658
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
659 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
660 * @brief Graylevel, unsigned 32bpp image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
661 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
662 * The image is graylevel. Each pixel is unsigned and stored in
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
663 * four bytes.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
664 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
665 OrthancPluginPixelFormat_Grayscale32 = 8,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
666
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
667 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
668 * @brief Graylevel, floating-point 32bpp image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670 * The image is graylevel. Each pixel is floating-point and stored
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671 * in four bytes.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
672 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673 OrthancPluginPixelFormat_Float32 = 9,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676 * @brief Color image in BGRA32 format.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
678 * This format describes a color image. The pixels are stored in 4
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679 * consecutive bytes. The memory layout is BGRA.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
680 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681 OrthancPluginPixelFormat_BGRA32 = 10,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
682
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
684 * @brief Graylevel, unsigned 64bpp image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
685 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
686 * The image is graylevel. Each pixel is unsigned and stored in
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
687 * eight bytes.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
688 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689 OrthancPluginPixelFormat_Grayscale64 = 11,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
690
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
691 _OrthancPluginPixelFormat_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
692 } OrthancPluginPixelFormat;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
693
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
695
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
696 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
697 * The content types that are supported by Orthanc plugins.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
700 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
701 OrthancPluginContentType_Unknown = 0, /*!< Unknown content type */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
702 OrthancPluginContentType_Dicom = 1, /*!< DICOM */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
703 OrthancPluginContentType_DicomAsJson = 2, /*!< JSON summary of a DICOM file */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
704 OrthancPluginContentType_DicomUntilPixelData = 3, /*!< DICOM Header till pixel data */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
705
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
706 _OrthancPluginContentType_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
707 } OrthancPluginContentType;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
708
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
709
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
710
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
711 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
712 * The supported types of DICOM resources.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
713 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
714 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716 OrthancPluginResourceType_Patient = 0, /*!< Patient */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
717 OrthancPluginResourceType_Study = 1, /*!< Study */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
718 OrthancPluginResourceType_Series = 2, /*!< Series */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
719 OrthancPluginResourceType_Instance = 3, /*!< Instance */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
720 OrthancPluginResourceType_None = 4, /*!< Unavailable resource type */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
722 _OrthancPluginResourceType_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
723 } OrthancPluginResourceType;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
724
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
725
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
726
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
727 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
728 * The supported types of changes that can be signaled to the change callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
729 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
730 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
731 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
732 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
733 OrthancPluginChangeType_CompletedSeries = 0, /*!< Series is now complete */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
734 OrthancPluginChangeType_Deleted = 1, /*!< Deleted resource */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
735 OrthancPluginChangeType_NewChildInstance = 2, /*!< A new instance was added to this resource */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
736 OrthancPluginChangeType_NewInstance = 3, /*!< New instance received */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
737 OrthancPluginChangeType_NewPatient = 4, /*!< New patient created */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
738 OrthancPluginChangeType_NewSeries = 5, /*!< New series created */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
739 OrthancPluginChangeType_NewStudy = 6, /*!< New study created */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
740 OrthancPluginChangeType_StablePatient = 7, /*!< Timeout: No new instance in this patient */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
741 OrthancPluginChangeType_StableSeries = 8, /*!< Timeout: No new instance in this series */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
742 OrthancPluginChangeType_StableStudy = 9, /*!< Timeout: No new instance in this study */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
743 OrthancPluginChangeType_OrthancStarted = 10, /*!< Orthanc has started */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
744 OrthancPluginChangeType_OrthancStopped = 11, /*!< Orthanc is stopping */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
745 OrthancPluginChangeType_UpdatedAttachment = 12, /*!< Some user-defined attachment has changed for this resource */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
746 OrthancPluginChangeType_UpdatedMetadata = 13, /*!< Some user-defined metadata has changed for this resource */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
747 OrthancPluginChangeType_UpdatedPeers = 14, /*!< The list of Orthanc peers has changed */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
748 OrthancPluginChangeType_UpdatedModalities = 15, /*!< The list of DICOM modalities has changed */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
749 OrthancPluginChangeType_JobSubmitted = 16, /*!< New Job submitted */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
750 OrthancPluginChangeType_JobSuccess = 17, /*!< A Job has completed successfully */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
751 OrthancPluginChangeType_JobFailure = 18, /*!< A Job has failed */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
752
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
753 _OrthancPluginChangeType_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
754 } OrthancPluginChangeType;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
758 * The compression algorithms that are supported by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
760 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
761 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
762 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763 OrthancPluginCompressionType_Zlib = 0, /*!< Standard zlib compression */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
764 OrthancPluginCompressionType_ZlibWithSize = 1, /*!< zlib, prefixed with uncompressed size (uint64_t) */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
765 OrthancPluginCompressionType_Gzip = 2, /*!< Standard gzip compression */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
766 OrthancPluginCompressionType_GzipWithSize = 3, /*!< gzip, prefixed with uncompressed size (uint64_t) */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
768 _OrthancPluginCompressionType_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
769 } OrthancPluginCompressionType;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
770
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
771
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
772 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773 * The image formats that are supported by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
774 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
775 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
776 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
777 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
778 OrthancPluginImageFormat_Png = 0, /*!< Image compressed using PNG */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
779 OrthancPluginImageFormat_Jpeg = 1, /*!< Image compressed using JPEG */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
780 OrthancPluginImageFormat_Dicom = 2, /*!< Image compressed using DICOM */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
781
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
782 _OrthancPluginImageFormat_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
783 } OrthancPluginImageFormat;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
784
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
785
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
786 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
787 * The value representations present in the DICOM standard (version 2013).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
788 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
789 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
790 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
791 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
792 OrthancPluginValueRepresentation_AE = 1, /*!< Application Entity */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
793 OrthancPluginValueRepresentation_AS = 2, /*!< Age String */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
794 OrthancPluginValueRepresentation_AT = 3, /*!< Attribute Tag */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
795 OrthancPluginValueRepresentation_CS = 4, /*!< Code String */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
796 OrthancPluginValueRepresentation_DA = 5, /*!< Date */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
797 OrthancPluginValueRepresentation_DS = 6, /*!< Decimal String */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
798 OrthancPluginValueRepresentation_DT = 7, /*!< Date Time */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
799 OrthancPluginValueRepresentation_FD = 8, /*!< Floating Point Double */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
800 OrthancPluginValueRepresentation_FL = 9, /*!< Floating Point Single */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
801 OrthancPluginValueRepresentation_IS = 10, /*!< Integer String */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
802 OrthancPluginValueRepresentation_LO = 11, /*!< Long String */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
803 OrthancPluginValueRepresentation_LT = 12, /*!< Long Text */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
804 OrthancPluginValueRepresentation_OB = 13, /*!< Other Byte String */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
805 OrthancPluginValueRepresentation_OF = 14, /*!< Other Float String */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
806 OrthancPluginValueRepresentation_OW = 15, /*!< Other Word String */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
807 OrthancPluginValueRepresentation_PN = 16, /*!< Person Name */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
808 OrthancPluginValueRepresentation_SH = 17, /*!< Short String */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
809 OrthancPluginValueRepresentation_SL = 18, /*!< Signed Long */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
810 OrthancPluginValueRepresentation_SQ = 19, /*!< Sequence of Items */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
811 OrthancPluginValueRepresentation_SS = 20, /*!< Signed Short */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
812 OrthancPluginValueRepresentation_ST = 21, /*!< Short Text */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
813 OrthancPluginValueRepresentation_TM = 22, /*!< Time */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
814 OrthancPluginValueRepresentation_UI = 23, /*!< Unique Identifier (UID) */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
815 OrthancPluginValueRepresentation_UL = 24, /*!< Unsigned Long */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
816 OrthancPluginValueRepresentation_UN = 25, /*!< Unknown */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
817 OrthancPluginValueRepresentation_US = 26, /*!< Unsigned Short */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
818 OrthancPluginValueRepresentation_UT = 27, /*!< Unlimited Text */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
819
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
820 _OrthancPluginValueRepresentation_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
821 } OrthancPluginValueRepresentation;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
822
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
823
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
824 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
825 * The possible output formats for a DICOM-to-JSON conversion.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
826 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
827 * @see OrthancPluginDicomToJson()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
828 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
829 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
830 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
831 OrthancPluginDicomToJsonFormat_Full = 1, /*!< Full output, with most details */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
832 OrthancPluginDicomToJsonFormat_Short = 2, /*!< Tags output as hexadecimal numbers */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
833 OrthancPluginDicomToJsonFormat_Human = 3, /*!< Human-readable JSON */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
834
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
835 _OrthancPluginDicomToJsonFormat_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
836 } OrthancPluginDicomToJsonFormat;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
837
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
838
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
839 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
840 * Flags to customize a DICOM-to-JSON conversion. By default, binary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
841 * tags are formatted using Data URI scheme.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
842 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
843 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
844 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
845 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
846 OrthancPluginDicomToJsonFlags_None = 0,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
847 OrthancPluginDicomToJsonFlags_IncludeBinary = (1 << 0), /*!< Include the binary tags */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
848 OrthancPluginDicomToJsonFlags_IncludePrivateTags = (1 << 1), /*!< Include the private tags */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
849 OrthancPluginDicomToJsonFlags_IncludeUnknownTags = (1 << 2), /*!< Include the tags unknown by the dictionary */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
850 OrthancPluginDicomToJsonFlags_IncludePixelData = (1 << 3), /*!< Include the pixel data */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
851 OrthancPluginDicomToJsonFlags_ConvertBinaryToAscii = (1 << 4), /*!< Output binary tags as-is, dropping non-ASCII */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
852 OrthancPluginDicomToJsonFlags_ConvertBinaryToNull = (1 << 5), /*!< Signal binary tags as null values */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
853 OrthancPluginDicomToJsonFlags_StopAfterPixelData = (1 << 6), /*!< Stop processing after pixel data (new in 1.9.1) */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
854 OrthancPluginDicomToJsonFlags_SkipGroupLengths = (1 << 7), /*!< Skip tags whose element is zero (new in 1.9.1) */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
855
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
856 _OrthancPluginDicomToJsonFlags_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
857 } OrthancPluginDicomToJsonFlags;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
858
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
859
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
860 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
861 * Flags to the creation of a DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
862 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
863 * @see OrthancPluginCreateDicom()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
864 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
865 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
866 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
867 OrthancPluginCreateDicomFlags_None = 0,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
868 OrthancPluginCreateDicomFlags_DecodeDataUriScheme = (1 << 0), /*!< Decode fields encoded using data URI scheme */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
869 OrthancPluginCreateDicomFlags_GenerateIdentifiers = (1 << 1), /*!< Automatically generate DICOM identifiers */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
870
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
871 _OrthancPluginCreateDicomFlags_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
872 } OrthancPluginCreateDicomFlags;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
873
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
874
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
875 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
876 * The constraints on the DICOM identifiers that must be supported
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
877 * by the database plugins.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
878 * @deprecated Plugins using OrthancPluginConstraintType will be faster
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
879 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
880 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
881 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
882 OrthancPluginIdentifierConstraint_Equal = 1, /*!< Equal */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
883 OrthancPluginIdentifierConstraint_SmallerOrEqual = 2, /*!< Less or equal */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
884 OrthancPluginIdentifierConstraint_GreaterOrEqual = 3, /*!< More or equal */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
885 OrthancPluginIdentifierConstraint_Wildcard = 4, /*!< Case-sensitive wildcard matching (with * and ?) */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
886
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
887 _OrthancPluginIdentifierConstraint_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
888 } OrthancPluginIdentifierConstraint;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
889
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
890
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
891 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
892 * The constraints on the tags (main DICOM tags and identifier tags)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
893 * that must be supported by the database plugins.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
894 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
895 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
896 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
897 OrthancPluginConstraintType_Equal = 1, /*!< Equal */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
898 OrthancPluginConstraintType_SmallerOrEqual = 2, /*!< Less or equal */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
899 OrthancPluginConstraintType_GreaterOrEqual = 3, /*!< More or equal */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
900 OrthancPluginConstraintType_Wildcard = 4, /*!< Wildcard matching */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
901 OrthancPluginConstraintType_List = 5, /*!< List of values */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
902
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
903 _OrthancPluginConstraintType_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
904 } OrthancPluginConstraintType;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
905
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
906
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
907 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
908 * The origin of a DICOM instance that has been received by Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
909 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
910 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
911 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
912 OrthancPluginInstanceOrigin_Unknown = 1, /*!< Unknown origin */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
913 OrthancPluginInstanceOrigin_DicomProtocol = 2, /*!< Instance received through DICOM protocol */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
914 OrthancPluginInstanceOrigin_RestApi = 3, /*!< Instance received through REST API of Orthanc */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
915 OrthancPluginInstanceOrigin_Plugin = 4, /*!< Instance added to Orthanc by a plugin */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
916 OrthancPluginInstanceOrigin_Lua = 5, /*!< Instance added to Orthanc by a Lua script */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
917 OrthancPluginInstanceOrigin_WebDav = 6, /*!< Instance received through WebDAV (new in 1.8.0) */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
918
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
919 _OrthancPluginInstanceOrigin_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
920 } OrthancPluginInstanceOrigin;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
921
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
922
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
923 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
924 * The possible status for one single step of a job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
925 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
926 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
927 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
928 OrthancPluginJobStepStatus_Success = 1, /*!< The job has successfully executed all its steps */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
929 OrthancPluginJobStepStatus_Failure = 2, /*!< The job has failed while executing this step */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
930 OrthancPluginJobStepStatus_Continue = 3 /*!< The job has still data to process after this step */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
931 } OrthancPluginJobStepStatus;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
932
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
933
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
934 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
935 * Explains why the job should stop and release the resources it has
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
936 * allocated. This is especially important to disambiguate between
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
937 * the "paused" condition and the "final" conditions (success,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
938 * failure, or canceled).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
939 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
940 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
941 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
942 OrthancPluginJobStopReason_Success = 1, /*!< The job has succeeded */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
943 OrthancPluginJobStopReason_Paused = 2, /*!< The job was paused, and will be resumed later */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
944 OrthancPluginJobStopReason_Failure = 3, /*!< The job has failed, and might be resubmitted later */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
945 OrthancPluginJobStopReason_Canceled = 4 /*!< The job was canceled, and might be resubmitted later */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
946 } OrthancPluginJobStopReason;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
947
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
948
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
949 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
950 * The available types of metrics.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
951 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
952 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
953 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
954 OrthancPluginMetricsType_Default = 0, /*!< Default metrics */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
955
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
956 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
957 * This metrics represents a time duration. Orthanc will keep the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
958 * maximum value of the metrics over a sliding window of ten
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
959 * seconds, which is useful if the metrics is sampled frequently.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
960 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
961 OrthancPluginMetricsType_Timer = 1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
962 } OrthancPluginMetricsType;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
963
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
964
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
965 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
966 * The available modes to export a binary DICOM tag into a DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
967 * JSON or XML document.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
968 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
969 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
970 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
971 OrthancPluginDicomWebBinaryMode_Ignore = 0, /*!< Don't include binary tags */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
972 OrthancPluginDicomWebBinaryMode_InlineBinary = 1, /*!< Inline encoding using Base64 */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
973 OrthancPluginDicomWebBinaryMode_BulkDataUri = 2 /*!< Use a bulk data URI field */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
974 } OrthancPluginDicomWebBinaryMode;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
975
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
976
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
977 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
978 * The available values for the Failure Reason (0008,1197) during
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
979 * storage commitment.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
980 * http://dicom.nema.org/medical/dicom/2019e/output/chtml/part03/sect_C.14.html#sect_C.14.1.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
981 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
982 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
983 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
984 OrthancPluginStorageCommitmentFailureReason_Success = 0,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
985 /*!< Success: The DICOM instance is properly stored in the SCP */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
986
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
987 OrthancPluginStorageCommitmentFailureReason_ProcessingFailure = 1,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
988 /*!< 0110H: A general failure in processing the operation was encountered */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
989
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
990 OrthancPluginStorageCommitmentFailureReason_NoSuchObjectInstance = 2,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
991 /*!< 0112H: One or more of the elements in the Referenced SOP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
992 Instance Sequence was not available */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
993
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
994 OrthancPluginStorageCommitmentFailureReason_ResourceLimitation = 3,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
995 /*!< 0213H: The SCP does not currently have enough resources to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
996 store the requested SOP Instance(s) */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
997
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
998 OrthancPluginStorageCommitmentFailureReason_ReferencedSOPClassNotSupported = 4,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
999 /*!< 0122H: Storage Commitment has been requested for a SOP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1000 Instance with a SOP Class that is not supported by the SCP */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1001
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1002 OrthancPluginStorageCommitmentFailureReason_ClassInstanceConflict = 5,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1003 /*!< 0119H: The SOP Class of an element in the Referenced SOP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1004 Instance Sequence did not correspond to the SOP class registered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1005 for this SOP Instance at the SCP */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1006
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1007 OrthancPluginStorageCommitmentFailureReason_DuplicateTransactionUID = 6
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1008 /*!< 0131H: The Transaction UID of the Storage Commitment Request
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1009 is already in use */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1010 } OrthancPluginStorageCommitmentFailureReason;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1011
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1012
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1013 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1014 * The action to be taken after ReceivedInstanceCallback is triggered
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1015 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1016 typedef enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1017 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1018 OrthancPluginReceivedInstanceAction_KeepAsIs = 1, /*!< Keep the instance as is */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1019 OrthancPluginReceivedInstanceAction_Modify = 2, /*!< Modify the instance */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1020 OrthancPluginReceivedInstanceAction_Discard = 3, /*!< Discard the instance */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1022 _OrthancPluginReceivedInstanceAction_INTERNAL = 0x7fffffff
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1023 } OrthancPluginReceivedInstanceAction;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1025
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1026 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1027 * @brief A 32-bit memory buffer allocated by the core system of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1028 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1029 * A memory buffer allocated by the core system of Orthanc. When the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1030 * content of the buffer is not useful anymore, it must be free by a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1031 * call to ::OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1032 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1033 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1034 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1035 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1036 * @brief The content of the buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1037 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1038 void* data;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1039
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1040 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1041 * @brief The number of bytes in the buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1042 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1043 uint32_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1044 } OrthancPluginMemoryBuffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1045
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1046
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1047
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1048 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1049 * @brief A 64-bit memory buffer allocated by the core system of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1050 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1051 * A memory buffer allocated by the core system of Orthanc. When the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1052 * content of the buffer is not useful anymore, it must be free by a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1053 * call to ::OrthancPluginFreeMemoryBuffer64().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1054 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1055 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1056 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1057 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1058 * @brief The content of the buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1059 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1060 void* data;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1061
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1062 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1063 * @brief The number of bytes in the buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1064 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1065 uint64_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1066 } OrthancPluginMemoryBuffer64;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1067
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1068
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1069
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1071 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1072 * @brief Opaque structure that represents the HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1073 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1074 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1075 typedef struct _OrthancPluginRestOutput_t OrthancPluginRestOutput;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1076
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1077
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1078
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1079 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1080 * @brief Opaque structure that represents a DICOM instance that is managed by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1081 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1082 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1083 typedef struct _OrthancPluginDicomInstance_t OrthancPluginDicomInstance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1084
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1085
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1086
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1087 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1088 * @brief Opaque structure that represents an image that is uncompressed in memory.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1089 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1090 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1091 typedef struct _OrthancPluginImage_t OrthancPluginImage;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1092
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1093
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1094
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1095 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1096 * @brief Opaque structure that represents the storage area that is actually used by Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1097 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1098 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1099 typedef struct _OrthancPluginStorageArea_t OrthancPluginStorageArea;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1100
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1101
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1102
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1103 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1104 * @brief Opaque structure to an object that represents a C-Find query for worklists.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1105 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1106 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1107 typedef struct _OrthancPluginWorklistQuery_t OrthancPluginWorklistQuery;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1108
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1109
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1110
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1111 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1112 * @brief Opaque structure to an object that represents the answers to a C-Find query for worklists.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1113 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1114 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1115 typedef struct _OrthancPluginWorklistAnswers_t OrthancPluginWorklistAnswers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1116
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1117
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1118
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1119 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1120 * @brief Opaque structure to an object that represents a C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1121 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1122 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1123 typedef struct _OrthancPluginFindQuery_t OrthancPluginFindQuery;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1124
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1125
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1126
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1127 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1128 * @brief Opaque structure to an object that represents the answers to a C-Find query for worklists.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1129 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1130 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1131 typedef struct _OrthancPluginFindAnswers_t OrthancPluginFindAnswers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1132
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1133
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1134
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1135 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1136 * @brief Opaque structure to an object that can be used to check whether a DICOM instance matches a C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1137 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1138 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1139 typedef struct _OrthancPluginFindMatcher_t OrthancPluginFindMatcher;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1140
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1141
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1142
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1143 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1144 * @brief Opaque structure to the set of remote Orthanc Peers that are known to the local Orthanc server.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1145 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1146 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1147 typedef struct _OrthancPluginPeers_t OrthancPluginPeers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1148
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1149
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1150
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1151 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1152 * @brief Opaque structure to a job to be executed by Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1153 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1154 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1155 typedef struct _OrthancPluginJob_t OrthancPluginJob;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1156
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1157
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1158
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1159 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1160 * @brief Opaque structure that represents a node in a JSON or XML
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1161 * document used in DICOMweb.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1162 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1163 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1164 typedef struct _OrthancPluginDicomWebNode_t OrthancPluginDicomWebNode;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1165
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1166
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1167
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1168 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1169 * @brief Signature of a callback function that answers to a REST request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1170 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1171 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1172 typedef OrthancPluginErrorCode (*OrthancPluginRestCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1173 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1174 const char* url,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1175 const OrthancPluginHttpRequest* request);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1176
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1177
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1178
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1179 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1180 * @brief Signature of a callback function that is triggered when Orthanc stores a new DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1181 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1182 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1183 typedef OrthancPluginErrorCode (*OrthancPluginOnStoredInstanceCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1184 const OrthancPluginDicomInstance* instance,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1185 const char* instanceId);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1186
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1187
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1188
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1189 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1190 * @brief Signature of a callback function that is triggered when a change happens to some DICOM resource.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1191 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1192 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1193 typedef OrthancPluginErrorCode (*OrthancPluginOnChangeCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1194 OrthancPluginChangeType changeType,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1195 OrthancPluginResourceType resourceType,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1196 const char* resourceId);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1197
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1198
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1199
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1200 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1201 * @brief Signature of a callback function to decode a DICOM instance as an image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1202 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1203 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1204 typedef OrthancPluginErrorCode (*OrthancPluginDecodeImageCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1205 OrthancPluginImage** target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1206 const void* dicom,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1207 const uint32_t size,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1208 uint32_t frameIndex);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1209
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1210
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1211
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1212 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1213 * @brief Signature of a function to free dynamic memory.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1214 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1215 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1216 typedef void (*OrthancPluginFree) (void* buffer);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1217
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1218
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1219
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1220 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1221 * @brief Signature of a function to set the content of a node
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1222 * encoding a binary DICOM tag, into a JSON or XML document
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1223 * generated for DICOMweb.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1224 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1225 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1226 typedef void (*OrthancPluginDicomWebSetBinaryNode) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1227 OrthancPluginDicomWebNode* node,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1228 OrthancPluginDicomWebBinaryMode mode,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1229 const char* bulkDataUri);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1230
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1231
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1232
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1233 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1234 * @brief Callback for writing to the storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1235 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1236 * Signature of a callback function that is triggered when Orthanc writes a file to the storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1237 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1238 * @param uuid The UUID of the file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1239 * @param content The content of the file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1240 * @param size The size of the file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1241 * @param type The content type corresponding to this file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1242 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1243 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1244 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1245 typedef OrthancPluginErrorCode (*OrthancPluginStorageCreate) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1246 const char* uuid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1247 const void* content,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1248 int64_t size,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1249 OrthancPluginContentType type);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1250
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1251
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1252
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1253 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1254 * @brief Callback for reading from the storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1255 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1256 * Signature of a callback function that is triggered when Orthanc reads a file from the storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1257 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1258 * @param content The content of the file (output).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1259 * @param size The size of the file (output).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1260 * @param uuid The UUID of the file of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1261 * @param type The content type corresponding to this file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1262 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1263 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1264 * @deprecated New plugins should use OrthancPluginStorageRead2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1265 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1266 * @warning The "content" buffer *must* have been allocated using
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1267 * the "malloc()" function of your C standard library (i.e. nor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1268 * "new[]", neither a pointer to a buffer). The "free()" function of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1269 * your C standard library will automatically be invoked on the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1270 * "content" pointer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1271 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1272 typedef OrthancPluginErrorCode (*OrthancPluginStorageRead) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1273 void** content,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1274 int64_t* size,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1275 const char* uuid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1276 OrthancPluginContentType type);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1277
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1278
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1279
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1280 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1281 * @brief Callback for reading a whole file from the storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1282 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1283 * Signature of a callback function that is triggered when Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1284 * reads a whole file from the storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1285 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1286 * @param target Memory buffer where to store the content of the file. It must be allocated by the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1287 * plugin using OrthancPluginCreateMemoryBuffer64(). The core of Orthanc will free it.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1288 * @param uuid The UUID of the file of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1289 * @param type The content type corresponding to this file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1290 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1291 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1292 typedef OrthancPluginErrorCode (*OrthancPluginStorageReadWhole) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1293 OrthancPluginMemoryBuffer64* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1294 const char* uuid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1295 OrthancPluginContentType type);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1296
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1297
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1298
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1299 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1300 * @brief Callback for reading a range of a file from the storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1301 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1302 * Signature of a callback function that is triggered when Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1303 * reads a portion of a file from the storage area. Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1304 * indicates the start position and the length of the range.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1305 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1306 * @param target Memory buffer where to store the content of the range.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1307 * The memory buffer is allocated and freed by Orthanc. The length of the range
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1308 * of interest corresponds to the size of this buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1309 * @param uuid The UUID of the file of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1310 * @param type The content type corresponding to this file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1311 * @param rangeStart Start position of the requested range in the file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1312 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1313 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1314 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1315 typedef OrthancPluginErrorCode (*OrthancPluginStorageReadRange) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1316 OrthancPluginMemoryBuffer64* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1317 const char* uuid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1318 OrthancPluginContentType type,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1319 uint64_t rangeStart);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1320
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1321
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1322
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1323 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1324 * @brief Callback for removing a file from the storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1325 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1326 * Signature of a callback function that is triggered when Orthanc deletes a file from the storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1327 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1328 * @param uuid The UUID of the file to be removed.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1329 * @param type The content type corresponding to this file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1330 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1331 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1332 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1333 typedef OrthancPluginErrorCode (*OrthancPluginStorageRemove) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1334 const char* uuid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1335 OrthancPluginContentType type);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1336
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1337
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1338
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1339 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1340 * @brief Callback to handle the C-Find SCP requests for worklists.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1341 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1342 * Signature of a callback function that is triggered when Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1343 * receives a C-Find SCP request against modality worklists.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1344 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1345 * @param answers The target structure where answers must be stored.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1346 * @param query The worklist query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1347 * @param issuerAet The Application Entity Title (AET) of the modality from which the request originates.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1348 * @param calledAet The Application Entity Title (AET) of the modality that is called by the request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1349 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1350 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1351 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1352 typedef OrthancPluginErrorCode (*OrthancPluginWorklistCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1353 OrthancPluginWorklistAnswers* answers,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1354 const OrthancPluginWorklistQuery* query,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1355 const char* issuerAet,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1356 const char* calledAet);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1357
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1358
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1359
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1360 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1361 * @brief Callback to filter incoming HTTP requests received by Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1362 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1363 * Signature of a callback function that is triggered whenever
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1364 * Orthanc receives an HTTP/REST request, and that answers whether
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1365 * this request should be allowed. If the callback returns "0"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1366 * ("false"), the server answers with HTTP status code 403
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1367 * (Forbidden).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1368 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1369 * Pay attention to the fact that this function may be invoked
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1370 * concurrently by different threads of the Web server of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1371 * Orthanc. You must implement proper locking if applicable.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1372 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1373 * @param method The HTTP method used by the request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1374 * @param uri The URI of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1375 * @param ip The IP address of the HTTP client.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1376 * @param headersCount The number of HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1377 * @param headersKeys The keys of the HTTP headers (always converted to low-case).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1378 * @param headersValues The values of the HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1379 * @return 0 if forbidden access, 1 if allowed access, -1 if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1380 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1381 * @deprecated Please instead use OrthancPluginIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1382 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1383 typedef int32_t (*OrthancPluginIncomingHttpRequestFilter) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1384 OrthancPluginHttpMethod method,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1385 const char* uri,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1386 const char* ip,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1387 uint32_t headersCount,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1388 const char* const* headersKeys,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1389 const char* const* headersValues);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1390
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1391
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1392
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1393 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1394 * @brief Callback to filter incoming HTTP requests received by Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1395 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1396 * Signature of a callback function that is triggered whenever
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1397 * Orthanc receives an HTTP/REST request, and that answers whether
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1398 * this request should be allowed. If the callback returns "0"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1399 * ("false"), the server answers with HTTP status code 403
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1400 * (Forbidden).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1401 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1402 * Pay attention to the fact that this function may be invoked
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1403 * concurrently by different threads of the Web server of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1404 * Orthanc. You must implement proper locking if applicable.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1405 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1406 * @param method The HTTP method used by the request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1407 * @param uri The URI of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1408 * @param ip The IP address of the HTTP client.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1409 * @param headersCount The number of HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1410 * @param headersKeys The keys of the HTTP headers (always converted to low-case).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1411 * @param headersValues The values of the HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1412 * @param getArgumentsCount The number of GET arguments (only for the GET HTTP method).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1413 * @param getArgumentsKeys The keys of the GET arguments (only for the GET HTTP method).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1414 * @param getArgumentsValues The values of the GET arguments (only for the GET HTTP method).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1415 * @return 0 if forbidden access, 1 if allowed access, -1 if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1416 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1417 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1418 typedef int32_t (*OrthancPluginIncomingHttpRequestFilter2) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1419 OrthancPluginHttpMethod method,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1420 const char* uri,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1421 const char* ip,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1422 uint32_t headersCount,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1423 const char* const* headersKeys,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1424 const char* const* headersValues,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1425 uint32_t getArgumentsCount,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1426 const char* const* getArgumentsKeys,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1427 const char* const* getArgumentsValues);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1428
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1429
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1430
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1431 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1432 * @brief Callback to handle incoming C-Find SCP requests.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1433 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1434 * Signature of a callback function that is triggered whenever
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1435 * Orthanc receives a C-Find SCP request not concerning modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1436 * worklists.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1437 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1438 * @param answers The target structure where answers must be stored.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1439 * @param query The worklist query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1440 * @param issuerAet The Application Entity Title (AET) of the modality from which the request originates.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1441 * @param calledAet The Application Entity Title (AET) of the modality that is called by the request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1442 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1443 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1444 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1445 typedef OrthancPluginErrorCode (*OrthancPluginFindCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1446 OrthancPluginFindAnswers* answers,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1447 const OrthancPluginFindQuery* query,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1448 const char* issuerAet,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1449 const char* calledAet);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1450
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1451
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1452
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1453 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1454 * @brief Callback to handle incoming C-Move SCP requests.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1455 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1456 * Signature of a callback function that is triggered whenever
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1457 * Orthanc receives a C-Move SCP request. The callback receives the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1458 * type of the resource of interest (study, series, instance...)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1459 * together with the DICOM tags containing its identifiers. In turn,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1460 * the plugin must create a driver object that will be responsible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1461 * for driving the successive move suboperations.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1462 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1463 * @param resourceType The type of the resource of interest. Note
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1464 * that this might be set to ResourceType_None if the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1465 * QueryRetrieveLevel (0008,0052) tag was not provided by the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1466 * issuer (i.e. the originator modality).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1467 * @param patientId Content of the PatientID (0x0010, 0x0020) tag of the resource of interest. Might be NULL.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1468 * @param accessionNumber Content of the AccessionNumber (0x0008, 0x0050) tag. Might be NULL.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1469 * @param studyInstanceUid Content of the StudyInstanceUID (0x0020, 0x000d) tag. Might be NULL.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1470 * @param seriesInstanceUid Content of the SeriesInstanceUID (0x0020, 0x000e) tag. Might be NULL.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1471 * @param sopInstanceUid Content of the SOPInstanceUID (0x0008, 0x0018) tag. Might be NULL.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1472 * @param originatorAet The Application Entity Title (AET) of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1473 * modality from which the request originates.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1474 * @param sourceAet The Application Entity Title (AET) of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1475 * modality that should send its DICOM files to another modality.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1476 * @param targetAet The Application Entity Title (AET) of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1477 * modality that should receive the DICOM files.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1478 * @param originatorId The Message ID issued by the originator modality,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1479 * as found in tag (0000,0110) of the DICOM query emitted by the issuer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1480 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1481 * @return The NULL value if the plugin cannot deal with this query,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1482 * or a pointer to the driver object that is responsible for
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1483 * handling the successive move suboperations.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1484 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1485 * @note If targetAet equals sourceAet, this is actually a query/retrieve operation.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1486 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1487 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1488 typedef void* (*OrthancPluginMoveCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1489 OrthancPluginResourceType resourceType,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1490 const char* patientId,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1491 const char* accessionNumber,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1492 const char* studyInstanceUid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1493 const char* seriesInstanceUid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1494 const char* sopInstanceUid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1495 const char* originatorAet,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1496 const char* sourceAet,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1497 const char* targetAet,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1498 uint16_t originatorId);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1499
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1500
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1501 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1502 * @brief Callback to read the size of a C-Move driver.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1503 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1504 * Signature of a callback function that returns the number of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1505 * C-Move suboperations that are to be achieved by the given C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1506 * driver. This driver is the return value of a previous call to the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1507 * OrthancPluginMoveCallback() callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1508 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1509 * @param moveDriver The C-Move driver of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1510 * @return The number of suboperations.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1511 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1512 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1513 typedef uint32_t (*OrthancPluginGetMoveSize) (void* moveDriver);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1514
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1515
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1516 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1517 * @brief Callback to apply one C-Move suboperation.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1518 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1519 * Signature of a callback function that applies the next C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1520 * suboperation that os to be achieved by the given C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1521 * driver. This driver is the return value of a previous call to the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1522 * OrthancPluginMoveCallback() callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1523 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1524 * @param moveDriver The C-Move driver of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1525 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1526 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1527 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1528 typedef OrthancPluginErrorCode (*OrthancPluginApplyMove) (void* moveDriver);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1529
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1530
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1531 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1532 * @brief Callback to free one C-Move driver.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1533 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1534 * Signature of a callback function that releases the resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1535 * allocated by the given C-Move driver. This driver is the return
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1536 * value of a previous call to the OrthancPluginMoveCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1537 * callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1538 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1539 * @param moveDriver The C-Move driver of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1540 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1541 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1542 typedef void (*OrthancPluginFreeMove) (void* moveDriver);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1543
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1544
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1545 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1546 * @brief Callback to finalize one custom job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1547 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1548 * Signature of a callback function that releases all the resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1549 * allocated by the given job. This job is the argument provided to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1550 * OrthancPluginCreateJob().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1551 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1552 * @param job The job of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1553 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1554 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1555 typedef void (*OrthancPluginJobFinalize) (void* job);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1556
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1557
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1558 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1559 * @brief Callback to check the progress of one custom job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1560 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1561 * Signature of a callback function that returns the progress of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1562 * job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1563 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1564 * @param job The job of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1565 * @return The progress, as a floating-point number ranging from 0 to 1.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1566 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1567 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1568 typedef float (*OrthancPluginJobGetProgress) (void* job);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1569
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1570
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1571 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1572 * @brief Callback to retrieve the content of one custom job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1573 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1574 * Signature of a callback function that returns human-readable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1575 * statistics about the job. This statistics must be formatted as a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1576 * JSON object. This information is notably displayed in the "Jobs"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1577 * tab of "Orthanc Explorer".
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1578 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1579 * @param job The job of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1580 * @return The statistics, as a JSON object encoded as a string.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1581 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1582 * @deprecated This signature should not be used anymore since Orthanc SDK 1.11.3.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1583 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1584 typedef const char* (*OrthancPluginJobGetContent) (void* job);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1585
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1586
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1587 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1588 * @brief Callback to retrieve the content of one custom job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1589 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1590 * Signature of a callback function that returns human-readable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1591 * statistics about the job. This statistics must be formatted as a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1592 * JSON object. This information is notably displayed in the "Jobs"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1593 * tab of "Orthanc Explorer".
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1594 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1595 * @param target The target memory buffer where to store the JSON string.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1596 * This buffer must be allocated using OrthancPluginCreateMemoryBuffer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1597 * and will be freed by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1598 * @param job The job of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1599 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1600 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1601 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1602 typedef OrthancPluginErrorCode (*OrthancPluginJobGetContent2) (OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1603 void* job);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1604
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1605
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1606 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1607 * @brief Callback to serialize one custom job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1608 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1609 * Signature of a callback function that returns a serialized
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1610 * version of the job, formatted as a JSON object. This
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1611 * serialization is stored in the Orthanc database, and is used to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1612 * reload the job on the restart of Orthanc. The "unserialization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1613 * callback (with OrthancPluginJobsUnserializer signature) will
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1614 * receive this serialized object.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1615 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1616 * @param job The job of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1617 * @return The serialized job, as a JSON object encoded as a string.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1618 * @see OrthancPluginRegisterJobsUnserializer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1619 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1620 * @deprecated This signature should not be used anymore since Orthanc SDK 1.11.3.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1621 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1622 typedef const char* (*OrthancPluginJobGetSerialized) (void* job);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1623
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1624
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1625 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1626 * @brief Callback to serialize one custom job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1627 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1628 * Signature of a callback function that returns a serialized
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1629 * version of the job, formatted as a JSON object. This
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1630 * serialization is stored in the Orthanc database, and is used to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1631 * reload the job on the restart of Orthanc. The "unserialization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1632 * callback (with OrthancPluginJobsUnserializer signature) will
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1633 * receive this serialized object.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1634 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1635 * @param target The target memory buffer where to store the JSON string.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1636 * This buffer must be allocated using OrthancPluginCreateMemoryBuffer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1637 * and will be freed by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1638 * @param job The job of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1639 * @return 1 if the serialization has succeeded, 0 if serialization is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1640 * not implemented for this type of job, or -1 in case of error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1641 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1642 typedef int32_t (*OrthancPluginJobGetSerialized2) (OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1643 void* job);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1644
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1645
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1646 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1647 * @brief Callback to execute one step of a custom job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1648 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1649 * Signature of a callback function that executes one step in the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1650 * job. The jobs engine of Orthanc will make successive calls to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1651 * this method, as long as it returns
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1652 * OrthancPluginJobStepStatus_Continue.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1653 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1654 * @param job The job of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1655 * @return The status of execution.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1656 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1657 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1658 typedef OrthancPluginJobStepStatus (*OrthancPluginJobStep) (void* job);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1659
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1660
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1661 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1662 * @brief Callback executed once one custom job leaves the "running" state.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1663 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1664 * Signature of a callback function that is invoked once a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1665 * leaves the "running" state. This can happen if the previous call
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1666 * to OrthancPluginJobStep has failed/succeeded, if the host Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1667 * server is being stopped, or if the user manually tags the job as
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1668 * paused/canceled. This callback allows the plugin to free
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1669 * resources allocated for running this custom job (e.g. to stop
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1670 * threads, or to remove temporary files).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1671 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1672 * Note that handling pauses might involves a specific treatment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1673 * (such a stopping threads, but keeping temporary files on the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1674 * disk). This "paused" situation can be checked by looking at the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1675 * "reason" parameter.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1676 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1677 * @param job The job of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1678 * @param reason The reason for leaving the "running" state.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1679 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1680 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1681 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1682 typedef OrthancPluginErrorCode (*OrthancPluginJobStop) (void* job,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1683 OrthancPluginJobStopReason reason);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1684
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1685
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1686 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1687 * @brief Callback executed once one stopped custom job is started again.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1688 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1689 * Signature of a callback function that is invoked once a job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1690 * leaves the "failure/canceled" state, to be started again. This
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1691 * function will typically reset the progress to zero. Note that
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1692 * before being actually executed, the job would first be tagged as
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1693 * "pending" in the Orthanc jobs engine.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1694 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1695 * @param job The job of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1696 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1697 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1698 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1699 typedef OrthancPluginErrorCode (*OrthancPluginJobReset) (void* job);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1700
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1701
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1702 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1703 * @brief Callback executed to unserialize a custom job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1704 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1705 * Signature of a callback function that unserializes a job that was
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1706 * saved in the Orthanc database.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1707 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1708 * @param jobType The type of the job, as provided to OrthancPluginCreateJob().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1709 * @param serialized The serialization of the job, as provided by OrthancPluginJobGetSerialized.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1710 * @return The unserialized job (as created by OrthancPluginCreateJob()), or NULL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1711 * if this unserializer cannot handle this job type.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1712 * @see OrthancPluginRegisterJobsUnserializer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1713 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1714 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1715 typedef OrthancPluginJob* (*OrthancPluginJobsUnserializer) (const char* jobType,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1716 const char* serialized);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1717
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1718
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1719
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1720 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1721 * @brief Callback executed to update the metrics of the plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1722 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1723 * Signature of a callback function that is called by Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1724 * whenever a monitoring tool (such as Prometheus) asks the current
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1725 * values of the metrics. This callback gives the plugin a chance to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1726 * update its metrics, by calling OrthancPluginSetMetricsValue().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1727 * This is typically useful for metrics that are expensive to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1728 * acquire.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1729 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1730 * @see OrthancPluginRegisterRefreshMetrics()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1731 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1732 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1733 typedef void (*OrthancPluginRefreshMetricsCallback) ();
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1734
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1735
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1736
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1737 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1738 * @brief Callback executed to encode a binary tag in DICOMweb.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1739 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1740 * Signature of a callback function that is called by Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1741 * whenever a DICOM tag that contains a binary value must be written
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1742 * to a JSON or XML node, while a DICOMweb document is being
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1743 * generated. The value representation (VR) of the DICOM tag can be
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1744 * OB, OD, OF, OL, OW, or UN.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1745 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1746 * @see OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1747 * @param node The node being generated, as provided by Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1748 * @param setter The setter to be used to encode the content of the node. If
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1749 * the setter is not called, the binary tag is not written to the output document.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1750 * @param levelDepth The depth of the node in the DICOM hierarchy of sequences.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1751 * This parameter gives the number of elements in the "levelTagGroup",
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1752 * "levelTagElement", and "levelIndex" arrays.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1753 * @param levelTagGroup The group of the parent DICOM tags in the hierarchy.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1754 * @param levelTagElement The element of the parent DICOM tags in the hierarchy.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1755 * @param levelIndex The index of the node in the parent sequences of the hierarchy.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1756 * @param tagGroup The group of the DICOM tag of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1757 * @param tagElement The element of the DICOM tag of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1758 * @param vr The value representation of the binary DICOM node.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1759 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1760 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1761 typedef void (*OrthancPluginDicomWebBinaryCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1762 OrthancPluginDicomWebNode* node,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1763 OrthancPluginDicomWebSetBinaryNode setter,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1764 uint32_t levelDepth,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1765 const uint16_t* levelTagGroup,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1766 const uint16_t* levelTagElement,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1767 const uint32_t* levelIndex,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1768 uint16_t tagGroup,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1769 uint16_t tagElement,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1770 OrthancPluginValueRepresentation vr);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1771
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1772
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1773
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1774 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1775 * @brief Callback executed to encode a binary tag in DICOMweb.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1776 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1777 * Signature of a callback function that is called by Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1778 * whenever a DICOM tag that contains a binary value must be written
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1779 * to a JSON or XML node, while a DICOMweb document is being
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1780 * generated. The value representation (VR) of the DICOM tag can be
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1781 * OB, OD, OF, OL, OW, or UN.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1782 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1783 * @see OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1784 * @param node The node being generated, as provided by Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1785 * @param setter The setter to be used to encode the content of the node. If
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1786 * the setter is not called, the binary tag is not written to the output document.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1787 * @param levelDepth The depth of the node in the DICOM hierarchy of sequences.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1788 * This parameter gives the number of elements in the "levelTagGroup",
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1789 * "levelTagElement", and "levelIndex" arrays.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1790 * @param levelTagGroup The group of the parent DICOM tags in the hierarchy.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1791 * @param levelTagElement The element of the parent DICOM tags in the hierarchy.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1792 * @param levelIndex The index of the node in the parent sequences of the hierarchy.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1793 * @param tagGroup The group of the DICOM tag of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1794 * @param tagElement The element of the DICOM tag of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1795 * @param vr The value representation of the binary DICOM node.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1796 * @param payload The user payload.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1797 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1798 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1799 typedef void (*OrthancPluginDicomWebBinaryCallback2) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1800 OrthancPluginDicomWebNode* node,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1801 OrthancPluginDicomWebSetBinaryNode setter,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1802 uint32_t levelDepth,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1803 const uint16_t* levelTagGroup,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1804 const uint16_t* levelTagElement,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1805 const uint32_t* levelIndex,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1806 uint16_t tagGroup,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1807 uint16_t tagElement,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1808 OrthancPluginValueRepresentation vr,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1809 void* payload);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1810
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1811
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1812
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1813 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1814 * @brief Data structure that contains information about the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1815 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1816 typedef struct _OrthancPluginContext_t
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1817 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1818 void* pluginsManager;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1819 const char* orthancVersion;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1820 OrthancPluginFree Free;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1821 OrthancPluginErrorCode (*InvokeService) (struct _OrthancPluginContext_t* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1822 _OrthancPluginService service,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1823 const void* params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1824 } OrthancPluginContext;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1825
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1826
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1827
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1828 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1829 * @brief An entry in the dictionary of DICOM tags.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1830 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1831 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1832 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1833 uint16_t group; /*!< The group of the tag */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1834 uint16_t element; /*!< The element of the tag */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1835 OrthancPluginValueRepresentation vr; /*!< The value representation of the tag */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1836 uint32_t minMultiplicity; /*!< The minimum multiplicity of the tag */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1837 uint32_t maxMultiplicity; /*!< The maximum multiplicity of the tag (0 means arbitrary) */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1838 } OrthancPluginDictionaryEntry;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1839
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1840
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1841
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1842 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1843 * @brief Free a string.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1844 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1845 * Free a string that was allocated by the core system of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1846 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1847 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1848 * @param str The string to be freed.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1849 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1850 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeString(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1851 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1852 char* str)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1853 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1854 if (str != NULL)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1855 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1856 context->Free(str);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1857 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1858 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1859
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1860
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1861 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1862 * @brief Check that the version of the hosting Orthanc is above a given version.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1863 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1864 * This function checks whether the version of the Orthanc server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1865 * running this plugin, is above the given version. Contrarily to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1866 * OrthancPluginCheckVersion(), it is up to the developer of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1867 * plugin to make sure that all the Orthanc SDK services called by
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1868 * the plugin are actually implemented in the given version of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1869 * Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1870 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1871 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1872 * @param expectedMajor Expected major version.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1873 * @param expectedMinor Expected minor version.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1874 * @param expectedRevision Expected revision.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1875 * @return 1 if and only if the versions are compatible. If the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1876 * result is 0, the initialization of the plugin should fail.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1877 * @see OrthancPluginCheckVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1878 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1879 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1880 ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersionAdvanced(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1881 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1882 int expectedMajor,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1883 int expectedMinor,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1884 int expectedRevision)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1885 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1886 int major, minor, revision;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1887
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1888 if (sizeof(int32_t) != sizeof(OrthancPluginErrorCode) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1889 sizeof(int32_t) != sizeof(OrthancPluginHttpMethod) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1890 sizeof(int32_t) != sizeof(_OrthancPluginService) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1891 sizeof(int32_t) != sizeof(_OrthancPluginProperty) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1892 sizeof(int32_t) != sizeof(OrthancPluginPixelFormat) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1893 sizeof(int32_t) != sizeof(OrthancPluginContentType) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1894 sizeof(int32_t) != sizeof(OrthancPluginResourceType) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1895 sizeof(int32_t) != sizeof(OrthancPluginChangeType) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1896 sizeof(int32_t) != sizeof(OrthancPluginCompressionType) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1897 sizeof(int32_t) != sizeof(OrthancPluginImageFormat) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1898 sizeof(int32_t) != sizeof(OrthancPluginValueRepresentation) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1899 sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFormat) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1900 sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFlags) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1901 sizeof(int32_t) != sizeof(OrthancPluginCreateDicomFlags) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1902 sizeof(int32_t) != sizeof(OrthancPluginIdentifierConstraint) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1903 sizeof(int32_t) != sizeof(OrthancPluginInstanceOrigin) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1904 sizeof(int32_t) != sizeof(OrthancPluginJobStepStatus) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1905 sizeof(int32_t) != sizeof(OrthancPluginConstraintType) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1906 sizeof(int32_t) != sizeof(OrthancPluginMetricsType) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1907 sizeof(int32_t) != sizeof(OrthancPluginDicomWebBinaryMode) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1908 sizeof(int32_t) != sizeof(OrthancPluginStorageCommitmentFailureReason) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1909 sizeof(int32_t) != sizeof(OrthancPluginReceivedInstanceAction))
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1910 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1911 /* Mismatch in the size of the enumerations */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1912 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1913 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1914
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1915 /* Assume compatibility with the mainline */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1916 if (!strcmp(context->orthancVersion, "mainline"))
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1917 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1918 return 1;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1919 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1920
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1921 /* Parse the version of the Orthanc core */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1922 if (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1923 #ifdef _MSC_VER
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1924 sscanf_s
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1925 #else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1926 sscanf
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1927 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1928 (context->orthancVersion, "%4d.%4d.%4d", &major, &minor, &revision) != 3)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1929 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1930 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1931 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1932
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1933 /* Check the major number of the version */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1934
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1935 if (major > expectedMajor)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1936 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1937 return 1;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1938 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1939
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1940 if (major < expectedMajor)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1941 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1942 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1943 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1944
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1945 /* Check the minor number of the version */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1946
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1947 if (minor > expectedMinor)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1948 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1949 return 1;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1950 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1951
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1952 if (minor < expectedMinor)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1953 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1954 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1955 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1956
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1957 /* Check the revision number of the version */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1958
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1959 if (revision >= expectedRevision)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1960 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1961 return 1;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1962 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1963 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1964 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1965 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1966 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1967 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1968
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1969
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1970 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1971 * @brief Check the compatibility of the plugin wrt. the version of its hosting Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1972 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1973 * This function checks whether the version of the Orthanc server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1974 * running this plugin, is above the version of the current Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1975 * SDK header. This guarantees that the plugin is compatible with
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1976 * the hosting Orthanc (i.e. it will not call unavailable services).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1977 * The result of this function should always be checked in the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1978 * OrthancPluginInitialize() entry point of the plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1979 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1980 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1981 * @return 1 if and only if the versions are compatible. If the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1982 * result is 0, the initialization of the plugin should fail.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1983 * @see OrthancPluginCheckVersionAdvanced
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1984 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1985 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1986 ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersion(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1987 OrthancPluginContext* context)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1988 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1989 return OrthancPluginCheckVersionAdvanced(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1990 context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1991 ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1992 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1993 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1994 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1995
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1996
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1997 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1998 * @brief Free a memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1999 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2000 * Free a memory buffer that was allocated by the core system of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2001 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2002 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2003 * @param buffer The memory buffer to release.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2004 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2005 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeMemoryBuffer(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2006 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2007 OrthancPluginMemoryBuffer* buffer)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2008 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2009 context->Free(buffer->data);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2010 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2011
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2012
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2013 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2014 * @brief Free a memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2015 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2016 * Free a memory buffer that was allocated by the core system of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2017 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2018 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2019 * @param buffer The memory buffer to release.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2020 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2021 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeMemoryBuffer64(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2022 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2023 OrthancPluginMemoryBuffer64* buffer)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2024 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2025 context->Free(buffer->data);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2026 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2027
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2028
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2029 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2030 * @brief Log an error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2031 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2032 * Log an error message using the Orthanc logging system.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2033 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2034 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2035 * @param message The message to be logged.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2036 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2037 ORTHANC_PLUGIN_INLINE void OrthancPluginLogError(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2038 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2039 const char* message)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2040 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2041 context->InvokeService(context, _OrthancPluginService_LogError, message);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2042 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2043
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2044
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2045 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2046 * @brief Log a warning.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2047 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2048 * Log a warning message using the Orthanc logging system.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2049 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2050 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2051 * @param message The message to be logged.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2052 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2053 ORTHANC_PLUGIN_INLINE void OrthancPluginLogWarning(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2054 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2055 const char* message)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2056 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2057 context->InvokeService(context, _OrthancPluginService_LogWarning, message);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2058 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2059
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2060
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2061 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2062 * @brief Log an information.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2063 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2064 * Log an information message using the Orthanc logging system.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2065 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2066 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2067 * @param message The message to be logged.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2068 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2069 ORTHANC_PLUGIN_INLINE void OrthancPluginLogInfo(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2070 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2071 const char* message)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2072 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2073 context->InvokeService(context, _OrthancPluginService_LogInfo, message);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2074 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2075
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2076
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2077
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2078 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2079 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2080 const char* pathRegularExpression;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2081 OrthancPluginRestCallback callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2082 } _OrthancPluginRestCallback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2083
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2084 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2085 * @brief Register a REST callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2086 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2087 * This function registers a REST callback against a regular
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2088 * expression for a URI. This function must be called during the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2089 * initialization of the plugin, i.e. inside the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2090 * OrthancPluginInitialize() public function.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2091 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2092 * Each REST callback is guaranteed to run in mutual exclusion.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2093 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2094 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2095 * @param pathRegularExpression Regular expression for the URI. May contain groups.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2096 * @param callback The callback function to handle the REST call.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2097 * @see OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2098 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2099 * @note
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2100 * The regular expression is case sensitive and must follow the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2101 * [Perl syntax](https://www.boost.org/doc/libs/1_67_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2102 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2103 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2104 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2105 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallback(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2106 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2107 const char* pathRegularExpression,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2108 OrthancPluginRestCallback callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2109 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2110 _OrthancPluginRestCallback params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2111 params.pathRegularExpression = pathRegularExpression;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2112 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2113 context->InvokeService(context, _OrthancPluginService_RegisterRestCallback, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2114 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2115
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2116
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2117
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2118 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2119 * @brief Register a REST callback, without locking.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2120 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2121 * This function registers a REST callback against a regular
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2122 * expression for a URI. This function must be called during the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2123 * initialization of the plugin, i.e. inside the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2124 * OrthancPluginInitialize() public function.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2125 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2126 * Contrarily to OrthancPluginRegisterRestCallback(), the callback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2127 * will NOT be invoked in mutual exclusion. This can be useful for
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2128 * high-performance plugins that must handle concurrent requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2129 * (Orthanc uses a pool of threads, one thread being assigned to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2130 * each incoming HTTP request). Of course, if using this function,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2131 * it is up to the plugin to implement the required locking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2132 * mechanisms.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2133 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2134 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2135 * @param pathRegularExpression Regular expression for the URI. May contain groups.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2136 * @param callback The callback function to handle the REST call.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2137 * @see OrthancPluginRegisterRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2138 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2139 * @note
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2140 * The regular expression is case sensitive and must follow the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2141 * [Perl syntax](https://www.boost.org/doc/libs/1_67_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2142 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2143 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2144 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2145 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallbackNoLock(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2146 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2147 const char* pathRegularExpression,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2148 OrthancPluginRestCallback callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2149 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2150 _OrthancPluginRestCallback params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2151 params.pathRegularExpression = pathRegularExpression;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2152 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2153 context->InvokeService(context, _OrthancPluginService_RegisterRestCallbackNoLock, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2154 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2155
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2156
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2157
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2158 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2159 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2160 OrthancPluginOnStoredInstanceCallback callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2161 } _OrthancPluginOnStoredInstanceCallback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2162
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2163 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2164 * @brief Register a callback for received instances.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2165 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2166 * This function registers a callback function that is called
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2167 * whenever a new DICOM instance is stored into the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2168 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2169 * @warning Your callback function will be called synchronously with
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2170 * the core of Orthanc. This implies that deadlocks might emerge if
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2171 * you call other core primitives of Orthanc in your callback (such
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2172 * deadlocks are particularly visible in the presence of other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2173 * or Lua scripts). It is thus strongly advised to avoid any call to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2174 * the REST API of Orthanc in the callback. If you have to call
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2175 * other primitives of Orthanc, you should make these calls in a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2176 * separate thread, passing the pending events to be processed
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2177 * through a message queue.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2178 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2179 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2180 * @param callback The callback function.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2181 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2182 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2183 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnStoredInstanceCallback(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2184 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2185 OrthancPluginOnStoredInstanceCallback callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2186 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2187 _OrthancPluginOnStoredInstanceCallback params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2188 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2189
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2190 context->InvokeService(context, _OrthancPluginService_RegisterOnStoredInstanceCallback, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2191 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2192
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2193
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2194
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2195 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2196 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2197 OrthancPluginRestOutput* output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2198 const void* answer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2199 uint32_t answerSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2200 const char* mimeType;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2201 } _OrthancPluginAnswerBuffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2202
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2203 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2204 * @brief Answer to a REST request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2205 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2206 * This function answers to a REST request with the content of a memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2207 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2208 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2209 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2210 * @param answer Pointer to the memory buffer containing the answer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2211 * @param answerSize Number of bytes of the answer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2212 * @param mimeType The MIME type of the answer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2213 * @ingroup REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2214 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2215 ORTHANC_PLUGIN_INLINE void OrthancPluginAnswerBuffer(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2216 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2217 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2218 const void* answer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2219 uint32_t answerSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2220 const char* mimeType)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2221 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2222 _OrthancPluginAnswerBuffer params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2223 params.output = output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2224 params.answer = answer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2225 params.answerSize = answerSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2226 params.mimeType = mimeType;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2227 context->InvokeService(context, _OrthancPluginService_AnswerBuffer, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2228 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2229
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2230
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2231 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2232 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2233 OrthancPluginRestOutput* output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2234 OrthancPluginPixelFormat format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2235 uint32_t width;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2236 uint32_t height;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2237 uint32_t pitch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2238 const void* buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2239 } _OrthancPluginCompressAndAnswerPngImage;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2240
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2241 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2242 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2243 OrthancPluginRestOutput* output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2244 OrthancPluginImageFormat imageFormat;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2245 OrthancPluginPixelFormat pixelFormat;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2246 uint32_t width;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2247 uint32_t height;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2248 uint32_t pitch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2249 const void* buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2250 uint8_t quality;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2251 } _OrthancPluginCompressAndAnswerImage;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2252
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2253
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2254 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2255 * @brief Answer to a REST request with a PNG image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2256 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2257 * This function answers to a REST request with a PNG image. The
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2258 * parameters of this function describe a memory buffer that
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2259 * contains an uncompressed image. The image will be automatically compressed
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2260 * as a PNG image by the core system of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2261 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2262 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2263 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2264 * @param format The memory layout of the uncompressed image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2265 * @param width The width of the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2266 * @param height The height of the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2267 * @param pitch The pitch of the image (i.e. the number of bytes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2268 * between 2 successive lines of the image in the memory buffer).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2269 * @param buffer The memory buffer containing the uncompressed image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2270 * @ingroup REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2271 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2272 ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerPngImage(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2273 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2274 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2275 OrthancPluginPixelFormat format,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2276 uint32_t width,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2277 uint32_t height,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2278 uint32_t pitch,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2279 const void* buffer)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2280 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2281 _OrthancPluginCompressAndAnswerImage params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2282 params.output = output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2283 params.imageFormat = OrthancPluginImageFormat_Png;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2284 params.pixelFormat = format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2285 params.width = width;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2286 params.height = height;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2287 params.pitch = pitch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2288 params.buffer = buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2289 params.quality = 0; /* No quality for PNG */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2290 context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2291 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2292
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2293
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2294
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2295 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2296 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2297 OrthancPluginMemoryBuffer* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2298 const char* instanceId;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2299 } _OrthancPluginGetDicomForInstance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2300
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2301 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2302 * @brief Retrieve a DICOM instance using its Orthanc identifier.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2303 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2304 * Retrieve a DICOM instance using its Orthanc identifier. The DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2305 * file is stored into a newly allocated memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2306 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2307 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2308 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2309 * @param instanceId The Orthanc identifier of the DICOM instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2310 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2311 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2312 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2313 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginGetDicomForInstance(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2314 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2315 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2316 const char* instanceId)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2317 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2318 _OrthancPluginGetDicomForInstance params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2319 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2320 params.instanceId = instanceId;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2321 return context->InvokeService(context, _OrthancPluginService_GetDicomForInstance, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2322 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2323
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2324
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2325
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2326 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2327 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2328 OrthancPluginMemoryBuffer* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2329 const char* uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2330 } _OrthancPluginRestApiGet;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2331
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2332 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2333 * @brief Make a GET call to the built-in Orthanc REST API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2334 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2335 * Make a GET call to the built-in Orthanc REST API. The result to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2336 * the query is stored into a newly allocated memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2337 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2338 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2339 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2340 * @param uri The URI in the built-in Orthanc API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2341 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2342 * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2343 * @see OrthancPluginRestApiGetAfterPlugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2344 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2345 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2346 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiGet(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2347 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2348 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2349 const char* uri)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2350 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2351 _OrthancPluginRestApiGet params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2352 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2353 params.uri = uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2354 return context->InvokeService(context, _OrthancPluginService_RestApiGet, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2355 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2356
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2357
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2358
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2359 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2360 * @brief Make a GET call to the REST API, as tainted by the plugins.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2361 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2362 * Make a GET call to the Orthanc REST API, after all the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2363 * are applied. In other words, if some plugin overrides or adds the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2364 * called URI to the built-in Orthanc REST API, this call will
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2365 * return the result provided by this plugin. The result to the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2366 * query is stored into a newly allocated memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2367 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2368 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2369 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2370 * @param uri The URI in the built-in Orthanc API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2371 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2372 * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2373 * @see OrthancPluginRestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2374 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2375 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2376 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiGetAfterPlugins(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2377 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2378 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2379 const char* uri)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2380 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2381 _OrthancPluginRestApiGet params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2382 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2383 params.uri = uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2384 return context->InvokeService(context, _OrthancPluginService_RestApiGetAfterPlugins, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2385 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2386
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2387
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2388
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2389 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2390 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2391 OrthancPluginMemoryBuffer* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2392 const char* uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2393 const void* body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2394 uint32_t bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2395 } _OrthancPluginRestApiPostPut;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2396
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2397 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2398 * @brief Make a POST call to the built-in Orthanc REST API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2399 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2400 * Make a POST call to the built-in Orthanc REST API. The result to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2401 * the query is stored into a newly allocated memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2402 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2403 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2404 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2405 * @param uri The URI in the built-in Orthanc API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2406 * @param body The body of the POST request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2407 * @param bodySize The size of the body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2408 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2409 * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2410 * @see OrthancPluginRestApiPostAfterPlugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2411 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2412 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2413 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPost(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2414 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2415 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2416 const char* uri,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2417 const void* body,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2418 uint32_t bodySize)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2419 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2420 _OrthancPluginRestApiPostPut params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2421 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2422 params.uri = uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2423 params.body = body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2424 params.bodySize = bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2425 return context->InvokeService(context, _OrthancPluginService_RestApiPost, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2426 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2427
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2428
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2429 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2430 * @brief Make a POST call to the REST API, as tainted by the plugins.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2431 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2432 * Make a POST call to the Orthanc REST API, after all the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2433 * are applied. In other words, if some plugin overrides or adds the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2434 * called URI to the built-in Orthanc REST API, this call will
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2435 * return the result provided by this plugin. The result to the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2436 * query is stored into a newly allocated memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2437 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2438 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2439 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2440 * @param uri The URI in the built-in Orthanc API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2441 * @param body The body of the POST request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2442 * @param bodySize The size of the body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2443 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2444 * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2445 * @see OrthancPluginRestApiPost
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2446 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2447 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2448 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPostAfterPlugins(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2449 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2450 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2451 const char* uri,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2452 const void* body,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2453 uint32_t bodySize)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2454 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2455 _OrthancPluginRestApiPostPut params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2456 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2457 params.uri = uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2458 params.body = body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2459 params.bodySize = bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2460 return context->InvokeService(context, _OrthancPluginService_RestApiPostAfterPlugins, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2461 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2462
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2463
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2464
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2465 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2466 * @brief Make a DELETE call to the built-in Orthanc REST API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2467 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2468 * Make a DELETE call to the built-in Orthanc REST API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2469 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2470 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2471 * @param uri The URI to delete in the built-in Orthanc API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2472 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2473 * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2474 * @see OrthancPluginRestApiDeleteAfterPlugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2475 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2476 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2477 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiDelete(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2478 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2479 const char* uri)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2480 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2481 return context->InvokeService(context, _OrthancPluginService_RestApiDelete, uri);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2482 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2483
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2484
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2485 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2486 * @brief Make a DELETE call to the REST API, as tainted by the plugins.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2487 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2488 * Make a DELETE call to the Orthanc REST API, after all the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2489 * are applied. In other words, if some plugin overrides or adds the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2490 * called URI to the built-in Orthanc REST API, this call will
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2491 * return the result provided by this plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2492 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2493 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2494 * @param uri The URI to delete in the built-in Orthanc API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2495 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2496 * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2497 * @see OrthancPluginRestApiDelete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2498 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2499 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2500 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiDeleteAfterPlugins(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2501 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2502 const char* uri)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2503 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2504 return context->InvokeService(context, _OrthancPluginService_RestApiDeleteAfterPlugins, uri);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2505 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2506
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2507
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2508
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2509 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2510 * @brief Make a PUT call to the built-in Orthanc REST API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2511 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2512 * Make a PUT call to the built-in Orthanc REST API. The result to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2513 * the query is stored into a newly allocated memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2514 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2515 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2516 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2517 * @param uri The URI in the built-in Orthanc API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2518 * @param body The body of the PUT request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2519 * @param bodySize The size of the body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2520 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2521 * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2522 * @see OrthancPluginRestApiPutAfterPlugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2523 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2524 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2525 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPut(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2526 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2527 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2528 const char* uri,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2529 const void* body,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2530 uint32_t bodySize)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2531 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2532 _OrthancPluginRestApiPostPut params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2533 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2534 params.uri = uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2535 params.body = body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2536 params.bodySize = bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2537 return context->InvokeService(context, _OrthancPluginService_RestApiPut, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2538 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2539
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2540
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2541
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2542 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2543 * @brief Make a PUT call to the REST API, as tainted by the plugins.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2544 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2545 * Make a PUT call to the Orthanc REST API, after all the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2546 * are applied. In other words, if some plugin overrides or adds the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2547 * called URI to the built-in Orthanc REST API, this call will
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2548 * return the result provided by this plugin. The result to the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2549 * query is stored into a newly allocated memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2550 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2551 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2552 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2553 * @param uri The URI in the built-in Orthanc API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2554 * @param body The body of the PUT request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2555 * @param bodySize The size of the body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2556 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2557 * @note If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2558 * @see OrthancPluginRestApiPut
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2559 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2560 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2561 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPutAfterPlugins(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2562 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2563 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2564 const char* uri,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2565 const void* body,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2566 uint32_t bodySize)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2567 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2568 _OrthancPluginRestApiPostPut params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2569 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2570 params.uri = uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2571 params.body = body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2572 params.bodySize = bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2573 return context->InvokeService(context, _OrthancPluginService_RestApiPutAfterPlugins, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2574 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2575
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2576
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2577
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2578 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2579 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2580 OrthancPluginRestOutput* output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2581 const char* argument;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2582 } _OrthancPluginOutputPlusArgument;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2583
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2584 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2585 * @brief Redirect a REST request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2586 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2587 * This function answers to a REST request by redirecting the user
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2588 * to another URI using HTTP status 301.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2589 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2590 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2591 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2592 * @param redirection Where to redirect.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2593 * @ingroup REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2594 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2595 ORTHANC_PLUGIN_INLINE void OrthancPluginRedirect(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2596 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2597 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2598 const char* redirection)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2599 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2600 _OrthancPluginOutputPlusArgument params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2601 params.output = output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2602 params.argument = redirection;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2603 context->InvokeService(context, _OrthancPluginService_Redirect, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2604 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2605
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2606
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2607
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2608 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2609 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2610 char** result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2611 const char* argument;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2612 } _OrthancPluginRetrieveDynamicString;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2613
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2614 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2615 * @brief Look for a patient.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2616 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2617 * Look for a patient stored in Orthanc, using its Patient ID tag (0x0010, 0x0020).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2618 * This function uses the database index to run as fast as possible (it does not loop
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2619 * over all the stored patients).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2620 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2621 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2622 * @param patientID The Patient ID of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2623 * @return The NULL value if the patient is non-existent, or a string containing the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2624 * Orthanc ID of the patient. This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2625 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2626 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2627 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupPatient(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2628 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2629 const char* patientID)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2630 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2631 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2632
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2633 _OrthancPluginRetrieveDynamicString params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2634 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2635 params.argument = patientID;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2636
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2637 if (context->InvokeService(context, _OrthancPluginService_LookupPatient, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2638 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2639 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2640 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2641 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2642 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2643 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2644 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2645 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2646 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2647
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2648
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2649 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2650 * @brief Look for a study.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2651 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2652 * Look for a study stored in Orthanc, using its Study Instance UID tag (0x0020, 0x000d).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2653 * This function uses the database index to run as fast as possible (it does not loop
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2654 * over all the stored studies).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2655 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2656 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2657 * @param studyUID The Study Instance UID of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2658 * @return The NULL value if the study is non-existent, or a string containing the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2659 * Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2660 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2661 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2662 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudy(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2663 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2664 const char* studyUID)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2665 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2666 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2667
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2668 _OrthancPluginRetrieveDynamicString params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2669 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2670 params.argument = studyUID;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2671
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2672 if (context->InvokeService(context, _OrthancPluginService_LookupStudy, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2673 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2674 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2675 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2676 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2677 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2678 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2679 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2680 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2681 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2682
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2683
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2684 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2685 * @brief Look for a study, using the accession number.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2686 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2687 * Look for a study stored in Orthanc, using its Accession Number tag (0x0008, 0x0050).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2688 * This function uses the database index to run as fast as possible (it does not loop
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2689 * over all the stored studies).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2690 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2691 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2692 * @param accessionNumber The Accession Number of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2693 * @return The NULL value if the study is non-existent, or a string containing the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2694 * Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2695 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2696 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2697 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudyWithAccessionNumber(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2698 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2699 const char* accessionNumber)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2700 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2701 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2702
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2703 _OrthancPluginRetrieveDynamicString params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2704 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2705 params.argument = accessionNumber;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2706
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2707 if (context->InvokeService(context, _OrthancPluginService_LookupStudyWithAccessionNumber, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2708 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2709 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2710 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2711 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2712 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2713 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2714 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2715 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2716 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2717
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2718
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2719 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2720 * @brief Look for a series.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2721 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2722 * Look for a series stored in Orthanc, using its Series Instance UID tag (0x0020, 0x000e).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2723 * This function uses the database index to run as fast as possible (it does not loop
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2724 * over all the stored series).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2725 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2726 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2727 * @param seriesUID The Series Instance UID of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2728 * @return The NULL value if the series is non-existent, or a string containing the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2729 * Orthanc ID of the series. This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2730 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2731 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2732 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupSeries(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2733 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2734 const char* seriesUID)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2735 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2736 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2737
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2738 _OrthancPluginRetrieveDynamicString params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2739 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2740 params.argument = seriesUID;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2741
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2742 if (context->InvokeService(context, _OrthancPluginService_LookupSeries, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2743 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2744 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2745 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2746 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2747 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2748 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2749 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2750 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2751 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2752
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2753
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2754 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2755 * @brief Look for an instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2756 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2757 * Look for an instance stored in Orthanc, using its SOP Instance UID tag (0x0008, 0x0018).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2758 * This function uses the database index to run as fast as possible (it does not loop
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2759 * over all the stored instances).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2760 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2761 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2762 * @param sopInstanceUID The SOP Instance UID of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2763 * @return The NULL value if the instance is non-existent, or a string containing the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2764 * Orthanc ID of the instance. This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2765 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2766 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2767 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupInstance(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2768 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2769 const char* sopInstanceUID)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2770 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2771 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2772
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2773 _OrthancPluginRetrieveDynamicString params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2774 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2775 params.argument = sopInstanceUID;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2776
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2777 if (context->InvokeService(context, _OrthancPluginService_LookupInstance, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2778 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2779 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2780 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2781 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2782 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2783 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2784 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2785 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2786 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2787
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2788
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2789
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2790 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2791 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2792 OrthancPluginRestOutput* output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2793 uint16_t status;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2794 } _OrthancPluginSendHttpStatusCode;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2795
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2796 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2797 * @brief Send a HTTP status code.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2798 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2799 * This function answers to a REST request by sending a HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2800 * code (such as "400 - Bad Request"). Note that:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2801 * - Successful requests (status 200) must use ::OrthancPluginAnswerBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2802 * - Redirections (status 301) must use ::OrthancPluginRedirect().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2803 * - Unauthorized access (status 401) must use ::OrthancPluginSendUnauthorized().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2804 * - Methods not allowed (status 405) must use ::OrthancPluginSendMethodNotAllowed().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2805 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2806 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2807 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2808 * @param status The HTTP status code to be sent.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2809 * @ingroup REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2810 * @see OrthancPluginSendHttpStatus()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2811 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2812 ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatusCode(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2813 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2814 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2815 uint16_t status)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2816 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2817 _OrthancPluginSendHttpStatusCode params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2818 params.output = output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2819 params.status = status;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2820 context->InvokeService(context, _OrthancPluginService_SendHttpStatusCode, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2821 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2822
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2823
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2824 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2825 * @brief Signal that a REST request is not authorized.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2826 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2827 * This function answers to a REST request by signaling that it is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2828 * not authorized.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2829 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2830 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2831 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2832 * @param realm The realm for the authorization process.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2833 * @ingroup REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2834 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2835 ORTHANC_PLUGIN_INLINE void OrthancPluginSendUnauthorized(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2836 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2837 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2838 const char* realm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2839 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2840 _OrthancPluginOutputPlusArgument params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2841 params.output = output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2842 params.argument = realm;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2843 context->InvokeService(context, _OrthancPluginService_SendUnauthorized, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2844 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2845
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2846
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2847 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2848 * @brief Signal that this URI does not support this HTTP method.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2849 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2850 * This function answers to a REST request by signaling that the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2851 * queried URI does not support this method.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2852 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2853 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2854 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2855 * @param allowedMethods The allowed methods for this URI (e.g. "GET,POST" after a PUT or a POST request).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2856 * @ingroup REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2857 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2858 ORTHANC_PLUGIN_INLINE void OrthancPluginSendMethodNotAllowed(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2859 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2860 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2861 const char* allowedMethods)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2862 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2863 _OrthancPluginOutputPlusArgument params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2864 params.output = output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2865 params.argument = allowedMethods;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2866 context->InvokeService(context, _OrthancPluginService_SendMethodNotAllowed, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2867 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2868
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2869
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2870 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2871 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2872 OrthancPluginRestOutput* output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2873 const char* key;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2874 const char* value;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2875 } _OrthancPluginSetHttpHeader;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2876
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2877 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2878 * @brief Set a cookie.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2879 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2880 * This function sets a cookie in the HTTP client.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2881 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2882 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2883 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2884 * @param cookie The cookie to be set.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2885 * @param value The value of the cookie.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2886 * @ingroup REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2887 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2888 ORTHANC_PLUGIN_INLINE void OrthancPluginSetCookie(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2889 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2890 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2891 const char* cookie,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2892 const char* value)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2893 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2894 _OrthancPluginSetHttpHeader params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2895 params.output = output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2896 params.key = cookie;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2897 params.value = value;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2898 context->InvokeService(context, _OrthancPluginService_SetCookie, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2899 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2900
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2901
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2902 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2903 * @brief Set some HTTP header.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2904 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2905 * This function sets a HTTP header in the HTTP answer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2906 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2907 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2908 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2909 * @param key The HTTP header to be set.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2910 * @param value The value of the HTTP header.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2911 * @ingroup REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2912 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2913 ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpHeader(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2914 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2915 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2916 const char* key,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2917 const char* value)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2918 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2919 _OrthancPluginSetHttpHeader params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2920 params.output = output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2921 params.key = key;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2922 params.value = value;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2923 context->InvokeService(context, _OrthancPluginService_SetHttpHeader, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2924 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2925
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2926
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2927 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2928 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2929 char** resultStringToFree;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2930 const char** resultString;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2931 int64_t* resultInt64;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2932 const char* key;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2933 const OrthancPluginDicomInstance* instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2934 OrthancPluginInstanceOrigin* resultOrigin; /* New in Orthanc 0.9.5 SDK */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2935 } _OrthancPluginAccessDicomInstance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2936
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2937
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2938 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2939 * @brief Get the AET of a DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2940 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2941 * This function returns the Application Entity Title (AET) of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2942 * DICOM modality from which a DICOM instance originates.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2943 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2944 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2945 * @param instance The instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2946 * @return The AET if success, NULL if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2947 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2948 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2949 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceRemoteAet(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2950 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2951 const OrthancPluginDicomInstance* instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2952 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2953 const char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2954
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2955 _OrthancPluginAccessDicomInstance params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2956 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2957 params.resultString = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2958 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2959
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2960 if (context->InvokeService(context, _OrthancPluginService_GetInstanceRemoteAet, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2961 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2962 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2963 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2964 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2965 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2966 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2967 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2968 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2969 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2970
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2971
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2972 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2973 * @brief Get the size of a DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2974 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2975 * This function returns the number of bytes of the given DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2976 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2977 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2978 * @param instance The instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2979 * @return The size of the file, -1 in case of error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2980 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2981 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2982 ORTHANC_PLUGIN_INLINE int64_t OrthancPluginGetInstanceSize(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2983 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2984 const OrthancPluginDicomInstance* instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2985 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2986 int64_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2987
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2988 _OrthancPluginAccessDicomInstance params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2989 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2990 params.resultInt64 = &size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2991 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2992
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2993 if (context->InvokeService(context, _OrthancPluginService_GetInstanceSize, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2994 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2995 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2996 return -1;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2997 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2998 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2999 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3000 return size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3001 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3002 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3003
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3004
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3005 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3006 * @brief Get the data of a DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3007 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3008 * This function returns a pointer to the content of the given DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3009 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3010 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3011 * @param instance The instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3012 * @return The pointer to the DICOM data, NULL in case of error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3013 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3014 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3015 ORTHANC_PLUGIN_INLINE const void* OrthancPluginGetInstanceData(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3016 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3017 const OrthancPluginDicomInstance* instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3018 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3019 const char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3021 _OrthancPluginAccessDicomInstance params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3022 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3023 params.resultString = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3024 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3025
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3026 if (context->InvokeService(context, _OrthancPluginService_GetInstanceData, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3027 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3028 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3029 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3030 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3031 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3032 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3033 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3034 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3035 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3036
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3037
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3038 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3039 * @brief Get the DICOM tag hierarchy as a JSON file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3040 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3041 * This function returns a pointer to a newly created string
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3042 * containing a JSON file. This JSON file encodes the tag hierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3043 * of the given DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3044 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3045 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3046 * @param instance The instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3047 * @return The NULL value in case of error, or a string containing the JSON file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3048 * This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3049 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3050 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3051 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceJson(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3052 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3053 const OrthancPluginDicomInstance* instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3054 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3055 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3056
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3057 _OrthancPluginAccessDicomInstance params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3058 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3059 params.resultStringToFree = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3060 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3061
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3062 if (context->InvokeService(context, _OrthancPluginService_GetInstanceJson, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3063 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3064 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3065 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3066 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3067 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3068 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3069 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3070 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3071 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3072
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3073
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3074 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3075 * @brief Get the DICOM tag hierarchy as a JSON file (with simplification).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3076 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3077 * This function returns a pointer to a newly created string
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3078 * containing a JSON file. This JSON file encodes the tag hierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3079 * of the given DICOM instance. In contrast with
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3080 * ::OrthancPluginGetInstanceJson(), the returned JSON file is in
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3081 * its simplified version.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3082 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3083 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3084 * @param instance The instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3085 * @return The NULL value in case of error, or a string containing the JSON file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3086 * This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3087 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3088 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3089 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceSimplifiedJson(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3090 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3091 const OrthancPluginDicomInstance* instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3092 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3093 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3094
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3095 _OrthancPluginAccessDicomInstance params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3096 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3097 params.resultStringToFree = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3098 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3099
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3100 if (context->InvokeService(context, _OrthancPluginService_GetInstanceSimplifiedJson, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3101 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3102 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3103 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3104 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3105 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3106 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3107 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3108 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3109 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3110
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3112 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3113 * @brief Check whether a DICOM instance is associated with some metadata.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3114 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3115 * This function checks whether the DICOM instance of interest is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3116 * associated with some metadata. As of Orthanc 0.8.1, in the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3117 * callbacks registered by
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3118 * ::OrthancPluginRegisterOnStoredInstanceCallback(), the only
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3119 * possibly available metadata are "ReceptionDate", "RemoteAET" and
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3120 * "IndexInSeries".
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3121 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3122 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3123 * @param instance The instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3124 * @param metadata The metadata of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3125 * @return 1 if the metadata is present, 0 if it is absent, -1 in case of error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3126 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3127 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3128 ORTHANC_PLUGIN_INLINE int OrthancPluginHasInstanceMetadata(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3129 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3130 const OrthancPluginDicomInstance* instance,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3131 const char* metadata)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3132 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3133 int64_t result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3134
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3135 _OrthancPluginAccessDicomInstance params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3136 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3137 params.resultInt64 = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3138 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3139 params.key = metadata;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3140
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3141 if (context->InvokeService(context, _OrthancPluginService_HasInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3142 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3143 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3144 return -1;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3145 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3146 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3147 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3148 return (result != 0);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3149 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3150 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3151
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3152
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3153 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3154 * @brief Get the value of some metadata associated with a given DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3155 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3156 * This functions returns the value of some metadata that is associated with the DICOM instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3157 * Before calling this function, the existence of the metadata must have been checked with
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3158 * ::OrthancPluginHasInstanceMetadata().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3159 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3160 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3161 * @param instance The instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3162 * @param metadata The metadata of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3163 * @return The metadata value if success, NULL if error. Please note that the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3164 * returned string belongs to the instance object and must NOT be
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3165 * deallocated. Please make a copy of the string if you wish to access
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3166 * it later.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3167 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3168 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3169 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceMetadata(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3170 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3171 const OrthancPluginDicomInstance* instance,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3172 const char* metadata)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3173 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3174 const char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3175
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3176 _OrthancPluginAccessDicomInstance params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3177 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3178 params.resultString = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3179 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3180 params.key = metadata;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3181
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3182 if (context->InvokeService(context, _OrthancPluginService_GetInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3183 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3184 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3185 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3186 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3187 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3188 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3189 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3190 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3191 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3192
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3193
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3194
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3195 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3196 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3197 OrthancPluginStorageCreate create;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3198 OrthancPluginStorageRead read;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3199 OrthancPluginStorageRemove remove;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3200 OrthancPluginFree free;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3201 } _OrthancPluginRegisterStorageArea;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3202
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3203 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3204 * @brief Register a custom storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3205 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3206 * This function registers a custom storage area, to replace the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3207 * built-in way Orthanc stores its files on the filesystem. This
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3208 * function must be called during the initialization of the plugin,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3209 * i.e. inside the OrthancPluginInitialize() public function.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3210 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3211 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3212 * @param create The callback function to store a file on the custom storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3213 * @param read The callback function to read a file from the custom storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3214 * @param remove The callback function to remove a file from the custom storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3215 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3216 * @deprecated Please use OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3217 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3218 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterStorageArea(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3219 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3220 OrthancPluginStorageCreate create,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3221 OrthancPluginStorageRead read,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3222 OrthancPluginStorageRemove remove)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3223 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3224 _OrthancPluginRegisterStorageArea params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3225 params.create = create;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3226 params.read = read;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3227 params.remove = remove;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3228
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3229 #ifdef __cplusplus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3230 params.free = ::free;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3231 #else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3232 params.free = free;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3233 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3234
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3235 context->InvokeService(context, _OrthancPluginService_RegisterStorageArea, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3236 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3237
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3238
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3239
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3240 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3241 * @brief Return the path to the Orthanc executable.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3242 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3243 * This function returns the path to the Orthanc executable.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3244 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3245 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3246 * @return NULL in the case of an error, or a newly allocated string
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3247 * containing the path. This string must be freed by
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3248 * OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3249 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3250 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancPath(OrthancPluginContext* context)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3251 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3252 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3253
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3254 _OrthancPluginRetrieveDynamicString params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3255 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3256 params.argument = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3257
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3258 if (context->InvokeService(context, _OrthancPluginService_GetOrthancPath, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3259 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3260 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3261 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3262 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3263 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3264 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3265 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3266 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3267 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3268
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3269
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3270 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3271 * @brief Return the directory containing the Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3272 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3273 * This function returns the path to the directory containing the Orthanc executable.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3274 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3275 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3276 * @return NULL in the case of an error, or a newly allocated string
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3277 * containing the path. This string must be freed by
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3278 * OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3279 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3280 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancDirectory(OrthancPluginContext* context)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3281 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3282 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3283
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3284 _OrthancPluginRetrieveDynamicString params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3285 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3286 params.argument = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3287
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3288 if (context->InvokeService(context, _OrthancPluginService_GetOrthancDirectory, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3289 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3290 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3291 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3292 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3293 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3294 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3295 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3296 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3297 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3298
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3299
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3300 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3301 * @brief Return the path to the configuration file(s).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3302 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3303 * This function returns the path to the configuration file(s) that
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3304 * was specified when starting Orthanc. Since version 0.9.1, this
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3305 * path can refer to a folder that stores a set of configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3306 * files. This function is deprecated in favor of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3307 * OrthancPluginGetConfiguration().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3308 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3309 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3310 * @return NULL in the case of an error, or a newly allocated string
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3311 * containing the path. This string must be freed by
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3312 * OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3313 * @see OrthancPluginGetConfiguration()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3314 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3315 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfigurationPath(OrthancPluginContext* context)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3316 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3317 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3318
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3319 _OrthancPluginRetrieveDynamicString params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3320 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3321 params.argument = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3322
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3323 if (context->InvokeService(context, _OrthancPluginService_GetConfigurationPath, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3324 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3325 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3326 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3327 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3328 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3329 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3330 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3331 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3332 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3333
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3334
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3335
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3336 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3337 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3338 OrthancPluginOnChangeCallback callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3339 } _OrthancPluginOnChangeCallback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3340
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3341 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3342 * @brief Register a callback to monitor changes.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3343 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3344 * This function registers a callback function that is called
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3345 * whenever a change happens to some DICOM resource.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3346 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3347 * @warning Your callback function will be called synchronously with
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3348 * the core of Orthanc. This implies that deadlocks might emerge if
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3349 * you call other core primitives of Orthanc in your callback (such
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3350 * deadlocks are particularly visible in the presence of other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3351 * or Lua scripts). It is thus strongly advised to avoid any call to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3352 * the REST API of Orthanc in the callback. If you have to call
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3353 * other primitives of Orthanc, you should make these calls in a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3354 * separate thread, passing the pending events to be processed
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3355 * through a message queue.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3356 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3357 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3358 * @param callback The callback function.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3359 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3360 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3361 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnChangeCallback(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3362 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3363 OrthancPluginOnChangeCallback callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3364 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3365 _OrthancPluginOnChangeCallback params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3366 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3367
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3368 context->InvokeService(context, _OrthancPluginService_RegisterOnChangeCallback, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3369 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3370
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3371
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3372
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3373 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3374 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3375 const char* plugin;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3376 _OrthancPluginProperty property;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3377 const char* value;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3378 } _OrthancPluginSetPluginProperty;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3379
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3380
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3381 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3382 * @brief Set the URI where the plugin provides its Web interface.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3383 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3384 * For plugins that come with a Web interface, this function
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3385 * declares the entry path where to find this interface. This
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3386 * information is notably used in the "Plugins" page of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3387 * Explorer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3388 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3389 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3390 * @param uri The root URI for this plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3391 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3392 ORTHANC_PLUGIN_INLINE void OrthancPluginSetRootUri(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3393 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3394 const char* uri)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3395 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3396 _OrthancPluginSetPluginProperty params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3397 params.plugin = OrthancPluginGetName();
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3398 params.property = _OrthancPluginProperty_RootUri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3399 params.value = uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3400
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3401 context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3402 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3403
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3404
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3405 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3406 * @brief Set a description for this plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3407 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3408 * Set a description for this plugin. It is displayed in the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3409 * "Plugins" page of Orthanc Explorer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3410 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3411 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3412 * @param description The description.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3413 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3414 ORTHANC_PLUGIN_INLINE void OrthancPluginSetDescription(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3415 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3416 const char* description)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3417 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3418 _OrthancPluginSetPluginProperty params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3419 params.plugin = OrthancPluginGetName();
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3420 params.property = _OrthancPluginProperty_Description;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3421 params.value = description;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3422
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3423 context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3424 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3425
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3426
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3427 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3428 * @brief Extend the JavaScript code of Orthanc Explorer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3429 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3430 * Add JavaScript code to customize the default behavior of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3431 * Explorer. This can for instance be used to add new buttons.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3432 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3433 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3434 * @param javascript The custom JavaScript code.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3435 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3436 ORTHANC_PLUGIN_INLINE void OrthancPluginExtendOrthancExplorer(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3437 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3438 const char* javascript)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3439 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3440 _OrthancPluginSetPluginProperty params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3441 params.plugin = OrthancPluginGetName();
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3442 params.property = _OrthancPluginProperty_OrthancExplorer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3443 params.value = javascript;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3444
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3445 context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3446 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3447
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3448
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3449 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3450 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3451 char** result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3452 int32_t property;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3453 const char* value;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3454 } _OrthancPluginGlobalProperty;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3455
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3456
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3457 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3458 * @brief Get the value of a global property.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3459 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3460 * Get the value of a global property that is stored in the Orthanc database. Global
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3461 * properties whose index is below 1024 are reserved by Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3462 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3463 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3464 * @param property The global property of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3465 * @param defaultValue The value to return, if the global property is unset.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3466 * @return The value of the global property, or NULL in the case of an error. This
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3467 * string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3468 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3469 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3470 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetGlobalProperty(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3471 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3472 int32_t property,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3473 const char* defaultValue)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3474 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3475 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3476
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3477 _OrthancPluginGlobalProperty params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3478 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3479 params.property = property;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3480 params.value = defaultValue;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3481
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3482 if (context->InvokeService(context, _OrthancPluginService_GetGlobalProperty, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3483 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3484 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3485 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3486 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3487 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3488 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3489 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3490 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3491 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3492
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3493
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3494 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3495 * @brief Set the value of a global property.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3496 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3497 * Set the value of a global property into the Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3498 * database. Setting a global property can be used by plugins to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3499 * save their internal parameters. Plugins are only allowed to set
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3500 * properties whose index are above or equal to 1024 (properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3501 * below 1024 are read-only and reserved by Orthanc).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3502 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3503 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3504 * @param property The global property of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3505 * @param value The value to be set in the global property.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3506 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3507 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3508 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3509 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginSetGlobalProperty(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3510 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3511 int32_t property,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3512 const char* value)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3513 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3514 _OrthancPluginGlobalProperty params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3515 params.result = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3516 params.property = property;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3517 params.value = value;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3518
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3519 return context->InvokeService(context, _OrthancPluginService_SetGlobalProperty, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3520 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3521
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3522
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3523
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3524 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3525 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3526 int32_t *resultInt32;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3527 uint32_t *resultUint32;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3528 int64_t *resultInt64;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3529 uint64_t *resultUint64;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3530 } _OrthancPluginReturnSingleValue;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3531
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3532 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3533 * @brief Get the number of command-line arguments.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3534 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3535 * Retrieve the number of command-line arguments that were used to launch Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3536 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3537 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3538 * @return The number of arguments.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3539 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3540 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetCommandLineArgumentsCount(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3541 OrthancPluginContext* context)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3542 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3543 uint32_t count = 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3544
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3545 _OrthancPluginReturnSingleValue params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3546 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3547 params.resultUint32 = &count;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3548
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3549 if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgumentsCount, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3550 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3551 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3552 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3553 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3554 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3555 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3556 return count;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3557 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3558 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3559
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3560
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3561
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3562 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3563 * @brief Get the value of a command-line argument.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3564 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3565 * Get the value of one of the command-line arguments that were used
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3566 * to launch Orthanc. The number of available arguments can be
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3567 * retrieved by OrthancPluginGetCommandLineArgumentsCount().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3568 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3569 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3570 * @param argument The index of the argument.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3571 * @return The value of the argument, or NULL in the case of an error. This
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3572 * string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3573 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3574 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetCommandLineArgument(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3575 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3576 uint32_t argument)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3577 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3578 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3579
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3580 _OrthancPluginGlobalProperty params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3581 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3582 params.property = (int32_t) argument;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3583 params.value = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3584
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3585 if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgument, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3586 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3587 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3588 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3589 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3590 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3591 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3592 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3593 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3594 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3595
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3596
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3597 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3598 * @brief Get the expected version of the database schema.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3599 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3600 * Retrieve the expected version of the database schema.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3601 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3602 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3603 * @return The version.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3604 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3605 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3606 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetExpectedDatabaseVersion(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3607 OrthancPluginContext* context)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3608 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3609 uint32_t count = 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3610
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3611 _OrthancPluginReturnSingleValue params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3612 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3613 params.resultUint32 = &count;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3614
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3615 if (context->InvokeService(context, _OrthancPluginService_GetExpectedDatabaseVersion, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3616 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3617 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3618 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3619 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3620 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3621 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3622 return count;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3623 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3624 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3625
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3626
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3627
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3628 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3629 * @brief Return the content of the configuration file(s).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3630 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3631 * This function returns the content of the configuration that is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3632 * used by Orthanc, formatted as a JSON string.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3633 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3634 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3635 * @return NULL in the case of an error, or a newly allocated string
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3636 * containing the configuration. This string must be freed by
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3637 * OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3638 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3639 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfiguration(OrthancPluginContext* context)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3640 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3641 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3642
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3643 _OrthancPluginRetrieveDynamicString params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3644 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3645 params.argument = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3646
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3647 if (context->InvokeService(context, _OrthancPluginService_GetConfiguration, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3648 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3649 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3650 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3651 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3652 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3653 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3654 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3655 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3656 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3657
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3658
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3659
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3660 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3661 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3662 OrthancPluginRestOutput* output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3663 const char* subType;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3664 const char* contentType;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3665 } _OrthancPluginStartMultipartAnswer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3666
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3667 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3668 * @brief Start an HTTP multipart answer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3669 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3670 * Initiates a HTTP multipart answer, as the result of a REST request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3671 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3672 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3673 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3674 * @param subType The sub-type of the multipart answer ("mixed" or "related").
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3675 * @param contentType The MIME type of the items in the multipart answer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3676 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3677 * @see OrthancPluginSendMultipartItem(), OrthancPluginSendMultipartItem2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3678 * @ingroup REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3679 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3680 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStartMultipartAnswer(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3681 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3682 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3683 const char* subType,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3684 const char* contentType)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3685 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3686 _OrthancPluginStartMultipartAnswer params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3687 params.output = output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3688 params.subType = subType;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3689 params.contentType = contentType;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3690 return context->InvokeService(context, _OrthancPluginService_StartMultipartAnswer, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3691 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3692
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3693
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3694 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3695 * @brief Send an item as a part of some HTTP multipart answer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3696 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3697 * This function sends an item as a part of some HTTP multipart
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3698 * answer that was initiated by OrthancPluginStartMultipartAnswer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3699 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3700 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3701 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3702 * @param answer Pointer to the memory buffer containing the item.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3703 * @param answerSize Number of bytes of the item.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3704 * @return 0 if success, or the error code if failure (this notably happens
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3705 * if the connection is closed by the client).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3706 * @see OrthancPluginSendMultipartItem2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3707 * @ingroup REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3708 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3709 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginSendMultipartItem(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3710 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3711 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3712 const void* answer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3713 uint32_t answerSize)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3714 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3715 _OrthancPluginAnswerBuffer params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3716 params.output = output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3717 params.answer = answer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3718 params.answerSize = answerSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3719 params.mimeType = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3720 return context->InvokeService(context, _OrthancPluginService_SendMultipartItem, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3721 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3722
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3723
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3724
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3725 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3726 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3727 OrthancPluginMemoryBuffer* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3728 const void* source;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3729 uint32_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3730 OrthancPluginCompressionType compression;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3731 uint8_t uncompress;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3732 } _OrthancPluginBufferCompression;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3733
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3734
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3735 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3736 * @brief Compress or decompress a buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3737 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3738 * This function compresses or decompresses a buffer, using the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3739 * version of the zlib library that is used by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3740 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3741 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3742 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3743 * @param source The source buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3744 * @param size The size in bytes of the source buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3745 * @param compression The compression algorithm.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3746 * @param uncompress If set to "0", the buffer must be compressed.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3747 * If set to "1", the buffer must be uncompressed.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3748 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3749 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3750 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3751 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginBufferCompression(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3752 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3753 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3754 const void* source,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3755 uint32_t size,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3756 OrthancPluginCompressionType compression,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3757 uint8_t uncompress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3758 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3759 _OrthancPluginBufferCompression params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3760 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3761 params.source = source;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3762 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3763 params.compression = compression;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3764 params.uncompress = uncompress;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3765
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3766 return context->InvokeService(context, _OrthancPluginService_BufferCompression, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3767 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3768
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3769
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3770
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3771 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3772 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3773 OrthancPluginMemoryBuffer* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3774 const char* path;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3775 } _OrthancPluginReadFile;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3776
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3777 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3778 * @brief Read a file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3779 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3780 * Read the content of a file on the filesystem, and returns it into
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3781 * a newly allocated memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3782 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3783 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3784 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3785 * @param path The path of the file to be read.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3786 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3787 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3788 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginReadFile(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3789 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3790 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3791 const char* path)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3792 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3793 _OrthancPluginReadFile params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3794 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3795 params.path = path;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3796 return context->InvokeService(context, _OrthancPluginService_ReadFile, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3797 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3798
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3799
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3800
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3801 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3802 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3803 const char* path;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3804 const void* data;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3805 uint32_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3806 } _OrthancPluginWriteFile;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3807
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3808 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3809 * @brief Write a file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3810 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3811 * Write the content of a memory buffer to the filesystem.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3812 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3813 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3814 * @param path The path of the file to be written.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3815 * @param data The content of the memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3816 * @param size The size of the memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3817 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3818 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3819 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginWriteFile(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3820 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3821 const char* path,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3822 const void* data,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3823 uint32_t size)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3824 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3825 _OrthancPluginWriteFile params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3826 params.path = path;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3827 params.data = data;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3828 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3829 return context->InvokeService(context, _OrthancPluginService_WriteFile, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3830 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3831
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3832
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3833
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3834 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3835 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3836 const char** target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3837 OrthancPluginErrorCode error;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3838 } _OrthancPluginGetErrorDescription;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3839
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3840 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3841 * @brief Get the description of a given error code.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3842 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3843 * This function returns the description of a given error code.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3844 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3845 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3846 * @param error The error code of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3847 * @return The error description. This is a statically-allocated
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3848 * string, do not free it.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3849 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3850 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetErrorDescription(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3851 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3852 OrthancPluginErrorCode error)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3853 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3854 const char* result = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3855
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3856 _OrthancPluginGetErrorDescription params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3857 params.target = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3858 params.error = error;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3859
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3860 if (context->InvokeService(context, _OrthancPluginService_GetErrorDescription, &params) != OrthancPluginErrorCode_Success ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3861 result == NULL)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3862 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3863 return "Unknown error code";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3864 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3865 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3866 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3867 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3868 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3869 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3870
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3871
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3872
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3873 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3874 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3875 OrthancPluginRestOutput* output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3876 uint16_t status;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3877 const void* body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3878 uint32_t bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3879 } _OrthancPluginSendHttpStatus;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3880
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3881 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3882 * @brief Send a HTTP status, with a custom body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3883 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3884 * This function answers to a HTTP request by sending a HTTP status
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3885 * code (such as "400 - Bad Request"), together with a body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3886 * describing the error. The body will only be returned if the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3887 * configuration option "HttpDescribeErrors" of Orthanc is set to "true".
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3888 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3889 * Note that:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3890 * - Successful requests (status 200) must use ::OrthancPluginAnswerBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3891 * - Redirections (status 301) must use ::OrthancPluginRedirect().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3892 * - Unauthorized access (status 401) must use ::OrthancPluginSendUnauthorized().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3893 * - Methods not allowed (status 405) must use ::OrthancPluginSendMethodNotAllowed().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3894 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3895 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3896 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3897 * @param status The HTTP status code to be sent.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3898 * @param body The body of the answer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3899 * @param bodySize The size of the body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3900 * @see OrthancPluginSendHttpStatusCode()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3901 * @ingroup REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3902 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3903 ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatus(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3904 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3905 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3906 uint16_t status,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3907 const void* body,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3908 uint32_t bodySize)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3909 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3910 _OrthancPluginSendHttpStatus params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3911 params.output = output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3912 params.status = status;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3913 params.body = body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3914 params.bodySize = bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3915 context->InvokeService(context, _OrthancPluginService_SendHttpStatus, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3916 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3917
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3918
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3919
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3920 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3921 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3922 const OrthancPluginImage* image;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3923 uint32_t* resultUint32;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3924 OrthancPluginPixelFormat* resultPixelFormat;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3925 void** resultBuffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3926 } _OrthancPluginGetImageInfo;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3927
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3928
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3929 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3930 * @brief Return the pixel format of an image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3931 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3932 * This function returns the type of memory layout for the pixels of the given image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3933 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3934 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3935 * @param image The image of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3936 * @return The pixel format.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3937 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3938 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3939 ORTHANC_PLUGIN_INLINE OrthancPluginPixelFormat OrthancPluginGetImagePixelFormat(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3940 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3941 const OrthancPluginImage* image)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3942 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3943 OrthancPluginPixelFormat target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3944
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3945 _OrthancPluginGetImageInfo params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3946 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3947 params.image = image;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3948 params.resultPixelFormat = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3949
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3950 if (context->InvokeService(context, _OrthancPluginService_GetImagePixelFormat, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3951 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3952 return OrthancPluginPixelFormat_Unknown;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3953 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3954 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3955 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3956 return (OrthancPluginPixelFormat) target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3957 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3958 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3959
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3960
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3961
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3962 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3963 * @brief Return the width of an image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3964 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3965 * This function returns the width of the given image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3966 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3967 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3968 * @param image The image of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3969 * @return The width.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3970 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3971 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3972 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageWidth(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3973 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3974 const OrthancPluginImage* image)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3975 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3976 uint32_t width;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3977
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3978 _OrthancPluginGetImageInfo params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3979 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3980 params.image = image;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3981 params.resultUint32 = &width;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3982
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3983 if (context->InvokeService(context, _OrthancPluginService_GetImageWidth, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3984 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3985 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3986 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3987 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3988 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3989 return width;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3990 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3991 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3992
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3993
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3994
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3995 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3996 * @brief Return the height of an image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3997 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3998 * This function returns the height of the given image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3999 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4000 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4001 * @param image The image of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4002 * @return The height.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4003 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4004 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4005 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageHeight(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4006 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4007 const OrthancPluginImage* image)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4008 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4009 uint32_t height;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4010
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4011 _OrthancPluginGetImageInfo params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4012 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4013 params.image = image;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4014 params.resultUint32 = &height;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4016 if (context->InvokeService(context, _OrthancPluginService_GetImageHeight, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4017 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4018 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4019 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4020 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4021 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4022 return height;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4023 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4024 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4025
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4026
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4027
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4028 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4029 * @brief Return the pitch of an image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4030 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4031 * This function returns the pitch of the given image. The pitch is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4032 * defined as the number of bytes between 2 successive lines of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4033 * image in the memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4034 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4035 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4036 * @param image The image of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4037 * @return The pitch.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4038 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4039 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4040 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImagePitch(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4041 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4042 const OrthancPluginImage* image)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4043 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4044 uint32_t pitch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4045
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4046 _OrthancPluginGetImageInfo params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4047 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4048 params.image = image;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4049 params.resultUint32 = &pitch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4050
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4051 if (context->InvokeService(context, _OrthancPluginService_GetImagePitch, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4052 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4053 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4054 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4055 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4056 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4057 return pitch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4058 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4059 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4060
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4061
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4062
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4063 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4064 * @brief Return a pointer to the content of an image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4065 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4066 * This function returns a pointer to the memory buffer that
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4067 * contains the pixels of the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4068 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4069 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4070 * @param image The image of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4071 * @return The pointer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4072 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4073 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4074 ORTHANC_PLUGIN_INLINE void* OrthancPluginGetImageBuffer(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4075 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4076 const OrthancPluginImage* image)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4077 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4078 void* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4079
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4080 _OrthancPluginGetImageInfo params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4081 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4082 params.resultBuffer = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4083 params.image = image;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4084
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4085 if (context->InvokeService(context, _OrthancPluginService_GetImageBuffer, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4086 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4087 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4088 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4089 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4090 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4091 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4092 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4093 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4094
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4095
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4096 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4097 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4098 OrthancPluginImage** target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4099 const void* data;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4100 uint32_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4101 OrthancPluginImageFormat format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4102 } _OrthancPluginUncompressImage;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4103
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4104
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4105 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4106 * @brief Decode a compressed image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4107 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4108 * This function decodes a compressed image from a memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4109 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4110 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4111 * @param data Pointer to a memory buffer containing the compressed image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4112 * @param size Size of the memory buffer containing the compressed image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4113 * @param format The file format of the compressed image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4114 * @return The uncompressed image. It must be freed with OrthancPluginFreeImage().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4115 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4116 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4117 ORTHANC_PLUGIN_INLINE OrthancPluginImage *OrthancPluginUncompressImage(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4118 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4119 const void* data,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4120 uint32_t size,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4121 OrthancPluginImageFormat format)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4122 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4123 OrthancPluginImage* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4124
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4125 _OrthancPluginUncompressImage params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4126 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4127 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4128 params.data = data;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4129 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4130 params.format = format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4131
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4132 if (context->InvokeService(context, _OrthancPluginService_UncompressImage, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4133 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4134 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4135 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4136 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4137 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4138 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4139 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4140 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4141
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4142
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4144
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4145 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4146 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4147 OrthancPluginImage* image;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4148 } _OrthancPluginFreeImage;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4149
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4150 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4151 * @brief Free an image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4152 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4153 * This function frees an image that was decoded with OrthancPluginUncompressImage().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4154 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4155 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4156 * @param image The image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4157 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4158 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4159 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeImage(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4160 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4161 OrthancPluginImage* image)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4162 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4163 _OrthancPluginFreeImage params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4164 params.image = image;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4165
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4166 context->InvokeService(context, _OrthancPluginService_FreeImage, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4167 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4168
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4169
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4170
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4171
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4172 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4173 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4174 OrthancPluginMemoryBuffer* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4175 OrthancPluginImageFormat imageFormat;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4176 OrthancPluginPixelFormat pixelFormat;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4177 uint32_t width;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4178 uint32_t height;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4179 uint32_t pitch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4180 const void* buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4181 uint8_t quality;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4182 } _OrthancPluginCompressImage;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4183
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4184
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4185 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4186 * @brief Encode a PNG image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4187 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4188 * This function compresses the given memory buffer containing an
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4189 * image using the PNG specification, and stores the result of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4190 * compression into a newly allocated memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4191 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4192 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4193 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4194 * @param format The memory layout of the uncompressed image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4195 * @param width The width of the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4196 * @param height The height of the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4197 * @param pitch The pitch of the image (i.e. the number of bytes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4198 * between 2 successive lines of the image in the memory buffer).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4199 * @param buffer The memory buffer containing the uncompressed image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4200 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4201 * @see OrthancPluginCompressAndAnswerPngImage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4202 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4203 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4204 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCompressPngImage(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4205 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4206 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4207 OrthancPluginPixelFormat format,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4208 uint32_t width,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4209 uint32_t height,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4210 uint32_t pitch,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4211 const void* buffer)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4212 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4213 _OrthancPluginCompressImage params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4214 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4215 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4216 params.imageFormat = OrthancPluginImageFormat_Png;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4217 params.pixelFormat = format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4218 params.width = width;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4219 params.height = height;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4220 params.pitch = pitch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4221 params.buffer = buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4222 params.quality = 0; /* Unused for PNG */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4223
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4224 return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4225 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4226
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4227
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4228 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4229 * @brief Encode a JPEG image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4230 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4231 * This function compresses the given memory buffer containing an
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4232 * image using the JPEG specification, and stores the result of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4233 * compression into a newly allocated memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4234 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4235 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4236 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4237 * @param format The memory layout of the uncompressed image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4238 * @param width The width of the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4239 * @param height The height of the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4240 * @param pitch The pitch of the image (i.e. the number of bytes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4241 * between 2 successive lines of the image in the memory buffer).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4242 * @param buffer The memory buffer containing the uncompressed image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4243 * @param quality The quality of the JPEG encoding, between 1 (worst
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4244 * quality, best compression) and 100 (best quality, worst
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4245 * compression).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4246 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4247 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4248 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4249 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCompressJpegImage(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4250 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4251 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4252 OrthancPluginPixelFormat format,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4253 uint32_t width,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4254 uint32_t height,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4255 uint32_t pitch,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4256 const void* buffer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4257 uint8_t quality)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4258 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4259 _OrthancPluginCompressImage params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4260 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4261 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4262 params.imageFormat = OrthancPluginImageFormat_Jpeg;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4263 params.pixelFormat = format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4264 params.width = width;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4265 params.height = height;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4266 params.pitch = pitch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4267 params.buffer = buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4268 params.quality = quality;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4269
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4270 return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4271 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4272
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4273
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4274
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4275 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4276 * @brief Answer to a REST request with a JPEG image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4277 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4278 * This function answers to a REST request with a JPEG image. The
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4279 * parameters of this function describe a memory buffer that
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4280 * contains an uncompressed image. The image will be automatically compressed
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4281 * as a JPEG image by the core system of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4282 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4283 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4284 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4285 * @param format The memory layout of the uncompressed image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4286 * @param width The width of the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4287 * @param height The height of the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4288 * @param pitch The pitch of the image (i.e. the number of bytes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4289 * between 2 successive lines of the image in the memory buffer).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4290 * @param buffer The memory buffer containing the uncompressed image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4291 * @param quality The quality of the JPEG encoding, between 1 (worst
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4292 * quality, best compression) and 100 (best quality, worst
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4293 * compression).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4294 * @ingroup REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4295 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4296 ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerJpegImage(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4297 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4298 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4299 OrthancPluginPixelFormat format,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4300 uint32_t width,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4301 uint32_t height,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4302 uint32_t pitch,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4303 const void* buffer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4304 uint8_t quality)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4305 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4306 _OrthancPluginCompressAndAnswerImage params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4307 params.output = output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4308 params.imageFormat = OrthancPluginImageFormat_Jpeg;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4309 params.pixelFormat = format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4310 params.width = width;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4311 params.height = height;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4312 params.pitch = pitch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4313 params.buffer = buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4314 params.quality = quality;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4315 context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4316 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4317
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4318
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4319
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4320
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4321 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4322 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4323 OrthancPluginMemoryBuffer* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4324 OrthancPluginHttpMethod method;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4325 const char* url;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4326 const char* username;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4327 const char* password;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4328 const void* body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4329 uint32_t bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4330 } _OrthancPluginCallHttpClient;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4331
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4332
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4333 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4334 * @brief Issue a HTTP GET call.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4335 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4336 * Make a HTTP GET call to the given URL. The result to the query is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4337 * stored into a newly allocated memory buffer. Favor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4338 * OrthancPluginRestApiGet() if calling the built-in REST API of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4339 * Orthanc instance that hosts this plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4340 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4341 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4342 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4343 * @param url The URL of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4344 * @param username The username (can be <tt>NULL</tt> if no password protection).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4345 * @param password The password (can be <tt>NULL</tt> if no password protection).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4346 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4347 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4348 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4349 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginHttpGet(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4350 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4351 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4352 const char* url,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4353 const char* username,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4354 const char* password)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4355 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4356 _OrthancPluginCallHttpClient params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4357 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4358
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4359 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4360 params.method = OrthancPluginHttpMethod_Get;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4361 params.url = url;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4362 params.username = username;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4363 params.password = password;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4364
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4365 return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4366 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4367
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4368
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4369 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4370 * @brief Issue a HTTP POST call.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4371 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4372 * Make a HTTP POST call to the given URL. The result to the query
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4373 * is stored into a newly allocated memory buffer. Favor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4374 * OrthancPluginRestApiPost() if calling the built-in REST API of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4375 * the Orthanc instance that hosts this plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4376 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4377 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4378 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4379 * @param url The URL of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4380 * @param body The content of the body of the request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4381 * @param bodySize The size of the body of the request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4382 * @param username The username (can be <tt>NULL</tt> if no password protection).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4383 * @param password The password (can be <tt>NULL</tt> if no password protection).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4384 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4385 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4386 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4387 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginHttpPost(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4388 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4389 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4390 const char* url,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4391 const void* body,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4392 uint32_t bodySize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4393 const char* username,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4394 const char* password)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4395 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4396 _OrthancPluginCallHttpClient params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4397 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4398
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4399 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4400 params.method = OrthancPluginHttpMethod_Post;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4401 params.url = url;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4402 params.body = body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4403 params.bodySize = bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4404 params.username = username;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4405 params.password = password;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4406
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4407 return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4408 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4409
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4410
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4411 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4412 * @brief Issue a HTTP PUT call.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4413 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4414 * Make a HTTP PUT call to the given URL. The result to the query is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4415 * stored into a newly allocated memory buffer. Favor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4416 * OrthancPluginRestApiPut() if calling the built-in REST API of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4417 * Orthanc instance that hosts this plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4418 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4419 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4420 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4421 * @param url The URL of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4422 * @param body The content of the body of the request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4423 * @param bodySize The size of the body of the request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4424 * @param username The username (can be <tt>NULL</tt> if no password protection).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4425 * @param password The password (can be <tt>NULL</tt> if no password protection).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4426 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4427 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4428 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4429 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginHttpPut(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4430 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4431 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4432 const char* url,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4433 const void* body,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4434 uint32_t bodySize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4435 const char* username,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4436 const char* password)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4437 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4438 _OrthancPluginCallHttpClient params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4439 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4440
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4441 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4442 params.method = OrthancPluginHttpMethod_Put;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4443 params.url = url;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4444 params.body = body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4445 params.bodySize = bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4446 params.username = username;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4447 params.password = password;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4448
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4449 return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4450 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4451
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4452
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4453 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4454 * @brief Issue a HTTP DELETE call.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4455 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4456 * Make a HTTP DELETE call to the given URL. Favor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4457 * OrthancPluginRestApiDelete() if calling the built-in REST API of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4458 * the Orthanc instance that hosts this plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4459 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4460 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4461 * @param url The URL of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4462 * @param username The username (can be <tt>NULL</tt> if no password protection).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4463 * @param password The password (can be <tt>NULL</tt> if no password protection).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4464 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4465 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4466 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4467 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginHttpDelete(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4468 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4469 const char* url,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4470 const char* username,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4471 const char* password)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4472 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4473 _OrthancPluginCallHttpClient params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4474 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4475
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4476 params.method = OrthancPluginHttpMethod_Delete;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4477 params.url = url;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4478 params.username = username;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4479 params.password = password;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4480
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4481 return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4482 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4483
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4484
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4485
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4486 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4487 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4488 OrthancPluginImage** target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4489 const OrthancPluginImage* source;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4490 OrthancPluginPixelFormat targetFormat;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4491 } _OrthancPluginConvertPixelFormat;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4492
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4493
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4494 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4495 * @brief Change the pixel format of an image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4496 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4497 * This function creates a new image, changing the memory layout of the pixels.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4498 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4499 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4500 * @param source The source image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4501 * @param targetFormat The target pixel format.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4502 * @return The resulting image. It must be freed with OrthancPluginFreeImage().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4503 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4504 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4505 ORTHANC_PLUGIN_INLINE OrthancPluginImage *OrthancPluginConvertPixelFormat(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4506 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4507 const OrthancPluginImage* source,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4508 OrthancPluginPixelFormat targetFormat)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4509 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4510 OrthancPluginImage* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4511
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4512 _OrthancPluginConvertPixelFormat params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4513 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4514 params.source = source;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4515 params.targetFormat = targetFormat;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4516
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4517 if (context->InvokeService(context, _OrthancPluginService_ConvertPixelFormat, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4518 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4519 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4520 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4521 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4522 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4523 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4524 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4525 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4526
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4527
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4528
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4529 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4530 * @brief Return the number of available fonts.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4531 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4532 * This function returns the number of fonts that are built in the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4533 * Orthanc core. These fonts can be used to draw texts on images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4534 * through OrthancPluginDrawText().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4535 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4536 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4537 * @return The number of fonts.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4538 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4539 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4540 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontsCount(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4541 OrthancPluginContext* context)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4542 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4543 uint32_t count = 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4544
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4545 _OrthancPluginReturnSingleValue params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4546 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4547 params.resultUint32 = &count;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4548
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4549 if (context->InvokeService(context, _OrthancPluginService_GetFontsCount, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4550 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4551 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4552 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4553 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4554 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4555 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4556 return count;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4557 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4558 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4559
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4560
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4561
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4562
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4563 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4564 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4565 uint32_t fontIndex; /* in */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4566 const char** name; /* out */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4567 uint32_t* size; /* out */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4568 } _OrthancPluginGetFontInfo;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4569
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4570 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4571 * @brief Return the name of a font.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4572 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4573 * This function returns the name of a font that is built in the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4574 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4575 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4576 * @param fontIndex The index of the font. This value must be less than OrthancPluginGetFontsCount().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4577 * @return The font name. This is a statically-allocated string, do not free it.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4578 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4579 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4580 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetFontName(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4581 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4582 uint32_t fontIndex)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4583 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4584 const char* result = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4585
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4586 _OrthancPluginGetFontInfo params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4587 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4588 params.name = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4589 params.fontIndex = fontIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4590
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4591 if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4592 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4593 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4594 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4595 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4596 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4597 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4598 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4599 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4600
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4601
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4602 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4603 * @brief Return the size of a font.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4604 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4605 * This function returns the size of a font that is built in the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4606 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4607 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4608 * @param fontIndex The index of the font. This value must be less than OrthancPluginGetFontsCount().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4609 * @return The font size.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4610 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4611 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4612 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontSize(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4613 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4614 uint32_t fontIndex)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4615 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4616 uint32_t result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4617
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4618 _OrthancPluginGetFontInfo params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4619 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4620 params.size = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4621 params.fontIndex = fontIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4622
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4623 if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4624 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4625 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4626 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4627 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4628 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4629 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4630 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4631 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4632
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4633
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4634
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4635 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4636 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4637 OrthancPluginImage* image;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4638 uint32_t fontIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4639 const char* utf8Text;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4640 int32_t x;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4641 int32_t y;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4642 uint8_t r;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4643 uint8_t g;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4644 uint8_t b;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4645 } _OrthancPluginDrawText;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4646
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4647
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4648 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4649 * @brief Draw text on an image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4650 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4651 * This function draws some text on some image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4652 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4653 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4654 * @param image The image upon which to draw the text.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4655 * @param fontIndex The index of the font. This value must be less than OrthancPluginGetFontsCount().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4656 * @param utf8Text The text to be drawn, encoded as an UTF-8 zero-terminated string.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4657 * @param x The X position of the text over the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4658 * @param y The Y position of the text over the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4659 * @param r The value of the red color channel of the text.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4660 * @param g The value of the green color channel of the text.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4661 * @param b The value of the blue color channel of the text.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4662 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4663 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4664 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4665 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginDrawText(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4666 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4667 OrthancPluginImage* image,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4668 uint32_t fontIndex,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4669 const char* utf8Text,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4670 int32_t x,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4671 int32_t y,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4672 uint8_t r,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4673 uint8_t g,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4674 uint8_t b)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4675 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4676 _OrthancPluginDrawText params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4677 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4678 params.image = image;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4679 params.fontIndex = fontIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4680 params.utf8Text = utf8Text;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4681 params.x = x;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4682 params.y = y;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4683 params.r = r;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4684 params.g = g;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4685 params.b = b;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4686
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4687 return context->InvokeService(context, _OrthancPluginService_DrawText, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4688 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4689
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4690
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4691
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4692 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4693 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4694 OrthancPluginStorageArea* storageArea;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4695 const char* uuid;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4696 const void* content;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4697 uint64_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4698 OrthancPluginContentType type;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4699 } _OrthancPluginStorageAreaCreate;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4700
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4701
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4702 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4703 * @brief Create a file inside the storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4704 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4705 * This function creates a new file inside the storage area that is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4706 * currently used by Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4707 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4708 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4709 * @param storageArea The storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4710 * @param uuid The identifier of the file to be created.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4711 * @param content The content to store in the newly created file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4712 * @param size The size of the content.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4713 * @param type The type of the file content.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4714 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4715 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4716 * @deprecated This function should not be used anymore. Use "OrthancPluginRestApiPut()" on
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4717 * "/{patients|studies|series|instances}/{id}/attachments/{name}" instead.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4718 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4719 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStorageAreaCreate(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4720 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4721 OrthancPluginStorageArea* storageArea,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4722 const char* uuid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4723 const void* content,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4724 uint64_t size,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4725 OrthancPluginContentType type)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4726 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4727 _OrthancPluginStorageAreaCreate params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4728 params.storageArea = storageArea;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4729 params.uuid = uuid;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4730 params.content = content;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4731 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4732 params.type = type;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4733
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4734 return context->InvokeService(context, _OrthancPluginService_StorageAreaCreate, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4735 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4736
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4737
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4738 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4739 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4740 OrthancPluginMemoryBuffer* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4741 OrthancPluginStorageArea* storageArea;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4742 const char* uuid;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4743 OrthancPluginContentType type;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4744 } _OrthancPluginStorageAreaRead;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4745
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4746
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4747 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4748 * @brief Read a file from the storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4749 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4750 * This function reads the content of a given file from the storage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4751 * area that is currently used by Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4752 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4753 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4754 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4755 * @param storageArea The storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4756 * @param uuid The identifier of the file to be read.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4757 * @param type The type of the file content.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4758 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4759 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4760 * @deprecated This function should not be used anymore. Use "OrthancPluginRestApiGet()" on
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4761 * "/{patients|studies|series|instances}/{id}/attachments/{name}" instead.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4762 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4763 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStorageAreaRead(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4764 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4765 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4766 OrthancPluginStorageArea* storageArea,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4767 const char* uuid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4768 OrthancPluginContentType type)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4769 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4770 _OrthancPluginStorageAreaRead params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4771 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4772 params.storageArea = storageArea;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4773 params.uuid = uuid;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4774 params.type = type;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4775
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4776 return context->InvokeService(context, _OrthancPluginService_StorageAreaRead, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4777 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4778
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4779
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4780 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4781 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4782 OrthancPluginStorageArea* storageArea;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4783 const char* uuid;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4784 OrthancPluginContentType type;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4785 } _OrthancPluginStorageAreaRemove;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4786
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4787 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4788 * @brief Remove a file from the storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4789 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4790 * This function removes a given file from the storage area that is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4791 * currently used by Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4792 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4793 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4794 * @param storageArea The storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4795 * @param uuid The identifier of the file to be removed.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4796 * @param type The type of the file content.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4797 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4798 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4799 * @deprecated This function should not be used anymore. Use "OrthancPluginRestApiDelete()" on
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4800 * "/{patients|studies|series|instances}/{id}/attachments/{name}" instead.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4801 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4802 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStorageAreaRemove(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4803 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4804 OrthancPluginStorageArea* storageArea,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4805 const char* uuid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4806 OrthancPluginContentType type)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4807 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4808 _OrthancPluginStorageAreaRemove params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4809 params.storageArea = storageArea;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4810 params.uuid = uuid;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4811 params.type = type;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4812
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4813 return context->InvokeService(context, _OrthancPluginService_StorageAreaRemove, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4814 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4815
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4816
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4817
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4818 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4819 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4820 OrthancPluginErrorCode* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4821 int32_t code;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4822 uint16_t httpStatus;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4823 const char* message;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4824 } _OrthancPluginRegisterErrorCode;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4825
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4826 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4827 * @brief Declare a custom error code for this plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4828 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4829 * This function declares a custom error code that can be generated
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4830 * by this plugin. This declaration is used to enrich the body of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4831 * the HTTP answer in the case of an error, and to set the proper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4832 * HTTP status code.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4833 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4834 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4835 * @param code The error code that is internal to this plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4836 * @param httpStatus The HTTP status corresponding to this error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4837 * @param message The description of the error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4838 * @return The error code that has been assigned inside the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4839 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4840 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4841 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterErrorCode(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4842 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4843 int32_t code,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4844 uint16_t httpStatus,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4845 const char* message)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4846 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4847 OrthancPluginErrorCode target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4848
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4849 _OrthancPluginRegisterErrorCode params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4850 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4851 params.code = code;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4852 params.httpStatus = httpStatus;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4853 params.message = message;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4854
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4855 if (context->InvokeService(context, _OrthancPluginService_RegisterErrorCode, &params) == OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4856 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4857 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4858 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4859 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4860 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4861 /* There was an error while assigned the error. Use a generic code. */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4862 return OrthancPluginErrorCode_Plugin;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4863 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4864 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4865
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4866
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4867
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4868 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4869 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4870 uint16_t group;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4871 uint16_t element;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4872 OrthancPluginValueRepresentation vr;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4873 const char* name;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4874 uint32_t minMultiplicity;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4875 uint32_t maxMultiplicity;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4876 } _OrthancPluginRegisterDictionaryTag;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4877
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4878 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4879 * @brief Register a new tag into the DICOM dictionary.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4880 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4881 * This function declares a new public tag in the dictionary of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4882 * DICOM tags that are known to Orthanc. This function should be
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4883 * used in the OrthancPluginInitialize() callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4884 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4885 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4886 * @param group The group of the tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4887 * @param element The element of the tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4888 * @param vr The value representation of the tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4889 * @param name The nickname of the tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4890 * @param minMultiplicity The minimum multiplicity of the tag (must be above 0).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4891 * @param maxMultiplicity The maximum multiplicity of the tag. A value of 0 means
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4892 * an arbitrary multiplicity ("<tt>n</tt>").
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4893 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4894 * @see OrthancPluginRegisterPrivateDictionaryTag()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4895 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4896 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4897 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterDictionaryTag(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4898 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4899 uint16_t group,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4900 uint16_t element,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4901 OrthancPluginValueRepresentation vr,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4902 const char* name,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4903 uint32_t minMultiplicity,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4904 uint32_t maxMultiplicity)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4905 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4906 _OrthancPluginRegisterDictionaryTag params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4907 params.group = group;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4908 params.element = element;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4909 params.vr = vr;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4910 params.name = name;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4911 params.minMultiplicity = minMultiplicity;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4912 params.maxMultiplicity = maxMultiplicity;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4913
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4914 return context->InvokeService(context, _OrthancPluginService_RegisterDictionaryTag, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4915 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4916
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4917
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4918
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4919 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4920 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4921 uint16_t group;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4922 uint16_t element;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4923 OrthancPluginValueRepresentation vr;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4924 const char* name;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4925 uint32_t minMultiplicity;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4926 uint32_t maxMultiplicity;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4927 const char* privateCreator;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4928 } _OrthancPluginRegisterPrivateDictionaryTag;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4929
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4930 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4931 * @brief Register a new private tag into the DICOM dictionary.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4932 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4933 * This function declares a new private tag in the dictionary of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4934 * DICOM tags that are known to Orthanc. This function should be
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4935 * used in the OrthancPluginInitialize() callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4936 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4937 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4938 * @param group The group of the tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4939 * @param element The element of the tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4940 * @param vr The value representation of the tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4941 * @param name The nickname of the tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4942 * @param minMultiplicity The minimum multiplicity of the tag (must be above 0).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4943 * @param maxMultiplicity The maximum multiplicity of the tag. A value of 0 means
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4944 * an arbitrary multiplicity ("<tt>n</tt>").
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4945 * @param privateCreator The private creator of this private tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4946 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4947 * @see OrthancPluginRegisterDictionaryTag()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4948 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4949 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4950 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterPrivateDictionaryTag(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4951 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4952 uint16_t group,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4953 uint16_t element,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4954 OrthancPluginValueRepresentation vr,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4955 const char* name,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4956 uint32_t minMultiplicity,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4957 uint32_t maxMultiplicity,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4958 const char* privateCreator)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4959 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4960 _OrthancPluginRegisterPrivateDictionaryTag params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4961 params.group = group;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4962 params.element = element;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4963 params.vr = vr;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4964 params.name = name;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4965 params.minMultiplicity = minMultiplicity;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4966 params.maxMultiplicity = maxMultiplicity;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4967 params.privateCreator = privateCreator;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4968
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4969 return context->InvokeService(context, _OrthancPluginService_RegisterPrivateDictionaryTag, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4970 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4971
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4972
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4973
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4974 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4975 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4976 OrthancPluginStorageArea* storageArea;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4977 OrthancPluginResourceType level;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4978 } _OrthancPluginReconstructMainDicomTags;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4979
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4980 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4981 * @brief Reconstruct the main DICOM tags.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4982 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4983 * This function requests the Orthanc core to reconstruct the main
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4984 * DICOM tags of all the resources of the given type. This function
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4985 * can only be used as a part of the upgrade of a custom database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4986 * back-end. A database transaction will be automatically setup.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4987 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4988 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4989 * @param storageArea The storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4990 * @param level The type of the resources of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4991 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4992 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4993 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4994 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginReconstructMainDicomTags(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4995 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4996 OrthancPluginStorageArea* storageArea,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4997 OrthancPluginResourceType level)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4998 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4999 _OrthancPluginReconstructMainDicomTags params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5000 params.level = level;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5001 params.storageArea = storageArea;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5002
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5003 return context->InvokeService(context, _OrthancPluginService_ReconstructMainDicomTags, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5004 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5005
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5006
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5007 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5008 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5009 char** result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5010 const char* instanceId;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5011 const void* buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5012 uint32_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5013 OrthancPluginDicomToJsonFormat format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5014 OrthancPluginDicomToJsonFlags flags;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5015 uint32_t maxStringLength;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5016 } _OrthancPluginDicomToJson;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5017
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5019 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5020 * @brief Format a DICOM memory buffer as a JSON string.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5021 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5022 * This function takes as input a memory buffer containing a DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5023 * file, and outputs a JSON string representing the tags of this
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5024 * DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5025 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5026 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5027 * @param buffer The memory buffer containing the DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5028 * @param size The size of the memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5029 * @param format The output format.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5030 * @param flags Flags governing the output.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5031 * @param maxStringLength The maximum length of a field. Too long fields will
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5032 * be output as "null". The 0 value means no maximum length.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5033 * @return The NULL value if the case of an error, or the JSON
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5034 * string. This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5035 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5036 * @see OrthancPluginDicomInstanceToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5037 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5038 ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomBufferToJson(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5039 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5040 const void* buffer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5041 uint32_t size,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5042 OrthancPluginDicomToJsonFormat format,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5043 OrthancPluginDicomToJsonFlags flags,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5044 uint32_t maxStringLength)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5045 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5046 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5047
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5048 _OrthancPluginDicomToJson params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5049 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5050 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5051 params.buffer = buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5052 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5053 params.format = format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5054 params.flags = flags;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5055 params.maxStringLength = maxStringLength;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5056
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5057 if (context->InvokeService(context, _OrthancPluginService_DicomBufferToJson, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5058 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5059 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5060 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5061 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5062 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5063 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5064 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5065 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5066 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5067
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5068
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5069 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5070 * @brief Format a DICOM instance as a JSON string.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5071 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5072 * This function formats a DICOM instance that is stored in Orthanc,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5073 * and outputs a JSON string representing the tags of this DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5074 * instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5075 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5076 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5077 * @param instanceId The Orthanc identifier of the instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5078 * @param format The output format.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5079 * @param flags Flags governing the output.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5080 * @param maxStringLength The maximum length of a field. Too long fields will
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5081 * be output as "null". The 0 value means no maximum length.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5082 * @return The NULL value if the case of an error, or the JSON
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5083 * string. This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5084 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5085 * @see OrthancPluginDicomInstanceToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5086 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5087 ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomInstanceToJson(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5088 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5089 const char* instanceId,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5090 OrthancPluginDicomToJsonFormat format,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5091 OrthancPluginDicomToJsonFlags flags,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5092 uint32_t maxStringLength)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5093 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5094 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5095
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5096 _OrthancPluginDicomToJson params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5097 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5098 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5099 params.instanceId = instanceId;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5100 params.format = format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5101 params.flags = flags;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5102 params.maxStringLength = maxStringLength;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5103
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5104 if (context->InvokeService(context, _OrthancPluginService_DicomInstanceToJson, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5105 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5106 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5107 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5108 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5109 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5110 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5111 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5112 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5113 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5114
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5115
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5116 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5117 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5118 OrthancPluginMemoryBuffer* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5119 const char* uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5120 uint32_t headersCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5121 const char* const* headersKeys;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5122 const char* const* headersValues;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5123 int32_t afterPlugins;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5124 } _OrthancPluginRestApiGet2;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5125
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5126 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5127 * @brief Make a GET call to the Orthanc REST API, with custom HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5128 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5129 * Make a GET call to the Orthanc REST API with extended
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5130 * parameters. The result to the query is stored into a newly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5131 * allocated memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5132 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5133 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5134 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5135 * @param uri The URI in the built-in Orthanc API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5136 * @param headersCount The number of HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5137 * @param headersKeys Array containing the keys of the HTTP headers (can be <tt>NULL</tt> if no header).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5138 * @param headersValues Array containing the values of the HTTP headers (can be <tt>NULL</tt> if no header).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5139 * @param afterPlugins If 0, the built-in API of Orthanc is used.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5140 * If 1, the API is tainted by the plugins.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5141 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5142 * @see OrthancPluginRestApiGet, OrthancPluginRestApiGetAfterPlugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5143 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5144 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5145 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiGet2(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5146 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5147 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5148 const char* uri,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5149 uint32_t headersCount,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5150 const char* const* headersKeys,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5151 const char* const* headersValues,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5152 int32_t afterPlugins)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5153 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5154 _OrthancPluginRestApiGet2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5155 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5156 params.uri = uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5157 params.headersCount = headersCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5158 params.headersKeys = headersKeys;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5159 params.headersValues = headersValues;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5160 params.afterPlugins = afterPlugins;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5161
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5162 return context->InvokeService(context, _OrthancPluginService_RestApiGet2, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5163 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5165
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5166
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5167 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5168 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5169 OrthancPluginWorklistCallback callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5170 } _OrthancPluginWorklistCallback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5171
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5172 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5173 * @brief Register a callback to handle modality worklists requests.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5174 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5175 * This function registers a callback to handle C-Find SCP requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5176 * on modality worklists.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5177 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5178 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5179 * @param callback The callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5180 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5181 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5182 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5183 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterWorklistCallback(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5184 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5185 OrthancPluginWorklistCallback callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5186 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5187 _OrthancPluginWorklistCallback params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5188 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5189
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5190 return context->InvokeService(context, _OrthancPluginService_RegisterWorklistCallback, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5191 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5192
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5193
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5194
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5195 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5196 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5197 OrthancPluginWorklistAnswers* answers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5198 const OrthancPluginWorklistQuery* query;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5199 const void* dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5200 uint32_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5201 } _OrthancPluginWorklistAnswersOperation;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5202
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5203 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5204 * @brief Add one answer to some modality worklist request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5205 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5206 * This function adds one worklist (encoded as a DICOM file) to the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5207 * set of answers corresponding to some C-Find SCP request against
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5208 * modality worklists.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5209 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5210 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5211 * @param answers The set of answers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5212 * @param query The worklist query, as received by the callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5213 * @param dicom The worklist to answer, encoded as a DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5214 * @param size The size of the DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5215 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5216 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5217 * @see OrthancPluginCreateDicom()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5218 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5219 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginWorklistAddAnswer(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5220 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5221 OrthancPluginWorklistAnswers* answers,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5222 const OrthancPluginWorklistQuery* query,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5223 const void* dicom,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5224 uint32_t size)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5225 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5226 _OrthancPluginWorklistAnswersOperation params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5227 params.answers = answers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5228 params.query = query;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5229 params.dicom = dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5230 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5231
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5232 return context->InvokeService(context, _OrthancPluginService_WorklistAddAnswer, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5233 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5234
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5235
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5236 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5237 * @brief Mark the set of worklist answers as incomplete.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5238 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5239 * This function marks as incomplete the set of answers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5240 * corresponding to some C-Find SCP request against modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5241 * worklists. This must be used if canceling the handling of a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5242 * request when too many answers are to be returned.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5243 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5244 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5245 * @param answers The set of answers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5246 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5247 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5248 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5249 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginWorklistMarkIncomplete(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5250 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5251 OrthancPluginWorklistAnswers* answers)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5252 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5253 _OrthancPluginWorklistAnswersOperation params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5254 params.answers = answers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5255 params.query = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5256 params.dicom = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5257 params.size = 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5258
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5259 return context->InvokeService(context, _OrthancPluginService_WorklistMarkIncomplete, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5260 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5261
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5262
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5263 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5264 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5265 const OrthancPluginWorklistQuery* query;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5266 const void* dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5267 uint32_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5268 int32_t* isMatch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5269 OrthancPluginMemoryBuffer* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5270 } _OrthancPluginWorklistQueryOperation;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5271
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5272 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5273 * @brief Test whether a worklist matches the query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5274 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5275 * This function checks whether one worklist (encoded as a DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5276 * file) matches the C-Find SCP query against modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5277 * worklists. This function must be called before adding the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5278 * worklist as an answer through OrthancPluginWorklistAddAnswer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5279 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5280 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5281 * @param query The worklist query, as received by the callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5282 * @param dicom The worklist to answer, encoded as a DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5283 * @param size The size of the DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5284 * @return 1 if the worklist matches the query, 0 otherwise.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5285 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5286 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5287 ORTHANC_PLUGIN_INLINE int32_t OrthancPluginWorklistIsMatch(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5288 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5289 const OrthancPluginWorklistQuery* query,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5290 const void* dicom,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5291 uint32_t size)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5292 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5293 int32_t isMatch = 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5294
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5295 _OrthancPluginWorklistQueryOperation params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5296 params.query = query;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5297 params.dicom = dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5298 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5299 params.isMatch = &isMatch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5300 params.target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5301
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5302 if (context->InvokeService(context, _OrthancPluginService_WorklistIsMatch, &params) == OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5303 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5304 return isMatch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5305 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5306 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5307 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5308 /* Error: Assume non-match */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5309 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5310 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5311 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5312
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5313
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5314 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5315 * @brief Retrieve the worklist query as a DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5316 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5317 * This function retrieves the DICOM file that underlies a C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5318 * SCP query against modality worklists.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5319 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5320 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5321 * @param target Memory buffer where to store the DICOM file. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5322 * @param query The worklist query, as received by the callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5323 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5324 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5325 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5326 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginWorklistGetDicomQuery(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5327 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5328 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5329 const OrthancPluginWorklistQuery* query)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5330 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5331 _OrthancPluginWorklistQueryOperation params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5332 params.query = query;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5333 params.dicom = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5334 params.size = 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5335 params.isMatch = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5336 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5337
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5338 return context->InvokeService(context, _OrthancPluginService_WorklistGetDicomQuery, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5339 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5340
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5341
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5342 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5343 * @brief Get the origin of a DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5344 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5345 * This function returns the origin of a DICOM instance that has been received by Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5346 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5347 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5348 * @param instance The instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5349 * @return The origin of the instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5350 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5351 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5352 ORTHANC_PLUGIN_INLINE OrthancPluginInstanceOrigin OrthancPluginGetInstanceOrigin(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5353 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5354 const OrthancPluginDicomInstance* instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5355 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5356 OrthancPluginInstanceOrigin origin;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5357
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5358 _OrthancPluginAccessDicomInstance params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5359 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5360 params.resultOrigin = &origin;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5361 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5362
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5363 if (context->InvokeService(context, _OrthancPluginService_GetInstanceOrigin, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5364 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5365 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5366 return OrthancPluginInstanceOrigin_Unknown;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5367 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5368 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5369 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5370 return origin;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5371 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5372 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5373
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5374
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5375 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5376 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5377 OrthancPluginMemoryBuffer* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5378 const char* json;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5379 const OrthancPluginImage* pixelData;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5380 OrthancPluginCreateDicomFlags flags;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5381 } _OrthancPluginCreateDicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5382
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5383 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5384 * @brief Create a DICOM instance from a JSON string and an image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5385 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5386 * This function takes as input a string containing a JSON file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5387 * describing the content of a DICOM instance. As an output, it
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5388 * writes the corresponding DICOM instance to a newly allocated
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5389 * memory buffer. Additionally, an image to be encoded within the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5390 * DICOM instance can also be provided.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5391 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5392 * Private tags will be associated with the private creator whose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5393 * value is specified in the "DefaultPrivateCreator" configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5394 * option of Orthanc. The function OrthancPluginCreateDicom2() can
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5395 * be used if another private creator must be used to create this
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5396 * instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5397 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5398 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5399 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5400 * @param json The input JSON file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5401 * @param pixelData The image. Can be NULL, if the pixel data is encoded inside the JSON with the data URI scheme.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5402 * @param flags Flags governing the output.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5403 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5404 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5405 * @see OrthancPluginCreateDicom2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5406 * @see OrthancPluginDicomBufferToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5407 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5408 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCreateDicom(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5409 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5410 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5411 const char* json,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5412 const OrthancPluginImage* pixelData,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5413 OrthancPluginCreateDicomFlags flags)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5414 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5415 _OrthancPluginCreateDicom params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5416 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5417 params.json = json;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5418 params.pixelData = pixelData;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5419 params.flags = flags;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5420
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5421 return context->InvokeService(context, _OrthancPluginService_CreateDicom, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5422 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5423
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5424
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5425 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5426 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5427 OrthancPluginDecodeImageCallback callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5428 } _OrthancPluginDecodeImageCallback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5429
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5430 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5431 * @brief Register a callback to handle the decoding of DICOM images.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5432 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5433 * This function registers a custom callback to decode DICOM images,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5434 * extending the built-in decoder of Orthanc that uses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5435 * DCMTK. Starting with Orthanc 1.7.0, the exact behavior is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5436 * affected by the configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5437 * "BuiltinDecoderTranscoderOrder" of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5438 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5439 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5440 * @param callback The callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5441 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5442 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5443 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5444 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterDecodeImageCallback(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5445 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5446 OrthancPluginDecodeImageCallback callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5447 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5448 _OrthancPluginDecodeImageCallback params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5449 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5450
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5451 return context->InvokeService(context, _OrthancPluginService_RegisterDecodeImageCallback, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5452 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5453
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5454
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5455
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5456 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5457 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5458 OrthancPluginImage** target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5459 OrthancPluginPixelFormat format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5460 uint32_t width;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5461 uint32_t height;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5462 uint32_t pitch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5463 void* buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5464 const void* constBuffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5465 uint32_t bufferSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5466 uint32_t frameIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5467 } _OrthancPluginCreateImage;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5468
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5469
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5470 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5471 * @brief Create an image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5472 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5473 * This function creates an image of given size and format.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5474 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5475 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5476 * @param format The format of the pixels.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5477 * @param width The width of the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5478 * @param height The height of the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5479 * @return The newly allocated image. It must be freed with OrthancPluginFreeImage().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5480 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5481 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5482 ORTHANC_PLUGIN_INLINE OrthancPluginImage* OrthancPluginCreateImage(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5483 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5484 OrthancPluginPixelFormat format,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5485 uint32_t width,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5486 uint32_t height)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5487 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5488 OrthancPluginImage* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5489
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5490 _OrthancPluginCreateImage params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5491 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5492 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5493 params.format = format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5494 params.width = width;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5495 params.height = height;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5496
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5497 if (context->InvokeService(context, _OrthancPluginService_CreateImage, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5498 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5499 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5500 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5501 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5502 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5503 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5504 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5505 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5506
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5507
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5508 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5509 * @brief Create an image pointing to a memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5510 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5511 * This function creates an image whose content points to a memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5512 * buffer managed by the plugin. Note that the buffer is directly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5513 * accessed, no memory is allocated and no data is copied.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5514 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5515 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5516 * @param format The format of the pixels.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5517 * @param width The width of the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5518 * @param height The height of the image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5519 * @param pitch The pitch of the image (i.e. the number of bytes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5520 * between 2 successive lines of the image in the memory buffer).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5521 * @param buffer The memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5522 * @return The newly allocated image. It must be freed with OrthancPluginFreeImage().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5523 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5524 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5525 ORTHANC_PLUGIN_INLINE OrthancPluginImage* OrthancPluginCreateImageAccessor(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5526 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5527 OrthancPluginPixelFormat format,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5528 uint32_t width,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5529 uint32_t height,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5530 uint32_t pitch,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5531 void* buffer)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5532 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5533 OrthancPluginImage* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5534
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5535 _OrthancPluginCreateImage params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5536 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5537 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5538 params.format = format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5539 params.width = width;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5540 params.height = height;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5541 params.pitch = pitch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5542 params.buffer = buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5543
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5544 if (context->InvokeService(context, _OrthancPluginService_CreateImageAccessor, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5545 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5546 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5547 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5548 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5549 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5550 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5551 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5552 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5553
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5554
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5555
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5556 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5557 * @brief Decode one frame from a DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5558 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5559 * This function decodes one frame of a DICOM image that is stored
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5560 * in a memory buffer. This function will give the same result as
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5561 * OrthancPluginUncompressImage() for single-frame DICOM images.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5562 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5563 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5564 * @param buffer Pointer to a memory buffer containing the DICOM image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5565 * @param bufferSize Size of the memory buffer containing the DICOM image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5566 * @param frameIndex The index of the frame of interest in a multi-frame image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5567 * @return The uncompressed image. It must be freed with OrthancPluginFreeImage().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5568 * @ingroup Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5569 * @see OrthancPluginGetInstanceDecodedFrame()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5570 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5571 ORTHANC_PLUGIN_INLINE OrthancPluginImage* OrthancPluginDecodeDicomImage(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5572 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5573 const void* buffer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5574 uint32_t bufferSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5575 uint32_t frameIndex)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5576 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5577 OrthancPluginImage* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5578
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5579 _OrthancPluginCreateImage params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5580 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5581 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5582 params.constBuffer = buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5583 params.bufferSize = bufferSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5584 params.frameIndex = frameIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5585
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5586 if (context->InvokeService(context, _OrthancPluginService_DecodeDicomImage, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5587 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5588 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5589 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5590 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5591 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5592 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5593 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5594 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5595
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5596
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5597
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5598 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5599 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5600 char** result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5601 const void* buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5602 uint32_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5603 } _OrthancPluginComputeHash;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5604
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5605 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5606 * @brief Compute an MD5 hash.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5607 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5608 * This functions computes the MD5 cryptographic hash of the given memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5609 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5610 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5611 * @param buffer The source memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5612 * @param size The size in bytes of the source buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5613 * @return The NULL value in case of error, or a string containing the cryptographic hash.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5614 * This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5615 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5616 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5617 ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeMd5(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5618 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5619 const void* buffer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5620 uint32_t size)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5621 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5622 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5623
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5624 _OrthancPluginComputeHash params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5625 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5626 params.buffer = buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5627 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5628
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5629 if (context->InvokeService(context, _OrthancPluginService_ComputeMd5, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5630 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5631 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5632 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5633 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5634 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5635 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5636 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5637 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5638 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5639
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5640
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5641 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5642 * @brief Compute a SHA-1 hash.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5643 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5644 * This functions computes the SHA-1 cryptographic hash of the given memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5645 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5646 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5647 * @param buffer The source memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5648 * @param size The size in bytes of the source buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5649 * @return The NULL value in case of error, or a string containing the cryptographic hash.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5650 * This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5651 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5652 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5653 ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeSha1(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5654 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5655 const void* buffer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5656 uint32_t size)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5657 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5658 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5659
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5660 _OrthancPluginComputeHash params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5661 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5662 params.buffer = buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5663 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5664
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5665 if (context->InvokeService(context, _OrthancPluginService_ComputeSha1, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5666 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5667 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5668 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5669 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5670 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5671 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5672 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5673 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5674 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5675
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5676
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5677
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5678 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5679 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5680 OrthancPluginDictionaryEntry* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5681 const char* name;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5682 } _OrthancPluginLookupDictionary;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5683
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5684 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5685 * @brief Get information about the given DICOM tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5686 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5687 * This functions makes a lookup in the dictionary of DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5688 * that are known to Orthanc, and returns information about this
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5689 * tag. The tag can be specified using its human-readable name
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5690 * (e.g. "PatientName") or a set of two hexadecimal numbers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5691 * (e.g. "0010-0020").
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5692 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5693 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5694 * @param target Where to store the information about the tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5695 * @param name The name of the DICOM tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5696 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5697 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5698 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5699 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginLookupDictionary(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5700 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5701 OrthancPluginDictionaryEntry* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5702 const char* name)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5703 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5704 _OrthancPluginLookupDictionary params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5705 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5706 params.name = name;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5707 return context->InvokeService(context, _OrthancPluginService_LookupDictionary, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5708 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5709
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5710
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5711
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5712 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5713 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5714 OrthancPluginRestOutput* output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5715 const void* answer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5716 uint32_t answerSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5717 uint32_t headersCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5718 const char* const* headersKeys;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5719 const char* const* headersValues;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5720 } _OrthancPluginSendMultipartItem2;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5721
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5722 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5723 * @brief Send an item as a part of some HTTP multipart answer, with custom headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5724 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5725 * This function sends an item as a part of some HTTP multipart
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5726 * answer that was initiated by OrthancPluginStartMultipartAnswer(). In addition to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5727 * OrthancPluginSendMultipartItem(), this function will set HTTP header associated
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5728 * with the item.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5729 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5730 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5731 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5732 * @param answer Pointer to the memory buffer containing the item.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5733 * @param answerSize Number of bytes of the item.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5734 * @param headersCount The number of HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5735 * @param headersKeys Array containing the keys of the HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5736 * @param headersValues Array containing the values of the HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5737 * @return 0 if success, or the error code if failure (this notably happens
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5738 * if the connection is closed by the client).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5739 * @see OrthancPluginSendMultipartItem()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5740 * @ingroup REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5741 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5742 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginSendMultipartItem2(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5743 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5744 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5745 const void* answer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5746 uint32_t answerSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5747 uint32_t headersCount,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5748 const char* const* headersKeys,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5749 const char* const* headersValues)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5750 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5751 _OrthancPluginSendMultipartItem2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5752 params.output = output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5753 params.answer = answer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5754 params.answerSize = answerSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5755 params.headersCount = headersCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5756 params.headersKeys = headersKeys;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5757 params.headersValues = headersValues;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5758
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5759 return context->InvokeService(context, _OrthancPluginService_SendMultipartItem2, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5760 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5761
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5762
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5763 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5764 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5765 OrthancPluginIncomingHttpRequestFilter callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5766 } _OrthancPluginIncomingHttpRequestFilter;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5767
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5768 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5769 * @brief Register a callback to filter incoming HTTP requests.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5770 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5771 * This function registers a custom callback to filter incoming HTTP/REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5772 * requests received by the HTTP server of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5773 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5774 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5775 * @param callback The callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5776 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5777 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5778 * @deprecated Please instead use OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5779 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5780 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5781 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5782 OrthancPluginIncomingHttpRequestFilter callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5783 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5784 _OrthancPluginIncomingHttpRequestFilter params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5785 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5786
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5787 return context->InvokeService(context, _OrthancPluginService_RegisterIncomingHttpRequestFilter, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5788 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5789
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5790
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5791
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5792 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5793 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5794 OrthancPluginMemoryBuffer* answerBody;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5795 OrthancPluginMemoryBuffer* answerHeaders;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5796 uint16_t* httpStatus;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5797 OrthancPluginHttpMethod method;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5798 const char* url;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5799 uint32_t headersCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5800 const char* const* headersKeys;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5801 const char* const* headersValues;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5802 const void* body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5803 uint32_t bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5804 const char* username;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5805 const char* password;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5806 uint32_t timeout;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5807 const char* certificateFile;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5808 const char* certificateKeyFile;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5809 const char* certificateKeyPassword;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5810 uint8_t pkcs11;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5811 } _OrthancPluginCallHttpClient2;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5812
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5813
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5814
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5815 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5816 * @brief Issue a HTTP call with full flexibility.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5817 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5818 * Make a HTTP call to the given URL. The result to the query is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5819 * stored into a newly allocated memory buffer. The HTTP request
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5820 * will be done accordingly to the global configuration of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5821 * (in particular, the options "HttpProxy", "HttpTimeout",
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5822 * "HttpsVerifyPeers", "HttpsCACertificates", and "Pkcs11" will be
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5823 * taken into account).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5824 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5825 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5826 * @param answerBody The target memory buffer (out argument).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5827 * It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5828 * The value of this argument is ignored if the HTTP method is DELETE.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5829 * @param answerHeaders The target memory buffer for the HTTP headers in the answers (out argument).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5830 * The answer headers are formatted as a JSON object (associative array).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5831 * The buffer must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5832 * This argument can be set to NULL if the plugin has no interest in the HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5833 * @param httpStatus The HTTP status after the execution of the request (out argument).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5834 * @param method HTTP method to be used.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5835 * @param url The URL of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5836 * @param headersCount The number of HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5837 * @param headersKeys Array containing the keys of the HTTP headers (can be <tt>NULL</tt> if no header).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5838 * @param headersValues Array containing the values of the HTTP headers (can be <tt>NULL</tt> if no header).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5839 * @param username The username (can be <tt>NULL</tt> if no password protection).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5840 * @param password The password (can be <tt>NULL</tt> if no password protection).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5841 * @param body The HTTP body for a POST or PUT request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5842 * @param bodySize The size of the body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5843 * @param timeout Timeout in seconds (0 for default timeout).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5844 * @param certificateFile Path to the client certificate for HTTPS, in PEM format
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5845 * (can be <tt>NULL</tt> if no client certificate or if not using HTTPS).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5846 * @param certificateKeyFile Path to the key of the client certificate for HTTPS, in PEM format
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5847 * (can be <tt>NULL</tt> if no client certificate or if not using HTTPS).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5848 * @param certificateKeyPassword Password to unlock the key of the client certificate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5849 * (can be <tt>NULL</tt> if no client certificate or if not using HTTPS).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5850 * @param pkcs11 Enable PKCS#11 client authentication for hardware security modules and smart cards.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5851 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5852 * @see OrthancPluginCallPeerApi()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5853 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5854 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5855 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginHttpClient(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5856 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5857 OrthancPluginMemoryBuffer* answerBody,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5858 OrthancPluginMemoryBuffer* answerHeaders,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5859 uint16_t* httpStatus,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5860 OrthancPluginHttpMethod method,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5861 const char* url,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5862 uint32_t headersCount,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5863 const char* const* headersKeys,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5864 const char* const* headersValues,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5865 const void* body,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5866 uint32_t bodySize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5867 const char* username,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5868 const char* password,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5869 uint32_t timeout,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5870 const char* certificateFile,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5871 const char* certificateKeyFile,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5872 const char* certificateKeyPassword,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5873 uint8_t pkcs11)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5874 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5875 _OrthancPluginCallHttpClient2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5876 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5877
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5878 params.answerBody = answerBody;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5879 params.answerHeaders = answerHeaders;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5880 params.httpStatus = httpStatus;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5881 params.method = method;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5882 params.url = url;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5883 params.headersCount = headersCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5884 params.headersKeys = headersKeys;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5885 params.headersValues = headersValues;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5886 params.body = body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5887 params.bodySize = bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5888 params.username = username;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5889 params.password = password;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5890 params.timeout = timeout;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5891 params.certificateFile = certificateFile;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5892 params.certificateKeyFile = certificateKeyFile;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5893 params.certificateKeyPassword = certificateKeyPassword;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5894 params.pkcs11 = pkcs11;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5895
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5896 return context->InvokeService(context, _OrthancPluginService_CallHttpClient2, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5897 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5898
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5899
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5900 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5901 * @brief Generate an UUID.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5902 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5903 * Generate a random GUID/UUID (globally unique identifier).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5904 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5905 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5906 * @return NULL in the case of an error, or a newly allocated string
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5907 * containing the UUID. This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5908 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5909 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5910 ORTHANC_PLUGIN_INLINE char* OrthancPluginGenerateUuid(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5911 OrthancPluginContext* context)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5912 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5913 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5914
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5915 _OrthancPluginRetrieveDynamicString params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5916 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5917 params.argument = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5918
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5919 if (context->InvokeService(context, _OrthancPluginService_GenerateUuid, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5920 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5921 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5922 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5923 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5924 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5925 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5926 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5927 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5928 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5929
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5930
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5931
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5932
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5933 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5934 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5935 OrthancPluginFindCallback callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5936 } _OrthancPluginFindCallback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5937
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5938 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5939 * @brief Register a callback to handle C-Find requests.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5940 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5941 * This function registers a callback to handle C-Find SCP requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5942 * that are not related to modality worklists.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5943 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5944 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5945 * @param callback The callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5946 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5947 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5948 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5949 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterFindCallback(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5950 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5951 OrthancPluginFindCallback callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5952 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5953 _OrthancPluginFindCallback params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5954 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5955
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5956 return context->InvokeService(context, _OrthancPluginService_RegisterFindCallback, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5957 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5958
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5959
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5960 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5961 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5962 OrthancPluginFindAnswers *answers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5963 const OrthancPluginFindQuery *query;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5964 const void *dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5965 uint32_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5966 uint32_t index;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5967 uint32_t *resultUint32;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5968 uint16_t *resultGroup;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5969 uint16_t *resultElement;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5970 char **resultString;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5971 } _OrthancPluginFindOperation;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5972
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5973 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5974 * @brief Add one answer to some C-Find request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5975 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5976 * This function adds one answer (encoded as a DICOM file) to the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5977 * set of answers corresponding to some C-Find SCP request that is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5978 * not related to modality worklists.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5979 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5980 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5981 * @param answers The set of answers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5982 * @param dicom The answer to be added, encoded as a DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5983 * @param size The size of the DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5984 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5985 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5986 * @see OrthancPluginCreateDicom()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5987 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5988 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginFindAddAnswer(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5989 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5990 OrthancPluginFindAnswers* answers,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5991 const void* dicom,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5992 uint32_t size)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5993 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5994 _OrthancPluginFindOperation params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5995 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5996 params.answers = answers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5997 params.dicom = dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5998 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5999
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6000 return context->InvokeService(context, _OrthancPluginService_FindAddAnswer, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6001 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6002
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6003
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6004 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6005 * @brief Mark the set of C-Find answers as incomplete.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6006 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6007 * This function marks as incomplete the set of answers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6008 * corresponding to some C-Find SCP request that is not related to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6009 * modality worklists. This must be used if canceling the handling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6010 * of a request when too many answers are to be returned.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6011 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6012 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6013 * @param answers The set of answers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6014 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6015 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6016 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6017 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginFindMarkIncomplete(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6018 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6019 OrthancPluginFindAnswers* answers)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6020 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6021 _OrthancPluginFindOperation params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6022 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6023 params.answers = answers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6025 return context->InvokeService(context, _OrthancPluginService_FindMarkIncomplete, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6026 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6027
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6028
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6029
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6030 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6031 * @brief Get the number of tags in a C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6032 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6033 * This function returns the number of tags that are contained in
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6034 * the given C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6035 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6036 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6037 * @param query The C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6038 * @return The number of tags.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6039 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6040 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6041 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFindQuerySize(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6042 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6043 const OrthancPluginFindQuery* query)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6044 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6045 uint32_t count = 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6046
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6047 _OrthancPluginFindOperation params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6048 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6049 params.query = query;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6050 params.resultUint32 = &count;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6051
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6052 if (context->InvokeService(context, _OrthancPluginService_GetFindQuerySize, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6053 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6054 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6055 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6056 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6057 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6058 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6059 return count;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6060 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6061 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6062
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6063
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6064 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6065 * @brief Get one tag in a C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6066 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6067 * This function returns the group and the element of one DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6068 * in the given C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6069 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6070 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6071 * @param group The group of the tag (output).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6072 * @param element The element of the tag (output).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6073 * @param query The C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6074 * @param index The index of the tag of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6075 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6076 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6077 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6078 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginGetFindQueryTag(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6079 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6080 uint16_t* group,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6081 uint16_t* element,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6082 const OrthancPluginFindQuery* query,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6083 uint32_t index)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6084 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6085 _OrthancPluginFindOperation params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6086 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6087 params.query = query;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6088 params.index = index;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6089 params.resultGroup = group;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6090 params.resultElement = element;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6091
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6092 return context->InvokeService(context, _OrthancPluginService_GetFindQueryTag, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6093 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6094
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6095
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6096 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6097 * @brief Get the symbolic name of one tag in a C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6098 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6099 * This function returns the symbolic name of one DICOM tag in the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6100 * given C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6101 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6102 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6103 * @param query The C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6104 * @param index The index of the tag of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6105 * @return The NULL value in case of error, or a string containing the name of the tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6106 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6107 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6108 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6109 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetFindQueryTagName(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6110 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6111 const OrthancPluginFindQuery* query,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6112 uint32_t index)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6113 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6114 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6115
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6116 _OrthancPluginFindOperation params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6117 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6118 params.query = query;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6119 params.index = index;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6120 params.resultString = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6121
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6122 if (context->InvokeService(context, _OrthancPluginService_GetFindQueryTagName, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6123 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6124 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6125 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6126 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6127 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6128 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6129 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6130 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6131 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6132
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6133
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6134 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6135 * @brief Get the value associated with one tag in a C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6136 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6137 * This function returns the value associated with one tag in the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6138 * given C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6139 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6140 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6141 * @param query The C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6142 * @param index The index of the tag of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6143 * @return The NULL value in case of error, or a string containing the value of the tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6144 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6145 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6146 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6147 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetFindQueryValue(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6148 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6149 const OrthancPluginFindQuery* query,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6150 uint32_t index)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6151 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6152 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6153
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6154 _OrthancPluginFindOperation params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6155 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6156 params.query = query;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6157 params.index = index;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6158 params.resultString = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6159
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6160 if (context->InvokeService(context, _OrthancPluginService_GetFindQueryValue, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6161 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6162 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6163 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6164 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6165 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6166 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6167 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6168 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6169 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6170
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6171
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6172
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6173
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6174 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6175 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6176 OrthancPluginMoveCallback callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6177 OrthancPluginGetMoveSize getMoveSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6178 OrthancPluginApplyMove applyMove;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6179 OrthancPluginFreeMove freeMove;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6180 } _OrthancPluginMoveCallback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6181
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6182 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6183 * @brief Register a callback to handle C-Move requests.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6184 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6185 * This function registers a callback to handle C-Move SCP requests.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6186 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6187 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6188 * @param callback The main callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6189 * @param getMoveSize Callback to read the number of C-Move suboperations.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6190 * @param applyMove Callback to apply one C-Move suboperation.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6191 * @param freeMove Callback to free the C-Move driver.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6192 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6193 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6194 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6195 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterMoveCallback(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6196 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6197 OrthancPluginMoveCallback callback,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6198 OrthancPluginGetMoveSize getMoveSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6199 OrthancPluginApplyMove applyMove,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6200 OrthancPluginFreeMove freeMove)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6201 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6202 _OrthancPluginMoveCallback params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6203 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6204 params.getMoveSize = getMoveSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6205 params.applyMove = applyMove;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6206 params.freeMove = freeMove;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6207
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6208 return context->InvokeService(context, _OrthancPluginService_RegisterMoveCallback, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6209 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6210
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6211
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6212
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6213 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6214 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6215 OrthancPluginFindMatcher** target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6216 const void* query;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6217 uint32_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6218 } _OrthancPluginCreateFindMatcher;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6219
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6220
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6221 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6222 * @brief Create a C-Find matcher.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6223 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6224 * This function creates a "matcher" object that can be used to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6225 * check whether a DICOM instance matches a C-Find query. The C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6226 * query must be expressed as a DICOM buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6227 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6228 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6229 * @param query The C-Find DICOM query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6230 * @param size The size of the DICOM query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6231 * @return The newly allocated matcher. It must be freed with OrthancPluginFreeFindMatcher().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6232 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6233 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6234 ORTHANC_PLUGIN_INLINE OrthancPluginFindMatcher* OrthancPluginCreateFindMatcher(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6235 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6236 const void* query,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6237 uint32_t size)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6238 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6239 OrthancPluginFindMatcher* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6240
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6241 _OrthancPluginCreateFindMatcher params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6242 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6243 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6244 params.query = query;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6245 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6246
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6247 if (context->InvokeService(context, _OrthancPluginService_CreateFindMatcher, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6248 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6249 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6250 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6251 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6252 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6253 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6254 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6255 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6256
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6257
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6258 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6259 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6260 OrthancPluginFindMatcher* matcher;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6261 } _OrthancPluginFreeFindMatcher;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6262
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6263 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6264 * @brief Free a C-Find matcher.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6265 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6266 * This function frees a matcher that was created using OrthancPluginCreateFindMatcher().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6267 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6268 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6269 * @param matcher The matcher of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6270 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6271 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6272 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeFindMatcher(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6273 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6274 OrthancPluginFindMatcher* matcher)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6275 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6276 _OrthancPluginFreeFindMatcher params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6277 params.matcher = matcher;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6278
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6279 context->InvokeService(context, _OrthancPluginService_FreeFindMatcher, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6280 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6281
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6282
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6283 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6284 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6285 const OrthancPluginFindMatcher* matcher;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6286 const void* dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6287 uint32_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6288 int32_t* isMatch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6289 } _OrthancPluginFindMatcherIsMatch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6290
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6291 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6292 * @brief Test whether a DICOM instance matches a C-Find query.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6293 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6294 * This function checks whether one DICOM instance matches C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6295 * matcher that was previously allocated using
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6296 * OrthancPluginCreateFindMatcher().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6297 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6298 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6299 * @param matcher The matcher of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6300 * @param dicom The DICOM instance to be matched.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6301 * @param size The size of the DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6302 * @return 1 if the DICOM instance matches the query, 0 otherwise.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6303 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6304 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6305 ORTHANC_PLUGIN_INLINE int32_t OrthancPluginFindMatcherIsMatch(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6306 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6307 const OrthancPluginFindMatcher* matcher,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6308 const void* dicom,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6309 uint32_t size)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6310 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6311 int32_t isMatch = 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6312
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6313 _OrthancPluginFindMatcherIsMatch params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6314 params.matcher = matcher;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6315 params.dicom = dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6316 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6317 params.isMatch = &isMatch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6318
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6319 if (context->InvokeService(context, _OrthancPluginService_FindMatcherIsMatch, &params) == OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6320 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6321 return isMatch;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6322 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6323 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6324 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6325 /* Error: Assume non-match */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6326 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6327 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6328 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6329
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6330
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6331 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6332 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6333 OrthancPluginIncomingHttpRequestFilter2 callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6334 } _OrthancPluginIncomingHttpRequestFilter2;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6335
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6336 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6337 * @brief Register a callback to filter incoming HTTP requests.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6338 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6339 * This function registers a custom callback to filter incoming HTTP/REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6340 * requests received by the HTTP server of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6341 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6342 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6343 * @param callback The callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6344 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6345 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6346 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6347 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter2(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6348 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6349 OrthancPluginIncomingHttpRequestFilter2 callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6350 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6351 _OrthancPluginIncomingHttpRequestFilter2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6352 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6353
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6354 return context->InvokeService(context, _OrthancPluginService_RegisterIncomingHttpRequestFilter2, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6355 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6356
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6357
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6358
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6359 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6360 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6361 OrthancPluginPeers** peers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6362 } _OrthancPluginGetPeers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6363
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6364 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6365 * @brief Return the list of available Orthanc peers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6366 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6367 * This function returns the parameters of the Orthanc peers that are known to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6368 * the Orthanc server hosting the plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6369 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6370 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6371 * @return NULL if error, or a newly allocated opaque data structure containing the peers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6372 * This structure must be freed with OrthancPluginFreePeers().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6373 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6374 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6375 ORTHANC_PLUGIN_INLINE OrthancPluginPeers* OrthancPluginGetPeers(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6376 OrthancPluginContext* context)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6377 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6378 OrthancPluginPeers* peers = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6379
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6380 _OrthancPluginGetPeers params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6381 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6382 params.peers = &peers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6383
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6384 if (context->InvokeService(context, _OrthancPluginService_GetPeers, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6385 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6386 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6387 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6388 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6389 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6390 return peers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6391 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6392 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6393
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6394
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6395 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6396 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6397 OrthancPluginPeers* peers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6398 } _OrthancPluginFreePeers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6399
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6400 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6401 * @brief Free the list of available Orthanc peers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6402 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6403 * This function frees the data structure returned by OrthancPluginGetPeers().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6404 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6405 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6406 * @param peers The data structure describing the Orthanc peers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6407 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6408 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6409 ORTHANC_PLUGIN_INLINE void OrthancPluginFreePeers(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6410 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6411 OrthancPluginPeers* peers)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6412 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6413 _OrthancPluginFreePeers params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6414 params.peers = peers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6415
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6416 context->InvokeService(context, _OrthancPluginService_FreePeers, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6417 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6418
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6419
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6420 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6421 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6422 uint32_t* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6423 const OrthancPluginPeers* peers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6424 } _OrthancPluginGetPeersCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6425
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6426 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6427 * @brief Get the number of Orthanc peers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6428 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6429 * This function returns the number of Orthanc peers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6430 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6431 * This function is thread-safe: Several threads sharing the same
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6432 * OrthancPluginPeers object can simultaneously call this function.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6433 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6434 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6435 * @param peers The data structure describing the Orthanc peers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6436 * @result The number of peers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6437 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6438 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6439 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetPeersCount(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6440 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6441 const OrthancPluginPeers* peers)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6442 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6443 uint32_t target = 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6444
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6445 _OrthancPluginGetPeersCount params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6446 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6447 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6448 params.peers = peers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6449
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6450 if (context->InvokeService(context, _OrthancPluginService_GetPeersCount, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6451 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6452 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6453 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6454 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6455 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6456 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6457 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6458 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6459 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6460
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6461
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6462 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6463 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6464 const char** target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6465 const OrthancPluginPeers* peers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6466 uint32_t peerIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6467 const char* userProperty;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6468 } _OrthancPluginGetPeerProperty;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6469
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6470 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6471 * @brief Get the symbolic name of an Orthanc peer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6472 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6473 * This function returns the symbolic name of the Orthanc peer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6474 * which corresponds to the key of the "OrthancPeers" configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6475 * option of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6476 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6477 * This function is thread-safe: Several threads sharing the same
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6478 * OrthancPluginPeers object can simultaneously call this function.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6479 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6480 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6481 * @param peers The data structure describing the Orthanc peers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6482 * @param peerIndex The index of the peer of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6483 * This value must be lower than OrthancPluginGetPeersCount().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6484 * @result The symbolic name, or NULL in the case of an error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6485 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6486 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6487 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetPeerName(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6488 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6489 const OrthancPluginPeers* peers,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6490 uint32_t peerIndex)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6491 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6492 const char* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6493
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6494 _OrthancPluginGetPeerProperty params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6495 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6496 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6497 params.peers = peers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6498 params.peerIndex = peerIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6499 params.userProperty = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6500
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6501 if (context->InvokeService(context, _OrthancPluginService_GetPeerName, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6502 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6503 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6504 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6505 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6506 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6507 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6508 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6509 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6510 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6511
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6512
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6513 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6514 * @brief Get the base URL of an Orthanc peer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6515 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6516 * This function returns the base URL to the REST API of some Orthanc peer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6517 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6518 * This function is thread-safe: Several threads sharing the same
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6519 * OrthancPluginPeers object can simultaneously call this function.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6520 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6521 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6522 * @param peers The data structure describing the Orthanc peers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6523 * @param peerIndex The index of the peer of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6524 * This value must be lower than OrthancPluginGetPeersCount().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6525 * @result The URL, or NULL in the case of an error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6526 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6527 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6528 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetPeerUrl(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6529 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6530 const OrthancPluginPeers* peers,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6531 uint32_t peerIndex)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6532 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6533 const char* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6534
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6535 _OrthancPluginGetPeerProperty params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6536 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6537 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6538 params.peers = peers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6539 params.peerIndex = peerIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6540 params.userProperty = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6541
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6542 if (context->InvokeService(context, _OrthancPluginService_GetPeerUrl, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6543 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6544 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6545 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6546 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6547 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6548 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6549 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6550 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6551 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6552
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6553
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6554
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6555 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6556 * @brief Get some user-defined property of an Orthanc peer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6557 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6558 * This function returns some user-defined property of some Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6559 * peer. An user-defined property is a property that is associated
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6560 * with the peer in the Orthanc configuration file, but that is not
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6561 * recognized by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6562 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6563 * This function is thread-safe: Several threads sharing the same
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6564 * OrthancPluginPeers object can simultaneously call this function.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6565 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6566 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6567 * @param peers The data structure describing the Orthanc peers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6568 * @param peerIndex The index of the peer of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6569 * This value must be lower than OrthancPluginGetPeersCount().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6570 * @param userProperty The user property of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6571 * @result The value of the user property, or NULL if it is not defined.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6572 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6573 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6574 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetPeerUserProperty(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6575 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6576 const OrthancPluginPeers* peers,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6577 uint32_t peerIndex,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6578 const char* userProperty)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6579 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6580 const char* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6581
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6582 _OrthancPluginGetPeerProperty params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6583 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6584 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6585 params.peers = peers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6586 params.peerIndex = peerIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6587 params.userProperty = userProperty;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6588
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6589 if (context->InvokeService(context, _OrthancPluginService_GetPeerUserProperty, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6590 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6591 /* No such user property */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6592 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6593 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6594 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6595 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6596 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6597 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6598 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6599
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6600
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6601
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6602 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6603 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6604 OrthancPluginMemoryBuffer* answerBody;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6605 OrthancPluginMemoryBuffer* answerHeaders;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6606 uint16_t* httpStatus;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6607 const OrthancPluginPeers* peers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6608 uint32_t peerIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6609 OrthancPluginHttpMethod method;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6610 const char* uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6611 uint32_t additionalHeadersCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6612 const char* const* additionalHeadersKeys;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6613 const char* const* additionalHeadersValues;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6614 const void* body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6615 uint32_t bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6616 uint32_t timeout;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6617 } _OrthancPluginCallPeerApi;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6618
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6619 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6620 * @brief Call the REST API of an Orthanc peer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6621 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6622 * Make a REST call to the given URI in the REST API of a remote
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6623 * Orthanc peer. The result to the query is stored into a newly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6624 * allocated memory buffer. The HTTP request will be done according
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6625 * to the "OrthancPeers" configuration option of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6626 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6627 * This function is thread-safe: Several threads sharing the same
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6628 * OrthancPluginPeers object can simultaneously call this function.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6629 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6630 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6631 * @param answerBody The target memory buffer (out argument).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6632 * It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6633 * The value of this argument is ignored if the HTTP method is DELETE.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6634 * @param answerHeaders The target memory buffer for the HTTP headers in the answers (out argument).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6635 * The answer headers are formatted as a JSON object (associative array).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6636 * The buffer must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6637 * This argument can be set to NULL if the plugin has no interest in the HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6638 * @param httpStatus The HTTP status after the execution of the request (out argument).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6639 * @param peers The data structure describing the Orthanc peers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6640 * @param peerIndex The index of the peer of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6641 * This value must be lower than OrthancPluginGetPeersCount().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6642 * @param method HTTP method to be used.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6643 * @param uri The URI of interest in the REST API.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6644 * @param additionalHeadersCount The number of HTTP headers to be added to the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6645 * HTTP headers provided in the global configuration of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6646 * @param additionalHeadersKeys Array containing the keys of the HTTP headers (can be <tt>NULL</tt> if no header).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6647 * @param additionalHeadersValues Array containing the values of the HTTP headers (can be <tt>NULL</tt> if no header).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6648 * @param body The HTTP body for a POST or PUT request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6649 * @param bodySize The size of the body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6650 * @param timeout Timeout in seconds (0 for default timeout).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6651 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6652 * @see OrthancPluginHttpClient()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6653 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6654 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6655 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCallPeerApi(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6656 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6657 OrthancPluginMemoryBuffer* answerBody,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6658 OrthancPluginMemoryBuffer* answerHeaders,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6659 uint16_t* httpStatus,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6660 const OrthancPluginPeers* peers,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6661 uint32_t peerIndex,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6662 OrthancPluginHttpMethod method,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6663 const char* uri,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6664 uint32_t additionalHeadersCount,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6665 const char* const* additionalHeadersKeys,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6666 const char* const* additionalHeadersValues,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6667 const void* body,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6668 uint32_t bodySize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6669 uint32_t timeout)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6670 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6671 _OrthancPluginCallPeerApi params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6672 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6673
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6674 params.answerBody = answerBody;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6675 params.answerHeaders = answerHeaders;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6676 params.httpStatus = httpStatus;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6677 params.peers = peers;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6678 params.peerIndex = peerIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6679 params.method = method;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6680 params.uri = uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6681 params.additionalHeadersCount = additionalHeadersCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6682 params.additionalHeadersKeys = additionalHeadersKeys;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6683 params.additionalHeadersValues = additionalHeadersValues;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6684 params.body = body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6685 params.bodySize = bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6686 params.timeout = timeout;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6687
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6688 return context->InvokeService(context, _OrthancPluginService_CallPeerApi, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6689 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6690
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6691
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6692
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6693
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6694
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6695 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6696 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6697 OrthancPluginJob** target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6698 void *job;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6699 OrthancPluginJobFinalize finalize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6700 const char *type;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6701 OrthancPluginJobGetProgress getProgress;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6702 OrthancPluginJobGetContent getContent;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6703 OrthancPluginJobGetSerialized getSerialized;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6704 OrthancPluginJobStep step;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6705 OrthancPluginJobStop stop;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6706 OrthancPluginJobReset reset;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6707 } _OrthancPluginCreateJob;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6708
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6709 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6710 * @brief Create a custom job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6711 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6712 * This function creates a custom job to be run by the jobs engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6713 * of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6714 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6715 * Orthanc starts one dedicated thread per custom job that is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6716 * running. It is guaranteed that all the callbacks will only be
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6717 * called from this single dedicated thread, in mutual exclusion: As
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6718 * a consequence, it is *not* mandatory to protect the various
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6719 * callbacks by mutexes.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6720 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6721 * The custom job can nonetheless launch its own processing threads
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6722 * on the first call to the "step()" callback, and stop them once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6723 * the "stop()" callback is called.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6724 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6725 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6726 * @param job The job to be executed.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6727 * @param finalize The finalization callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6728 * @param type The type of the job, provided to the job unserializer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6729 * See OrthancPluginRegisterJobsUnserializer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6730 * @param getProgress The progress callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6731 * @param getContent The content callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6732 * @param getSerialized The serialization callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6733 * @param step The callback to execute the individual steps of the job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6734 * @param stop The callback that is invoked once the job leaves the "running" state.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6735 * @param reset The callback that is invoked if a stopped job is started again.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6736 * @return The newly allocated job. It must be freed with OrthancPluginFreeJob(),
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6737 * as long as it is not submitted with OrthancPluginSubmitJob().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6738 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6739 * @deprecated This signature should not be used anymore since Orthanc SDK 1.11.3.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6740 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6741 ORTHANC_PLUGIN_INLINE OrthancPluginJob *OrthancPluginCreateJob(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6742 OrthancPluginContext *context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6743 void *job,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6744 OrthancPluginJobFinalize finalize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6745 const char *type,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6746 OrthancPluginJobGetProgress getProgress,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6747 OrthancPluginJobGetContent getContent,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6748 OrthancPluginJobGetSerialized getSerialized,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6749 OrthancPluginJobStep step,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6750 OrthancPluginJobStop stop,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6751 OrthancPluginJobReset reset)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6752 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6753 OrthancPluginJob* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6754
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6755 _OrthancPluginCreateJob params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6756 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6757
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6758 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6759 params.job = job;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6760 params.finalize = finalize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6761 params.type = type;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6762 params.getProgress = getProgress;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6763 params.getContent = getContent;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6764 params.getSerialized = getSerialized;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6765 params.step = step;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6766 params.stop = stop;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6767 params.reset = reset;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6768
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6769 if (context->InvokeService(context, _OrthancPluginService_CreateJob, &params) != OrthancPluginErrorCode_Success ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6770 target == NULL)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6771 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6772 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6773 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6774 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6775 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6776 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6777 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6778 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6779 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6780
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6781
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6782 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6783 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6784 OrthancPluginJob** target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6785 void *job;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6786 OrthancPluginJobFinalize finalize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6787 const char *type;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6788 OrthancPluginJobGetProgress getProgress;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6789 OrthancPluginJobGetContent2 getContent;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6790 OrthancPluginJobGetSerialized2 getSerialized;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6791 OrthancPluginJobStep step;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6792 OrthancPluginJobStop stop;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6793 OrthancPluginJobReset reset;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6794 } _OrthancPluginCreateJob2;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6795
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6796 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6797 * @brief Create a custom job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6798 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6799 * This function creates a custom job to be run by the jobs engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6800 * of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6801 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6802 * Orthanc starts one dedicated thread per custom job that is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6803 * running. It is guaranteed that all the callbacks will only be
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6804 * called from this single dedicated thread, in mutual exclusion: As
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6805 * a consequence, it is *not* mandatory to protect the various
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6806 * callbacks by mutexes.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6807 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6808 * The custom job can nonetheless launch its own processing threads
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6809 * on the first call to the "step()" callback, and stop them once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6810 * the "stop()" callback is called.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6811 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6812 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6813 * @param job The job to be executed.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6814 * @param finalize The finalization callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6815 * @param type The type of the job, provided to the job unserializer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6816 * See OrthancPluginRegisterJobsUnserializer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6817 * @param getProgress The progress callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6818 * @param getContent The content callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6819 * @param getSerialized The serialization callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6820 * @param step The callback to execute the individual steps of the job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6821 * @param stop The callback that is invoked once the job leaves the "running" state.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6822 * @param reset The callback that is invoked if a stopped job is started again.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6823 * @return The newly allocated job. It must be freed with OrthancPluginFreeJob(),
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6824 * as long as it is not submitted with OrthancPluginSubmitJob().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6825 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6826 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6827 ORTHANC_PLUGIN_INLINE OrthancPluginJob *OrthancPluginCreateJob2(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6828 OrthancPluginContext *context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6829 void *job,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6830 OrthancPluginJobFinalize finalize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6831 const char *type,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6832 OrthancPluginJobGetProgress getProgress,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6833 OrthancPluginJobGetContent2 getContent,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6834 OrthancPluginJobGetSerialized2 getSerialized,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6835 OrthancPluginJobStep step,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6836 OrthancPluginJobStop stop,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6837 OrthancPluginJobReset reset)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6838 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6839 OrthancPluginJob* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6840
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6841 _OrthancPluginCreateJob2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6842 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6843
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6844 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6845 params.job = job;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6846 params.finalize = finalize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6847 params.type = type;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6848 params.getProgress = getProgress;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6849 params.getContent = getContent;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6850 params.getSerialized = getSerialized;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6851 params.step = step;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6852 params.stop = stop;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6853 params.reset = reset;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6854
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6855 if (context->InvokeService(context, _OrthancPluginService_CreateJob2, &params) != OrthancPluginErrorCode_Success ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6856 target == NULL)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6857 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6858 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6859 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6860 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6861 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6862 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6863 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6864 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6865 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6866
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6867
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6868 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6869 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6870 OrthancPluginJob* job;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6871 } _OrthancPluginFreeJob;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6872
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6873 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6874 * @brief Free a custom job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6875 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6876 * This function frees an image that was created with OrthancPluginCreateJob().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6877 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6878 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6879 * @param job The job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6880 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6881 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6882 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeJob(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6883 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6884 OrthancPluginJob* job)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6885 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6886 _OrthancPluginFreeJob params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6887 params.job = job;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6888
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6889 context->InvokeService(context, _OrthancPluginService_FreeJob, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6890 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6891
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6892
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6893
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6894 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6895 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6896 char** resultId;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6897 OrthancPluginJob *job;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6898 int priority;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6899 } _OrthancPluginSubmitJob;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6900
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6901 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6902 * @brief Submit a new job to the jobs engine of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6903 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6904 * This function adds the given job to the pending jobs of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6905 * Orthanc. Orthanc will take take of freeing it by invoking the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6906 * finalization callback provided to OrthancPluginCreateJob().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6907 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6908 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6909 * @param job The job, as received by OrthancPluginCreateJob().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6910 * @param priority The priority of the job.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6911 * @return ID of the newly-submitted job. This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6912 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6913 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6914 ORTHANC_PLUGIN_INLINE char *OrthancPluginSubmitJob(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6915 OrthancPluginContext *context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6916 OrthancPluginJob *job,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6917 int priority)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6918 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6919 char* resultId = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6920
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6921 _OrthancPluginSubmitJob params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6922 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6923
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6924 params.resultId = &resultId;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6925 params.job = job;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6926 params.priority = priority;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6927
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6928 if (context->InvokeService(context, _OrthancPluginService_SubmitJob, &params) != OrthancPluginErrorCode_Success ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6929 resultId == NULL)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6930 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6931 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6932 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6933 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6934 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6935 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6936 return resultId;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6937 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6938 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6939
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6940
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6941
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6942 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6943 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6944 OrthancPluginJobsUnserializer unserializer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6945 } _OrthancPluginJobsUnserializer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6946
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6947 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6948 * @brief Register an unserializer for custom jobs.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6949 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6950 * This function registers an unserializer that decodes custom jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6951 * from a JSON string. This callback is invoked when the jobs engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6952 * of Orthanc is started (on Orthanc initialization), for each job
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6953 * that is stored in the Orthanc database.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6954 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6955 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6956 * @param unserializer The job unserializer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6957 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6958 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6959 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterJobsUnserializer(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6960 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6961 OrthancPluginJobsUnserializer unserializer)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6962 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6963 _OrthancPluginJobsUnserializer params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6964 params.unserializer = unserializer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6965
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6966 context->InvokeService(context, _OrthancPluginService_RegisterJobsUnserializer, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6967 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6968
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6969
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6970
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6971 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6972 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6973 OrthancPluginRestOutput* output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6974 const char* details;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6975 uint8_t log;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6976 } _OrthancPluginSetHttpErrorDetails;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6977
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6978 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6979 * @brief Provide a detailed description for an HTTP error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6980 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6981 * This function sets the detailed description associated with an
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6982 * HTTP error. This description will be displayed in the "Details"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6983 * field of the JSON body of the HTTP answer. It is only taken into
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6984 * consideration if the REST callback returns an error code that is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6985 * different from "OrthancPluginErrorCode_Success", and if the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6986 * "HttpDescribeErrors" configuration option of Orthanc is set to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6987 * "true".
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6988 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6989 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6990 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6991 * @param details The details of the error message.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6992 * @param log Whether to also write the detailed error to the Orthanc logs.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6993 * @ingroup REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6994 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6995 ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpErrorDetails(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6996 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6997 OrthancPluginRestOutput* output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6998 const char* details,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6999 uint8_t log)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7000 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7001 _OrthancPluginSetHttpErrorDetails params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7002 params.output = output;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7003 params.details = details;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7004 params.log = log;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7005 context->InvokeService(context, _OrthancPluginService_SetHttpErrorDetails, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7006 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7007
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7008
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7009
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7010 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7011 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7012 const char** result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7013 const char* argument;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7014 } _OrthancPluginRetrieveStaticString;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7016 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7017 * @brief Detect the MIME type of a file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7018 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7019 * This function returns the MIME type of a file by inspecting its extension.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7020 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7021 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7022 * @param path Path to the file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7023 * @return The MIME type. This is a statically-allocated
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7024 * string, do not free it.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7025 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7026 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7027 ORTHANC_PLUGIN_INLINE const char* OrthancPluginAutodetectMimeType(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7028 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7029 const char* path)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7030 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7031 const char* result = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7032
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7033 _OrthancPluginRetrieveStaticString params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7034 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7035 params.argument = path;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7036
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7037 if (context->InvokeService(context, _OrthancPluginService_AutodetectMimeType, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7038 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7039 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7040 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7041 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7042 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7043 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7044 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7045 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7046 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7047
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7048
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7049
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7050 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7051 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7052 const char* name;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7053 float value;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7054 OrthancPluginMetricsType type;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7055 } _OrthancPluginSetMetricsValue;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7056
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7057 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7058 * @brief Set the value of a metrics.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7059 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7060 * This function sets the value of a metrics to monitor the behavior
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7061 * of the plugin through tools such as Prometheus. The values of all
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7062 * the metrics are stored within the Orthanc context.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7063 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7064 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7065 * @param name The name of the metrics to be set.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7066 * @param value The value of the metrics.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7067 * @param type The type of the metrics. This parameter is only taken into consideration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7068 * the first time this metrics is set.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7069 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7070 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7071 ORTHANC_PLUGIN_INLINE void OrthancPluginSetMetricsValue(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7072 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7073 const char* name,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7074 float value,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7075 OrthancPluginMetricsType type)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7076 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7077 _OrthancPluginSetMetricsValue params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7078 params.name = name;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7079 params.value = value;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7080 params.type = type;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7081 context->InvokeService(context, _OrthancPluginService_SetMetricsValue, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7082 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7083
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7084
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7085
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7086 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7087 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7088 OrthancPluginRefreshMetricsCallback callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7089 } _OrthancPluginRegisterRefreshMetricsCallback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7090
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7091 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7092 * @brief Register a callback to refresh the metrics.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7093 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7094 * This function registers a callback to refresh the metrics. The
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7095 * callback must make calls to OrthancPluginSetMetricsValue().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7096 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7097 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7098 * @param callback The callback function to handle the refresh.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7099 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7100 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7101 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRefreshMetricsCallback(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7102 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7103 OrthancPluginRefreshMetricsCallback callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7104 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7105 _OrthancPluginRegisterRefreshMetricsCallback params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7106 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7107 context->InvokeService(context, _OrthancPluginService_RegisterRefreshMetricsCallback, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7108 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7109
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7110
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7111
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7112
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7113 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7114 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7115 char** target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7116 const void* dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7117 uint32_t dicomSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7118 OrthancPluginDicomWebBinaryCallback callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7119 } _OrthancPluginEncodeDicomWeb;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7120
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7121 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7122 * @brief Convert a DICOM instance to DICOMweb JSON.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7123 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7124 * This function converts a memory buffer containing a DICOM instance,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7125 * into its DICOMweb JSON representation.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7126 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7127 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7128 * @param dicom Pointer to the DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7129 * @param dicomSize Size of the DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7130 * @param callback Callback to set the value of the binary tags.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7131 * @see OrthancPluginCreateDicom()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7132 * @return The NULL value in case of error, or the JSON document. This string must
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7133 * be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7134 * @deprecated OrthancPluginEncodeDicomWebJson2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7135 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7136 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7137 ORTHANC_PLUGIN_INLINE char* OrthancPluginEncodeDicomWebJson(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7138 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7139 const void* dicom,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7140 uint32_t dicomSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7141 OrthancPluginDicomWebBinaryCallback callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7142 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7143 char* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7144
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7145 _OrthancPluginEncodeDicomWeb params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7146 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7147 params.dicom = dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7148 params.dicomSize = dicomSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7149 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7150
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7151 if (context->InvokeService(context, _OrthancPluginService_EncodeDicomWebJson, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7152 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7153 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7154 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7155 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7156 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7157 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7158 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7159 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7160 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7161
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7162
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7163 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7164 * @brief Convert a DICOM instance to DICOMweb XML.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7165 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7166 * This function converts a memory buffer containing a DICOM instance,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7167 * into its DICOMweb XML representation.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7168 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7169 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7170 * @param dicom Pointer to the DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7171 * @param dicomSize Size of the DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7172 * @param callback Callback to set the value of the binary tags.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7173 * @return The NULL value in case of error, or the XML document. This string must
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7174 * be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7175 * @see OrthancPluginCreateDicom()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7176 * @deprecated OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7177 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7178 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7179 ORTHANC_PLUGIN_INLINE char* OrthancPluginEncodeDicomWebXml(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7180 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7181 const void* dicom,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7182 uint32_t dicomSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7183 OrthancPluginDicomWebBinaryCallback callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7184 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7185 char* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7186
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7187 _OrthancPluginEncodeDicomWeb params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7188 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7189 params.dicom = dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7190 params.dicomSize = dicomSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7191 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7192
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7193 if (context->InvokeService(context, _OrthancPluginService_EncodeDicomWebXml, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7194 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7195 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7196 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7197 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7198 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7199 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7200 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7201 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7202 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7203
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7204
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7205
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7206 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7207 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7208 char** target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7209 const void* dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7210 uint32_t dicomSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7211 OrthancPluginDicomWebBinaryCallback2 callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7212 void* payload;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7213 } _OrthancPluginEncodeDicomWeb2;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7214
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7215 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7216 * @brief Convert a DICOM instance to DICOMweb JSON.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7217 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7218 * This function converts a memory buffer containing a DICOM instance,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7219 * into its DICOMweb JSON representation.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7220 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7221 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7222 * @param dicom Pointer to the DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7223 * @param dicomSize Size of the DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7224 * @param callback Callback to set the value of the binary tags.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7225 * @param payload User payload.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7226 * @return The NULL value in case of error, or the JSON document. This string must
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7227 * be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7228 * @see OrthancPluginCreateDicom()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7229 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7230 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7231 ORTHANC_PLUGIN_INLINE char* OrthancPluginEncodeDicomWebJson2(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7232 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7233 const void* dicom,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7234 uint32_t dicomSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7235 OrthancPluginDicomWebBinaryCallback2 callback,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7236 void* payload)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7237 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7238 char* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7239
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7240 _OrthancPluginEncodeDicomWeb2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7241 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7242 params.dicom = dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7243 params.dicomSize = dicomSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7244 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7245 params.payload = payload;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7246
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7247 if (context->InvokeService(context, _OrthancPluginService_EncodeDicomWebJson2, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7248 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7249 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7250 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7251 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7252 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7253 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7254 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7255 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7256 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7257
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7258
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7259 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7260 * @brief Convert a DICOM instance to DICOMweb XML.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7261 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7262 * This function converts a memory buffer containing a DICOM instance,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7263 * into its DICOMweb XML representation.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7264 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7265 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7266 * @param dicom Pointer to the DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7267 * @param dicomSize Size of the DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7268 * @param callback Callback to set the value of the binary tags.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7269 * @param payload User payload.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7270 * @return The NULL value in case of error, or the XML document. This string must
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7271 * be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7272 * @see OrthancPluginCreateDicom()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7273 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7274 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7275 ORTHANC_PLUGIN_INLINE char* OrthancPluginEncodeDicomWebXml2(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7276 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7277 const void* dicom,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7278 uint32_t dicomSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7279 OrthancPluginDicomWebBinaryCallback2 callback,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7280 void* payload)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7281 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7282 char* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7283
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7284 _OrthancPluginEncodeDicomWeb2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7285 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7286 params.dicom = dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7287 params.dicomSize = dicomSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7288 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7289 params.payload = payload;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7290
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7291 if (context->InvokeService(context, _OrthancPluginService_EncodeDicomWebXml2, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7292 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7293 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7294 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7295 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7296 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7297 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7298 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7299 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7300 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7301
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7302
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7303
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7304 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7305 * @brief Callback executed when a HTTP header is received during a chunked transfer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7306 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7307 * Signature of a callback function that is called by Orthanc acting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7308 * as a HTTP client during a chunked HTTP transfer, as soon as it
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7309 * receives one HTTP header from the answer of the remote HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7310 * server.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7311 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7312 * @see OrthancPluginChunkedHttpClient()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7313 * @param answer The user payload, as provided by the calling plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7314 * @param key The key of the HTTP header.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7315 * @param value The value of the HTTP header.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7316 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7317 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7318 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7319 typedef OrthancPluginErrorCode (*OrthancPluginChunkedClientAnswerAddHeader) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7320 void* answer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7321 const char* key,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7322 const char* value);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7323
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7324
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7325 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7326 * @brief Callback executed when an answer chunk is received during a chunked transfer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7327 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7328 * Signature of a callback function that is called by Orthanc acting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7329 * as a HTTP client during a chunked HTTP transfer, as soon as it
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7330 * receives one data chunk from the answer of the remote HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7331 * server.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7332 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7333 * @see OrthancPluginChunkedHttpClient()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7334 * @param answer The user payload, as provided by the calling plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7335 * @param data The content of the data chunk.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7336 * @param size The size of the data chunk.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7337 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7338 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7339 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7340 typedef OrthancPluginErrorCode (*OrthancPluginChunkedClientAnswerAddChunk) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7341 void* answer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7342 const void* data,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7343 uint32_t size);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7344
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7345
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7346 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7347 * @brief Callback to know whether the request body is entirely read during a chunked transfer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7348 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7349 * Signature of a callback function that is called by Orthanc acting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7350 * as a HTTP client during a chunked HTTP transfer, while reading
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7351 * the body of a POST or PUT request. The plugin must answer "1" as
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7352 * soon as the body is entirely read: The "request" data structure
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7353 * must act as an iterator.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7354 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7355 * @see OrthancPluginChunkedHttpClient()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7356 * @param request The user payload, as provided by the calling plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7357 * @return "1" if the body is over, or "0" if there is still data to be read.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7358 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7359 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7360 typedef uint8_t (*OrthancPluginChunkedClientRequestIsDone) (void* request);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7361
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7362
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7363 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7364 * @brief Callback to advance in the request body during a chunked transfer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7365 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7366 * Signature of a callback function that is called by Orthanc acting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7367 * as a HTTP client during a chunked HTTP transfer, while reading
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7368 * the body of a POST or PUT request. This function asks the plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7369 * to advance to the next chunk of data of the request body: The
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7370 * "request" data structure must act as an iterator.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7371 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7372 * @see OrthancPluginChunkedHttpClient()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7373 * @param request The user payload, as provided by the calling plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7374 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7375 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7376 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7377 typedef OrthancPluginErrorCode (*OrthancPluginChunkedClientRequestNext) (void* request);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7378
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7379
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7380 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7381 * @brief Callback to read the current chunk of the request body during a chunked transfer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7382 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7383 * Signature of a callback function that is called by Orthanc acting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7384 * as a HTTP client during a chunked HTTP transfer, while reading
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7385 * the body of a POST or PUT request. The plugin must provide the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7386 * content of the current chunk of data of the request body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7387 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7388 * @see OrthancPluginChunkedHttpClient()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7389 * @param request The user payload, as provided by the calling plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7390 * @return The content of the current request chunk.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7391 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7392 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7393 typedef const void* (*OrthancPluginChunkedClientRequestGetChunkData) (void* request);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7394
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7395
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7396 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7397 * @brief Callback to read the size of the current request chunk during a chunked transfer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7398 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7399 * Signature of a callback function that is called by Orthanc acting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7400 * as a HTTP client during a chunked HTTP transfer, while reading
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7401 * the body of a POST or PUT request. The plugin must provide the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7402 * size of the current chunk of data of the request body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7403 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7404 * @see OrthancPluginChunkedHttpClient()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7405 * @param request The user payload, as provided by the calling plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7406 * @return The size of the current request chunk.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7407 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7408 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7409 typedef uint32_t (*OrthancPluginChunkedClientRequestGetChunkSize) (void* request);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7410
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7411
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7412 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7413 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7414 void* answer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7415 OrthancPluginChunkedClientAnswerAddChunk answerAddChunk;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7416 OrthancPluginChunkedClientAnswerAddHeader answerAddHeader;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7417 uint16_t* httpStatus;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7418 OrthancPluginHttpMethod method;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7419 const char* url;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7420 uint32_t headersCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7421 const char* const* headersKeys;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7422 const char* const* headersValues;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7423 void* request;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7424 OrthancPluginChunkedClientRequestIsDone requestIsDone;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7425 OrthancPluginChunkedClientRequestGetChunkData requestChunkData;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7426 OrthancPluginChunkedClientRequestGetChunkSize requestChunkSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7427 OrthancPluginChunkedClientRequestNext requestNext;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7428 const char* username;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7429 const char* password;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7430 uint32_t timeout;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7431 const char* certificateFile;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7432 const char* certificateKeyFile;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7433 const char* certificateKeyPassword;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7434 uint8_t pkcs11;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7435 } _OrthancPluginChunkedHttpClient;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7436
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7437
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7438 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7439 * @brief Issue a HTTP call, using chunked HTTP transfers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7440 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7441 * Make a HTTP call to the given URL using chunked HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7442 * transfers. The request body is provided as an iterator over data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7443 * chunks. The answer is provided as a sequence of function calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7444 * with the individual HTTP headers and answer chunks.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7445 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7446 * Contrarily to OrthancPluginHttpClient() that entirely stores the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7447 * request body and the answer body in memory buffers, this function
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7448 * uses chunked HTTP transfers. This results in a lower memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7449 * consumption. Pay attention to the fact that Orthanc servers with
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7450 * version <= 1.5.6 do not support chunked transfers: You must use
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7451 * OrthancPluginHttpClient() if contacting such older servers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7452 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7453 * The HTTP request will be done accordingly to the global
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7454 * configuration of Orthanc (in particular, the options "HttpProxy",
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7455 * "HttpTimeout", "HttpsVerifyPeers", "HttpsCACertificates", and
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7456 * "Pkcs11" will be taken into account).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7457 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7458 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7459 * @param answer The user payload for the answer body. It will be provided to the callbacks for the answer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7460 * @param answerAddChunk Callback function to report a data chunk from the answer body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7461 * @param answerAddHeader Callback function to report an HTTP header sent by the remote server.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7462 * @param httpStatus The HTTP status after the execution of the request (out argument).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7463 * @param method HTTP method to be used.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7464 * @param url The URL of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7465 * @param headersCount The number of HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7466 * @param headersKeys Array containing the keys of the HTTP headers (can be <tt>NULL</tt> if no header).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7467 * @param headersValues Array containing the values of the HTTP headers (can be <tt>NULL</tt> if no header).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7468 * @param request The user payload containing the request body, and acting as an iterator.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7469 * It will be provided to the callbacks for the request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7470 * @param requestIsDone Callback function to tell whether the request body is entirely read.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7471 * @param requestChunkData Callback function to get the content of the current data chunk of the request body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7472 * @param requestChunkSize Callback function to get the size of the current data chunk of the request body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7473 * @param requestNext Callback function to advance to the next data chunk of the request body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7474 * @param username The username (can be <tt>NULL</tt> if no password protection).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7475 * @param password The password (can be <tt>NULL</tt> if no password protection).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7476 * @param timeout Timeout in seconds (0 for default timeout).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7477 * @param certificateFile Path to the client certificate for HTTPS, in PEM format
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7478 * (can be <tt>NULL</tt> if no client certificate or if not using HTTPS).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7479 * @param certificateKeyFile Path to the key of the client certificate for HTTPS, in PEM format
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7480 * (can be <tt>NULL</tt> if no client certificate or if not using HTTPS).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7481 * @param certificateKeyPassword Password to unlock the key of the client certificate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7482 * (can be <tt>NULL</tt> if no client certificate or if not using HTTPS).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7483 * @param pkcs11 Enable PKCS#11 client authentication for hardware security modules and smart cards.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7484 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7485 * @see OrthancPluginHttpClient()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7486 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7487 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7488 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginChunkedHttpClient(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7489 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7490 void* answer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7491 OrthancPluginChunkedClientAnswerAddChunk answerAddChunk,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7492 OrthancPluginChunkedClientAnswerAddHeader answerAddHeader,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7493 uint16_t* httpStatus,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7494 OrthancPluginHttpMethod method,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7495 const char* url,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7496 uint32_t headersCount,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7497 const char* const* headersKeys,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7498 const char* const* headersValues,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7499 void* request,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7500 OrthancPluginChunkedClientRequestIsDone requestIsDone,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7501 OrthancPluginChunkedClientRequestGetChunkData requestChunkData,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7502 OrthancPluginChunkedClientRequestGetChunkSize requestChunkSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7503 OrthancPluginChunkedClientRequestNext requestNext,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7504 const char* username,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7505 const char* password,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7506 uint32_t timeout,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7507 const char* certificateFile,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7508 const char* certificateKeyFile,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7509 const char* certificateKeyPassword,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7510 uint8_t pkcs11)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7511 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7512 _OrthancPluginChunkedHttpClient params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7513 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7514
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7515 /* In common with OrthancPluginHttpClient() */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7516 params.httpStatus = httpStatus;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7517 params.method = method;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7518 params.url = url;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7519 params.headersCount = headersCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7520 params.headersKeys = headersKeys;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7521 params.headersValues = headersValues;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7522 params.username = username;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7523 params.password = password;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7524 params.timeout = timeout;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7525 params.certificateFile = certificateFile;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7526 params.certificateKeyFile = certificateKeyFile;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7527 params.certificateKeyPassword = certificateKeyPassword;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7528 params.pkcs11 = pkcs11;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7529
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7530 /* For chunked body/answer */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7531 params.answer = answer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7532 params.answerAddChunk = answerAddChunk;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7533 params.answerAddHeader = answerAddHeader;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7534 params.request = request;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7535 params.requestIsDone = requestIsDone;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7536 params.requestChunkData = requestChunkData;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7537 params.requestChunkSize = requestChunkSize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7538 params.requestNext = requestNext;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7539
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7540 return context->InvokeService(context, _OrthancPluginService_ChunkedHttpClient, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7541 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7542
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7543
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7544
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7545 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7546 * @brief Opaque structure that reads the content of a HTTP request body during a chunked HTTP transfer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7547 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7548 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7549 typedef struct _OrthancPluginServerChunkedRequestReader_t OrthancPluginServerChunkedRequestReader;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7550
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7551
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7552
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7553 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7554 * @brief Callback to create a reader to handle incoming chunked HTTP transfers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7555 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7556 * Signature of a callback function that is called by Orthanc acting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7557 * as a HTTP server that supports chunked HTTP transfers. This
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7558 * callback is only invoked if the HTTP method is POST or PUT. The
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7559 * callback must create an user-specific "reader" object that will
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7560 * be fed with the body of the incoming body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7561 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7562 * @see OrthancPluginRegisterChunkedRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7563 * @param reader Memory location that must be filled with the newly-created reader.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7564 * @param url The URI that is accessed.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7565 * @param request The body of the HTTP request. Note that "body" and "bodySize" are not used.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7566 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7567 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7568 typedef OrthancPluginErrorCode (*OrthancPluginServerChunkedRequestReaderFactory) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7569 OrthancPluginServerChunkedRequestReader** reader,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7570 const char* url,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7571 const OrthancPluginHttpRequest* request);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7572
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7573
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7574 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7575 * @brief Callback invoked whenever a new data chunk is available during a chunked transfer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7576 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7577 * Signature of a callback function that is called by Orthanc acting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7578 * as a HTTP server that supports chunked HTTP transfers. This callback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7579 * is invoked as soon as a new data chunk is available for the request body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7580 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7581 * @see OrthancPluginRegisterChunkedRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7582 * @param reader The user payload, as created by the OrthancPluginServerChunkedRequestReaderFactory() callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7583 * @param data The content of the data chunk.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7584 * @param size The size of the data chunk.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7585 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7586 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7587 typedef OrthancPluginErrorCode (*OrthancPluginServerChunkedRequestReaderAddChunk) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7588 OrthancPluginServerChunkedRequestReader* reader,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7589 const void* data,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7590 uint32_t size);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7591
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7592
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7593 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7594 * @brief Callback invoked whenever the request body is entirely received.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7595 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7596 * Signature of a callback function that is called by Orthanc acting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7597 * as a HTTP server that supports chunked HTTP transfers. This
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7598 * callback is invoked as soon as the full body of the HTTP request
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7599 * is available. The plugin can then send its answer thanks to the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7600 * provided "output" object.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7601 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7602 * @see OrthancPluginRegisterChunkedRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7603 * @param reader The user payload, as created by the OrthancPluginServerChunkedRequestReaderFactory() callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7604 * @param output The HTTP connection to the client application.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7605 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7606 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7607 typedef OrthancPluginErrorCode (*OrthancPluginServerChunkedRequestReaderExecute) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7608 OrthancPluginServerChunkedRequestReader* reader,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7609 OrthancPluginRestOutput* output);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7610
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7611
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7612 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7613 * @brief Callback invoked to release the resources associated with an incoming HTTP chunked transfer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7614 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7615 * Signature of a callback function that is called by Orthanc acting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7616 * as a HTTP server that supports chunked HTTP transfers. This
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7617 * callback is invoked to release all the resources allocated by the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7618 * given reader. Note that this function might be invoked even if
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7619 * the entire body was not read, to deal with client error or
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7620 * disconnection.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7621 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7622 * @see OrthancPluginRegisterChunkedRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7623 * @param reader The user payload, as created by the OrthancPluginServerChunkedRequestReaderFactory() callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7624 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7625 typedef void (*OrthancPluginServerChunkedRequestReaderFinalize) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7626 OrthancPluginServerChunkedRequestReader* reader);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7627
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7628 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7629 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7630 const char* pathRegularExpression;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7631 OrthancPluginRestCallback getHandler;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7632 OrthancPluginServerChunkedRequestReaderFactory postHandler;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7633 OrthancPluginRestCallback deleteHandler;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7634 OrthancPluginServerChunkedRequestReaderFactory putHandler;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7635 OrthancPluginServerChunkedRequestReaderAddChunk addChunk;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7636 OrthancPluginServerChunkedRequestReaderExecute execute;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7637 OrthancPluginServerChunkedRequestReaderFinalize finalize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7638 } _OrthancPluginChunkedRestCallback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7639
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7640
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7641 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7642 * @brief Register a REST callback to handle chunked HTTP transfers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7643 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7644 * This function registers a REST callback against a regular
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7645 * expression for a URI. This function must be called during the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7646 * initialization of the plugin, i.e. inside the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7647 * OrthancPluginInitialize() public function.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7648 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7649 * Contrarily to OrthancPluginRegisterRestCallback(), the callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7650 * will NOT be invoked in mutual exclusion, so it is up to the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7651 * plugin to implement the required locking mechanisms.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7652 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7653 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7654 * @param pathRegularExpression Regular expression for the URI. May contain groups.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7655 * @param getHandler The callback function to handle REST calls using the GET HTTP method.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7656 * @param postHandler The callback function to handle REST calls using the POST HTTP method.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7657 * @param deleteHandler The callback function to handle REST calls using the DELETE HTTP method.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7658 * @param putHandler The callback function to handle REST calls using the PUT HTTP method.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7659 * @param addChunk The callback invoked when a new chunk is available for the request body of a POST or PUT call.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7660 * @param execute The callback invoked once the entire body of a POST or PUT call is read.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7661 * @param finalize The callback invoked to release the resources associated with a POST or PUT call.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7662 * @see OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7663 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7664 * @note
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7665 * The regular expression is case sensitive and must follow the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7666 * [Perl syntax](https://www.boost.org/doc/libs/1_67_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7667 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7668 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7669 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7670 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterChunkedRestCallback(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7671 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7672 const char* pathRegularExpression,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7673 OrthancPluginRestCallback getHandler,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7674 OrthancPluginServerChunkedRequestReaderFactory postHandler,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7675 OrthancPluginRestCallback deleteHandler,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7676 OrthancPluginServerChunkedRequestReaderFactory putHandler,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7677 OrthancPluginServerChunkedRequestReaderAddChunk addChunk,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7678 OrthancPluginServerChunkedRequestReaderExecute execute,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7679 OrthancPluginServerChunkedRequestReaderFinalize finalize)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7680 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7681 _OrthancPluginChunkedRestCallback params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7682 params.pathRegularExpression = pathRegularExpression;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7683 params.getHandler = getHandler;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7684 params.postHandler = postHandler;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7685 params.deleteHandler = deleteHandler;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7686 params.putHandler = putHandler;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7687 params.addChunk = addChunk;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7688 params.execute = execute;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7689 params.finalize = finalize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7690
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7691 context->InvokeService(context, _OrthancPluginService_RegisterChunkedRestCallback, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7692 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7693
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7694
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7695
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7696
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7697
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7698 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7699 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7700 char** result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7701 uint16_t group;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7702 uint16_t element;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7703 const char* privateCreator;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7704 } _OrthancPluginGetTagName;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7705
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7706 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7707 * @brief Returns the symbolic name of a DICOM tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7708 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7709 * This function makes a lookup to the dictionary of DICOM tags that
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7710 * are known to Orthanc, and returns the symbolic name of a DICOM tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7711 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7712 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7713 * @param group The group of the tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7714 * @param element The element of the tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7715 * @param privateCreator For private tags, the name of the private creator (can be NULL).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7716 * @return NULL in the case of an error, or a newly allocated string
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7717 * containing the path. This string must be freed by
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7718 * OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7719 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7720 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7721 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetTagName(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7722 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7723 uint16_t group,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7724 uint16_t element,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7725 const char* privateCreator)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7726 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7727 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7728
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7729 _OrthancPluginGetTagName params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7730 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7731 params.group = group;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7732 params.element = element;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7733 params.privateCreator = privateCreator;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7734
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7735 if (context->InvokeService(context, _OrthancPluginService_GetTagName, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7736 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7737 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7738 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7739 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7740 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7741 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7742 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7743 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7744 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7745
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7746
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7747
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7748 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7749 * @brief Callback executed by the storage commitment SCP.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7750 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7751 * Signature of a factory function that creates an object to handle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7752 * one incoming storage commitment request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7753 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7754 * @remark The factory receives the list of the SOP class/instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7755 * UIDs of interest to the remote storage commitment SCU. This gives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7756 * the factory the possibility to start some prefetch process
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7757 * upfront in the background, before the handler object is actually
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7758 * queried about the status of these DICOM instances.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7759 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7760 * @param handler Output variable where the factory puts the handler object it created.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7761 * @param jobId ID of the Orthanc job that is responsible for handling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7762 * the storage commitment request. This job will successively look for the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7763 * status of all the individual queried DICOM instances.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7764 * @param transactionUid UID of the storage commitment transaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7765 * provided by the storage commitment SCU. It contains the value of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7766 * (0008,1195) DICOM tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7767 * @param sopClassUids Array of the SOP class UIDs (0008,0016) that are queried by the SCU.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7768 * @param sopInstanceUids Array of the SOP instance UIDs (0008,0018) that are queried by the SCU.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7769 * @param countInstances Number of DICOM instances that are queried. This is the size
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7770 * of the `sopClassUids` and `sopInstanceUids` arrays.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7771 * @param remoteAet The AET of the storage commitment SCU.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7772 * @param calledAet The AET used by the SCU to contact the storage commitment SCP (i.e. Orthanc).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7773 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7774 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7775 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7776 typedef OrthancPluginErrorCode (*OrthancPluginStorageCommitmentFactory) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7777 void** handler /* out */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7778 const char* jobId,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7779 const char* transactionUid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7780 const char* const* sopClassUids,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7781 const char* const* sopInstanceUids,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7782 uint32_t countInstances,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7783 const char* remoteAet,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7784 const char* calledAet);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7785
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7786
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7787 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7788 * @brief Callback to free one storage commitment SCP handler.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7789 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7790 * Signature of a callback function that releases the resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7791 * allocated by the factory of the storage commitment SCP. The
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7792 * handler is the return value of a previous call to the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7793 * OrthancPluginStorageCommitmentFactory() callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7794 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7795 * @param handler The handler object to be destructed.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7796 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7797 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7798 typedef void (*OrthancPluginStorageCommitmentDestructor) (void* handler);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7799
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7800
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7801 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7802 * @brief Callback to get the status of one DICOM instance in the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7803 * storage commitment SCP.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7804 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7805 * Signature of a callback function that is successively invoked for
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7806 * each DICOM instance that is queried by the remote storage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7807 * commitment SCU. The function must be tought of as a method of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7808 * the handler object that was created by a previous call to the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7809 * OrthancPluginStorageCommitmentFactory() callback. After each call
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7810 * to this method, the progress of the associated Orthanc job is
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7811 * updated.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7812 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7813 * @param target Output variable where to put the status for the queried instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7814 * @param handler The handler object associated with this storage commitment request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7815 * @param sopClassUid The SOP class UID (0008,0016) of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7816 * @param sopInstanceUid The SOP instance UID (0008,0018) of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7817 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7818 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7819 typedef OrthancPluginErrorCode (*OrthancPluginStorageCommitmentLookup) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7820 OrthancPluginStorageCommitmentFailureReason* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7821 void* handler,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7822 const char* sopClassUid,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7823 const char* sopInstanceUid);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7824
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7825
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7826 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7827 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7828 OrthancPluginStorageCommitmentFactory factory;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7829 OrthancPluginStorageCommitmentDestructor destructor;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7830 OrthancPluginStorageCommitmentLookup lookup;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7831 } _OrthancPluginRegisterStorageCommitmentScpCallback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7832
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7833 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7834 * @brief Register a callback to handle incoming requests to the storage commitment SCP.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7835 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7836 * This function registers a callback to handle storage commitment SCP requests.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7837 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7838 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7839 * @param factory Factory function that creates the handler object
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7840 * for incoming storage commitment requests.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7841 * @param destructor Destructor function to destroy the handler object.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7842 * @param lookup Callback function to get the status of one DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7843 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7844 * @ingroup DicomCallbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7845 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7846 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterStorageCommitmentScpCallback(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7847 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7848 OrthancPluginStorageCommitmentFactory factory,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7849 OrthancPluginStorageCommitmentDestructor destructor,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7850 OrthancPluginStorageCommitmentLookup lookup)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7851 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7852 _OrthancPluginRegisterStorageCommitmentScpCallback params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7853 params.factory = factory;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7854 params.destructor = destructor;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7855 params.lookup = lookup;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7856 return context->InvokeService(context, _OrthancPluginService_RegisterStorageCommitmentScpCallback, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7857 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7858
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7859
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7860
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7861 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7862 * @brief Callback to filter incoming DICOM instances received by Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7863 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7864 * Signature of a callback function that is triggered whenever
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7865 * Orthanc receives a new DICOM instance (e.g. through REST API or
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7866 * DICOM protocol), and that answers whether this DICOM instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7867 * should be accepted or discarded by Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7868 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7869 * Note that the metadata information is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7870 * (i.e. GetInstanceMetadata() should not be used on "instance").
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7871 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7872 * @warning Your callback function will be called synchronously with
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7873 * the core of Orthanc. This implies that deadlocks might emerge if
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7874 * you call other core primitives of Orthanc in your callback (such
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7875 * deadlocks are particularly visible in the presence of other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7876 * or Lua scripts). It is thus strongly advised to avoid any call to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7877 * the REST API of Orthanc in the callback. If you have to call
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7878 * other primitives of Orthanc, you should make these calls in a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7879 * separate thread, passing the pending events to be processed
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7880 * through a message queue.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7881 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7882 * @param instance The received DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7883 * @return 0 to discard the instance, 1 to store the instance, -1 if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7884 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7885 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7886 typedef int32_t (*OrthancPluginIncomingDicomInstanceFilter) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7887 const OrthancPluginDicomInstance* instance);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7888
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7889
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7890 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7891 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7892 OrthancPluginIncomingDicomInstanceFilter callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7893 } _OrthancPluginIncomingDicomInstanceFilter;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7894
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7895 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7896 * @brief Register a callback to filter incoming DICOM instances.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7897 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7898 * This function registers a custom callback to filter incoming
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7899 * DICOM instances received by Orthanc (either through the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7900 * or through the DICOM protocol).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7901 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7902 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7903 * @param callback The callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7904 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7905 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7906 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7907 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterIncomingDicomInstanceFilter(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7908 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7909 OrthancPluginIncomingDicomInstanceFilter callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7910 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7911 _OrthancPluginIncomingDicomInstanceFilter params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7912 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7913
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7914 return context->InvokeService(context, _OrthancPluginService_RegisterIncomingDicomInstanceFilter, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7915 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7916
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7917
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7918 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7919 * @brief Callback to filter incoming DICOM instances received by
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7920 * Orthanc through C-STORE.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7921 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7922 * Signature of a callback function that is triggered whenever
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7923 * Orthanc receives a new DICOM instance using DICOM C-STORE, and
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7924 * that answers whether this DICOM instance should be accepted or
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7925 * discarded by Orthanc. If the instance is discarded, the callback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7926 * can specify the DIMSE error code answered by the Orthanc C-STORE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7927 * SCP.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7928 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7929 * Note that the metadata information is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7930 * (i.e. GetInstanceMetadata() should not be used on "instance").
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7931 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7932 * @warning Your callback function will be called synchronously with
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7933 * the core of Orthanc. This implies that deadlocks might emerge if
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7934 * you call other core primitives of Orthanc in your callback (such
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7935 * deadlocks are particularly visible in the presence of other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7936 * or Lua scripts). It is thus strongly advised to avoid any call to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7937 * the REST API of Orthanc in the callback. If you have to call
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7938 * other primitives of Orthanc, you should make these calls in a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7939 * separate thread, passing the pending events to be processed
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7940 * through a message queue.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7941 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7942 * @param dimseStatus If the DICOM instance is discarded,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7943 * DIMSE status to be sent by the C-STORE SCP of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7944 * @param instance The received DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7945 * @return 0 to discard the instance, 1 to store the instance, -1 if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7946 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7947 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7948 typedef int32_t (*OrthancPluginIncomingCStoreInstanceFilter) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7949 uint16_t* dimseStatus /* out */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7950 const OrthancPluginDicomInstance* instance);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7951
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7952
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7953 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7954 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7955 OrthancPluginIncomingCStoreInstanceFilter callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7956 } _OrthancPluginIncomingCStoreInstanceFilter;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7957
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7958 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7959 * @brief Register a callback to filter incoming DICOM instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7960 * received by Orthanc through C-STORE.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7961 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7962 * This function registers a custom callback to filter incoming
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7963 * DICOM instances received by Orthanc through the DICOM protocol.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7964 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7965 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7966 * @param callback The callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7967 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7968 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7969 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7970 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterIncomingCStoreInstanceFilter(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7971 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7972 OrthancPluginIncomingCStoreInstanceFilter callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7973 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7974 _OrthancPluginIncomingCStoreInstanceFilter params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7975 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7976
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7977 return context->InvokeService(context, _OrthancPluginService_RegisterIncomingCStoreInstanceFilter, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7978 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7979
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7980 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7981 * @brief Callback to keep/discard/modify a DICOM instance received
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7982 * by Orthanc from any source (C-STORE or REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7983 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7984 * Signature of a callback function that is triggered whenever
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7985 * Orthanc receives a new DICOM instance (through DICOM protocol or
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7986 * REST API), and that specifies an action to be applied to this
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7987 * newly received instance. The instance can be kept as it is, can
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7988 * be modified by the plugin, or can be discarded.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7989 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7990 * This callback is invoked immediately after reception, i.e. before
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7991 * transcoding and before filtering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7992 * (cf. OrthancPluginRegisterIncomingDicomInstanceFilter()).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7993 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7994 * @warning Your callback function will be called synchronously with
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7995 * the core of Orthanc. This implies that deadlocks might emerge if
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7996 * you call other core primitives of Orthanc in your callback (such
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7997 * deadlocks are particularly visible in the presence of other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7998 * or Lua scripts). It is thus strongly advised to avoid any call to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7999 * the REST API of Orthanc in the callback. If you have to call
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8000 * other primitives of Orthanc, you should make these calls in a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8001 * separate thread, passing the pending events to be processed
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8002 * through a message queue.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8003 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8004 * @param modifiedDicomBuffer A buffer containing the modified DICOM (output).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8005 * This buffer must be allocated using OrthancPluginCreateMemoryBuffer64()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8006 * and will be freed by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8007 * @param receivedDicomBuffer A buffer containing the received DICOM (input).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8008 * @param receivedDicomBufferSize The size of the received DICOM (input).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8009 * @param origin The origin of the DICOM instance (input).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8010 * @return `OrthancPluginReceivedInstanceAction_KeepAsIs` to accept the instance as is,<br/>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8011 * `OrthancPluginReceivedInstanceAction_Modify` to store the modified DICOM contained in `modifiedDicomBuffer`,<br/>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8012 * `OrthancPluginReceivedInstanceAction_Discard` to tell Orthanc to discard the instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8013 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8014 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8015 typedef OrthancPluginReceivedInstanceAction (*OrthancPluginReceivedInstanceCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8016 OrthancPluginMemoryBuffer64* modifiedDicomBuffer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8017 const void* receivedDicomBuffer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8018 uint64_t receivedDicomBufferSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8019 OrthancPluginInstanceOrigin origin);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8022 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8023 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8024 OrthancPluginReceivedInstanceCallback callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8025 } _OrthancPluginReceivedInstanceCallback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8026
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8027 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8028 * @brief Register a callback to keep/discard/modify a DICOM instance received
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8029 * by Orthanc from any source (C-STORE or REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8030 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8031 * This function registers a custom callback to keep/discard/modify
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8032 * incoming DICOM instances received by Orthanc from any source
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8033 * (C-STORE or REST API).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8034 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8035 * @warning Contrarily to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8036 * OrthancPluginRegisterIncomingCStoreInstanceFilter() and
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8037 * OrthancPluginRegisterIncomingDicomInstanceFilter() that can be
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8038 * called by multiple plugins,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8039 * OrthancPluginRegisterReceivedInstanceCallback() can only be used
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8040 * by one single plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8041 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8042 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8043 * @param callback The callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8044 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8045 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8046 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8047 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterReceivedInstanceCallback(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8048 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8049 OrthancPluginReceivedInstanceCallback callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8050 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8051 _OrthancPluginReceivedInstanceCallback params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8052 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8053
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8054 return context->InvokeService(context, _OrthancPluginService_RegisterReceivedInstanceCallback, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8055 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8056
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8057 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8058 * @brief Get the transfer syntax of a DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8059 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8060 * This function returns a pointer to a newly created string that
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8061 * contains the transfer syntax UID of the DICOM instance. The empty
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8062 * string might be returned if this information is unknown.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8063 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8064 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8065 * @param instance The instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8066 * @return The NULL value in case of error, or a string containing the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8067 * transfer syntax UID. This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8068 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8069 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8070 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceTransferSyntaxUid(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8071 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8072 const OrthancPluginDicomInstance* instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8073 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8074 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8075
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8076 _OrthancPluginAccessDicomInstance params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8077 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8078 params.resultStringToFree = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8079 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8080
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8081 if (context->InvokeService(context, _OrthancPluginService_GetInstanceTransferSyntaxUid, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8082 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8083 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8084 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8085 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8086 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8087 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8088 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8089 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8090 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8091
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8092
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8093 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8094 * @brief Check whether the DICOM file has pixel data.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8095 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8096 * This function returns a Boolean value indicating whether the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8097 * DICOM instance contains the pixel data (7FE0,0010) tag.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8098 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8099 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8100 * @param instance The instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8101 * @return "1" if the DICOM instance contains pixel data, or "0" if
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8102 * the tag is missing, or "-1" in the case of an error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8103 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8104 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8105 ORTHANC_PLUGIN_INLINE int32_t OrthancPluginHasInstancePixelData(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8106 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8107 const OrthancPluginDicomInstance* instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8108 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8109 int64_t hasPixelData;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8110
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8111 _OrthancPluginAccessDicomInstance params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8112 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8113 params.resultInt64 = &hasPixelData;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8114 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8115
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8116 if (context->InvokeService(context, _OrthancPluginService_HasInstancePixelData, &params) != OrthancPluginErrorCode_Success ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8117 hasPixelData < 0 ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8118 hasPixelData > 1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8119 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8120 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8121 return -1;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8122 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8123 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8124 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8125 return (hasPixelData != 0);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8126 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8127 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8128
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8129
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8130
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8131
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8132
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8133
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8134 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8135 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8136 OrthancPluginDicomInstance** target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8137 const void* buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8138 uint32_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8139 const char* transferSyntax;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8140 } _OrthancPluginCreateDicomInstance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8141
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8142 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8143 * @brief Parse a DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8144 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8145 * This function parses a memory buffer that contains a DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8146 * file. The function returns a new pointer to a data structure that
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8147 * is managed by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8148 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8149 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8150 * @param buffer The memory buffer containing the DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8151 * @param size The size of the memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8152 * @return The newly allocated DICOM instance. It must be freed with OrthancPluginFreeDicomInstance().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8153 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8154 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8155 ORTHANC_PLUGIN_INLINE OrthancPluginDicomInstance* OrthancPluginCreateDicomInstance(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8156 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8157 const void* buffer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8158 uint32_t size)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8159 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8160 OrthancPluginDicomInstance* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8161
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8162 _OrthancPluginCreateDicomInstance params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8163 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8164 params.buffer = buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8165 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8166
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8167 if (context->InvokeService(context, _OrthancPluginService_CreateDicomInstance, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8168 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8169 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8170 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8171 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8172 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8173 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8174 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8175 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8176 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8177
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8178 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8179 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8180 OrthancPluginDicomInstance* dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8181 } _OrthancPluginFreeDicomInstance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8182
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8183 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8184 * @brief Free a DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8185 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8186 * This function frees a DICOM instance that was parsed using
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8187 * OrthancPluginCreateDicomInstance().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8188 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8189 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8190 * @param dicom The DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8191 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8192 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8193 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeDicomInstance(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8194 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8195 OrthancPluginDicomInstance* dicom)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8196 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8197 _OrthancPluginFreeDicomInstance params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8198 params.dicom = dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8199
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8200 context->InvokeService(context, _OrthancPluginService_FreeDicomInstance, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8201 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8202
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8203
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8204 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8205 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8206 uint32_t* targetUint32;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8207 OrthancPluginMemoryBuffer* targetBuffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8208 OrthancPluginImage** targetImage;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8209 char** targetStringToFree;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8210 const OrthancPluginDicomInstance* instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8211 uint32_t frameIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8212 OrthancPluginDicomToJsonFormat format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8213 OrthancPluginDicomToJsonFlags flags;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8214 uint32_t maxStringLength;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8215 OrthancPluginDicomWebBinaryCallback2 dicomWebCallback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8216 void* dicomWebPayload;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8217 } _OrthancPluginAccessDicomInstance2;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8218
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8219 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8220 * @brief Get the number of frames in a DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8221 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8222 * This function returns the number of frames that are part of a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8223 * DICOM image managed by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8224 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8225 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8226 * @param instance The instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8227 * @return The number of frames (will be zero in the case of an error).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8228 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8229 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8230 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetInstanceFramesCount(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8231 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8232 const OrthancPluginDicomInstance* instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8233 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8234 uint32_t count;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8235
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8236 _OrthancPluginAccessDicomInstance2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8237 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8238 params.targetUint32 = &count;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8239 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8240
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8241 if (context->InvokeService(context, _OrthancPluginService_GetInstanceFramesCount, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8242 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8243 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8244 return 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8245 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8246 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8247 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8248 return count;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8249 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8250 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8251
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8252
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8253 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8254 * @brief Get the raw content of a frame in a DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8255 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8256 * This function returns a memory buffer containing the raw content
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8257 * of a frame in a DICOM instance that is managed by the Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8258 * core. This is notably useful for compressed transfer syntaxes, as
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8259 * it gives access to the embedded files (such as JPEG, JPEG-LS or
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8260 * JPEG2k). The Orthanc core transparently reassembles the fragments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8261 * to extract the raw frame.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8262 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8263 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8264 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8265 * @param instance The instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8266 * @param frameIndex The index of the frame of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8267 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8268 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8269 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8270 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginGetInstanceRawFrame(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8271 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8272 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8273 const OrthancPluginDicomInstance* instance,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8274 uint32_t frameIndex)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8275 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8276 _OrthancPluginAccessDicomInstance2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8277 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8278 params.targetBuffer = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8279 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8280 params.frameIndex = frameIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8281
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8282 return context->InvokeService(context, _OrthancPluginService_GetInstanceRawFrame, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8283 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8284
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8285
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8286 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8287 * @brief Decode one frame from a DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8288 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8289 * This function decodes one frame of a DICOM image that is managed
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8290 * by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8291 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8292 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8293 * @param instance The instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8294 * @param frameIndex The index of the frame of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8295 * @return The uncompressed image. It must be freed with OrthancPluginFreeImage().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8296 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8297 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8298 ORTHANC_PLUGIN_INLINE OrthancPluginImage* OrthancPluginGetInstanceDecodedFrame(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8299 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8300 const OrthancPluginDicomInstance* instance,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8301 uint32_t frameIndex)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8302 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8303 OrthancPluginImage* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8304
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8305 _OrthancPluginAccessDicomInstance2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8306 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8307 params.targetImage = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8308 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8309 params.frameIndex = frameIndex;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8310
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8311 if (context->InvokeService(context, _OrthancPluginService_GetInstanceDecodedFrame, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8312 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8313 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8314 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8315 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8316 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8317 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8318 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8319 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8320
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8321
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8322 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8323 * @brief Parse and transcode a DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8324 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8325 * This function parses a memory buffer that contains a DICOM file,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8326 * then transcodes it to the given transfer syntax. The function
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8327 * returns a new pointer to a data structure that is managed by the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8328 * Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8329 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8330 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8331 * @param buffer The memory buffer containing the DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8332 * @param size The size of the memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8333 * @param transferSyntax The transfer syntax UID for the transcoding.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8334 * @return The newly allocated DICOM instance. It must be freed with OrthancPluginFreeDicomInstance().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8335 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8336 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8337 ORTHANC_PLUGIN_INLINE OrthancPluginDicomInstance* OrthancPluginTranscodeDicomInstance(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8338 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8339 const void* buffer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8340 uint32_t size,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8341 const char* transferSyntax)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8342 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8343 OrthancPluginDicomInstance* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8344
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8345 _OrthancPluginCreateDicomInstance params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8346 params.target = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8347 params.buffer = buffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8348 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8349 params.transferSyntax = transferSyntax;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8350
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8351 if (context->InvokeService(context, _OrthancPluginService_TranscodeDicomInstance, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8352 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8353 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8354 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8355 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8356 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8357 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8358 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8359 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8360 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8361
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8362 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8363 * @brief Writes a DICOM instance to a memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8364 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8365 * This function returns a memory buffer containing the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8366 * serialization of a DICOM instance that is managed by the Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8367 * core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8368 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8369 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8370 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8371 * @param instance The instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8372 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8373 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8374 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8375 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginSerializeDicomInstance(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8376 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8377 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8378 const OrthancPluginDicomInstance* instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8379 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8380 _OrthancPluginAccessDicomInstance2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8381 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8382 params.targetBuffer = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8383 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8384
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8385 return context->InvokeService(context, _OrthancPluginService_SerializeDicomInstance, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8386 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8387
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8388
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8389 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8390 * @brief Format a DICOM memory buffer as a JSON string.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8391 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8392 * This function takes as DICOM instance managed by the Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8393 * core, and outputs a JSON string representing the tags of this
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8394 * DICOM file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8395 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8396 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8397 * @param instance The DICOM instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8398 * @param format The output format.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8399 * @param flags Flags governing the output.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8400 * @param maxStringLength The maximum length of a field. Too long fields will
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8401 * be output as "null". The 0 value means no maximum length.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8402 * @return The NULL value if the case of an error, or the JSON
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8403 * string. This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8404 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8405 * @see OrthancPluginDicomBufferToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8406 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8407 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceAdvancedJson(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8408 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8409 const OrthancPluginDicomInstance* instance,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8410 OrthancPluginDicomToJsonFormat format,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8411 OrthancPluginDicomToJsonFlags flags,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8412 uint32_t maxStringLength)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8413 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8414 char* result = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8415
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8416 _OrthancPluginAccessDicomInstance2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8417 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8418 params.targetStringToFree = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8419 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8420 params.format = format;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8421 params.flags = flags;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8422 params.maxStringLength = maxStringLength;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8423
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8424 if (context->InvokeService(context, _OrthancPluginService_GetInstanceAdvancedJson, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8425 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8426 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8427 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8428 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8429 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8430 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8431 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8432 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8433 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8434
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8435
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8436 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8437 * @brief Convert a DICOM instance to DICOMweb JSON.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8438 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8439 * This function converts a DICOM instance that is managed by the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8440 * Orthanc core, into its DICOMweb JSON representation.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8441 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8442 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8443 * @param instance The DICOM instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8444 * @param callback Callback to set the value of the binary tags.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8445 * @param payload User payload.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8446 * @return The NULL value in case of error, or the JSON document. This string must
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8447 * be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8448 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8449 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8450 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceDicomWebJson(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8451 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8452 const OrthancPluginDicomInstance* instance,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8453 OrthancPluginDicomWebBinaryCallback2 callback,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8454 void* payload)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8455 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8456 char* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8457
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8458 _OrthancPluginAccessDicomInstance2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8459 params.targetStringToFree = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8460 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8461 params.dicomWebCallback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8462 params.dicomWebPayload = payload;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8463
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8464 if (context->InvokeService(context, _OrthancPluginService_GetInstanceDicomWebJson, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8465 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8466 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8467 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8468 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8469 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8470 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8471 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8472 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8473 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8474
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8475
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8476 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8477 * @brief Convert a DICOM instance to DICOMweb XML.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8478 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8479 * This function converts a DICOM instance that is managed by the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8480 * Orthanc core, into its DICOMweb XML representation.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8481 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8482 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8483 * @param instance The DICOM instance of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8484 * @param callback Callback to set the value of the binary tags.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8485 * @param payload User payload.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8486 * @return The NULL value in case of error, or the XML document. This string must
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8487 * be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8488 * @ingroup DicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8489 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8490 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceDicomWebXml(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8491 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8492 const OrthancPluginDicomInstance* instance,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8493 OrthancPluginDicomWebBinaryCallback2 callback,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8494 void* payload)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8495 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8496 char* target = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8497
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8498 _OrthancPluginAccessDicomInstance2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8499 params.targetStringToFree = &target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8500 params.instance = instance;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8501 params.dicomWebCallback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8502 params.dicomWebPayload = payload;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8503
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8504 if (context->InvokeService(context, _OrthancPluginService_GetInstanceDicomWebXml, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8505 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8506 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8507 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8508 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8509 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8510 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8511 return target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8512 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8513 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8514
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8515
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8516
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8517 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8518 * @brief Signature of a callback function to transcode a DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8519 * @param transcoded Target memory buffer. It must be allocated by the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8520 * plugin using OrthancPluginCreateMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8521 * @param buffer Memory buffer containing the source DICOM instance.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8522 * @param size Size of the source memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8523 * @param allowedSyntaxes A C array of possible transfer syntaxes UIDs for the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8524 * result of the transcoding. The plugin must choose by itself the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8525 * transfer syntax that will be used for the resulting DICOM image.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8526 * @param countSyntaxes The number of transfer syntaxes that are contained
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8527 * in the "allowedSyntaxes" array.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8528 * @param allowNewSopInstanceUid Whether the transcoding plugin can select
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8529 * a transfer syntax that will change the SOP instance UID (or, in other
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8530 * terms, whether the plugin can transcode using lossy compression).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8531 * @return 0 if success (i.e. image successfully transcoded and stored into
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8532 * "transcoded"), or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8533 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8534 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8535 typedef OrthancPluginErrorCode (*OrthancPluginTranscoderCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8536 OrthancPluginMemoryBuffer* transcoded /* out */,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8537 const void* buffer,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8538 uint64_t size,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8539 const char* const* allowedSyntaxes,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8540 uint32_t countSyntaxes,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8541 uint8_t allowNewSopInstanceUid);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8542
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8543
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8544 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8545 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8546 OrthancPluginTranscoderCallback callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8547 } _OrthancPluginTranscoderCallback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8548
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8549 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8550 * @brief Register a callback to handle the transcoding of DICOM images.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8551 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8552 * This function registers a custom callback to transcode DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8553 * images, extending the built-in transcoder of Orthanc that uses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8554 * DCMTK. The exact behavior is affected by the configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8555 * "BuiltinDecoderTranscoderOrder" of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8556 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8557 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8558 * @param callback The callback.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8559 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8560 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8561 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8562 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterTranscoderCallback(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8563 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8564 OrthancPluginTranscoderCallback callback)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8565 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8566 _OrthancPluginTranscoderCallback params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8567 params.callback = callback;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8568
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8569 return context->InvokeService(context, _OrthancPluginService_RegisterTranscoderCallback, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8570 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8571
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8572
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8573
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8574 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8575 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8576 OrthancPluginMemoryBuffer* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8577 uint32_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8578 } _OrthancPluginCreateMemoryBuffer;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8579
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8580 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8581 * @brief Create a 32-bit memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8582 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8583 * This function creates a memory buffer that is managed by the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8584 * Orthanc core. The main use case of this function is for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8585 * that act as DICOM transcoders.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8586 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8587 * Your plugin should never call "free()" on the resulting memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8588 * buffer, as the C library that is used by the plugin is in general
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8589 * not the same as the one used by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8590 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8591 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8592 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8593 * @param size Size of the memory buffer to be created.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8594 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8595 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8596 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8597 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCreateMemoryBuffer(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8598 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8599 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8600 uint32_t size)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8601 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8602 _OrthancPluginCreateMemoryBuffer params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8603 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8604 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8605
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8606 return context->InvokeService(context, _OrthancPluginService_CreateMemoryBuffer, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8607 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8608
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8609
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8610 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8611 * @brief Generate a token to grant full access to the REST API of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8612 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8613 * This function generates a token that can be set in the HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8614 * header "Authorization" so as to grant full access to the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8615 * of Orthanc using an external HTTP client. Using this function
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8616 * avoids the need of adding a separate user in the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8617 * "RegisteredUsers" configuration of Orthanc, which eases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8618 * deployments.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8619 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8620 * This feature is notably useful in multiprocess scenarios, where a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8621 * subprocess created by a plugin has no access to the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8622 * "OrthancPluginContext", and thus cannot call
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8623 * "OrthancPluginRestApi[Get|Post|Put|Delete]()".
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8624 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8625 * This situation is frequently encountered in Python plugins, where
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8626 * the "multiprocessing" package can be used to bypass the Global
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8627 * Interpreter Lock (GIL) and thus to improve performance and
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8628 * concurrency.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8629 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8630 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8631 * @return The authorization token, or NULL value in the case of an error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8632 * This string must be freed by OrthancPluginFreeString().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8633 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8634 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8635 ORTHANC_PLUGIN_INLINE char* OrthancPluginGenerateRestApiAuthorizationToken(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8636 OrthancPluginContext* context)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8637 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8638 char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8639
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8640 _OrthancPluginRetrieveDynamicString params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8641 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8642 params.argument = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8643
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8644 if (context->InvokeService(context, _OrthancPluginService_GenerateRestApiAuthorizationToken,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8645 &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8646 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8647 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8648 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8649 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8650 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8651 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8652 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8653 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8654 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8655
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8656
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8657
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8658 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8659 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8660 OrthancPluginMemoryBuffer64* target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8661 uint64_t size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8662 } _OrthancPluginCreateMemoryBuffer64;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8663
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8664 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8665 * @brief Create a 64-bit memory buffer.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8666 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8667 * This function creates a 64-bit memory buffer that is managed by
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8668 * the Orthanc core. The main use case of this function is for
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8669 * plugins that read files from the storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8670 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8671 * Your plugin should never call "free()" on the resulting memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8672 * buffer, as the C library that is used by the plugin is in general
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8673 * not the same as the one used by the Orthanc core.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8674 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8675 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8676 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8677 * @param size Size of the memory buffer to be created.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8678 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8679 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8680 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8681 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCreateMemoryBuffer64(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8682 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8683 OrthancPluginMemoryBuffer64* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8684 uint64_t size)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8685 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8686 _OrthancPluginCreateMemoryBuffer64 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8687 params.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8688 params.size = size;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8689
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8690 return context->InvokeService(context, _OrthancPluginService_CreateMemoryBuffer64, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8691 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8692
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8693
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8694 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8695 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8696 OrthancPluginStorageCreate create;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8697 OrthancPluginStorageReadWhole readWhole;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8698 OrthancPluginStorageReadRange readRange;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8699 OrthancPluginStorageRemove remove;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8700 } _OrthancPluginRegisterStorageArea2;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8701
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8702 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8703 * @brief Register a custom storage area, with support for range request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8704 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8705 * This function registers a custom storage area, to replace the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8706 * built-in way Orthanc stores its files on the filesystem. This
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8707 * function must be called during the initialization of the plugin,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8708 * i.e. inside the OrthancPluginInitialize() public function.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8709 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8710 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8711 * @param create The callback function to store a file on the custom storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8712 * @param readWhole The callback function to read a whole file from the custom storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8713 * @param readRange The callback function to read some range of a file from the custom storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8714 * If this feature is not supported by the plugin, this value can be set to NULL.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8715 * @param remove The callback function to remove a file from the custom storage area.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8716 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8717 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8718 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterStorageArea2(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8719 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8720 OrthancPluginStorageCreate create,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8721 OrthancPluginStorageReadWhole readWhole,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8722 OrthancPluginStorageReadRange readRange,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8723 OrthancPluginStorageRemove remove)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8724 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8725 _OrthancPluginRegisterStorageArea2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8726 params.create = create;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8727 params.readWhole = readWhole;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8728 params.readRange = readRange;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8729 params.remove = remove;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8730 context->InvokeService(context, _OrthancPluginService_RegisterStorageArea2, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8731 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8732
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8733
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8734
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8735 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8736 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8737 _OrthancPluginCreateDicom createDicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8738 const char* privateCreator;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8739 } _OrthancPluginCreateDicom2;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8740
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8741 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8742 * @brief Create a DICOM instance from a JSON string and an image, with a private creator.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8743 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8744 * This function takes as input a string containing a JSON file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8745 * describing the content of a DICOM instance. As an output, it
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8746 * writes the corresponding DICOM instance to a newly allocated
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8747 * memory buffer. Additionally, an image to be encoded within the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8748 * DICOM instance can also be provided.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8749 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8750 * Contrarily to the function OrthancPluginCreateDicom(), this
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8751 * function can be explicitly provided with a private creator.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8752 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8753 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8754 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8755 * @param json The input JSON file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8756 * @param pixelData The image. Can be NULL, if the pixel data is encoded inside the JSON with the data URI scheme.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8757 * @param flags Flags governing the output.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8758 * @param privateCreator The private creator to be used for the private DICOM tags.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8759 * Check out the global configuration option "Dictionary" of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8760 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8761 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8762 * @see OrthancPluginCreateDicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8763 * @see OrthancPluginDicomBufferToJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8764 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8765 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCreateDicom2(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8766 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8767 OrthancPluginMemoryBuffer* target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8768 const char* json,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8769 const OrthancPluginImage* pixelData,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8770 OrthancPluginCreateDicomFlags flags,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8771 const char* privateCreator)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8772 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8773 _OrthancPluginCreateDicom2 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8774 params.createDicom.target = target;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8775 params.createDicom.json = json;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8776 params.createDicom.pixelData = pixelData;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8777 params.createDicom.flags = flags;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8778 params.privateCreator = privateCreator;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8779
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8780 return context->InvokeService(context, _OrthancPluginService_CreateDicom2, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8781 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8782
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8783
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8784
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8785
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8786
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8787
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8788 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8789 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8790 OrthancPluginMemoryBuffer* answerBody;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8791 OrthancPluginMemoryBuffer* answerHeaders;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8792 uint16_t* httpStatus;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8793 OrthancPluginHttpMethod method;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8794 const char* uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8795 uint32_t headersCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8796 const char* const* headersKeys;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8797 const char* const* headersValues;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8798 const void* body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8799 uint32_t bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8800 uint8_t afterPlugins;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8801 } _OrthancPluginCallRestApi;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8802
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8803 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8804 * @brief Call the REST API of Orthanc with full flexibility.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8805 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8806 * Make a call to the given URI in the REST API of Orthanc. The
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8807 * result to the query is stored into a newly allocated memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8808 * buffer. This function is always granted full access to the REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8809 * API (no credentials, nor security token is needed).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8810 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8811 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8812 * @param answerBody The target memory buffer (out argument).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8813 * It must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8814 * The value of this argument is ignored if the HTTP method is DELETE.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8815 * @param answerHeaders The target memory buffer for the HTTP headers in the answer (out argument).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8816 * The answer headers are formatted as a JSON object (associative array).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8817 * The buffer must be freed with OrthancPluginFreeMemoryBuffer().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8818 * This argument can be set to NULL if the plugin has no interest in the answer HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8819 * @param httpStatus The HTTP status after the execution of the request (out argument).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8820 * @param method HTTP method to be used.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8821 * @param uri The URI of interest.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8822 * @param headersCount The number of HTTP headers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8823 * @param headersKeys Array containing the keys of the HTTP headers (can be <tt>NULL</tt> if no header).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8824 * @param headersValues Array containing the values of the HTTP headers (can be <tt>NULL</tt> if no header).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8825 * @param body The HTTP body for a POST or PUT request.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8826 * @param bodySize The size of the body.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8827 * @param afterPlugins If 0, the built-in API of Orthanc is used.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8828 * If 1, the API is tainted by the plugins.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8829 * @return 0 if success, or the error code if failure.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8830 * @see OrthancPluginRestApiGet2, OrthancPluginRestApiPost, OrthancPluginRestApiPut, OrthancPluginRestApiDelete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8831 * @ingroup Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8832 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8833 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCallRestApi(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8834 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8835 OrthancPluginMemoryBuffer* answerBody,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8836 OrthancPluginMemoryBuffer* answerHeaders,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8837 uint16_t* httpStatus,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8838 OrthancPluginHttpMethod method,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8839 const char* uri,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8840 uint32_t headersCount,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8841 const char* const* headersKeys,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8842 const char* const* headersValues,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8843 const void* body,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8844 uint32_t bodySize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8845 uint8_t afterPlugins)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8846 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8847 _OrthancPluginCallRestApi params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8848 memset(&params, 0, sizeof(params));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8849
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8850 params.answerBody = answerBody;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8851 params.answerHeaders = answerHeaders;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8852 params.httpStatus = httpStatus;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8853 params.method = method;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8854 params.uri = uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8855 params.headersCount = headersCount;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8856 params.headersKeys = headersKeys;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8857 params.headersValues = headersValues;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8858 params.body = body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8859 params.bodySize = bodySize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8860 params.afterPlugins = afterPlugins;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8861
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8862 return context->InvokeService(context, _OrthancPluginService_CallRestApi, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8863 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8864
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8865
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8866
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8867 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8868 * @brief Opaque structure that represents a WebDAV collection.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8869 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8870 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8871 typedef struct _OrthancPluginWebDavCollection_t OrthancPluginWebDavCollection;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8872
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8873
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8874 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8875 * @brief Declare a file while returning the content of a folder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8876 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8877 * This function declares a file while returning the content of a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8878 * WebDAV folder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8879 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8880 * @param collection Context of the collection.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8881 * @param name Base name of the file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8882 * @param dateTime The date and time of creation of the file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8883 * Check out the documentation of OrthancPluginWebDavRetrieveFile() for more information.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8884 * @param size Size of the file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8885 * @param mimeType The MIME type of the file. If empty or set to `NULL`,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8886 * Orthanc will do a best guess depending on the file extension.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8887 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8888 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8889 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8890 typedef OrthancPluginErrorCode (*OrthancPluginWebDavAddFile) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8891 OrthancPluginWebDavCollection* collection,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8892 const char* name,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8893 uint64_t size,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8894 const char* mimeType,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8895 const char* dateTime);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8896
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8897
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8898 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8899 * @brief Declare a subfolder while returning the content of a folder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8900 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8901 * This function declares a subfolder while returning the content of a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8902 * WebDAV folder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8903 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8904 * @param collection Context of the collection.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8905 * @param name Base name of the subfolder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8906 * @param dateTime The date and time of creation of the subfolder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8907 * Check out the documentation of OrthancPluginWebDavRetrieveFile() for more information.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8908 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8909 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8910 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8911 typedef OrthancPluginErrorCode (*OrthancPluginWebDavAddFolder) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8912 OrthancPluginWebDavCollection* collection,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8913 const char* name,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8914 const char* dateTime);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8915
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8916
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8917 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8918 * @brief Retrieve the content of a file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8919 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8920 * This function is used to forward the content of a file from a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8921 * WebDAV collection, to the core of Orthanc.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8922 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8923 * @param collection Context of the collection.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8924 * @param data Content of the file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8925 * @param size Size of the file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8926 * @param mimeType The MIME type of the file. If empty or set to `NULL`,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8927 * Orthanc will do a best guess depending on the file extension.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8928 * @param dateTime The date and time of creation of the file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8929 * It must be formatted as an ISO string of form
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8930 * `YYYYMMDDTHHMMSS,fffffffff` where T is the date-time
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8931 * separator. It must be expressed in UTC (it is the responsibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8932 * of the plugin to do the possible timezone
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8933 * conversions). Internally, this string will be parsed using
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8934 * `boost::posix_time::from_iso_string()`.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8935 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8936 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8937 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8938 typedef OrthancPluginErrorCode (*OrthancPluginWebDavRetrieveFile) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8939 OrthancPluginWebDavCollection* collection,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8940 const void* data,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8941 uint64_t size,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8942 const char* mimeType,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8943 const char* dateTime);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8944
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8945
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8946 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8947 * @brief Callback for testing the existence of a folder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8948 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8949 * Signature of a callback function that tests whether the given
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8950 * path in the WebDAV collection exists and corresponds to a folder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8951 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8952 * @param isExisting Pointer to a Boolean that must be set to `1` if the folder exists, or `0` otherwise.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8953 * @param pathSize Number of levels in the path.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8954 * @param pathItems Items making the path.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8955 * @param payload The user payload.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8956 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8957 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8958 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8959 typedef OrthancPluginErrorCode (*OrthancPluginWebDavIsExistingFolderCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8960 uint8_t* isExisting, /* out */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8961 uint32_t pathSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8962 const char* const* pathItems,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8963 void* payload);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8964
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8965
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8966 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8967 * @brief Callback for listing the content of a folder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8968 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8969 * Signature of a callback function that lists the content of a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8970 * folder in the WebDAV collection. The callback must call the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8971 * provided `addFile()` and `addFolder()` functions to emit the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8972 * content of the folder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8973 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8974 * @param isExisting Pointer to a Boolean that must be set to `1` if the folder exists, or `0` otherwise.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8975 * @param collection Context to be provided to `addFile()` and `addFolder()` functions.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8976 * @param addFile Function to add a file to the list.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8977 * @param addFolder Function to add a folder to the list.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8978 * @param pathSize Number of levels in the path.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8979 * @param pathItems Items making the path.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8980 * @param payload The user payload.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8981 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8982 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8983 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8984 typedef OrthancPluginErrorCode (*OrthancPluginWebDavListFolderCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8985 uint8_t* isExisting, /* out */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8986 OrthancPluginWebDavCollection* collection,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8987 OrthancPluginWebDavAddFile addFile,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8988 OrthancPluginWebDavAddFolder addFolder,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8989 uint32_t pathSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8990 const char* const* pathItems,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8991 void* payload);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8992
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8993
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8994 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8995 * @brief Callback for retrieving the content of a file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8996 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8997 * Signature of a callback function that retrieves the content of a
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8998 * file in the WebDAV collection. The callback must call the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8999 * provided `retrieveFile()` function to emit the actual content of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9000 * the file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9001 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9002 * @param collection Context to be provided to `retrieveFile()` function.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9003 * @param retrieveFile Function to return the content of the file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9004 * @param pathSize Number of levels in the path.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9005 * @param pathItems Items making the path.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9006 * @param payload The user payload.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9007 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9008 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9009 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9010 typedef OrthancPluginErrorCode (*OrthancPluginWebDavRetrieveFileCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9011 OrthancPluginWebDavCollection* collection,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9012 OrthancPluginWebDavRetrieveFile retrieveFile,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9013 uint32_t pathSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9014 const char* const* pathItems,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9015 void* payload);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9016
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9017
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9018 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9019 * @brief Callback to store a file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9020 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9021 * Signature of a callback function that stores a file into the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9022 * WebDAV collection.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9023 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9024 * @param isReadOnly Pointer to a Boolean that must be set to `1` if the collection is read-only, or `0` otherwise.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9025 * @param pathSize Number of levels in the path.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9026 * @param pathItems Items making the path.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9027 * @param data Content of the file to be stored.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9028 * @param size Size of the file to be stored.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9029 * @param payload The user payload.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9030 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9031 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9032 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9033 typedef OrthancPluginErrorCode (*OrthancPluginWebDavStoreFileCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9034 uint8_t* isReadOnly, /* out */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9035 uint32_t pathSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9036 const char* const* pathItems,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9037 const void* data,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9038 uint64_t size,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9039 void* payload);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9040
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9041
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9042 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9043 * @brief Callback to create a folder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9044 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9045 * Signature of a callback function that creates a folder in the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9046 * WebDAV collection.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9047 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9048 * @param isReadOnly Pointer to a Boolean that must be set to `1` if the collection is read-only, or `0` otherwise.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9049 * @param pathSize Number of levels in the path.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9050 * @param pathItems Items making the path.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9051 * @param payload The user payload.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9052 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9053 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9054 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9055 typedef OrthancPluginErrorCode (*OrthancPluginWebDavCreateFolderCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9056 uint8_t* isReadOnly, /* out */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9057 uint32_t pathSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9058 const char* const* pathItems,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9059 void* payload);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9060
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9061
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9062 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9063 * @brief Callback to remove a file or a folder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9064 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9065 * Signature of a callback function that removes a file or a folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9066 * from the WebDAV collection.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9067 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9068 * @param isReadOnly Pointer to a Boolean that must be set to `1` if the collection is read-only, or `0` otherwise.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9069 * @param pathSize Number of levels in the path.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9070 * @param pathItems Items making the path.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9071 * @param payload The user payload.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9072 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9073 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9074 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9075 typedef OrthancPluginErrorCode (*OrthancPluginWebDavDeleteItemCallback) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9076 uint8_t* isReadOnly, /* out */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9077 uint32_t pathSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9078 const char* const* pathItems,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9079 void* payload);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9080
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9081
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9082 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9083 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9084 const char* uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9085 OrthancPluginWebDavIsExistingFolderCallback isExistingFolder;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9086 OrthancPluginWebDavListFolderCallback listFolder;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9087 OrthancPluginWebDavRetrieveFileCallback retrieveFile;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9088 OrthancPluginWebDavStoreFileCallback storeFile;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9089 OrthancPluginWebDavCreateFolderCallback createFolder;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9090 OrthancPluginWebDavDeleteItemCallback deleteItem;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9091 void* payload;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9092 } _OrthancPluginRegisterWebDavCollection;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9093
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9094 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9095 * @brief Register a WebDAV virtual filesystem.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9096 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9097 * This function maps a WebDAV collection onto the given URI in the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9098 * REST API of Orthanc. This function must be called during the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9099 * initialization of the plugin, i.e. inside the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9100 * OrthancPluginInitialize() public function.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9101 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9102 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9103 * @param uri URI where to map the WebDAV collection (must start with a `/` character).
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9104 * @param isExistingFolder Callback method to test for the existence of a folder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9105 * @param listFolder Callback method to list the content of a folder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9106 * @param retrieveFile Callback method to retrieve the content of a file.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9107 * @param storeFile Callback method to store a file into the WebDAV collection.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9108 * @param createFolder Callback method to create a folder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9109 * @param deleteItem Callback method to delete a file or a folder.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9110 * @param payload The user payload.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9111 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9112 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9113 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9114 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterWebDavCollection(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9115 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9116 const char* uri,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9117 OrthancPluginWebDavIsExistingFolderCallback isExistingFolder,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9118 OrthancPluginWebDavListFolderCallback listFolder,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9119 OrthancPluginWebDavRetrieveFileCallback retrieveFile,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9120 OrthancPluginWebDavStoreFileCallback storeFile,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9121 OrthancPluginWebDavCreateFolderCallback createFolder,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9122 OrthancPluginWebDavDeleteItemCallback deleteItem,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9123 void* payload)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9124 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9125 _OrthancPluginRegisterWebDavCollection params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9126 params.uri = uri;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9127 params.isExistingFolder = isExistingFolder;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9128 params.listFolder = listFolder;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9129 params.retrieveFile = retrieveFile;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9130 params.storeFile = storeFile;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9131 params.createFolder = createFolder;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9132 params.deleteItem = deleteItem;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9133 params.payload = payload;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9134
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9135 return context->InvokeService(context, _OrthancPluginService_RegisterWebDavCollection, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9136 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9137
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9138
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9139 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9140 * @brief Gets the DatabaseServerIdentifier.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9141 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9142 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9143 * @return the database server identifier. This is a statically-allocated
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9144 * string, do not free it.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9145 * @ingroup Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9146 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9147 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetDatabaseServerIdentifier(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9148 OrthancPluginContext* context)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9149 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9150 const char* result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9151
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9152 _OrthancPluginRetrieveStaticString params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9153 params.result = &result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9154 params.argument = NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9155
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9156 if (context->InvokeService(context, _OrthancPluginService_GetDatabaseServerIdentifier, &params) != OrthancPluginErrorCode_Success)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9157 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9158 /* Error */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9159 return NULL;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9160 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9161 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9162 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9163 return result;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9164 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9165 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9166
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9167
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9168 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9169 * @brief Signature of a callback function that is triggered when
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9170 * the Orthanc core requests an operation from the database plugin.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9171 * Both request and response are encoded as protobuf buffers.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9172 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9173 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9174 typedef OrthancPluginErrorCode (*OrthancPluginCallDatabaseBackendV4) (
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9175 OrthancPluginMemoryBuffer64* response,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9176 void* backend,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9177 const void* request,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9178 uint64_t requestSize);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9179
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9180 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9181 * @brief Signature of a callback function that is triggered when
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9182 * the database plugin must be finalized.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9183 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9184 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9185 typedef void (*OrthancPluginFinalizeDatabaseBackendV4) (void* backend);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9186
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9187 typedef struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9188 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9189 void* backend;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9190 uint32_t maxDatabaseRetries;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9191 OrthancPluginCallDatabaseBackendV4 operations;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9192 OrthancPluginFinalizeDatabaseBackendV4 finalize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9193 } _OrthancPluginRegisterDatabaseBackendV4;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9194
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9195 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9196 * Register a custom database back-end.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9197 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9198 * This function was added in Orthanc SDK 1.12.0. It uses Google
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9199 * Protocol Buffers for the communications between the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9200 * and database plugins. Check out "OrthancDatabasePlugin.proto" for
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9201 * the definition of the protobuf messages.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9202 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9203 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9204 * @param backend Pointer to the custom database backend.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9205 * @param maxDatabaseRetries Maximum number of retries if transaction doesn't succeed.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9206 * If no retry is successful, OrthancPluginErrorCode_DatabaseCannotSerialize is generated.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9207 * @param operations Access to the operations of the custom database backend.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9208 * @param finalize Callback to deallocate the custom database backend.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9209 * @return 0 if success, other value if error.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9210 * @ingroup Callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9211 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9212 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterDatabaseBackendV4(
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9213 OrthancPluginContext* context,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9214 void* backend,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9215 uint32_t maxDatabaseRetries,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9216 OrthancPluginCallDatabaseBackendV4 operations,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9217 OrthancPluginFinalizeDatabaseBackendV4 finalize)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9218 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9219 _OrthancPluginRegisterDatabaseBackendV4 params;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9220 params.backend = backend;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9221 params.maxDatabaseRetries = maxDatabaseRetries;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9222 params.operations = operations;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9223 params.finalize = finalize;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9224
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9225 return context->InvokeService(context, _OrthancPluginService_RegisterDatabaseBackendV4, &params);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9226 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9227
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9228 #ifdef __cplusplus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9229 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9230 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9231
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9232
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9233 /** @} */
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9234