annotate Applications/Resources/Orthanc/Sdk-1.0.0/orthanc/OrthancCPlugin.h @ 1688:c14dd6e11ddd

merge
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 25 Nov 2020 17:03:08 +0100
parents 754ef576d945
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1538
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * \mainpage
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * This C/C++ SDK allows external developers to create plugins that
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * can be loaded into Orthanc to extend its functionality. Each
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * Orthanc plugin must expose 4 public functions with the following
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * signatures:
1638
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
8 *
1538
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * -# <tt>int32_t OrthancPluginInitialize(const OrthancPluginContext* context)</tt>:
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * This function is invoked by Orthanc when it loads the plugin on startup.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * The plugin must:
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * - Check its compatibility with the Orthanc version using
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * ::OrthancPluginCheckVersion().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * - Store the context pointer so that it can use the plugin
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * services of Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * - Register all its REST callbacks using ::OrthancPluginRegisterRestCallback().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * - Possibly register its callback for received DICOM instances using ::OrthancPluginRegisterOnStoredInstanceCallback().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * - Possibly register its callback for changes to the DICOM store using ::OrthancPluginRegisterOnChangeCallback().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * - Possibly register a custom storage area using ::OrthancPluginRegisterStorageArea().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * - Possibly register a custom database back-end area using OrthancPluginRegisterDatabaseBackendV2().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * - Possibly register a handler for C-Find SCP against DICOM worklists using OrthancPluginRegisterWorklistCallback().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * - Possibly register a custom decoder for DICOM images using OrthancPluginRegisterDecodeImageCallback().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * -# <tt>void OrthancPluginFinalize()</tt>:
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This function is invoked by Orthanc during its shutdown. The plugin
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * must free all its memory.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * -# <tt>const char* OrthancPluginGetName()</tt>:
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * The plugin must return a short string to identify itself.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * -# <tt>const char* OrthancPluginGetVersion()</tt>:
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * The plugin must return a string containing its version number.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 * The name and the version of a plugin is only used to prevent it
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 * from being loaded twice. Note that, in C++, it is mandatory to
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 * declare these functions within an <tt>extern "C"</tt> section.
1638
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
34 *
1538
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 * To ensure multi-threading safety, the various REST callbacks are
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 * guaranteed to be executed in mutual exclusion since Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 * 0.8.5. If this feature is undesired (notably when developing
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 * high-performance plugins handling simultaneous requests), use
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 * ::OrthancPluginRegisterRestCallbackNoLock().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 * @defgroup Images Images and compression
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 * @brief Functions to deal with images and compressed buffers.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 * @defgroup REST REST
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 * @brief Functions to answer REST requests in a callback.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 * @defgroup Callbacks Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 * @brief Functions to register and manage callbacks by the plugins.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 * @defgroup Worklists Worklists
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 * @brief Functions to register and manage worklists.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 * @defgroup Orthanc Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 * @brief Functions to access the content of the Orthanc server.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 * @defgroup Toolbox Toolbox
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 * @brief Generic functions to help with the creation of plugins.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 * Orthanc - A Lightweight, RESTful DICOM Store
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 * Department, University Hospital of Liege, Belgium
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 * This program is free software: you can redistribute it and/or
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 * modify it under the terms of the GNU General Public License as
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 * published by the Free Software Foundation, either version 3 of the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 * License, or (at your option) any later version.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 * In addition, as a special exception, the copyright holders of this
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 * program give permission to link the code of its release with the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 * OpenSSL project's "OpenSSL" library (or with modified versions of it
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 * that use the same license as the "OpenSSL" library), and distribute
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 * the linked executables. You must obey the GNU General Public License
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 * in all respects for all of the code used other than "OpenSSL". If you
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 * modify file(s) with this exception, you may extend this exception to
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 * your version of the file(s), but you are not obligated to do so. If
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 * you do not wish to do so, delete this exception statement from your
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 * version. If you delete this exception statement from all source files
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 * in the program, then also delete it here.
1638
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
91 *
1538
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 * This program is distributed in the hope that it will be useful, but
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 * WITHOUT ANY WARRANTY; without even the implied warranty of
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 * General Public License for more details.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 * You should have received a copy of the GNU General Public License
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 * along with this program. If not, see <http://www.gnu.org/licenses/>.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 #pragma once
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 #include <stdio.h>
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 #include <string.h>
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 #ifdef WIN32
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 #define ORTHANC_PLUGINS_API __declspec(dllexport)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 #else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 #define ORTHANC_PLUGINS_API
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 #endif
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 #define ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER 1
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 #define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER 0
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 #define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 0
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 /********************************************************************
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 ** Check that function inlining is properly supported. The use of
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 ** inlining is required, to avoid the duplication of object code
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 ** between two compilation modules that would use the Orthanc Plugin
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 ** API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 ********************************************************************/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 /* If the auto-detection of the "inline" keyword below does not work
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 automatically and that your compiler is known to properly support
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 inlining, uncomment the following #define and adapt the definition
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 of "static inline". */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 /* #define ORTHANC_PLUGIN_INLINE static inline */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 #ifndef ORTHANC_PLUGIN_INLINE
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 # if __STDC_VERSION__ >= 199901L
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 /* This is C99 or above: http://predef.sourceforge.net/prestd.html */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 # define ORTHANC_PLUGIN_INLINE static inline
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 # elif defined(__cplusplus)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 /* This is C++ */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 # define ORTHANC_PLUGIN_INLINE static inline
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 # elif defined(__GNUC__)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 /* This is GCC running in C89 mode */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 # define ORTHANC_PLUGIN_INLINE static __inline
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 # elif defined(_MSC_VER)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 /* This is Visual Studio running in C89 mode */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 # define ORTHANC_PLUGIN_INLINE static __inline
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 # else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 # error Your compiler is not known to support the "inline" keyword
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 # endif
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 #endif
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 /********************************************************************
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 ** Inclusion of standard libraries.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 ********************************************************************/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 * For Microsoft Visual Studio, a compatibility "stdint.h" can be
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 * downloaded at the following URL:
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 * https://orthanc.googlecode.com/hg/Resources/ThirdParty/VisualStudio/stdint.h
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 #include <stdint.h>
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 #include <stdlib.h>
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 /********************************************************************
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 ** Definition of the Orthanc Plugin API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 ********************************************************************/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 /** @{ */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 #ifdef __cplusplus
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 extern "C"
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 #endif
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 * The various error codes that can be returned by the Orthanc core.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 OrthancPluginErrorCode_InternalError = -1 /*!< Internal error */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 OrthancPluginErrorCode_Success = 0 /*!< Success */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 OrthancPluginErrorCode_Plugin = 1 /*!< Error encountered within the plugin engine */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 OrthancPluginErrorCode_NotImplemented = 2 /*!< Not implemented yet */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 OrthancPluginErrorCode_ParameterOutOfRange = 3 /*!< Parameter out of range */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 OrthancPluginErrorCode_NotEnoughMemory = 4 /*!< Not enough memory */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 OrthancPluginErrorCode_BadParameterType = 5 /*!< Bad type for a parameter */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 OrthancPluginErrorCode_BadSequenceOfCalls = 6 /*!< Bad sequence of calls */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 OrthancPluginErrorCode_InexistentItem = 7 /*!< Accessing an inexistent item */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 OrthancPluginErrorCode_BadRequest = 8 /*!< Bad request */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 OrthancPluginErrorCode_NetworkProtocol = 9 /*!< Error in the network protocol */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 OrthancPluginErrorCode_SystemCommand = 10 /*!< Error while calling a system command */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 OrthancPluginErrorCode_Database = 11 /*!< Error with the database engine */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 OrthancPluginErrorCode_UriSyntax = 12 /*!< Badly formatted URI */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 OrthancPluginErrorCode_InexistentFile = 13 /*!< Inexistent file */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 OrthancPluginErrorCode_CannotWriteFile = 14 /*!< Cannot write to file */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 OrthancPluginErrorCode_BadFileFormat = 15 /*!< Bad file format */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 OrthancPluginErrorCode_Timeout = 16 /*!< Timeout */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 OrthancPluginErrorCode_UnknownResource = 17 /*!< Unknown resource */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 OrthancPluginErrorCode_IncompatibleDatabaseVersion = 18 /*!< Incompatible version of the database */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 OrthancPluginErrorCode_FullStorage = 19 /*!< The file storage is full */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 OrthancPluginErrorCode_CorruptedFile = 20 /*!< Corrupted file (e.g. inconsistent MD5 hash) */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 OrthancPluginErrorCode_InexistentTag = 21 /*!< Inexistent tag */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 OrthancPluginErrorCode_ReadOnly = 22 /*!< Cannot modify a read-only data structure */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 OrthancPluginErrorCode_IncompatibleImageFormat = 23 /*!< Incompatible format of the images */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 OrthancPluginErrorCode_IncompatibleImageSize = 24 /*!< Incompatible size of the images */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 OrthancPluginErrorCode_SharedLibrary = 25 /*!< Error while using a shared library (plugin) */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 OrthancPluginErrorCode_UnknownPluginService = 26 /*!< Plugin invoking an unknown service */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 OrthancPluginErrorCode_UnknownDicomTag = 27 /*!< Unknown DICOM tag */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 OrthancPluginErrorCode_BadJson = 28 /*!< Cannot parse a JSON document */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 OrthancPluginErrorCode_Unauthorized = 29 /*!< Bad credentials were provided to an HTTP request */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 OrthancPluginErrorCode_BadFont = 30 /*!< Badly formatted font file */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 OrthancPluginErrorCode_DatabasePlugin = 31 /*!< The plugin implementing a custom database back-end does not fulfill the proper interface */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 OrthancPluginErrorCode_StorageAreaPlugin = 32 /*!< Error in the plugin implementing a custom storage area */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 OrthancPluginErrorCode_EmptyRequest = 33 /*!< The request is empty */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 OrthancPluginErrorCode_NotAcceptable = 34 /*!< Cannot send a response which is acceptable according to the Accept HTTP header */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 OrthancPluginErrorCode_SQLiteNotOpened = 1000 /*!< SQLite: The database is not opened */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 OrthancPluginErrorCode_SQLiteAlreadyOpened = 1001 /*!< SQLite: Connection is already open */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 OrthancPluginErrorCode_SQLiteCannotOpen = 1002 /*!< SQLite: Unable to open the database */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 OrthancPluginErrorCode_SQLiteStatementAlreadyUsed = 1003 /*!< SQLite: This cached statement is already being referred to */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 OrthancPluginErrorCode_SQLiteExecute = 1004 /*!< SQLite: Cannot execute a command */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 OrthancPluginErrorCode_SQLiteRollbackWithoutTransaction = 1005 /*!< SQLite: Rolling back a nonexistent transaction (have you called Begin()?) */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 OrthancPluginErrorCode_SQLiteCommitWithoutTransaction = 1006 /*!< SQLite: Committing a nonexistent transaction */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 OrthancPluginErrorCode_SQLiteRegisterFunction = 1007 /*!< SQLite: Unable to register a function */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 OrthancPluginErrorCode_SQLiteFlush = 1008 /*!< SQLite: Unable to flush the database */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 OrthancPluginErrorCode_SQLiteCannotRun = 1009 /*!< SQLite: Cannot run a cached statement */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 OrthancPluginErrorCode_SQLiteCannotStep = 1010 /*!< SQLite: Cannot step over a cached statement */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 OrthancPluginErrorCode_SQLiteBindOutOfRange = 1011 /*!< SQLite: Bing a value while out of range (serious error) */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 OrthancPluginErrorCode_SQLitePrepareStatement = 1012 /*!< SQLite: Cannot prepare a cached statement */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 OrthancPluginErrorCode_SQLiteTransactionAlreadyStarted = 1013 /*!< SQLite: Beginning the same transaction twice */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 OrthancPluginErrorCode_SQLiteTransactionCommit = 1014 /*!< SQLite: Failure when committing the transaction */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 OrthancPluginErrorCode_SQLiteTransactionBegin = 1015 /*!< SQLite: Cannot start a transaction */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 OrthancPluginErrorCode_DirectoryOverFile = 2000 /*!< The directory to be created is already occupied by a regular file */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 OrthancPluginErrorCode_FileStorageCannotWrite = 2001 /*!< Unable to create a subdirectory or a file in the file storage */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 OrthancPluginErrorCode_DirectoryExpected = 2002 /*!< The specified path does not point to a directory */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 OrthancPluginErrorCode_HttpPortInUse = 2003 /*!< The TCP port of the HTTP server is already in use */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 OrthancPluginErrorCode_DicomPortInUse = 2004 /*!< The TCP port of the DICOM server is already in use */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 OrthancPluginErrorCode_BadHttpStatusInRest = 2005 /*!< This HTTP status is not allowed in a REST API */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 OrthancPluginErrorCode_RegularFileExpected = 2006 /*!< The specified path does not point to a regular file */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 OrthancPluginErrorCode_PathToExecutable = 2007 /*!< Unable to get the path to the executable */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 OrthancPluginErrorCode_MakeDirectory = 2008 /*!< Cannot create a directory */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 OrthancPluginErrorCode_BadApplicationEntityTitle = 2009 /*!< An application entity title (AET) cannot be empty or be longer than 16 characters */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 OrthancPluginErrorCode_NoCFindHandler = 2010 /*!< No request handler factory for DICOM C-FIND SCP */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 OrthancPluginErrorCode_NoCMoveHandler = 2011 /*!< No request handler factory for DICOM C-MOVE SCP */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 OrthancPluginErrorCode_NoCStoreHandler = 2012 /*!< No request handler factory for DICOM C-STORE SCP */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 OrthancPluginErrorCode_NoApplicationEntityFilter = 2013 /*!< No application entity filter */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 OrthancPluginErrorCode_NoSopClassOrInstance = 2014 /*!< DicomUserConnection: Unable to find the SOP class and instance */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 OrthancPluginErrorCode_NoPresentationContext = 2015 /*!< DicomUserConnection: No acceptable presentation context for modality */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 OrthancPluginErrorCode_DicomFindUnavailable = 2016 /*!< DicomUserConnection: The C-FIND command is not supported by the remote SCP */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 OrthancPluginErrorCode_DicomMoveUnavailable = 2017 /*!< DicomUserConnection: The C-MOVE command is not supported by the remote SCP */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 OrthancPluginErrorCode_CannotStoreInstance = 2018 /*!< Cannot store an instance */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 OrthancPluginErrorCode_CreateDicomNotString = 2019 /*!< Only string values are supported when creating DICOM instances */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 OrthancPluginErrorCode_CreateDicomOverrideTag = 2020 /*!< Trying to override a value inherited from a parent module */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 OrthancPluginErrorCode_CreateDicomUseContent = 2021 /*!< Use \"Content\" to inject an image into a new DICOM instance */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 OrthancPluginErrorCode_CreateDicomNoPayload = 2022 /*!< No payload is present for one instance in the series */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 OrthancPluginErrorCode_CreateDicomUseDataUriScheme = 2023 /*!< The payload of the DICOM instance must be specified according to Data URI scheme */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 OrthancPluginErrorCode_CreateDicomBadParent = 2024 /*!< Trying to attach a new DICOM instance to an inexistent resource */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 OrthancPluginErrorCode_CreateDicomParentIsInstance = 2025 /*!< Trying to attach a new DICOM instance to an instance (must be a series, study or patient) */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 OrthancPluginErrorCode_CreateDicomParentEncoding = 2026 /*!< Unable to get the encoding of the parent resource */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 OrthancPluginErrorCode_UnknownModality = 2027 /*!< Unknown modality */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 OrthancPluginErrorCode_BadJobOrdering = 2028 /*!< Bad ordering of filters in a job */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 OrthancPluginErrorCode_JsonToLuaTable = 2029 /*!< Cannot convert the given JSON object to a Lua table */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 OrthancPluginErrorCode_CannotCreateLua = 2030 /*!< Cannot create the Lua context */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 OrthancPluginErrorCode_CannotExecuteLua = 2031 /*!< Cannot execute a Lua command */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 OrthancPluginErrorCode_LuaAlreadyExecuted = 2032 /*!< Arguments cannot be pushed after the Lua function is executed */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 OrthancPluginErrorCode_LuaBadOutput = 2033 /*!< The Lua function does not give the expected number of outputs */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 OrthancPluginErrorCode_NotLuaPredicate = 2034 /*!< The Lua function is not a predicate (only true/false outputs allowed) */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 OrthancPluginErrorCode_LuaReturnsNoString = 2035 /*!< The Lua function does not return a string */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 OrthancPluginErrorCode_StorageAreaAlreadyRegistered = 2036 /*!< Another plugin has already registered a custom storage area */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 OrthancPluginErrorCode_DatabaseBackendAlreadyRegistered = 2037 /*!< Another plugin has already registered a custom database back-end */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 OrthancPluginErrorCode_DatabaseNotInitialized = 2038 /*!< Plugin trying to call the database during its initialization */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 OrthancPluginErrorCode_SslDisabled = 2039 /*!< Orthanc has been built without SSL support */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 OrthancPluginErrorCode_CannotOrderSlices = 2040 /*!< Unable to order the slices of the series */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 OrthancPluginErrorCode_NoWorklistHandler = 2041 /*!< No request handler factory for DICOM C-Find Modality SCP */,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 _OrthancPluginErrorCode_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 } OrthancPluginErrorCode;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 * Forward declaration of one of the mandatory functions for Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 * plugins.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 ORTHANC_PLUGINS_API const char* OrthancPluginGetName();
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 * The various HTTP methods for a REST call.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 OrthancPluginHttpMethod_Get = 1, /*!< GET request */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 OrthancPluginHttpMethod_Post = 2, /*!< POST request */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 OrthancPluginHttpMethod_Put = 3, /*!< PUT request */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 OrthancPluginHttpMethod_Delete = 4, /*!< DELETE request */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 _OrthancPluginHttpMethod_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 } OrthancPluginHttpMethod;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 * @brief The parameters of a REST request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 * @brief The HTTP method.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315 OrthancPluginHttpMethod method;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 * @brief The number of groups of the regular expression.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 uint32_t groupsCount;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 * @brief The matched values for the groups of the regular expression.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 const char* const* groups;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 * @brief For a GET request, the number of GET parameters.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 uint32_t getCount;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 * @brief For a GET request, the keys of the GET parameters.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 const char* const* getKeys;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 * @brief For a GET request, the values of the GET parameters.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 const char* const* getValues;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343 * @brief For a PUT or POST request, the content of the body.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345 const char* body;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348 * @brief For a PUT or POST request, the number of bytes of the body.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 uint32_t bodySize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 /* --------------------------------------------------
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 New in version 0.8.1
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 -------------------------------------------------- */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 * @brief The number of HTTP headers.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 uint32_t headersCount;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 * @brief The keys of the HTTP headers (always converted to low-case).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 const char* const* headersKeys;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 * @brief The values of the HTTP headers.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370 const char* const* headersValues;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 } OrthancPluginHttpRequest;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 /* Generic services */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 _OrthancPluginService_LogInfo = 1,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 _OrthancPluginService_LogWarning = 2,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 _OrthancPluginService_LogError = 3,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 _OrthancPluginService_GetOrthancPath = 4,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 _OrthancPluginService_GetOrthancDirectory = 5,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 _OrthancPluginService_GetConfigurationPath = 6,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 _OrthancPluginService_SetPluginProperty = 7,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 _OrthancPluginService_GetGlobalProperty = 8,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 _OrthancPluginService_SetGlobalProperty = 9,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 _OrthancPluginService_GetCommandLineArgumentsCount = 10,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 _OrthancPluginService_GetCommandLineArgument = 11,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 _OrthancPluginService_GetExpectedDatabaseVersion = 12,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 _OrthancPluginService_GetConfiguration = 13,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 _OrthancPluginService_BufferCompression = 14,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 _OrthancPluginService_ReadFile = 15,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393 _OrthancPluginService_WriteFile = 16,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 _OrthancPluginService_GetErrorDescription = 17,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 _OrthancPluginService_CallHttpClient = 18,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396 _OrthancPluginService_RegisterErrorCode = 19,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 _OrthancPluginService_RegisterDictionaryTag = 20,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 _OrthancPluginService_DicomBufferToJson = 21,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 _OrthancPluginService_DicomInstanceToJson = 22,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 _OrthancPluginService_CreateDicom = 23,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 _OrthancPluginService_ComputeMd5 = 24,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 _OrthancPluginService_ComputeSha1 = 25,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 _OrthancPluginService_LookupDictionary = 26,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405 /* Registration of callbacks */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 _OrthancPluginService_RegisterRestCallback = 1000,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407 _OrthancPluginService_RegisterOnStoredInstanceCallback = 1001,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 _OrthancPluginService_RegisterStorageArea = 1002,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 _OrthancPluginService_RegisterOnChangeCallback = 1003,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 _OrthancPluginService_RegisterRestCallbackNoLock = 1004,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411 _OrthancPluginService_RegisterWorklistCallback = 1005,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 _OrthancPluginService_RegisterDecodeImageCallback = 1006,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414 /* Sending answers to REST calls */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 _OrthancPluginService_AnswerBuffer = 2000,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 _OrthancPluginService_CompressAndAnswerPngImage = 2001, /* Unused as of Orthanc 0.9.4 */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417 _OrthancPluginService_Redirect = 2002,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 _OrthancPluginService_SendHttpStatusCode = 2003,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 _OrthancPluginService_SendUnauthorized = 2004,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420 _OrthancPluginService_SendMethodNotAllowed = 2005,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 _OrthancPluginService_SetCookie = 2006,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 _OrthancPluginService_SetHttpHeader = 2007,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423 _OrthancPluginService_StartMultipartAnswer = 2008,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424 _OrthancPluginService_SendMultipartItem = 2009,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425 _OrthancPluginService_SendHttpStatus = 2010,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426 _OrthancPluginService_CompressAndAnswerImage = 2011,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 _OrthancPluginService_SendMultipartItem2 = 2012,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 /* Access to the Orthanc database and API */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430 _OrthancPluginService_GetDicomForInstance = 3000,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431 _OrthancPluginService_RestApiGet = 3001,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432 _OrthancPluginService_RestApiPost = 3002,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 _OrthancPluginService_RestApiDelete = 3003,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 _OrthancPluginService_RestApiPut = 3004,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435 _OrthancPluginService_LookupPatient = 3005,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436 _OrthancPluginService_LookupStudy = 3006,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 _OrthancPluginService_LookupSeries = 3007,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 _OrthancPluginService_LookupInstance = 3008,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439 _OrthancPluginService_LookupStudyWithAccessionNumber = 3009,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440 _OrthancPluginService_RestApiGetAfterPlugins = 3010,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441 _OrthancPluginService_RestApiPostAfterPlugins = 3011,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 _OrthancPluginService_RestApiDeleteAfterPlugins = 3012,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443 _OrthancPluginService_RestApiPutAfterPlugins = 3013,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444 _OrthancPluginService_ReconstructMainDicomTags = 3014,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445 _OrthancPluginService_RestApiGet2 = 3015,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 /* Access to DICOM instances */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 _OrthancPluginService_GetInstanceRemoteAet = 4000,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449 _OrthancPluginService_GetInstanceSize = 4001,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
450 _OrthancPluginService_GetInstanceData = 4002,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
451 _OrthancPluginService_GetInstanceJson = 4003,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
452 _OrthancPluginService_GetInstanceSimplifiedJson = 4004,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453 _OrthancPluginService_HasInstanceMetadata = 4005,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 _OrthancPluginService_GetInstanceMetadata = 4006,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455 _OrthancPluginService_GetInstanceOrigin = 4007,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 /* Services for plugins implementing a database back-end */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 _OrthancPluginService_RegisterDatabaseBackend = 5000,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459 _OrthancPluginService_DatabaseAnswer = 5001,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460 _OrthancPluginService_RegisterDatabaseBackendV2 = 5002,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461 _OrthancPluginService_StorageAreaCreate = 5003,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 _OrthancPluginService_StorageAreaRead = 5004,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463 _OrthancPluginService_StorageAreaRemove = 5005,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465 /* Primitives for handling images */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466 _OrthancPluginService_GetImagePixelFormat = 6000,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467 _OrthancPluginService_GetImageWidth = 6001,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468 _OrthancPluginService_GetImageHeight = 6002,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469 _OrthancPluginService_GetImagePitch = 6003,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
470 _OrthancPluginService_GetImageBuffer = 6004,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
471 _OrthancPluginService_UncompressImage = 6005,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472 _OrthancPluginService_FreeImage = 6006,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
473 _OrthancPluginService_CompressImage = 6007,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
474 _OrthancPluginService_ConvertPixelFormat = 6008,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
475 _OrthancPluginService_GetFontsCount = 6009,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476 _OrthancPluginService_GetFontInfo = 6010,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477 _OrthancPluginService_DrawText = 6011,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 _OrthancPluginService_CreateImage = 6012,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
479 _OrthancPluginService_CreateImageAccessor = 6013,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
480 _OrthancPluginService_DecodeDicomImage = 6014,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
481
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482 /* Primitives for handling worklists */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
483 _OrthancPluginService_WorklistAddAnswer = 7000,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 _OrthancPluginService_WorklistMarkIncomplete = 7001,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
485 _OrthancPluginService_WorklistIsMatch = 7002,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486 _OrthancPluginService_WorklistGetDicomQuery = 7003,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488 _OrthancPluginService_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489 } _OrthancPluginService;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
490
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
491
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
492 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
494 _OrthancPluginProperty_Description = 1,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
495 _OrthancPluginProperty_RootUri = 2,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
496 _OrthancPluginProperty_OrthancExplorer = 3,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
497
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
498 _OrthancPluginProperty_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499 } _OrthancPluginProperty;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
500
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
501
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
503 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
504 * The memory layout of the pixels of an image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
505 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
506 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
507 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
508 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
509 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
510 * @brief Graylevel 8bpp image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
511 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
512 * The image is graylevel. Each pixel is unsigned and stored in
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
513 * one byte.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
515 OrthancPluginPixelFormat_Grayscale8 = 1,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
517 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
518 * @brief Graylevel, unsigned 16bpp image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
519 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
520 * The image is graylevel. Each pixel is unsigned and stored in
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
521 * two bytes.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
522 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
523 OrthancPluginPixelFormat_Grayscale16 = 2,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
524
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
525 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
526 * @brief Graylevel, signed 16bpp image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
528 * The image is graylevel. Each pixel is signed and stored in two
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
529 * bytes.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
530 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
531 OrthancPluginPixelFormat_SignedGrayscale16 = 3,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
532
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
533 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
534 * @brief Color image in RGB24 format.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
535 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
536 * This format describes a color image. The pixels are stored in 3
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
537 * consecutive bytes. The memory layout is RGB.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
538 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
539 OrthancPluginPixelFormat_RGB24 = 4,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
540
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
541 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
542 * @brief Color image in RGBA32 format.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
543 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
544 * This format describes a color image. The pixels are stored in 4
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
545 * consecutive bytes. The memory layout is RGBA.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
546 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
547 OrthancPluginPixelFormat_RGBA32 = 5,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
549 OrthancPluginPixelFormat_Unknown = 6, /*!< Unknown pixel format */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
550
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
551 _OrthancPluginPixelFormat_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
552 } OrthancPluginPixelFormat;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
554
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
555
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
556 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
557 * The content types that are supported by Orthanc plugins.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
558 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
559 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
560 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
561 OrthancPluginContentType_Unknown = 0, /*!< Unknown content type */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
562 OrthancPluginContentType_Dicom = 1, /*!< DICOM */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
563 OrthancPluginContentType_DicomAsJson = 2, /*!< JSON summary of a DICOM file */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
565 _OrthancPluginContentType_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
566 } OrthancPluginContentType;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
567
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
569
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571 * The supported types of DICOM resources.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 OrthancPluginResourceType_Patient = 0, /*!< Patient */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576 OrthancPluginResourceType_Study = 1, /*!< Study */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
577 OrthancPluginResourceType_Series = 2, /*!< Series */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
578 OrthancPluginResourceType_Instance = 3, /*!< Instance */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579 OrthancPluginResourceType_None = 4, /*!< Unavailable resource type */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
581 _OrthancPluginResourceType_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 } OrthancPluginResourceType;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
584
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
585
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
586 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
587 * The supported types of changes that can happen to DICOM resources.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
588 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
589 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
590 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
591 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
592 OrthancPluginChangeType_CompletedSeries = 0, /*!< Series is now complete */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
593 OrthancPluginChangeType_Deleted = 1, /*!< Deleted resource */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
594 OrthancPluginChangeType_NewChildInstance = 2, /*!< A new instance was added to this resource */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595 OrthancPluginChangeType_NewInstance = 3, /*!< New instance received */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596 OrthancPluginChangeType_NewPatient = 4, /*!< New patient created */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
597 OrthancPluginChangeType_NewSeries = 5, /*!< New series created */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
598 OrthancPluginChangeType_NewStudy = 6, /*!< New study created */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
599 OrthancPluginChangeType_StablePatient = 7, /*!< Timeout: No new instance in this patient */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
600 OrthancPluginChangeType_StableSeries = 8, /*!< Timeout: No new instance in this series */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
601 OrthancPluginChangeType_StableStudy = 9, /*!< Timeout: No new instance in this study */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
602 OrthancPluginChangeType_OrthancStarted = 10, /*!< Orthanc has started */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
603 OrthancPluginChangeType_OrthancStopped = 11, /*!< Orthanc is stopping */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
604 OrthancPluginChangeType_UpdatedAttachment = 12, /*!< Some user-defined attachment has changed for this resource */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
605 OrthancPluginChangeType_UpdatedMetadata = 13, /*!< Some user-defined metadata has changed for this resource */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
606
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
607 _OrthancPluginChangeType_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
608 } OrthancPluginChangeType;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
610
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
611 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
612 * The compression algorithms that are supported by the Orthanc core.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
613 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
614 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
615 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
616 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
617 OrthancPluginCompressionType_Zlib = 0, /*!< Standard zlib compression */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
618 OrthancPluginCompressionType_ZlibWithSize = 1, /*!< zlib, prefixed with uncompressed size (uint64_t) */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
619 OrthancPluginCompressionType_Gzip = 2, /*!< Standard gzip compression */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
620 OrthancPluginCompressionType_GzipWithSize = 3, /*!< gzip, prefixed with uncompressed size (uint64_t) */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
621
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
622 _OrthancPluginCompressionType_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
623 } OrthancPluginCompressionType;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
624
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
625
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
627 * The image formats that are supported by the Orthanc core.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
628 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
629 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
630 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
631 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
632 OrthancPluginImageFormat_Png = 0, /*!< Image compressed using PNG */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
633 OrthancPluginImageFormat_Jpeg = 1, /*!< Image compressed using JPEG */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
634 OrthancPluginImageFormat_Dicom = 2, /*!< Image compressed using DICOM */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
635
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
636 _OrthancPluginImageFormat_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
637 } OrthancPluginImageFormat;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
638
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
639
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
640 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
641 * The value representations present in the DICOM standard (version 2013).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
642 * @ingroup Toolbox
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
643 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
644 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
645 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
646 OrthancPluginValueRepresentation_AE = 1, /*!< Application Entity */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
647 OrthancPluginValueRepresentation_AS = 2, /*!< Age String */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
648 OrthancPluginValueRepresentation_AT = 3, /*!< Attribute Tag */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
649 OrthancPluginValueRepresentation_CS = 4, /*!< Code String */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
650 OrthancPluginValueRepresentation_DA = 5, /*!< Date */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
651 OrthancPluginValueRepresentation_DS = 6, /*!< Decimal String */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
652 OrthancPluginValueRepresentation_DT = 7, /*!< Date Time */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653 OrthancPluginValueRepresentation_FD = 8, /*!< Floating Point Double */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
654 OrthancPluginValueRepresentation_FL = 9, /*!< Floating Point Single */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
655 OrthancPluginValueRepresentation_IS = 10, /*!< Integer String */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
656 OrthancPluginValueRepresentation_LO = 11, /*!< Long String */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
657 OrthancPluginValueRepresentation_LT = 12, /*!< Long Text */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
658 OrthancPluginValueRepresentation_OB = 13, /*!< Other Byte String */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
659 OrthancPluginValueRepresentation_OF = 14, /*!< Other Float String */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
660 OrthancPluginValueRepresentation_OW = 15, /*!< Other Word String */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
661 OrthancPluginValueRepresentation_PN = 16, /*!< Person Name */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
662 OrthancPluginValueRepresentation_SH = 17, /*!< Short String */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
663 OrthancPluginValueRepresentation_SL = 18, /*!< Signed Long */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
664 OrthancPluginValueRepresentation_SQ = 19, /*!< Sequence of Items */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
665 OrthancPluginValueRepresentation_SS = 20, /*!< Signed Short */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
666 OrthancPluginValueRepresentation_ST = 21, /*!< Short Text */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
667 OrthancPluginValueRepresentation_TM = 22, /*!< Time */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
668 OrthancPluginValueRepresentation_UI = 23, /*!< Unique Identifier (UID) */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669 OrthancPluginValueRepresentation_UL = 24, /*!< Unsigned Long */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670 OrthancPluginValueRepresentation_UN = 25, /*!< Unknown */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671 OrthancPluginValueRepresentation_US = 26, /*!< Unsigned Short */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
672 OrthancPluginValueRepresentation_UT = 27, /*!< Unlimited Text */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674 _OrthancPluginValueRepresentation_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675 } OrthancPluginValueRepresentation;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
678 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679 * The possible output formats for a DICOM-to-JSON conversion.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
680 * @ingroup Toolbox
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681 * @see OrthancPluginDicomToJson()
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
682 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
684 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
685 OrthancPluginDicomToJsonFormat_Full = 1, /*!< Full output, with most details */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
686 OrthancPluginDicomToJsonFormat_Short = 2, /*!< Tags output as hexadecimal numbers */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
687 OrthancPluginDicomToJsonFormat_Human = 3, /*!< Human-readable JSON */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
688
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689 _OrthancPluginDicomToJsonFormat_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
690 } OrthancPluginDicomToJsonFormat;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
691
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
692
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
693 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694 * Flags to customize a DICOM-to-JSON conversion. By default, binary
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
695 * tags are formatted using Data URI scheme.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
696 * @ingroup Toolbox
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
697 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
700 OrthancPluginDicomToJsonFlags_IncludeBinary = (1 << 0), /*!< Include the binary tags */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
701 OrthancPluginDicomToJsonFlags_IncludePrivateTags = (1 << 1), /*!< Include the private tags */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
702 OrthancPluginDicomToJsonFlags_IncludeUnknownTags = (1 << 2), /*!< Include the tags unknown by the dictionary */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
703 OrthancPluginDicomToJsonFlags_IncludePixelData = (1 << 3), /*!< Include the pixel data */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
704 OrthancPluginDicomToJsonFlags_ConvertBinaryToAscii = (1 << 4), /*!< Output binary tags as-is, dropping non-ASCII */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
705 OrthancPluginDicomToJsonFlags_ConvertBinaryToNull = (1 << 5), /*!< Signal binary tags as null values */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
706
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
707 _OrthancPluginDicomToJsonFlags_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
708 } OrthancPluginDicomToJsonFlags;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
709
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
710
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
711 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
712 * Flags to the creation of a DICOM file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
713 * @ingroup Toolbox
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
714 * @see OrthancPluginCreateDicom()
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
717 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
718 OrthancPluginCreateDicomFlags_DecodeDataUriScheme = (1 << 0), /*!< Decode fields encoded using data URI scheme */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
719 OrthancPluginCreateDicomFlags_GenerateIdentifiers = (1 << 1), /*!< Automatically generate DICOM identifiers */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
720
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721 _OrthancPluginCreateDicomFlags_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
722 } OrthancPluginCreateDicomFlags;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
723
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
724
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
725 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
726 * The constraints on the DICOM identifiers that must be supported
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
727 * by the database plugins.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
728 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
729 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
730 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
731 OrthancPluginIdentifierConstraint_Equal = 1, /*!< Equal */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
732 OrthancPluginIdentifierConstraint_SmallerOrEqual = 2, /*!< Less or equal */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
733 OrthancPluginIdentifierConstraint_GreaterOrEqual = 3, /*!< More or equal */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
734 OrthancPluginIdentifierConstraint_Wildcard = 4, /*!< Case-sensitive wildcard matching (with * and ?) */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
735
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
736 _OrthancPluginIdentifierConstraint_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
737 } OrthancPluginIdentifierConstraint;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
738
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
739
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
740 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
741 * The origin of a DICOM instance that has been received by Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
742 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
743 typedef enum
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
744 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
745 OrthancPluginInstanceOrigin_Unknown = 1, /*!< Unknown origin */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
746 OrthancPluginInstanceOrigin_DicomProtocol = 2, /*!< Instance received through DICOM protocol */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
747 OrthancPluginInstanceOrigin_RestApi = 3, /*!< Instance received through REST API of Orthanc */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
748 OrthancPluginInstanceOrigin_Plugin = 4, /*!< Instance added to Orthanc by a plugin */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
749 OrthancPluginInstanceOrigin_Lua = 5, /*!< Instance added to Orthanc by a Lua script */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
750
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
751 _OrthancPluginInstanceOrigin_INTERNAL = 0x7fffffff
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
752 } OrthancPluginInstanceOrigin;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
753
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
754
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756 * @brief A memory buffer allocated by the core system of Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
758 * A memory buffer allocated by the core system of Orthanc. When the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759 * content of the buffer is not useful anymore, it must be free by a
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
760 * call to ::OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
761 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
762 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
764 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
765 * @brief The content of the buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
766 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767 void* data;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
768
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
769 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
770 * @brief The number of bytes in the buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
771 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
772 uint32_t size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773 } OrthancPluginMemoryBuffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
774
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
775
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
776
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
777
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
778 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
779 * @brief Opaque structure that represents the HTTP connection to the client application.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
780 * @ingroup Callback
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
781 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
782 typedef struct _OrthancPluginRestOutput_t OrthancPluginRestOutput;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
783
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
784
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
785
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
786 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
787 * @brief Opaque structure that represents a DICOM instance received by Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
788 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
789 typedef struct _OrthancPluginDicomInstance_t OrthancPluginDicomInstance;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
790
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
791
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
792
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
793 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
794 * @brief Opaque structure that represents an image that is uncompressed in memory.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
795 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
796 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
797 typedef struct _OrthancPluginImage_t OrthancPluginImage;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
798
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
799
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
800
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
801 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
802 * @brief Opaque structure that represents the storage area that is actually used by Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
803 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
804 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
805 typedef struct _OrthancPluginStorageArea_t OrthancPluginStorageArea;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
806
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
807
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
808
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
809 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
810 * @brief Opaque structure to an object that represents a C-Find query.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
811 * @ingroup Worklists
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
812 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
813 typedef struct _OrthancPluginWorklistQuery_t OrthancPluginWorklistQuery;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
814
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
815
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
816
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
817 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
818 * @brief Opaque structure to an object that represents the answers to a C-Find query.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
819 * @ingroup Worklists
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
820 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
821 typedef struct _OrthancPluginWorklistAnswers_t OrthancPluginWorklistAnswers;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
822
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
823
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
824
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
825 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
826 * @brief Signature of a callback function that answers to a REST request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
827 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
828 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
829 typedef OrthancPluginErrorCode (*OrthancPluginRestCallback) (
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
830 OrthancPluginRestOutput* output,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
831 const char* url,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
832 const OrthancPluginHttpRequest* request);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
833
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
834
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
835
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
836 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
837 * @brief Signature of a callback function that is triggered when Orthanc receives a DICOM instance.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
838 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
839 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
840 typedef OrthancPluginErrorCode (*OrthancPluginOnStoredInstanceCallback) (
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
841 OrthancPluginDicomInstance* instance,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
842 const char* instanceId);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
843
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
844
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
845
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
846 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
847 * @brief Signature of a callback function that is triggered when a change happens to some DICOM resource.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
848 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
849 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
850 typedef OrthancPluginErrorCode (*OrthancPluginOnChangeCallback) (
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
851 OrthancPluginChangeType changeType,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
852 OrthancPluginResourceType resourceType,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
853 const char* resourceId);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
854
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
855
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
856
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
857 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
858 * @brief Signature of a callback function to decode a DICOM instance as an image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
859 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
860 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
861 typedef OrthancPluginErrorCode (*OrthancPluginDecodeImageCallback) (
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
862 OrthancPluginImage** target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
863 const void* dicom,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
864 const uint32_t size,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
865 uint32_t frameIndex);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
866
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
867
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
868
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
869 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
870 * @brief Signature of a function to free dynamic memory.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
871 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
872 typedef void (*OrthancPluginFree) (void* buffer);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
873
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
874
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
875
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
876 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
877 * @brief Callback for writing to the storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
878 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
879 * Signature of a callback function that is triggered when Orthanc writes a file to the storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
880 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
881 * @param uuid The UUID of the file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
882 * @param content The content of the file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
883 * @param size The size of the file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
884 * @param type The content type corresponding to this file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
885 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
886 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
887 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
888 typedef OrthancPluginErrorCode (*OrthancPluginStorageCreate) (
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
889 const char* uuid,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
890 const void* content,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
891 int64_t size,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
892 OrthancPluginContentType type);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
893
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
894
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
895
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
896 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
897 * @brief Callback for reading from the storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
898 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
899 * Signature of a callback function that is triggered when Orthanc reads a file from the storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
900 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
901 * @param content The content of the file (output).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
902 * @param size The size of the file (output).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
903 * @param uuid The UUID of the file of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
904 * @param type The content type corresponding to this file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
905 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
906 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
907 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
908 typedef OrthancPluginErrorCode (*OrthancPluginStorageRead) (
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
909 void** content,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
910 int64_t* size,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
911 const char* uuid,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
912 OrthancPluginContentType type);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
913
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
914
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
915
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
916 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
917 * @brief Callback for removing a file from the storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
918 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
919 * Signature of a callback function that is triggered when Orthanc deletes a file from the storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
920 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
921 * @param uuid The UUID of the file to be removed.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
922 * @param type The content type corresponding to this file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
923 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
924 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
925 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
926 typedef OrthancPluginErrorCode (*OrthancPluginStorageRemove) (
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
927 const char* uuid,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
928 OrthancPluginContentType type);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
929
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
930
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
931
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
932 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
933 * @brief Callback to handle the C-Find SCP requests received by Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
934 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
935 * Signature of a callback function that is triggered when Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
936 * receives a C-Find SCP request against modality worklists.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
937 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
938 * @param answers The target structure where answers must be stored.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
939 * @param query The worklist query.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
940 * @param remoteAet The Application Entity Title (AET) of the modality from which the request originates.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
941 * @param calledAet The Application Entity Title (AET) of the modality that is called by the request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
942 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
943 * @ingroup Worklists
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
944 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
945 typedef OrthancPluginErrorCode (*OrthancPluginWorklistCallback) (
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
946 OrthancPluginWorklistAnswers* answers,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
947 const OrthancPluginWorklistQuery* query,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
948 const char* remoteAet,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
949 const char* calledAet);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
950
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
951
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
952
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
953 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
954 * @brief Data structure that contains information about the Orthanc core.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
955 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
956 typedef struct _OrthancPluginContext_t
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
957 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
958 void* pluginsManager;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
959 const char* orthancVersion;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
960 OrthancPluginFree Free;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
961 OrthancPluginErrorCode (*InvokeService) (struct _OrthancPluginContext_t* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
962 _OrthancPluginService service,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
963 const void* params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
964 } OrthancPluginContext;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
965
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
966
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
967
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
968 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
969 * @brief An entry in the dictionary of DICOM tags.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
970 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
971 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
972 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
973 uint16_t group; /*!< The group of the tag */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
974 uint16_t element; /*!< The element of the tag */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
975 OrthancPluginValueRepresentation vr; /*!< The value representation of the tag */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
976 uint32_t minMultiplicity; /*!< The minimum multiplicity of the tag */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
977 uint32_t maxMultiplicity; /*!< The maximum multiplicity of the tag (0 means arbitrary) */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
978 } OrthancPluginDictionaryEntry;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
979
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
980
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
981
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
982 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
983 * @brief Free a string.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
984 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
985 * Free a string that was allocated by the core system of Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
986 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
987 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
988 * @param str The string to be freed.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
989 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
990 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeString(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
991 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
992 char* str)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
993 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
994 if (str != NULL)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
995 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
996 context->Free(str);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
997 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
998 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
999
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1000
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1001 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1002 * @brief Check the compatibility of the plugin wrt. the version of its hosting Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1003 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1004 * This function checks whether the version of this C header is
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1005 * compatible with the current version of Orthanc. The result of
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1006 * this function should always be checked in the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1007 * OrthancPluginInitialize() entry point of the plugin.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1008 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1009 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1010 * @return 1 if and only if the versions are compatible. If the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1011 * result is 0, the initialization of the plugin should fail.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1012 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1013 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1014 ORTHANC_PLUGIN_INLINE int OrthancPluginCheckVersion(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1015 OrthancPluginContext* context)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1016 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1017 int major, minor, revision;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1018
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1019 if (sizeof(int32_t) != sizeof(OrthancPluginErrorCode) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1020 sizeof(int32_t) != sizeof(OrthancPluginHttpMethod) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1021 sizeof(int32_t) != sizeof(_OrthancPluginService) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1022 sizeof(int32_t) != sizeof(_OrthancPluginProperty) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1023 sizeof(int32_t) != sizeof(OrthancPluginPixelFormat) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1024 sizeof(int32_t) != sizeof(OrthancPluginContentType) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1025 sizeof(int32_t) != sizeof(OrthancPluginResourceType) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1026 sizeof(int32_t) != sizeof(OrthancPluginChangeType) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1027 sizeof(int32_t) != sizeof(OrthancPluginCompressionType) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1028 sizeof(int32_t) != sizeof(OrthancPluginImageFormat) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1029 sizeof(int32_t) != sizeof(OrthancPluginValueRepresentation) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1030 sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFormat) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1031 sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFlags) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1032 sizeof(int32_t) != sizeof(OrthancPluginCreateDicomFlags) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1033 sizeof(int32_t) != sizeof(OrthancPluginIdentifierConstraint) ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1034 sizeof(int32_t) != sizeof(OrthancPluginInstanceOrigin))
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1035 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1036 /* Mismatch in the size of the enumerations */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1037 return 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1038 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1039
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1040 /* Assume compatibility with the mainline */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1041 if (!strcmp(context->orthancVersion, "mainline"))
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1042 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1043 return 1;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1044 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1045
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1046 /* Parse the version of the Orthanc core */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1047 if (
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1048 #ifdef _MSC_VER
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1049 sscanf_s
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1050 #else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1051 sscanf
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1052 #endif
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1053 (context->orthancVersion, "%4d.%4d.%4d", &major, &minor, &revision) != 3)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1054 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1055 return 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1056 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1057
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1058 /* Check the major number of the version */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1059
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1060 if (major > ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1061 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1062 return 1;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1063 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1064
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1065 if (major < ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1066 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1067 return 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1068 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1069
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1070 /* Check the minor number of the version */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1071
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1072 if (minor > ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1073 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1074 return 1;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1075 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1076
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1077 if (minor < ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1078 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1079 return 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1080 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1081
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1082 /* Check the revision number of the version */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1083
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1084 if (revision >= ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1085 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1086 return 1;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1087 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1088 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1089 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1090 return 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1091 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1092 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1093
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1094
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1095 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1096 * @brief Free a memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1097 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1098 * Free a memory buffer that was allocated by the core system of Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1099 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1100 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1101 * @param buffer The memory buffer to release.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1102 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1103 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeMemoryBuffer(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1104 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1105 OrthancPluginMemoryBuffer* buffer)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1106 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1107 context->Free(buffer->data);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1108 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1109
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1110
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1111 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1112 * @brief Log an error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1113 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1114 * Log an error message using the Orthanc logging system.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1115 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1116 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1117 * @param message The message to be logged.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1118 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1119 ORTHANC_PLUGIN_INLINE void OrthancPluginLogError(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1120 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1121 const char* message)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1122 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1123 context->InvokeService(context, _OrthancPluginService_LogError, message);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1124 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1125
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1126
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1127 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1128 * @brief Log a warning.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1129 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1130 * Log a warning message using the Orthanc logging system.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1131 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1132 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1133 * @param message The message to be logged.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1134 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1135 ORTHANC_PLUGIN_INLINE void OrthancPluginLogWarning(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1136 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1137 const char* message)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1138 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1139 context->InvokeService(context, _OrthancPluginService_LogWarning, message);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1140 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1141
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1142
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1143 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1144 * @brief Log an information.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1145 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1146 * Log an information message using the Orthanc logging system.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1147 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1148 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1149 * @param message The message to be logged.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1150 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1151 ORTHANC_PLUGIN_INLINE void OrthancPluginLogInfo(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1152 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1153 const char* message)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1154 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1155 context->InvokeService(context, _OrthancPluginService_LogInfo, message);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1156 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1157
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1158
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1159
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1160 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1161 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1162 const char* pathRegularExpression;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1163 OrthancPluginRestCallback callback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1164 } _OrthancPluginRestCallback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1165
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1166 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1167 * @brief Register a REST callback.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1168 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1169 * This function registers a REST callback against a regular
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1170 * expression for a URI. This function must be called during the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1171 * initialization of the plugin, i.e. inside the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1172 * OrthancPluginInitialize() public function.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1173 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1174 * Each REST callback is guaranteed to run in mutual exclusion.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1175 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1176 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1177 * @param pathRegularExpression Regular expression for the URI. May contain groups.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1178 * @param callback The callback function to handle the REST call.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1179 * @see OrthancPluginRegisterRestCallbackNoLock()
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1180 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1181 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1182 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallback(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1183 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1184 const char* pathRegularExpression,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1185 OrthancPluginRestCallback callback)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1186 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1187 _OrthancPluginRestCallback params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1188 params.pathRegularExpression = pathRegularExpression;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1189 params.callback = callback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1190 context->InvokeService(context, _OrthancPluginService_RegisterRestCallback, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1191 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1192
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1193
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1194
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1195 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1196 * @brief Register a REST callback, without locking.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1197 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1198 * This function registers a REST callback against a regular
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1199 * expression for a URI. This function must be called during the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1200 * initialization of the plugin, i.e. inside the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1201 * OrthancPluginInitialize() public function.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1202 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1203 * Contrarily to OrthancPluginRegisterRestCallback(), the callback
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1204 * will NOT be invoked in mutual exclusion. This can be useful for
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1205 * high-performance plugins that must handle concurrent requests
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1206 * (Orthanc uses a pool of threads, one thread being assigned to
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1207 * each incoming HTTP request). Of course, it is up to the plugin to
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1208 * implement the required locking mechanisms.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1209 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1210 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1211 * @param pathRegularExpression Regular expression for the URI. May contain groups.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1212 * @param callback The callback function to handle the REST call.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1213 * @see OrthancPluginRegisterRestCallback()
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1214 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1215 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1216 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallbackNoLock(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1217 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1218 const char* pathRegularExpression,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1219 OrthancPluginRestCallback callback)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1220 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1221 _OrthancPluginRestCallback params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1222 params.pathRegularExpression = pathRegularExpression;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1223 params.callback = callback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1224 context->InvokeService(context, _OrthancPluginService_RegisterRestCallbackNoLock, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1225 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1226
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1227
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1228
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1229 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1230 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1231 OrthancPluginOnStoredInstanceCallback callback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1232 } _OrthancPluginOnStoredInstanceCallback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1233
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1234 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1235 * @brief Register a callback for received instances.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1236 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1237 * This function registers a callback function that is called
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1238 * whenever a new DICOM instance is stored into the Orthanc core.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1239 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1240 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1241 * @param callback The callback function.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1242 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1243 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1244 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnStoredInstanceCallback(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1245 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1246 OrthancPluginOnStoredInstanceCallback callback)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1247 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1248 _OrthancPluginOnStoredInstanceCallback params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1249 params.callback = callback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1250
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1251 context->InvokeService(context, _OrthancPluginService_RegisterOnStoredInstanceCallback, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1252 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1253
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1254
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1255
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1256 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1257 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1258 OrthancPluginRestOutput* output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1259 const char* answer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1260 uint32_t answerSize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1261 const char* mimeType;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1262 } _OrthancPluginAnswerBuffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1263
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1264 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1265 * @brief Answer to a REST request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1266 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1267 * This function answers to a REST request with the content of a memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1268 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1269 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1270 * @param output The HTTP connection to the client application.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1271 * @param answer Pointer to the memory buffer containing the answer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1272 * @param answerSize Number of bytes of the answer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1273 * @param mimeType The MIME type of the answer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1274 * @ingroup REST
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1275 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1276 ORTHANC_PLUGIN_INLINE void OrthancPluginAnswerBuffer(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1277 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1278 OrthancPluginRestOutput* output,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1279 const char* answer,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1280 uint32_t answerSize,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1281 const char* mimeType)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1282 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1283 _OrthancPluginAnswerBuffer params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1284 params.output = output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1285 params.answer = answer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1286 params.answerSize = answerSize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1287 params.mimeType = mimeType;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1288 context->InvokeService(context, _OrthancPluginService_AnswerBuffer, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1289 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1290
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1291
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1292 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1293 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1294 OrthancPluginRestOutput* output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1295 OrthancPluginPixelFormat format;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1296 uint32_t width;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1297 uint32_t height;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1298 uint32_t pitch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1299 const void* buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1300 } _OrthancPluginCompressAndAnswerPngImage;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1301
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1302 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1303 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1304 OrthancPluginRestOutput* output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1305 OrthancPluginImageFormat imageFormat;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1306 OrthancPluginPixelFormat pixelFormat;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1307 uint32_t width;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1308 uint32_t height;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1309 uint32_t pitch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1310 const void* buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1311 uint8_t quality;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1312 } _OrthancPluginCompressAndAnswerImage;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1313
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1314
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1315 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1316 * @brief Answer to a REST request with a PNG image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1317 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1318 * This function answers to a REST request with a PNG image. The
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1319 * parameters of this function describe a memory buffer that
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1320 * contains an uncompressed image. The image will be automatically compressed
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1321 * as a PNG image by the core system of Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1322 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1323 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1324 * @param output The HTTP connection to the client application.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1325 * @param format The memory layout of the uncompressed image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1326 * @param width The width of the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1327 * @param height The height of the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1328 * @param pitch The pitch of the image (i.e. the number of bytes
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1329 * between 2 successive lines of the image in the memory buffer).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1330 * @param buffer The memory buffer containing the uncompressed image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1331 * @ingroup REST
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1332 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1333 ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerPngImage(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1334 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1335 OrthancPluginRestOutput* output,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1336 OrthancPluginPixelFormat format,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1337 uint32_t width,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1338 uint32_t height,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1339 uint32_t pitch,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1340 const void* buffer)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1341 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1342 _OrthancPluginCompressAndAnswerImage params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1343 params.output = output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1344 params.imageFormat = OrthancPluginImageFormat_Png;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1345 params.pixelFormat = format;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1346 params.width = width;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1347 params.height = height;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1348 params.pitch = pitch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1349 params.buffer = buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1350 params.quality = 0; /* No quality for PNG */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1351 context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1352 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1353
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1354
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1355
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1356 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1357 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1358 OrthancPluginMemoryBuffer* target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1359 const char* instanceId;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1360 } _OrthancPluginGetDicomForInstance;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1361
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1362 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1363 * @brief Retrieve a DICOM instance using its Orthanc identifier.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1364 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1365 * Retrieve a DICOM instance using its Orthanc identifier. The DICOM
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1366 * file is stored into a newly allocated memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1367 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1368 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1369 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1370 * @param instanceId The Orthanc identifier of the DICOM instance of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1371 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1372 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1373 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1374 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginGetDicomForInstance(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1375 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1376 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1377 const char* instanceId)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1378 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1379 _OrthancPluginGetDicomForInstance params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1380 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1381 params.instanceId = instanceId;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1382 return context->InvokeService(context, _OrthancPluginService_GetDicomForInstance, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1383 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1384
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1385
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1386
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1387 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1388 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1389 OrthancPluginMemoryBuffer* target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1390 const char* uri;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1391 } _OrthancPluginRestApiGet;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1392
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1393 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1394 * @brief Make a GET call to the built-in Orthanc REST API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1395 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1396 * Make a GET call to the built-in Orthanc REST API. The result to
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1397 * the query is stored into a newly allocated memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1398 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1399 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1400 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1401 * @param uri The URI in the built-in Orthanc API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1402 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1403 * @see OrthancPluginRestApiGetAfterPlugins
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1404 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1405 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1406 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiGet(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1407 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1408 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1409 const char* uri)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1410 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1411 _OrthancPluginRestApiGet params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1412 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1413 params.uri = uri;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1414 return context->InvokeService(context, _OrthancPluginService_RestApiGet, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1415 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1416
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1417
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1418
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1419 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1420 * @brief Make a GET call to the REST API, as tainted by the plugins.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1421 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1422 * Make a GET call to the Orthanc REST API, after all the plugins
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1423 * are applied. In other words, if some plugin overrides or adds the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1424 * called URI to the built-in Orthanc REST API, this call will
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1425 * return the result provided by this plugin. The result to the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1426 * query is stored into a newly allocated memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1427 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1428 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1429 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1430 * @param uri The URI in the built-in Orthanc API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1431 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1432 * @see OrthancPluginRestApiGet
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1433 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1434 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1435 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiGetAfterPlugins(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1436 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1437 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1438 const char* uri)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1439 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1440 _OrthancPluginRestApiGet params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1441 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1442 params.uri = uri;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1443 return context->InvokeService(context, _OrthancPluginService_RestApiGetAfterPlugins, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1444 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1445
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1446
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1447
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1448 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1449 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1450 OrthancPluginMemoryBuffer* target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1451 const char* uri;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1452 const char* body;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1453 uint32_t bodySize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1454 } _OrthancPluginRestApiPostPut;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1455
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1456 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1457 * @brief Make a POST call to the built-in Orthanc REST API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1458 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1459 * Make a POST call to the built-in Orthanc REST API. The result to
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1460 * the query is stored into a newly allocated memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1461 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1462 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1463 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1464 * @param uri The URI in the built-in Orthanc API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1465 * @param body The body of the POST request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1466 * @param bodySize The size of the body.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1467 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1468 * @see OrthancPluginRestApiPostAfterPlugins
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1469 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1470 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1471 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPost(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1472 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1473 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1474 const char* uri,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1475 const char* body,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1476 uint32_t bodySize)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1477 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1478 _OrthancPluginRestApiPostPut params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1479 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1480 params.uri = uri;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1481 params.body = body;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1482 params.bodySize = bodySize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1483 return context->InvokeService(context, _OrthancPluginService_RestApiPost, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1484 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1485
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1486
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1487 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1488 * @brief Make a POST call to the REST API, as tainted by the plugins.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1489 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1490 * Make a POST call to the Orthanc REST API, after all the plugins
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1491 * are applied. In other words, if some plugin overrides or adds the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1492 * called URI to the built-in Orthanc REST API, this call will
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1493 * return the result provided by this plugin. The result to the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1494 * query is stored into a newly allocated memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1495 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1496 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1497 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1498 * @param uri The URI in the built-in Orthanc API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1499 * @param body The body of the POST request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1500 * @param bodySize The size of the body.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1501 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1502 * @see OrthancPluginRestApiPost
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1503 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1504 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1505 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPostAfterPlugins(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1506 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1507 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1508 const char* uri,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1509 const char* body,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1510 uint32_t bodySize)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1511 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1512 _OrthancPluginRestApiPostPut params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1513 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1514 params.uri = uri;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1515 params.body = body;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1516 params.bodySize = bodySize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1517 return context->InvokeService(context, _OrthancPluginService_RestApiPostAfterPlugins, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1518 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1519
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1520
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1521
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1522 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1523 * @brief Make a DELETE call to the built-in Orthanc REST API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1524 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1525 * Make a DELETE call to the built-in Orthanc REST API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1526 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1527 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1528 * @param uri The URI to delete in the built-in Orthanc API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1529 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1530 * @see OrthancPluginRestApiDeleteAfterPlugins
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1531 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1532 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1533 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiDelete(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1534 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1535 const char* uri)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1536 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1537 return context->InvokeService(context, _OrthancPluginService_RestApiDelete, uri);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1538 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1539
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1540
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1541 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1542 * @brief Make a DELETE call to the REST API, as tainted by the plugins.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1543 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1544 * Make a DELETE call to the Orthanc REST API, after all the plugins
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1545 * are applied. In other words, if some plugin overrides or adds the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1546 * called URI to the built-in Orthanc REST API, this call will
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1547 * return the result provided by this plugin.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1548 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1549 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1550 * @param uri The URI to delete in the built-in Orthanc API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1551 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1552 * @see OrthancPluginRestApiDelete
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1553 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1554 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1555 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiDeleteAfterPlugins(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1556 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1557 const char* uri)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1558 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1559 return context->InvokeService(context, _OrthancPluginService_RestApiDeleteAfterPlugins, uri);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1560 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1561
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1562
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1563
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1564 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1565 * @brief Make a PUT call to the built-in Orthanc REST API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1566 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1567 * Make a PUT call to the built-in Orthanc REST API. The result to
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1568 * the query is stored into a newly allocated memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1569 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1570 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1571 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1572 * @param uri The URI in the built-in Orthanc API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1573 * @param body The body of the PUT request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1574 * @param bodySize The size of the body.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1575 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1576 * @see OrthancPluginRestApiPutAfterPlugins
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1577 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1578 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1579 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPut(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1580 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1581 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1582 const char* uri,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1583 const char* body,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1584 uint32_t bodySize)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1585 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1586 _OrthancPluginRestApiPostPut params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1587 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1588 params.uri = uri;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1589 params.body = body;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1590 params.bodySize = bodySize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1591 return context->InvokeService(context, _OrthancPluginService_RestApiPut, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1592 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1593
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1594
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1595
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1596 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1597 * @brief Make a PUT call to the REST API, as tainted by the plugins.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1598 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1599 * Make a PUT call to the Orthanc REST API, after all the plugins
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1600 * are applied. In other words, if some plugin overrides or adds the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1601 * called URI to the built-in Orthanc REST API, this call will
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1602 * return the result provided by this plugin. The result to the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1603 * query is stored into a newly allocated memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1604 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1605 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1606 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1607 * @param uri The URI in the built-in Orthanc API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1608 * @param body The body of the PUT request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1609 * @param bodySize The size of the body.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1610 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1611 * @see OrthancPluginRestApiPut
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1612 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1613 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1614 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiPutAfterPlugins(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1615 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1616 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1617 const char* uri,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1618 const char* body,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1619 uint32_t bodySize)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1620 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1621 _OrthancPluginRestApiPostPut params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1622 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1623 params.uri = uri;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1624 params.body = body;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1625 params.bodySize = bodySize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1626 return context->InvokeService(context, _OrthancPluginService_RestApiPutAfterPlugins, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1627 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1628
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1629
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1630
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1631 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1632 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1633 OrthancPluginRestOutput* output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1634 const char* argument;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1635 } _OrthancPluginOutputPlusArgument;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1636
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1637 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1638 * @brief Redirect a REST request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1639 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1640 * This function answers to a REST request by redirecting the user
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1641 * to another URI using HTTP status 301.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1642 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1643 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1644 * @param output The HTTP connection to the client application.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1645 * @param redirection Where to redirect.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1646 * @ingroup REST
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1647 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1648 ORTHANC_PLUGIN_INLINE void OrthancPluginRedirect(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1649 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1650 OrthancPluginRestOutput* output,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1651 const char* redirection)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1652 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1653 _OrthancPluginOutputPlusArgument params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1654 params.output = output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1655 params.argument = redirection;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1656 context->InvokeService(context, _OrthancPluginService_Redirect, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1657 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1658
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1659
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1660
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1661 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1662 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1663 char** result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1664 const char* argument;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1665 } _OrthancPluginRetrieveDynamicString;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1666
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1667 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1668 * @brief Look for a patient.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1669 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1670 * Look for a patient stored in Orthanc, using its Patient ID tag (0x0010, 0x0020).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1671 * This function uses the database index to run as fast as possible (it does not loop
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1672 * over all the stored patients).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1673 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1674 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1675 * @param patientID The Patient ID of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1676 * @return The NULL value if the patient is non-existent, or a string containing the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1677 * Orthanc ID of the patient. This string must be freed by OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1678 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1679 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1680 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupPatient(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1681 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1682 const char* patientID)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1683 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1684 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1685
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1686 _OrthancPluginRetrieveDynamicString params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1687 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1688 params.argument = patientID;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1689
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1690 if (context->InvokeService(context, _OrthancPluginService_LookupPatient, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1691 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1692 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1693 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1694 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1695 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1696 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1697 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1698 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1699 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1700
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1701
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1702 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1703 * @brief Look for a study.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1704 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1705 * Look for a study stored in Orthanc, using its Study Instance UID tag (0x0020, 0x000d).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1706 * This function uses the database index to run as fast as possible (it does not loop
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1707 * over all the stored studies).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1708 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1709 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1710 * @param studyUID The Study Instance UID of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1711 * @return The NULL value if the study is non-existent, or a string containing the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1712 * Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1713 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1714 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1715 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudy(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1716 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1717 const char* studyUID)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1718 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1719 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1720
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1721 _OrthancPluginRetrieveDynamicString params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1722 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1723 params.argument = studyUID;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1724
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1725 if (context->InvokeService(context, _OrthancPluginService_LookupStudy, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1726 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1727 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1728 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1729 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1730 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1731 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1732 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1733 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1734 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1735
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1736
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1737 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1738 * @brief Look for a study, using the accession number.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1739 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1740 * Look for a study stored in Orthanc, using its Accession Number tag (0x0008, 0x0050).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1741 * This function uses the database index to run as fast as possible (it does not loop
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1742 * over all the stored studies).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1743 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1744 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1745 * @param accessionNumber The Accession Number of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1746 * @return The NULL value if the study is non-existent, or a string containing the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1747 * Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1748 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1749 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1750 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudyWithAccessionNumber(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1751 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1752 const char* accessionNumber)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1753 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1754 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1755
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1756 _OrthancPluginRetrieveDynamicString params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1757 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1758 params.argument = accessionNumber;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1759
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1760 if (context->InvokeService(context, _OrthancPluginService_LookupStudyWithAccessionNumber, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1761 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1762 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1763 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1764 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1765 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1766 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1767 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1768 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1769 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1770
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1771
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1772 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1773 * @brief Look for a series.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1774 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1775 * Look for a series stored in Orthanc, using its Series Instance UID tag (0x0020, 0x000e).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1776 * This function uses the database index to run as fast as possible (it does not loop
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1777 * over all the stored series).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1778 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1779 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1780 * @param seriesUID The Series Instance UID of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1781 * @return The NULL value if the series is non-existent, or a string containing the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1782 * Orthanc ID of the series. This string must be freed by OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1783 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1784 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1785 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupSeries(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1786 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1787 const char* seriesUID)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1788 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1789 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1790
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1791 _OrthancPluginRetrieveDynamicString params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1792 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1793 params.argument = seriesUID;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1794
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1795 if (context->InvokeService(context, _OrthancPluginService_LookupSeries, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1796 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1797 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1798 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1799 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1800 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1801 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1802 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1803 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1804 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1805
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1806
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1807 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1808 * @brief Look for an instance.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1809 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1810 * Look for an instance stored in Orthanc, using its SOP Instance UID tag (0x0008, 0x0018).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1811 * This function uses the database index to run as fast as possible (it does not loop
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1812 * over all the stored instances).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1813 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1814 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1815 * @param sopInstanceUID The SOP Instance UID of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1816 * @return The NULL value if the instance is non-existent, or a string containing the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1817 * Orthanc ID of the instance. This string must be freed by OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1818 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1819 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1820 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupInstance(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1821 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1822 const char* sopInstanceUID)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1823 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1824 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1825
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1826 _OrthancPluginRetrieveDynamicString params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1827 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1828 params.argument = sopInstanceUID;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1829
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1830 if (context->InvokeService(context, _OrthancPluginService_LookupInstance, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1831 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1832 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1833 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1834 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1835 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1836 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1837 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1838 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1839 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1840
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1841
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1842
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1843 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1844 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1845 OrthancPluginRestOutput* output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1846 uint16_t status;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1847 } _OrthancPluginSendHttpStatusCode;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1848
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1849 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1850 * @brief Send a HTTP status code.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1851 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1852 * This function answers to a REST request by sending a HTTP status
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1853 * code (such as "400 - Bad Request"). Note that:
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1854 * - Successful requests (status 200) must use ::OrthancPluginAnswerBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1855 * - Redirections (status 301) must use ::OrthancPluginRedirect().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1856 * - Unauthorized access (status 401) must use ::OrthancPluginSendUnauthorized().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1857 * - Methods not allowed (status 405) must use ::OrthancPluginSendMethodNotAllowed().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1858 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1859 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1860 * @param output The HTTP connection to the client application.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1861 * @param status The HTTP status code to be sent.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1862 * @ingroup REST
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1863 * @see OrthancPluginSendHttpStatus()
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1864 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1865 ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatusCode(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1866 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1867 OrthancPluginRestOutput* output,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1868 uint16_t status)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1869 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1870 _OrthancPluginSendHttpStatusCode params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1871 params.output = output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1872 params.status = status;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1873 context->InvokeService(context, _OrthancPluginService_SendHttpStatusCode, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1874 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1875
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1876
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1877 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1878 * @brief Signal that a REST request is not authorized.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1879 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1880 * This function answers to a REST request by signaling that it is
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1881 * not authorized.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1882 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1883 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1884 * @param output The HTTP connection to the client application.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1885 * @param realm The realm for the authorization process.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1886 * @ingroup REST
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1887 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1888 ORTHANC_PLUGIN_INLINE void OrthancPluginSendUnauthorized(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1889 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1890 OrthancPluginRestOutput* output,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1891 const char* realm)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1892 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1893 _OrthancPluginOutputPlusArgument params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1894 params.output = output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1895 params.argument = realm;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1896 context->InvokeService(context, _OrthancPluginService_SendUnauthorized, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1897 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1898
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1899
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1900 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1901 * @brief Signal that this URI does not support this HTTP method.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1902 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1903 * This function answers to a REST request by signaling that the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1904 * queried URI does not support this method.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1905 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1906 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1907 * @param output The HTTP connection to the client application.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1908 * @param allowedMethods The allowed methods for this URI (e.g. "GET,POST" after a PUT or a POST request).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1909 * @ingroup REST
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1910 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1911 ORTHANC_PLUGIN_INLINE void OrthancPluginSendMethodNotAllowed(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1912 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1913 OrthancPluginRestOutput* output,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1914 const char* allowedMethods)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1915 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1916 _OrthancPluginOutputPlusArgument params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1917 params.output = output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1918 params.argument = allowedMethods;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1919 context->InvokeService(context, _OrthancPluginService_SendMethodNotAllowed, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1920 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1921
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1922
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1923 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1924 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1925 OrthancPluginRestOutput* output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1926 const char* key;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1927 const char* value;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1928 } _OrthancPluginSetHttpHeader;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1929
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1930 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1931 * @brief Set a cookie.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1932 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1933 * This function sets a cookie in the HTTP client.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1934 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1935 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1936 * @param output The HTTP connection to the client application.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1937 * @param cookie The cookie to be set.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1938 * @param value The value of the cookie.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1939 * @ingroup REST
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1940 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1941 ORTHANC_PLUGIN_INLINE void OrthancPluginSetCookie(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1942 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1943 OrthancPluginRestOutput* output,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1944 const char* cookie,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1945 const char* value)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1946 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1947 _OrthancPluginSetHttpHeader params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1948 params.output = output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1949 params.key = cookie;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1950 params.value = value;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1951 context->InvokeService(context, _OrthancPluginService_SetCookie, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1952 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1953
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1954
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1955 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1956 * @brief Set some HTTP header.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1957 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1958 * This function sets a HTTP header in the HTTP answer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1959 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1960 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1961 * @param output The HTTP connection to the client application.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1962 * @param key The HTTP header to be set.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1963 * @param value The value of the HTTP header.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1964 * @ingroup REST
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1965 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1966 ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpHeader(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1967 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1968 OrthancPluginRestOutput* output,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1969 const char* key,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1970 const char* value)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1971 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1972 _OrthancPluginSetHttpHeader params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1973 params.output = output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1974 params.key = key;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1975 params.value = value;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1976 context->InvokeService(context, _OrthancPluginService_SetHttpHeader, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1977 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1978
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1979
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1980 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1981 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1982 char** resultStringToFree;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1983 const char** resultString;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1984 int64_t* resultInt64;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1985 const char* key;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1986 OrthancPluginDicomInstance* instance;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1987 OrthancPluginInstanceOrigin* resultOrigin; /* New in Orthanc 0.9.5 SDK */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1988 } _OrthancPluginAccessDicomInstance;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1989
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1990
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1991 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1992 * @brief Get the AET of a DICOM instance.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1993 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1994 * This function returns the Application Entity Title (AET) of the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1995 * DICOM modality from which a DICOM instance originates.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1996 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1997 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1998 * @param instance The instance of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1999 * @return The AET if success, NULL if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2000 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2001 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2002 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceRemoteAet(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2003 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2004 OrthancPluginDicomInstance* instance)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2005 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2006 const char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2007
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2008 _OrthancPluginAccessDicomInstance params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2009 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2010 params.resultString = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2011 params.instance = instance;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2012
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2013 if (context->InvokeService(context, _OrthancPluginService_GetInstanceRemoteAet, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2014 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2015 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2016 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2017 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2018 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2019 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2020 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2021 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2022 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2023
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2024
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2025 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2026 * @brief Get the size of a DICOM file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2027 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2028 * This function returns the number of bytes of the given DICOM instance.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2029 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2030 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2031 * @param instance The instance of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2032 * @return The size of the file, -1 in case of error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2033 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2034 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2035 ORTHANC_PLUGIN_INLINE int64_t OrthancPluginGetInstanceSize(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2036 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2037 OrthancPluginDicomInstance* instance)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2038 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2039 int64_t size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2040
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2041 _OrthancPluginAccessDicomInstance params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2042 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2043 params.resultInt64 = &size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2044 params.instance = instance;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2045
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2046 if (context->InvokeService(context, _OrthancPluginService_GetInstanceSize, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2047 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2048 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2049 return -1;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2050 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2051 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2052 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2053 return size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2054 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2055 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2056
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2057
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2058 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2059 * @brief Get the data of a DICOM file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2060 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2061 * This function returns a pointer to the content of the given DICOM instance.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2062 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2063 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2064 * @param instance The instance of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2065 * @return The pointer to the DICOM data, NULL in case of error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2066 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2067 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2068 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceData(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2069 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2070 OrthancPluginDicomInstance* instance)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2071 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2072 const char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2073
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2074 _OrthancPluginAccessDicomInstance params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2075 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2076 params.resultString = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2077 params.instance = instance;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2078
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2079 if (context->InvokeService(context, _OrthancPluginService_GetInstanceData, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2080 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2081 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2082 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2083 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2084 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2085 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2086 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2087 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2088 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2089
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2090
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2091 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2092 * @brief Get the DICOM tag hierarchy as a JSON file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2093 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2094 * This function returns a pointer to a newly created string
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2095 * containing a JSON file. This JSON file encodes the tag hierarchy
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2096 * of the given DICOM instance.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2097 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2098 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2099 * @param instance The instance of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2100 * @return The NULL value in case of error, or a string containing the JSON file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2101 * This string must be freed by OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2102 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2103 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2104 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceJson(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2105 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2106 OrthancPluginDicomInstance* instance)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2107 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2108 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2109
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2110 _OrthancPluginAccessDicomInstance params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2111 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2112 params.resultStringToFree = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2113 params.instance = instance;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2114
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2115 if (context->InvokeService(context, _OrthancPluginService_GetInstanceJson, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2116 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2117 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2118 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2119 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2120 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2121 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2122 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2123 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2124 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2125
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2126
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2127 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2128 * @brief Get the DICOM tag hierarchy as a JSON file (with simplification).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2129 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2130 * This function returns a pointer to a newly created string
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2131 * containing a JSON file. This JSON file encodes the tag hierarchy
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2132 * of the given DICOM instance. In contrast with
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2133 * ::OrthancPluginGetInstanceJson(), the returned JSON file is in
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2134 * its simplified version.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2135 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2136 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2137 * @param instance The instance of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2138 * @return The NULL value in case of error, or a string containing the JSON file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2139 * This string must be freed by OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2140 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2141 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2142 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetInstanceSimplifiedJson(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2143 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2144 OrthancPluginDicomInstance* instance)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2145 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2146 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2147
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2148 _OrthancPluginAccessDicomInstance params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2149 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2150 params.resultStringToFree = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2151 params.instance = instance;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2152
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2153 if (context->InvokeService(context, _OrthancPluginService_GetInstanceSimplifiedJson, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2154 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2155 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2156 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2157 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2158 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2159 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2160 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2161 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2162 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2163
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2164
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2165 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2166 * @brief Check whether a DICOM instance is associated with some metadata.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2167 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2168 * This function checks whether the DICOM instance of interest is
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2169 * associated with some metadata. As of Orthanc 0.8.1, in the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2170 * callbacks registered by
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2171 * ::OrthancPluginRegisterOnStoredInstanceCallback(), the only
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2172 * possibly available metadata are "ReceptionDate", "RemoteAET" and
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2173 * "IndexInSeries".
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2174 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2175 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2176 * @param instance The instance of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2177 * @param metadata The metadata of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2178 * @return 1 if the metadata is present, 0 if it is absent, -1 in case of error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2179 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2180 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2181 ORTHANC_PLUGIN_INLINE int OrthancPluginHasInstanceMetadata(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2182 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2183 OrthancPluginDicomInstance* instance,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2184 const char* metadata)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2185 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2186 int64_t result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2187
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2188 _OrthancPluginAccessDicomInstance params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2189 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2190 params.resultInt64 = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2191 params.instance = instance;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2192 params.key = metadata;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2193
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2194 if (context->InvokeService(context, _OrthancPluginService_HasInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2195 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2196 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2197 return -1;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2198 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2199 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2200 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2201 return (result != 0);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2202 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2203 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2204
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2205
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2206 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2207 * @brief Get the value of some metadata associated with a given DICOM instance.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2208 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2209 * This functions returns the value of some metadata that is associated with the DICOM instance of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2210 * Before calling this function, the existence of the metadata must have been checked with
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2211 * ::OrthancPluginHasInstanceMetadata().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2212 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2213 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2214 * @param instance The instance of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2215 * @param metadata The metadata of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2216 * @return The metadata value if success, NULL if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2217 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2218 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2219 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceMetadata(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2220 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2221 OrthancPluginDicomInstance* instance,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2222 const char* metadata)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2223 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2224 const char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2225
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2226 _OrthancPluginAccessDicomInstance params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2227 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2228 params.resultString = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2229 params.instance = instance;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2230 params.key = metadata;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2231
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2232 if (context->InvokeService(context, _OrthancPluginService_GetInstanceMetadata, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2233 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2234 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2235 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2236 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2237 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2238 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2239 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2240 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2241 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2242
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2243
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2244
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2245 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2246 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2247 OrthancPluginStorageCreate create;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2248 OrthancPluginStorageRead read;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2249 OrthancPluginStorageRemove remove;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2250 OrthancPluginFree free;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2251 } _OrthancPluginRegisterStorageArea;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2252
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2253 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2254 * @brief Register a custom storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2255 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2256 * This function registers a custom storage area, to replace the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2257 * built-in way Orthanc stores its files on the filesystem. This
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2258 * function must be called during the initialization of the plugin,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2259 * i.e. inside the OrthancPluginInitialize() public function.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2260 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2261 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2262 * @param create The callback function to store a file on the custom storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2263 * @param read The callback function to read a file from the custom storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2264 * @param remove The callback function to remove a file from the custom storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2265 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2266 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2267 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterStorageArea(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2268 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2269 OrthancPluginStorageCreate create,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2270 OrthancPluginStorageRead read,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2271 OrthancPluginStorageRemove remove)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2272 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2273 _OrthancPluginRegisterStorageArea params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2274 params.create = create;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2275 params.read = read;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2276 params.remove = remove;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2277
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2278 #ifdef __cplusplus
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2279 params.free = ::free;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2280 #else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2281 params.free = free;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2282 #endif
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2283
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2284 context->InvokeService(context, _OrthancPluginService_RegisterStorageArea, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2285 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2286
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2287
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2288
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2289 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2290 * @brief Return the path to the Orthanc executable.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2291 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2292 * This function returns the path to the Orthanc executable.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2293 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2294 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2295 * @return NULL in the case of an error, or a newly allocated string
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2296 * containing the path. This string must be freed by
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2297 * OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2298 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2299 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancPath(OrthancPluginContext* context)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2300 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2301 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2302
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2303 _OrthancPluginRetrieveDynamicString params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2304 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2305 params.argument = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2306
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2307 if (context->InvokeService(context, _OrthancPluginService_GetOrthancPath, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2308 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2309 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2310 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2311 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2312 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2313 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2314 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2315 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2316 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2317
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2318
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2319 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2320 * @brief Return the directory containing the Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2321 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2322 * This function returns the path to the directory containing the Orthanc executable.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2323 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2324 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2325 * @return NULL in the case of an error, or a newly allocated string
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2326 * containing the path. This string must be freed by
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2327 * OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2328 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2329 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancDirectory(OrthancPluginContext* context)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2330 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2331 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2332
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2333 _OrthancPluginRetrieveDynamicString params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2334 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2335 params.argument = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2336
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2337 if (context->InvokeService(context, _OrthancPluginService_GetOrthancDirectory, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2338 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2339 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2340 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2341 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2342 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2343 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2344 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2345 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2346 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2347
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2348
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2349 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2350 * @brief Return the path to the configuration file(s).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2351 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2352 * This function returns the path to the configuration file(s) that
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2353 * was specified when starting Orthanc. Since version 0.9.1, this
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2354 * path can refer to a folder that stores a set of configuration
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2355 * files. This function is deprecated in favor of
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2356 * OrthancPluginGetConfiguration().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2357 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2358 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2359 * @return NULL in the case of an error, or a newly allocated string
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2360 * containing the path. This string must be freed by
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2361 * OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2362 * @see OrthancPluginGetConfiguration()
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2363 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2364 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfigurationPath(OrthancPluginContext* context)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2365 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2366 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2367
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2368 _OrthancPluginRetrieveDynamicString params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2369 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2370 params.argument = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2371
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2372 if (context->InvokeService(context, _OrthancPluginService_GetConfigurationPath, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2373 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2374 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2375 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2376 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2377 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2378 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2379 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2380 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2381 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2382
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2383
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2384
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2385 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2386 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2387 OrthancPluginOnChangeCallback callback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2388 } _OrthancPluginOnChangeCallback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2389
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2390 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2391 * @brief Register a callback to monitor changes.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2392 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2393 * This function registers a callback function that is called
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2394 * whenever a change happens to some DICOM resource.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2395 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2396 * @warning If your change callback has to call the REST API of
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2397 * Orthanc, you should make these calls in a separate thread (with
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2398 * the events passing through a message queue). Otherwise, this
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2399 * could result in deadlocks in the presence of other plugins or Lua
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2400 * script.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2401 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2402 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2403 * @param callback The callback function.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2404 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2405 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2406 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterOnChangeCallback(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2407 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2408 OrthancPluginOnChangeCallback callback)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2409 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2410 _OrthancPluginOnChangeCallback params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2411 params.callback = callback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2412
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2413 context->InvokeService(context, _OrthancPluginService_RegisterOnChangeCallback, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2414 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2415
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2416
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2417
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2418 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2419 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2420 const char* plugin;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2421 _OrthancPluginProperty property;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2422 const char* value;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2423 } _OrthancPluginSetPluginProperty;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2424
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2425
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2426 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2427 * @brief Set the URI where the plugin provides its Web interface.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2428 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2429 * For plugins that come with a Web interface, this function
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2430 * declares the entry path where to find this interface. This
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2431 * information is notably used in the "Plugins" page of Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2432 * Explorer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2433 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2434 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2435 * @param uri The root URI for this plugin.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2436 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2437 ORTHANC_PLUGIN_INLINE void OrthancPluginSetRootUri(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2438 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2439 const char* uri)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2440 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2441 _OrthancPluginSetPluginProperty params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2442 params.plugin = OrthancPluginGetName();
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2443 params.property = _OrthancPluginProperty_RootUri;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2444 params.value = uri;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2445
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2446 context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2447 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2448
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2449
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2450 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2451 * @brief Set a description for this plugin.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2452 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2453 * Set a description for this plugin. It is displayed in the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2454 * "Plugins" page of Orthanc Explorer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2455 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2456 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2457 * @param description The description.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2458 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2459 ORTHANC_PLUGIN_INLINE void OrthancPluginSetDescription(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2460 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2461 const char* description)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2462 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2463 _OrthancPluginSetPluginProperty params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2464 params.plugin = OrthancPluginGetName();
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2465 params.property = _OrthancPluginProperty_Description;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2466 params.value = description;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2467
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2468 context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2469 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2470
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2471
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2472 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2473 * @brief Extend the JavaScript code of Orthanc Explorer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2474 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2475 * Add JavaScript code to customize the default behavior of Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2476 * Explorer. This can for instance be used to add new buttons.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2477 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2478 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2479 * @param javascript The custom JavaScript code.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2480 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2481 ORTHANC_PLUGIN_INLINE void OrthancPluginExtendOrthancExplorer(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2482 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2483 const char* javascript)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2484 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2485 _OrthancPluginSetPluginProperty params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2486 params.plugin = OrthancPluginGetName();
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2487 params.property = _OrthancPluginProperty_OrthancExplorer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2488 params.value = javascript;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2489
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2490 context->InvokeService(context, _OrthancPluginService_SetPluginProperty, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2491 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2492
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2493
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2494 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2495 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2496 char** result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2497 int32_t property;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2498 const char* value;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2499 } _OrthancPluginGlobalProperty;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2500
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2501
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2502 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2503 * @brief Get the value of a global property.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2504 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2505 * Get the value of a global property that is stored in the Orthanc database. Global
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2506 * properties whose index is below 1024 are reserved by Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2507 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2508 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2509 * @param property The global property of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2510 * @param defaultValue The value to return, if the global property is unset.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2511 * @return The value of the global property, or NULL in the case of an error. This
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2512 * string must be freed by OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2513 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2514 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2515 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetGlobalProperty(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2516 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2517 int32_t property,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2518 const char* defaultValue)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2519 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2520 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2521
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2522 _OrthancPluginGlobalProperty params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2523 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2524 params.property = property;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2525 params.value = defaultValue;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2526
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2527 if (context->InvokeService(context, _OrthancPluginService_GetGlobalProperty, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2528 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2529 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2530 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2531 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2532 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2533 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2534 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2535 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2536 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2537
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2538
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2539 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2540 * @brief Set the value of a global property.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2541 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2542 * Set the value of a global property into the Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2543 * database. Setting a global property can be used by plugins to
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2544 * save their internal parameters. Plugins are only allowed to set
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2545 * properties whose index are above or equal to 1024 (properties
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2546 * below 1024 are read-only and reserved by Orthanc).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2547 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2548 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2549 * @param property The global property of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2550 * @param value The value to be set in the global property.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2551 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2552 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2553 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2554 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginSetGlobalProperty(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2555 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2556 int32_t property,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2557 const char* value)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2558 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2559 _OrthancPluginGlobalProperty params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2560 params.result = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2561 params.property = property;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2562 params.value = value;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2563
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2564 return context->InvokeService(context, _OrthancPluginService_SetGlobalProperty, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2565 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2566
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2567
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2568
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2569 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2570 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2571 int32_t *resultInt32;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2572 uint32_t *resultUint32;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2573 int64_t *resultInt64;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2574 uint64_t *resultUint64;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2575 } _OrthancPluginReturnSingleValue;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2576
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2577 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2578 * @brief Get the number of command-line arguments.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2579 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2580 * Retrieve the number of command-line arguments that were used to launch Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2581 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2582 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2583 * @return The number of arguments.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2584 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2585 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetCommandLineArgumentsCount(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2586 OrthancPluginContext* context)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2587 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2588 uint32_t count = 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2589
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2590 _OrthancPluginReturnSingleValue params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2591 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2592 params.resultUint32 = &count;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2593
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2594 if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgumentsCount, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2595 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2596 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2597 return 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2598 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2599 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2600 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2601 return count;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2602 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2603 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2604
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2605
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2606
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2607 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2608 * @brief Get the value of a command-line argument.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2609 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2610 * Get the value of one of the command-line arguments that were used
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2611 * to launch Orthanc. The number of available arguments can be
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2612 * retrieved by OrthancPluginGetCommandLineArgumentsCount().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2613 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2614 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2615 * @param argument The index of the argument.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2616 * @return The value of the argument, or NULL in the case of an error. This
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2617 * string must be freed by OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2618 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2619 ORTHANC_PLUGIN_INLINE char* OrthancPluginGetCommandLineArgument(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2620 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2621 uint32_t argument)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2622 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2623 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2624
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2625 _OrthancPluginGlobalProperty params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2626 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2627 params.property = (int32_t) argument;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2628 params.value = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2629
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2630 if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgument, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2631 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2632 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2633 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2634 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2635 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2636 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2637 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2638 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2639 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2640
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2641
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2642 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2643 * @brief Get the expected version of the database schema.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2644 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2645 * Retrieve the expected version of the database schema.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2646 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2647 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2648 * @return The version.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2649 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2650 * @deprecated Please instead use IDatabaseBackend::UpgradeDatabase()
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2651 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2652 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetExpectedDatabaseVersion(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2653 OrthancPluginContext* context)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2654 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2655 uint32_t count = 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2656
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2657 _OrthancPluginReturnSingleValue params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2658 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2659 params.resultUint32 = &count;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2660
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2661 if (context->InvokeService(context, _OrthancPluginService_GetExpectedDatabaseVersion, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2662 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2663 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2664 return 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2665 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2666 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2667 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2668 return count;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2669 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2670 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2671
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2672
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2673
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2674 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2675 * @brief Return the content of the configuration file(s).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2676 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2677 * This function returns the content of the configuration that is
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2678 * used by Orthanc, formatted as a JSON string.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2679 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2680 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2681 * @return NULL in the case of an error, or a newly allocated string
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2682 * containing the configuration. This string must be freed by
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2683 * OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2684 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2685 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfiguration(OrthancPluginContext* context)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2686 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2687 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2688
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2689 _OrthancPluginRetrieveDynamicString params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2690 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2691 params.argument = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2692
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2693 if (context->InvokeService(context, _OrthancPluginService_GetConfiguration, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2694 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2695 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2696 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2697 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2698 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2699 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2700 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2701 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2702 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2703
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2704
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2705
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2706 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2707 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2708 OrthancPluginRestOutput* output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2709 const char* subType;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2710 const char* contentType;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2711 } _OrthancPluginStartMultipartAnswer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2712
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2713 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2714 * @brief Start an HTTP multipart answer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2715 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2716 * Initiates a HTTP multipart answer, as the result of a REST request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2717 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2718 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2719 * @param output The HTTP connection to the client application.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2720 * @param subType The sub-type of the multipart answer ("mixed" or "related").
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2721 * @param contentType The MIME type of the items in the multipart answer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2722 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2723 * @see OrthancPluginSendMultipartItem(), OrthancPluginSendMultipartItem2()
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2724 * @ingroup REST
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2725 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2726 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStartMultipartAnswer(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2727 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2728 OrthancPluginRestOutput* output,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2729 const char* subType,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2730 const char* contentType)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2731 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2732 _OrthancPluginStartMultipartAnswer params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2733 params.output = output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2734 params.subType = subType;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2735 params.contentType = contentType;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2736 return context->InvokeService(context, _OrthancPluginService_StartMultipartAnswer, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2737 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2738
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2739
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2740 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2741 * @brief Send an item as a part of some HTTP multipart answer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2742 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2743 * This function sends an item as a part of some HTTP multipart
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2744 * answer that was initiated by OrthancPluginStartMultipartAnswer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2745 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2746 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2747 * @param output The HTTP connection to the client application.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2748 * @param answer Pointer to the memory buffer containing the item.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2749 * @param answerSize Number of bytes of the item.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2750 * @return 0 if success, or the error code if failure (this notably happens
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2751 * if the connection is closed by the client).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2752 * @see OrthancPluginSendMultipartItem2()
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2753 * @ingroup REST
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2754 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2755 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginSendMultipartItem(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2756 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2757 OrthancPluginRestOutput* output,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2758 const char* answer,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2759 uint32_t answerSize)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2760 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2761 _OrthancPluginAnswerBuffer params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2762 params.output = output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2763 params.answer = answer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2764 params.answerSize = answerSize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2765 params.mimeType = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2766 return context->InvokeService(context, _OrthancPluginService_SendMultipartItem, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2767 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2768
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2769
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2770
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2771 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2772 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2773 OrthancPluginMemoryBuffer* target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2774 const void* source;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2775 uint32_t size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2776 OrthancPluginCompressionType compression;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2777 uint8_t uncompress;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2778 } _OrthancPluginBufferCompression;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2779
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2780
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2781 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2782 * @brief Compress or decompress a buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2783 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2784 * This function compresses or decompresses a buffer, using the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2785 * version of the zlib library that is used by the Orthanc core.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2786 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2787 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2788 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2789 * @param source The source buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2790 * @param size The size in bytes of the source buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2791 * @param compression The compression algorithm.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2792 * @param uncompress If set to "0", the buffer must be compressed.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2793 * If set to "1", the buffer must be uncompressed.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2794 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2795 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2796 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2797 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginBufferCompression(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2798 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2799 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2800 const void* source,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2801 uint32_t size,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2802 OrthancPluginCompressionType compression,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2803 uint8_t uncompress)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2804 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2805 _OrthancPluginBufferCompression params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2806 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2807 params.source = source;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2808 params.size = size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2809 params.compression = compression;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2810 params.uncompress = uncompress;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2811
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2812 return context->InvokeService(context, _OrthancPluginService_BufferCompression, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2813 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2814
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2815
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2816
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2817 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2818 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2819 OrthancPluginMemoryBuffer* target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2820 const char* path;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2821 } _OrthancPluginReadFile;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2822
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2823 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2824 * @brief Read a file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2825 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2826 * Read the content of a file on the filesystem, and returns it into
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2827 * a newly allocated memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2828 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2829 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2830 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2831 * @param path The path of the file to be read.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2832 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2833 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2834 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginReadFile(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2835 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2836 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2837 const char* path)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2838 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2839 _OrthancPluginReadFile params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2840 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2841 params.path = path;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2842 return context->InvokeService(context, _OrthancPluginService_ReadFile, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2843 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2844
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2845
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2846
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2847 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2848 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2849 const char* path;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2850 const void* data;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2851 uint32_t size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2852 } _OrthancPluginWriteFile;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2853
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2854 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2855 * @brief Write a file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2856 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2857 * Write the content of a memory buffer to the filesystem.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2858 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2859 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2860 * @param path The path of the file to be written.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2861 * @param data The content of the memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2862 * @param size The size of the memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2863 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2864 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2865 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginWriteFile(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2866 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2867 const char* path,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2868 const void* data,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2869 uint32_t size)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2870 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2871 _OrthancPluginWriteFile params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2872 params.path = path;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2873 params.data = data;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2874 params.size = size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2875 return context->InvokeService(context, _OrthancPluginService_WriteFile, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2876 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2877
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2878
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2879
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2880 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2881 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2882 const char** target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2883 OrthancPluginErrorCode error;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2884 } _OrthancPluginGetErrorDescription;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2885
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2886 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2887 * @brief Get the description of a given error code.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2888 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2889 * This function returns the description of a given error code.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2890 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2891 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2892 * @param error The error code of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2893 * @return The error description. This is a statically-allocated
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2894 * string, do not free it.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2895 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2896 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetErrorDescription(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2897 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2898 OrthancPluginErrorCode error)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2899 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2900 const char* result = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2901
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2902 _OrthancPluginGetErrorDescription params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2903 params.target = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2904 params.error = error;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2905
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2906 if (context->InvokeService(context, _OrthancPluginService_GetErrorDescription, &params) != OrthancPluginErrorCode_Success ||
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2907 result == NULL)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2908 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2909 return "Unknown error code";
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2910 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2911 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2912 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2913 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2914 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2915 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2916
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2917
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2918
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2919 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2920 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2921 OrthancPluginRestOutput* output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2922 uint16_t status;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2923 const char* body;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2924 uint32_t bodySize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2925 } _OrthancPluginSendHttpStatus;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2926
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2927 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2928 * @brief Send a HTTP status, with a custom body.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2929 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2930 * This function answers to a HTTP request by sending a HTTP status
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2931 * code (such as "400 - Bad Request"), together with a body
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2932 * describing the error. The body will only be returned if the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2933 * configuration option "HttpDescribeErrors" of Orthanc is set to "true".
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2934 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2935 * Note that:
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2936 * - Successful requests (status 200) must use ::OrthancPluginAnswerBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2937 * - Redirections (status 301) must use ::OrthancPluginRedirect().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2938 * - Unauthorized access (status 401) must use ::OrthancPluginSendUnauthorized().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2939 * - Methods not allowed (status 405) must use ::OrthancPluginSendMethodNotAllowed().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2940 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2941 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2942 * @param output The HTTP connection to the client application.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2943 * @param status The HTTP status code to be sent.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2944 * @param body The body of the answer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2945 * @param bodySize The size of the body.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2946 * @see OrthancPluginSendHttpStatusCode()
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2947 * @ingroup REST
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2948 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2949 ORTHANC_PLUGIN_INLINE void OrthancPluginSendHttpStatus(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2950 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2951 OrthancPluginRestOutput* output,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2952 uint16_t status,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2953 const char* body,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2954 uint32_t bodySize)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2955 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2956 _OrthancPluginSendHttpStatus params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2957 params.output = output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2958 params.status = status;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2959 params.body = body;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2960 params.bodySize = bodySize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2961 context->InvokeService(context, _OrthancPluginService_SendHttpStatus, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2962 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2963
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2964
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2965
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2966 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2967 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2968 const OrthancPluginImage* image;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2969 uint32_t* resultUint32;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2970 OrthancPluginPixelFormat* resultPixelFormat;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2971 void** resultBuffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2972 } _OrthancPluginGetImageInfo;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2973
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2974
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2975 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2976 * @brief Return the pixel format of an image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2977 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2978 * This function returns the type of memory layout for the pixels of the given image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2979 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2980 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2981 * @param image The image of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2982 * @return The pixel format.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2983 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2984 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2985 ORTHANC_PLUGIN_INLINE OrthancPluginPixelFormat OrthancPluginGetImagePixelFormat(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2986 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2987 const OrthancPluginImage* image)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2988 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2989 OrthancPluginPixelFormat target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2990
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2991 _OrthancPluginGetImageInfo params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2992 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2993 params.image = image;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2994 params.resultPixelFormat = &target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2995
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2996 if (context->InvokeService(context, _OrthancPluginService_GetImagePixelFormat, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2997 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2998 return OrthancPluginPixelFormat_Unknown;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2999 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3000 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3001 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3002 return (OrthancPluginPixelFormat) target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3003 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3004 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3005
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3006
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3007
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3008 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3009 * @brief Return the width of an image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3010 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3011 * This function returns the width of the given image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3012 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3013 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3014 * @param image The image of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3015 * @return The width.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3016 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3017 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3018 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageWidth(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3019 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3020 const OrthancPluginImage* image)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3021 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3022 uint32_t width;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3023
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3024 _OrthancPluginGetImageInfo params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3025 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3026 params.image = image;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3027 params.resultUint32 = &width;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3028
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3029 if (context->InvokeService(context, _OrthancPluginService_GetImageWidth, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3030 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3031 return 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3032 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3033 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3034 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3035 return width;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3036 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3037 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3038
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3039
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3040
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3041 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3042 * @brief Return the height of an image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3043 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3044 * This function returns the height of the given image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3045 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3046 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3047 * @param image The image of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3048 * @return The height.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3049 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3050 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3051 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImageHeight(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3052 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3053 const OrthancPluginImage* image)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3054 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3055 uint32_t height;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3056
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3057 _OrthancPluginGetImageInfo params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3058 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3059 params.image = image;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3060 params.resultUint32 = &height;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3061
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3062 if (context->InvokeService(context, _OrthancPluginService_GetImageHeight, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3063 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3064 return 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3065 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3066 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3067 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3068 return height;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3069 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3070 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3071
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3072
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3073
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3074 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3075 * @brief Return the pitch of an image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3076 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3077 * This function returns the pitch of the given image. The pitch is
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3078 * defined as the number of bytes between 2 successive lines of the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3079 * image in the memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3080 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3081 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3082 * @param image The image of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3083 * @return The pitch.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3084 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3085 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3086 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetImagePitch(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3087 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3088 const OrthancPluginImage* image)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3089 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3090 uint32_t pitch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3091
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3092 _OrthancPluginGetImageInfo params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3093 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3094 params.image = image;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3095 params.resultUint32 = &pitch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3096
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3097 if (context->InvokeService(context, _OrthancPluginService_GetImagePitch, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3098 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3099 return 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3100 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3101 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3102 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3103 return pitch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3104 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3105 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3106
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3107
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3108
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3109 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3110 * @brief Return a pointer to the content of an image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3111 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3112 * This function returns a pointer to the memory buffer that
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3113 * contains the pixels of the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3114 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3115 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3116 * @param image The image of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3117 * @return The pointer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3118 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3119 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3120 ORTHANC_PLUGIN_INLINE void* OrthancPluginGetImageBuffer(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3121 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3122 const OrthancPluginImage* image)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3123 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3124 void* target = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3125
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3126 _OrthancPluginGetImageInfo params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3127 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3128 params.resultBuffer = &target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3129 params.image = image;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3130
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3131 if (context->InvokeService(context, _OrthancPluginService_GetImageBuffer, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3132 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3133 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3134 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3135 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3136 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3137 return target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3138 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3139 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3140
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3141
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3142 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3143 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3144 OrthancPluginImage** target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3145 const void* data;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3146 uint32_t size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3147 OrthancPluginImageFormat format;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3148 } _OrthancPluginUncompressImage;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3149
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3150
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3151 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3152 * @brief Decode a compressed image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3153 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3154 * This function decodes a compressed image from a memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3155 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3156 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3157 * @param data Pointer to a memory buffer containing the compressed image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3158 * @param size Size of the memory buffer containing the compressed image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3159 * @param format The file format of the compressed image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3160 * @return The uncompressed image. It must be freed with OrthancPluginFreeImage().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3161 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3162 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3163 ORTHANC_PLUGIN_INLINE OrthancPluginImage *OrthancPluginUncompressImage(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3164 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3165 const void* data,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3166 uint32_t size,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3167 OrthancPluginImageFormat format)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3168 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3169 OrthancPluginImage* target = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3170
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3171 _OrthancPluginUncompressImage params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3172 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3173 params.target = &target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3174 params.data = data;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3175 params.size = size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3176 params.format = format;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3177
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3178 if (context->InvokeService(context, _OrthancPluginService_UncompressImage, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3179 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3180 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3181 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3182 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3183 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3184 return target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3185 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3186 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3187
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3188
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3189
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3190
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3191 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3192 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3193 OrthancPluginImage* image;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3194 } _OrthancPluginFreeImage;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3195
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3196 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3197 * @brief Free an image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3198 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3199 * This function frees an image that was decoded with OrthancPluginUncompressImage().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3200 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3201 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3202 * @param image The image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3203 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3204 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3205 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeImage(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3206 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3207 OrthancPluginImage* image)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3208 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3209 _OrthancPluginFreeImage params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3210 params.image = image;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3211
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3212 context->InvokeService(context, _OrthancPluginService_FreeImage, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3213 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3214
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3215
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3216
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3217
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3218 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3219 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3220 OrthancPluginMemoryBuffer* target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3221 OrthancPluginImageFormat imageFormat;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3222 OrthancPluginPixelFormat pixelFormat;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3223 uint32_t width;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3224 uint32_t height;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3225 uint32_t pitch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3226 const void* buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3227 uint8_t quality;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3228 } _OrthancPluginCompressImage;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3229
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3230
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3231 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3232 * @brief Encode a PNG image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3233 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3234 * This function compresses the given memory buffer containing an
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3235 * image using the PNG specification, and stores the result of the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3236 * compression into a newly allocated memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3237 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3238 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3239 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3240 * @param format The memory layout of the uncompressed image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3241 * @param width The width of the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3242 * @param height The height of the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3243 * @param pitch The pitch of the image (i.e. the number of bytes
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3244 * between 2 successive lines of the image in the memory buffer).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3245 * @param buffer The memory buffer containing the uncompressed image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3246 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3247 * @see OrthancPluginCompressAndAnswerPngImage()
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3248 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3249 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3250 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCompressPngImage(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3251 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3252 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3253 OrthancPluginPixelFormat format,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3254 uint32_t width,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3255 uint32_t height,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3256 uint32_t pitch,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3257 const void* buffer)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3258 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3259 _OrthancPluginCompressImage params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3260 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3261 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3262 params.imageFormat = OrthancPluginImageFormat_Png;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3263 params.pixelFormat = format;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3264 params.width = width;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3265 params.height = height;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3266 params.pitch = pitch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3267 params.buffer = buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3268 params.quality = 0; /* Unused for PNG */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3269
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3270 return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3271 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3272
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3273
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3274 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3275 * @brief Encode a JPEG image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3276 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3277 * This function compresses the given memory buffer containing an
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3278 * image using the JPEG specification, and stores the result of the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3279 * compression into a newly allocated memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3280 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3281 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3282 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3283 * @param format The memory layout of the uncompressed image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3284 * @param width The width of the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3285 * @param height The height of the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3286 * @param pitch The pitch of the image (i.e. the number of bytes
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3287 * between 2 successive lines of the image in the memory buffer).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3288 * @param buffer The memory buffer containing the uncompressed image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3289 * @param quality The quality of the JPEG encoding, between 1 (worst
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3290 * quality, best compression) and 100 (best quality, worst
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3291 * compression).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3292 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3293 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3294 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3295 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCompressJpegImage(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3296 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3297 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3298 OrthancPluginPixelFormat format,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3299 uint32_t width,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3300 uint32_t height,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3301 uint32_t pitch,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3302 const void* buffer,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3303 uint8_t quality)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3304 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3305 _OrthancPluginCompressImage params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3306 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3307 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3308 params.imageFormat = OrthancPluginImageFormat_Jpeg;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3309 params.pixelFormat = format;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3310 params.width = width;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3311 params.height = height;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3312 params.pitch = pitch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3313 params.buffer = buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3314 params.quality = quality;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3315
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3316 return context->InvokeService(context, _OrthancPluginService_CompressImage, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3317 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3318
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3319
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3320
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3321 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3322 * @brief Answer to a REST request with a JPEG image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3323 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3324 * This function answers to a REST request with a JPEG image. The
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3325 * parameters of this function describe a memory buffer that
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3326 * contains an uncompressed image. The image will be automatically compressed
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3327 * as a JPEG image by the core system of Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3328 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3329 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3330 * @param output The HTTP connection to the client application.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3331 * @param format The memory layout of the uncompressed image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3332 * @param width The width of the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3333 * @param height The height of the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3334 * @param pitch The pitch of the image (i.e. the number of bytes
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3335 * between 2 successive lines of the image in the memory buffer).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3336 * @param buffer The memory buffer containing the uncompressed image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3337 * @param quality The quality of the JPEG encoding, between 1 (worst
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3338 * quality, best compression) and 100 (best quality, worst
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3339 * compression).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3340 * @ingroup REST
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3341 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3342 ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerJpegImage(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3343 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3344 OrthancPluginRestOutput* output,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3345 OrthancPluginPixelFormat format,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3346 uint32_t width,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3347 uint32_t height,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3348 uint32_t pitch,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3349 const void* buffer,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3350 uint8_t quality)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3351 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3352 _OrthancPluginCompressAndAnswerImage params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3353 params.output = output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3354 params.imageFormat = OrthancPluginImageFormat_Jpeg;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3355 params.pixelFormat = format;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3356 params.width = width;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3357 params.height = height;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3358 params.pitch = pitch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3359 params.buffer = buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3360 params.quality = quality;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3361 context->InvokeService(context, _OrthancPluginService_CompressAndAnswerImage, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3362 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3363
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3364
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3365
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3366
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3367 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3368 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3369 OrthancPluginMemoryBuffer* target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3370 OrthancPluginHttpMethod method;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3371 const char* url;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3372 const char* username;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3373 const char* password;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3374 const char* body;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3375 uint32_t bodySize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3376 } _OrthancPluginCallHttpClient;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3377
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3378
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3379 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3380 * @brief Issue a HTTP GET call.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3381 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3382 * Make a HTTP GET call to the given URL. The result to the query is
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3383 * stored into a newly allocated memory buffer. Favor
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3384 * OrthancPluginRestApiGet() if calling the built-in REST API of the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3385 * Orthanc instance that hosts this plugin.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3386 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3387 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3388 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3389 * @param url The URL of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3390 * @param username The username (can be <tt>NULL</tt> if no password protection).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3391 * @param password The password (can be <tt>NULL</tt> if no password protection).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3392 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3393 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3394 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginHttpGet(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3395 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3396 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3397 const char* url,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3398 const char* username,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3399 const char* password)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3400 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3401 _OrthancPluginCallHttpClient params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3402 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3403
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3404 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3405 params.method = OrthancPluginHttpMethod_Get;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3406 params.url = url;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3407 params.username = username;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3408 params.password = password;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3409
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3410 return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3411 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3412
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3413
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3414 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3415 * @brief Issue a HTTP POST call.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3416 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3417 * Make a HTTP POST call to the given URL. The result to the query
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3418 * is stored into a newly allocated memory buffer. Favor
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3419 * OrthancPluginRestApiPost() if calling the built-in REST API of
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3420 * the Orthanc instance that hosts this plugin.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3421 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3422 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3423 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3424 * @param url The URL of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3425 * @param body The content of the body of the request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3426 * @param bodySize The size of the body of the request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3427 * @param username The username (can be <tt>NULL</tt> if no password protection).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3428 * @param password The password (can be <tt>NULL</tt> if no password protection).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3429 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3430 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3431 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginHttpPost(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3432 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3433 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3434 const char* url,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3435 const char* body,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3436 uint32_t bodySize,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3437 const char* username,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3438 const char* password)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3439 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3440 _OrthancPluginCallHttpClient params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3441 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3442
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3443 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3444 params.method = OrthancPluginHttpMethod_Post;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3445 params.url = url;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3446 params.body = body;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3447 params.bodySize = bodySize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3448 params.username = username;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3449 params.password = password;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3450
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3451 return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3452 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3453
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3454
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3455 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3456 * @brief Issue a HTTP PUT call.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3457 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3458 * Make a HTTP PUT call to the given URL. The result to the query is
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3459 * stored into a newly allocated memory buffer. Favor
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3460 * OrthancPluginRestApiPut() if calling the built-in REST API of the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3461 * Orthanc instance that hosts this plugin.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3462 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3463 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3464 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3465 * @param url The URL of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3466 * @param body The content of the body of the request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3467 * @param bodySize The size of the body of the request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3468 * @param username The username (can be <tt>NULL</tt> if no password protection).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3469 * @param password The password (can be <tt>NULL</tt> if no password protection).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3470 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3471 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3472 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginHttpPut(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3473 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3474 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3475 const char* url,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3476 const char* body,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3477 uint32_t bodySize,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3478 const char* username,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3479 const char* password)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3480 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3481 _OrthancPluginCallHttpClient params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3482 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3483
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3484 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3485 params.method = OrthancPluginHttpMethod_Put;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3486 params.url = url;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3487 params.body = body;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3488 params.bodySize = bodySize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3489 params.username = username;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3490 params.password = password;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3491
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3492 return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3493 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3494
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3495
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3496 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3497 * @brief Issue a HTTP DELETE call.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3498 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3499 * Make a HTTP DELETE call to the given URL. Favor
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3500 * OrthancPluginRestApiDelete() if calling the built-in REST API of
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3501 * the Orthanc instance that hosts this plugin.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3502 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3503 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3504 * @param url The URL of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3505 * @param username The username (can be <tt>NULL</tt> if no password protection).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3506 * @param password The password (can be <tt>NULL</tt> if no password protection).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3507 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3508 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3509 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginHttpDelete(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3510 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3511 const char* url,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3512 const char* username,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3513 const char* password)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3514 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3515 _OrthancPluginCallHttpClient params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3516 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3517
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3518 params.method = OrthancPluginHttpMethod_Delete;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3519 params.url = url;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3520 params.username = username;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3521 params.password = password;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3522
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3523 return context->InvokeService(context, _OrthancPluginService_CallHttpClient, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3524 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3525
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3526
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3527
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3528 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3529 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3530 OrthancPluginImage** target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3531 const OrthancPluginImage* source;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3532 OrthancPluginPixelFormat targetFormat;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3533 } _OrthancPluginConvertPixelFormat;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3534
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3535
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3536 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3537 * @brief Change the pixel format of an image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3538 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3539 * This function creates a new image, changing the memory layout of the pixels.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3540 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3541 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3542 * @param source The source image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3543 * @param targetFormat The target pixel format.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3544 * @return The resulting image. It must be freed with OrthancPluginFreeImage().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3545 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3546 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3547 ORTHANC_PLUGIN_INLINE OrthancPluginImage *OrthancPluginConvertPixelFormat(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3548 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3549 const OrthancPluginImage* source,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3550 OrthancPluginPixelFormat targetFormat)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3551 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3552 OrthancPluginImage* target = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3553
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3554 _OrthancPluginConvertPixelFormat params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3555 params.target = &target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3556 params.source = source;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3557 params.targetFormat = targetFormat;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3558
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3559 if (context->InvokeService(context, _OrthancPluginService_ConvertPixelFormat, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3560 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3561 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3562 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3563 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3564 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3565 return target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3566 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3567 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3568
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3569
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3570
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3571 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3572 * @brief Return the number of available fonts.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3573 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3574 * This function returns the number of fonts that are built in the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3575 * Orthanc core. These fonts can be used to draw texts on images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3576 * through OrthancPluginDrawText().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3577 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3578 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3579 * @return The number of fonts.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3580 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3581 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3582 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontsCount(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3583 OrthancPluginContext* context)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3584 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3585 uint32_t count = 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3586
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3587 _OrthancPluginReturnSingleValue params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3588 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3589 params.resultUint32 = &count;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3590
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3591 if (context->InvokeService(context, _OrthancPluginService_GetFontsCount, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3592 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3593 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3594 return 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3595 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3596 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3597 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3598 return count;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3599 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3600 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3601
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3602
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3603
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3604
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3605 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3606 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3607 uint32_t fontIndex; /* in */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3608 const char** name; /* out */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3609 uint32_t* size; /* out */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3610 } _OrthancPluginGetFontInfo;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3611
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3612 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3613 * @brief Return the name of a font.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3614 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3615 * This function returns the name of a font that is built in the Orthanc core.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3616 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3617 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3618 * @param fontIndex The index of the font. This value must be less than OrthancPluginGetFontsCount().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3619 * @return The font name. This is a statically-allocated string, do not free it.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3620 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3621 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3622 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetFontName(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3623 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3624 uint32_t fontIndex)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3625 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3626 const char* result = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3627
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3628 _OrthancPluginGetFontInfo params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3629 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3630 params.name = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3631 params.fontIndex = fontIndex;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3632
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3633 if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3634 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3635 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3636 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3637 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3638 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3639 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3640 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3641 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3642
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3643
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3644 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3645 * @brief Return the size of a font.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3646 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3647 * This function returns the size of a font that is built in the Orthanc core.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3648 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3649 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3650 * @param fontIndex The index of the font. This value must be less than OrthancPluginGetFontsCount().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3651 * @return The font size.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3652 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3653 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3654 ORTHANC_PLUGIN_INLINE uint32_t OrthancPluginGetFontSize(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3655 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3656 uint32_t fontIndex)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3657 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3658 uint32_t result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3659
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3660 _OrthancPluginGetFontInfo params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3661 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3662 params.size = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3663 params.fontIndex = fontIndex;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3664
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3665 if (context->InvokeService(context, _OrthancPluginService_GetFontInfo, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3666 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3667 return 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3668 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3669 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3670 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3671 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3672 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3673 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3674
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3675
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3676
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3677 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3678 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3679 OrthancPluginImage* image;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3680 uint32_t fontIndex;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3681 const char* utf8Text;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3682 int32_t x;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3683 int32_t y;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3684 uint8_t r;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3685 uint8_t g;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3686 uint8_t b;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3687 } _OrthancPluginDrawText;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3688
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3689
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3690 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3691 * @brief Draw text on an image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3692 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3693 * This function draws some text on some image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3694 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3695 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3696 * @param image The image upon which to draw the text.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3697 * @param fontIndex The index of the font. This value must be less than OrthancPluginGetFontsCount().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3698 * @param utf8Text The text to be drawn, encoded as an UTF-8 zero-terminated string.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3699 * @param x The X position of the text over the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3700 * @param y The Y position of the text over the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3701 * @param r The value of the red color channel of the text.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3702 * @param g The value of the green color channel of the text.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3703 * @param b The value of the blue color channel of the text.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3704 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3705 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3706 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3707 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginDrawText(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3708 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3709 OrthancPluginImage* image,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3710 uint32_t fontIndex,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3711 const char* utf8Text,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3712 int32_t x,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3713 int32_t y,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3714 uint8_t r,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3715 uint8_t g,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3716 uint8_t b)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3717 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3718 _OrthancPluginDrawText params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3719 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3720 params.image = image;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3721 params.fontIndex = fontIndex;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3722 params.utf8Text = utf8Text;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3723 params.x = x;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3724 params.y = y;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3725 params.r = r;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3726 params.g = g;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3727 params.b = b;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3728
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3729 return context->InvokeService(context, _OrthancPluginService_DrawText, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3730 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3731
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3732
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3733
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3734 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3735 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3736 OrthancPluginStorageArea* storageArea;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3737 const char* uuid;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3738 const void* content;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3739 uint64_t size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3740 OrthancPluginContentType type;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3741 } _OrthancPluginStorageAreaCreate;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3742
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3743
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3744 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3745 * @brief Create a file inside the storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3746 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3747 * This function creates a new file inside the storage area that is
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3748 * currently used by Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3749 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3750 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3751 * @param storageArea The storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3752 * @param uuid The identifier of the file to be created.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3753 * @param content The content to store in the newly created file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3754 * @param size The size of the content.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3755 * @param type The type of the file content.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3756 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3757 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3758 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3759 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStorageAreaCreate(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3760 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3761 OrthancPluginStorageArea* storageArea,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3762 const char* uuid,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3763 const void* content,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3764 uint64_t size,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3765 OrthancPluginContentType type)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3766 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3767 _OrthancPluginStorageAreaCreate params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3768 params.storageArea = storageArea;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3769 params.uuid = uuid;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3770 params.content = content;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3771 params.size = size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3772 params.type = type;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3773
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3774 return context->InvokeService(context, _OrthancPluginService_StorageAreaCreate, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3775 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3776
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3777
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3778 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3779 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3780 OrthancPluginMemoryBuffer* target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3781 OrthancPluginStorageArea* storageArea;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3782 const char* uuid;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3783 OrthancPluginContentType type;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3784 } _OrthancPluginStorageAreaRead;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3785
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3786
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3787 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3788 * @brief Read a file from the storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3789 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3790 * This function reads the content of a given file from the storage
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3791 * area that is currently used by Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3792 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3793 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3794 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3795 * @param storageArea The storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3796 * @param uuid The identifier of the file to be read.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3797 * @param type The type of the file content.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3798 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3799 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3800 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3801 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStorageAreaRead(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3802 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3803 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3804 OrthancPluginStorageArea* storageArea,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3805 const char* uuid,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3806 OrthancPluginContentType type)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3807 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3808 _OrthancPluginStorageAreaRead params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3809 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3810 params.storageArea = storageArea;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3811 params.uuid = uuid;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3812 params.type = type;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3813
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3814 return context->InvokeService(context, _OrthancPluginService_StorageAreaRead, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3815 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3816
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3817
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3818 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3819 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3820 OrthancPluginStorageArea* storageArea;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3821 const char* uuid;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3822 OrthancPluginContentType type;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3823 } _OrthancPluginStorageAreaRemove;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3824
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3825 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3826 * @brief Remove a file from the storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3827 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3828 * This function removes a given file from the storage area that is
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3829 * currently used by Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3830 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3831 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3832 * @param storageArea The storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3833 * @param uuid The identifier of the file to be removed.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3834 * @param type The type of the file content.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3835 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3836 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3837 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3838 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStorageAreaRemove(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3839 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3840 OrthancPluginStorageArea* storageArea,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3841 const char* uuid,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3842 OrthancPluginContentType type)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3843 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3844 _OrthancPluginStorageAreaRemove params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3845 params.storageArea = storageArea;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3846 params.uuid = uuid;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3847 params.type = type;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3848
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3849 return context->InvokeService(context, _OrthancPluginService_StorageAreaRemove, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3850 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3851
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3852
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3853
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3854 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3855 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3856 OrthancPluginErrorCode* target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3857 int32_t code;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3858 uint16_t httpStatus;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3859 const char* message;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3860 } _OrthancPluginRegisterErrorCode;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3861
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3862 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3863 * @brief Declare a custom error code for this plugin.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3864 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3865 * This function declares a custom error code that can be generated
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3866 * by this plugin. This declaration is used to enrich the body of
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3867 * the HTTP answer in the case of an error, and to set the proper
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3868 * HTTP status code.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3869 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3870 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3871 * @param code The error code that is internal to this plugin.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3872 * @param httpStatus The HTTP status corresponding to this error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3873 * @param message The description of the error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3874 * @return The error code that has been assigned inside the Orthanc core.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3875 * @ingroup Toolbox
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3876 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3877 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterErrorCode(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3878 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3879 int32_t code,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3880 uint16_t httpStatus,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3881 const char* message)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3882 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3883 OrthancPluginErrorCode target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3884
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3885 _OrthancPluginRegisterErrorCode params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3886 params.target = &target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3887 params.code = code;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3888 params.httpStatus = httpStatus;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3889 params.message = message;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3890
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3891 if (context->InvokeService(context, _OrthancPluginService_RegisterErrorCode, &params) == OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3892 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3893 return target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3894 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3895 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3896 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3897 /* There was an error while assigned the error. Use a generic code. */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3898 return OrthancPluginErrorCode_Plugin;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3899 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3900 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3901
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3902
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3903
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3904 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3905 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3906 uint16_t group;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3907 uint16_t element;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3908 OrthancPluginValueRepresentation vr;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3909 const char* name;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3910 uint32_t minMultiplicity;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3911 uint32_t maxMultiplicity;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3912 } _OrthancPluginRegisterDictionaryTag;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3913
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3914 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3915 * @brief Register a new tag into the DICOM dictionary.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3916 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3917 * This function declares a new tag in the dictionary of DICOM tags
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3918 * that are known to Orthanc. This function should be used in the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3919 * OrthancPluginInitialize() callback.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3920 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3921 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3922 * @param group The group of the tag.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3923 * @param element The element of the tag.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3924 * @param vr The value representation of the tag.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3925 * @param name The nickname of the tag.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3926 * @param minMultiplicity The minimum multiplicity of the tag (must be above 0).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3927 * @param maxMultiplicity The maximum multiplicity of the tag. A value of 0 means
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3928 * an arbitrary multiplicity ("<tt>n</tt>").
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3929 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3930 * @ingroup Toolbox
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3931 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3932 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterDictionaryTag(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3933 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3934 uint16_t group,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3935 uint16_t element,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3936 OrthancPluginValueRepresentation vr,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3937 const char* name,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3938 uint32_t minMultiplicity,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3939 uint32_t maxMultiplicity)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3940 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3941 _OrthancPluginRegisterDictionaryTag params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3942 params.group = group;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3943 params.element = element;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3944 params.vr = vr;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3945 params.name = name;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3946 params.minMultiplicity = minMultiplicity;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3947 params.maxMultiplicity = maxMultiplicity;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3948
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3949 return context->InvokeService(context, _OrthancPluginService_RegisterDictionaryTag, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3950 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3951
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3952
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3953
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3954
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3955 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3956 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3957 OrthancPluginStorageArea* storageArea;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3958 OrthancPluginResourceType level;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3959 } _OrthancPluginReconstructMainDicomTags;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3960
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3961 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3962 * @brief Reconstruct the main DICOM tags.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3963 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3964 * This function requests the Orthanc core to reconstruct the main
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3965 * DICOM tags of all the resources of the given type. This function
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3966 * can only be used as a part of the upgrade of a custom database
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3967 * back-end
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3968 * (cf. OrthancPlugins::IDatabaseBackend::UpgradeDatabase). A
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3969 * database transaction will be automatically setup.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3970 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3971 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3972 * @param storageArea The storage area.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3973 * @param level The type of the resources of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3974 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3975 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3976 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3977 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginReconstructMainDicomTags(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3978 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3979 OrthancPluginStorageArea* storageArea,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3980 OrthancPluginResourceType level)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3981 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3982 _OrthancPluginReconstructMainDicomTags params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3983 params.level = level;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3984 params.storageArea = storageArea;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3985
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3986 return context->InvokeService(context, _OrthancPluginService_ReconstructMainDicomTags, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3987 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3988
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3989
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3990 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3991 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3992 char** result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3993 const char* instanceId;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3994 const char* buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3995 uint32_t size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3996 OrthancPluginDicomToJsonFormat format;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3997 OrthancPluginDicomToJsonFlags flags;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3998 uint32_t maxStringLength;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3999 } _OrthancPluginDicomToJson;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4000
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4001
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4002 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4003 * @brief Format a DICOM memory buffer as a JSON string.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4004 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4005 * This function takes as input a memory buffer containing a DICOM
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4006 * file, and outputs a JSON string representing the tags of this
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4007 * DICOM file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4008 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4009 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4010 * @param buffer The memory buffer containing the DICOM file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4011 * @param size The size of the memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4012 * @param format The output format.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4013 * @param flags Flags governing the output.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4014 * @param maxStringLength The maximum length of a field. Too long fields will
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4015 * be output as "null". The 0 value means no maximum length.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4016 * @return The NULL value if the case of an error, or the JSON
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4017 * string. This string must be freed by OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4018 * @ingroup Toolbox
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4019 * @see OrthancPluginDicomInstanceToJson
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4020 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4021 ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomBufferToJson(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4022 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4023 const char* buffer,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4024 uint32_t size,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4025 OrthancPluginDicomToJsonFormat format,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4026 OrthancPluginDicomToJsonFlags flags,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4027 uint32_t maxStringLength)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4028 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4029 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4030
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4031 _OrthancPluginDicomToJson params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4032 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4033 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4034 params.buffer = buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4035 params.size = size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4036 params.format = format;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4037 params.flags = flags;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4038 params.maxStringLength = maxStringLength;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4039
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4040 if (context->InvokeService(context, _OrthancPluginService_DicomBufferToJson, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4041 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4042 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4043 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4044 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4045 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4046 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4047 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4048 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4049 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4050
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4051
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4052 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4053 * @brief Format a DICOM instance as a JSON string.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4054 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4055 * This function formats a DICOM instance that is stored in Orthanc,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4056 * and outputs a JSON string representing the tags of this DICOM
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4057 * instance.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4058 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4059 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4060 * @param instanceId The Orthanc identifier of the instance.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4061 * @param format The output format.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4062 * @param flags Flags governing the output.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4063 * @param maxStringLength The maximum length of a field. Too long fields will
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4064 * be output as "null". The 0 value means no maximum length.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4065 * @return The NULL value if the case of an error, or the JSON
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4066 * string. This string must be freed by OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4067 * @ingroup Toolbox
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4068 * @see OrthancPluginDicomInstanceToJson
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4069 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4070 ORTHANC_PLUGIN_INLINE char* OrthancPluginDicomInstanceToJson(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4071 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4072 const char* instanceId,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4073 OrthancPluginDicomToJsonFormat format,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4074 OrthancPluginDicomToJsonFlags flags,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4075 uint32_t maxStringLength)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4076 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4077 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4078
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4079 _OrthancPluginDicomToJson params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4080 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4081 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4082 params.instanceId = instanceId;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4083 params.format = format;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4084 params.flags = flags;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4085 params.maxStringLength = maxStringLength;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4086
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4087 if (context->InvokeService(context, _OrthancPluginService_DicomInstanceToJson, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4088 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4089 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4090 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4091 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4092 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4093 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4094 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4095 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4096 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4097
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4098
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4099 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4100 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4101 OrthancPluginMemoryBuffer* target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4102 const char* uri;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4103 uint32_t headersCount;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4104 const char* const* headersKeys;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4105 const char* const* headersValues;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4106 int32_t afterPlugins;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4107 } _OrthancPluginRestApiGet2;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4108
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4109 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4110 * @brief Make a GET call to the Orthanc REST API, with custom HTTP headers.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4111 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4112 * Make a GET call to the Orthanc REST API with extended
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4113 * parameters. The result to the query is stored into a newly
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4114 * allocated memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4115 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4116 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4117 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4118 * @param uri The URI in the built-in Orthanc API.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4119 * @param headersCount The number of HTTP headers.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4120 * @param headersKeys Array containing the keys of the HTTP headers.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4121 * @param headersValues Array containing the values of the HTTP headers.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4122 * @param afterPlugins If 0, the built-in API of Orthanc is used.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4123 * If 1, the API is tainted by the plugins.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4124 * @return 0 if success, or the error code if failure.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4125 * @see OrthancPluginRestApiGet, OrthancPluginRestApiGetAfterPlugins
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4126 * @ingroup Orthanc
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4127 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4128 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRestApiGet2(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4129 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4130 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4131 const char* uri,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4132 uint32_t headersCount,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4133 const char* const* headersKeys,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4134 const char* const* headersValues,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4135 int32_t afterPlugins)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4136 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4137 _OrthancPluginRestApiGet2 params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4138 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4139 params.uri = uri;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4140 params.headersCount = headersCount;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4141 params.headersKeys = headersKeys;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4142 params.headersValues = headersValues;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4143 params.afterPlugins = afterPlugins;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4144
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4145 return context->InvokeService(context, _OrthancPluginService_RestApiGet2, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4146 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4147
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4148
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4149
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4150 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4151 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4152 OrthancPluginWorklistCallback callback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4153 } _OrthancPluginWorklistCallback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4154
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4155 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4156 * @brief Register a callback to handle modality worklists requests.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4157 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4158 * This function registers a callback to handle C-Find SCP requests
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4159 * on modality worklists.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4160 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4161 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4162 * @param callback The callback.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4163 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4164 * @ingroup Worklists
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4165 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4166 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterWorklistCallback(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4167 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4168 OrthancPluginWorklistCallback callback)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4169 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4170 _OrthancPluginWorklistCallback params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4171 params.callback = callback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4172
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4173 return context->InvokeService(context, _OrthancPluginService_RegisterWorklistCallback, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4174 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4175
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4176
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4177
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4178 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4179 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4180 OrthancPluginWorklistAnswers* answers;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4181 const OrthancPluginWorklistQuery* query;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4182 const void* dicom;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4183 uint32_t size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4184 } _OrthancPluginWorklistAnswersOperation;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4185
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4186 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4187 * @brief Add one answer to some modality worklist request.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4188 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4189 * This function adds one worklist (encoded as a DICOM file) to the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4190 * set of answers corresponding to some C-Find SCP request against
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4191 * modality worklists.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4192 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4193 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4194 * @param answers The set of answers.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4195 * @param query The worklist query, as received by the callback.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4196 * @param dicom The worklist to answer, encoded as a DICOM file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4197 * @param size The size of the DICOM file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4198 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4199 * @ingroup Worklists
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4200 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4201 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginWorklistAddAnswer(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4202 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4203 OrthancPluginWorklistAnswers* answers,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4204 const OrthancPluginWorklistQuery* query,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4205 const void* dicom,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4206 uint32_t size)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4207 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4208 _OrthancPluginWorklistAnswersOperation params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4209 params.answers = answers;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4210 params.query = query;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4211 params.dicom = dicom;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4212 params.size = size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4213
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4214 return context->InvokeService(context, _OrthancPluginService_WorklistAddAnswer, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4215 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4216
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4217
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4218 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4219 * @brief Mark the set of worklist answers as incomplete.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4220 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4221 * This function marks as incomplete the set of answers
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4222 * corresponding to some C-Find SCP request against modality
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4223 * worklists. This must be used if canceling the handling of a
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4224 * request when too many answers are to be returned.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4225 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4226 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4227 * @param answers The set of answers.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4228 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4229 * @ingroup Worklists
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4230 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4231 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginWorklistMarkIncomplete(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4232 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4233 OrthancPluginWorklistAnswers* answers)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4234 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4235 _OrthancPluginWorklistAnswersOperation params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4236 params.answers = answers;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4237 params.query = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4238 params.dicom = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4239 params.size = 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4240
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4241 return context->InvokeService(context, _OrthancPluginService_WorklistMarkIncomplete, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4242 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4243
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4244
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4245 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4246 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4247 const OrthancPluginWorklistQuery* query;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4248 const void* dicom;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4249 uint32_t size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4250 int32_t* isMatch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4251 OrthancPluginMemoryBuffer* target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4252 } _OrthancPluginWorklistQueryOperation;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4253
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4254 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4255 * @brief Test whether a worklist matches the query.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4256 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4257 * This function checks whether one worklist (encoded as a DICOM
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4258 * file) matches the C-Find SCP query against modality
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4259 * worklists. This function must be called before adding the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4260 * worklist as an answer through OrthancPluginWorklistAddAnswer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4261 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4262 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4263 * @param query The worklist query, as received by the callback.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4264 * @param dicom The worklist to answer, encoded as a DICOM file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4265 * @param size The size of the DICOM file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4266 * @return 1 if the worklist matches the query, 0 otherwise.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4267 * @ingroup Worklists
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4268 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4269 ORTHANC_PLUGIN_INLINE int32_t OrthancPluginWorklistIsMatch(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4270 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4271 const OrthancPluginWorklistQuery* query,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4272 const void* dicom,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4273 uint32_t size)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4274 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4275 int32_t isMatch = 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4276
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4277 _OrthancPluginWorklistQueryOperation params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4278 params.query = query;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4279 params.dicom = dicom;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4280 params.size = size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4281 params.isMatch = &isMatch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4282 params.target = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4283
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4284 if (context->InvokeService(context, _OrthancPluginService_WorklistIsMatch, &params) == OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4285 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4286 return isMatch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4287 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4288 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4289 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4290 /* Error: Assume non-match */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4291 return 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4292 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4293 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4294
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4295
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4296 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4297 * @brief Retrieve the worklist query as a DICOM file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4298 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4299 * This function retrieves the DICOM file that underlies a C-Find
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4300 * SCP query against modality worklists.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4301 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4302 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4303 * @param target Memory buffer where to store the DICOM file. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4304 * @param query The worklist query, as received by the callback.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4305 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4306 * @ingroup Worklists
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4307 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4308 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginWorklistGetDicomQuery(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4309 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4310 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4311 const OrthancPluginWorklistQuery* query)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4312 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4313 _OrthancPluginWorklistQueryOperation params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4314 params.query = query;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4315 params.dicom = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4316 params.size = 0;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4317 params.isMatch = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4318 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4319
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4320 return context->InvokeService(context, _OrthancPluginService_WorklistGetDicomQuery, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4321 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4322
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4323
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4324 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4325 * @brief Get the origin of a DICOM file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4326 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4327 * This function returns the origin of a DICOM instance that has been received by Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4328 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4329 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4330 * @param instance The instance of interest.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4331 * @return The origin of the instance.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4332 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4333 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4334 ORTHANC_PLUGIN_INLINE OrthancPluginInstanceOrigin OrthancPluginGetInstanceOrigin(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4335 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4336 OrthancPluginDicomInstance* instance)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4337 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4338 OrthancPluginInstanceOrigin origin;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4339
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4340 _OrthancPluginAccessDicomInstance params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4341 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4342 params.resultOrigin = &origin;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4343 params.instance = instance;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4344
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4345 if (context->InvokeService(context, _OrthancPluginService_GetInstanceOrigin, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4346 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4347 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4348 return OrthancPluginInstanceOrigin_Unknown;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4349 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4350 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4351 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4352 return origin;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4353 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4354 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4355
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4356
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4357 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4358 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4359 OrthancPluginMemoryBuffer* target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4360 const char* json;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4361 const OrthancPluginImage* pixelData;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4362 OrthancPluginCreateDicomFlags flags;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4363 } _OrthancPluginCreateDicom;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4364
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4365 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4366 * @brief Create a DICOM instance from a JSON string and an image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4367 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4368 * This function takes as input a string containing a JSON file
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4369 * describing the content of a DICOM instance. As an output, it
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4370 * writes the corresponding DICOM instance to a newly allocated
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4371 * memory buffer. Additionally, an image to be encoded within the
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4372 * DICOM instance can also be provided.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4373 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4374 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4375 * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4376 * @param json The input JSON file.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4377 * @param pixelData The image. Can be NULL, if the pixel data is encoded inside the JSON with the data URI scheme.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4378 * @param flags Flags governing the output.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4379 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4380 * @ingroup Toolbox
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4381 * @see OrthancPluginDicomBufferToJson
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4382 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4383 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCreateDicom(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4384 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4385 OrthancPluginMemoryBuffer* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4386 const char* json,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4387 const OrthancPluginImage* pixelData,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4388 OrthancPluginCreateDicomFlags flags)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4389 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4390 _OrthancPluginCreateDicom params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4391 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4392 params.json = json;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4393 params.pixelData = pixelData;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4394 params.flags = flags;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4395
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4396 return context->InvokeService(context, _OrthancPluginService_CreateDicom, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4397 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4398
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4399
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4400 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4401 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4402 OrthancPluginDecodeImageCallback callback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4403 } _OrthancPluginDecodeImageCallback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4404
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4405 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4406 * @brief Register a callback to handle the decoding of DICOM images.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4407 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4408 * This function registers a custom callback to the decoding of
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4409 * DICOM images, replacing the built-in decoder of Orthanc.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4410 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4411 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4412 * @param callback The callback.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4413 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4414 * @ingroup Callbacks
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4415 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4416 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterDecodeImageCallback(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4417 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4418 OrthancPluginDecodeImageCallback callback)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4419 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4420 _OrthancPluginDecodeImageCallback params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4421 params.callback = callback;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4422
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4423 return context->InvokeService(context, _OrthancPluginService_RegisterDecodeImageCallback, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4424 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4425
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4426
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4427
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4428 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4429 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4430 OrthancPluginImage** target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4431 OrthancPluginPixelFormat format;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4432 uint32_t width;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4433 uint32_t height;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4434 uint32_t pitch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4435 void* buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4436 const void* constBuffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4437 uint32_t bufferSize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4438 uint32_t frameIndex;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4439 } _OrthancPluginCreateImage;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4440
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4441
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4442 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4443 * @brief Create an image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4444 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4445 * This function creates an image of given size and format.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4446 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4447 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4448 * @param format The format of the pixels.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4449 * @param width The width of the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4450 * @param height The height of the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4451 * @return The newly allocated image. It must be freed with OrthancPluginFreeImage().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4452 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4453 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4454 ORTHANC_PLUGIN_INLINE OrthancPluginImage* OrthancPluginCreateImage(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4455 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4456 OrthancPluginPixelFormat format,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4457 uint32_t width,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4458 uint32_t height)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4459 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4460 OrthancPluginImage* target = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4461
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4462 _OrthancPluginCreateImage params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4463 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4464 params.target = &target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4465 params.format = format;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4466 params.width = width;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4467 params.height = height;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4468
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4469 if (context->InvokeService(context, _OrthancPluginService_CreateImage, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4470 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4471 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4472 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4473 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4474 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4475 return target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4476 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4477 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4478
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4479
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4480 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4481 * @brief Create an image pointing to a memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4482 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4483 * This function creates an image whose content points to a memory
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4484 * buffer managed by the plugin. Note that the buffer is directly
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4485 * accessed, no memory is allocated and no data is copied.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4486 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4487 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4488 * @param format The format of the pixels.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4489 * @param width The width of the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4490 * @param height The height of the image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4491 * @param pitch The pitch of the image (i.e. the number of bytes
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4492 * between 2 successive lines of the image in the memory buffer).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4493 * @param buffer The memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4494 * @return The newly allocated image. It must be freed with OrthancPluginFreeImage().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4495 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4496 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4497 ORTHANC_PLUGIN_INLINE OrthancPluginImage* OrthancPluginCreateImageAccessor(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4498 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4499 OrthancPluginPixelFormat format,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4500 uint32_t width,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4501 uint32_t height,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4502 uint32_t pitch,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4503 void* buffer)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4504 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4505 OrthancPluginImage* target = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4506
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4507 _OrthancPluginCreateImage params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4508 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4509 params.target = &target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4510 params.format = format;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4511 params.width = width;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4512 params.height = height;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4513 params.pitch = pitch;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4514 params.buffer = buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4515
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4516 if (context->InvokeService(context, _OrthancPluginService_CreateImageAccessor, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4517 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4518 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4519 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4520 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4521 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4522 return target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4523 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4524 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4525
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4526
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4527
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4528 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4529 * @brief Decode one frame from a DICOM instance.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4530 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4531 * This function decodes one frame of a DICOM image that is stored
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4532 * in a memory buffer. This function will give the same result as
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4533 * OrthancPluginUncompressImage() for single-frame DICOM images.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4534 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4535 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4536 * @param buffer Pointer to a memory buffer containing the DICOM image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4537 * @param bufferSize Size of the memory buffer containing the DICOM image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4538 * @param frameIndex The index of the frame of interest in a multi-frame image.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4539 * @return The uncompressed image. It must be freed with OrthancPluginFreeImage().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4540 * @ingroup Images
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4541 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4542 ORTHANC_PLUGIN_INLINE OrthancPluginImage* OrthancPluginDecodeDicomImage(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4543 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4544 const void* buffer,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4545 uint32_t bufferSize,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4546 uint32_t frameIndex)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4547 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4548 OrthancPluginImage* target = NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4549
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4550 _OrthancPluginCreateImage params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4551 memset(&params, 0, sizeof(params));
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4552 params.target = &target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4553 params.constBuffer = buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4554 params.bufferSize = bufferSize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4555 params.frameIndex = frameIndex;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4556
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4557 if (context->InvokeService(context, _OrthancPluginService_DecodeDicomImage, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4558 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4559 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4560 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4561 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4562 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4563 return target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4564 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4565 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4566
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4567
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4568
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4569 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4570 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4571 char** result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4572 const void* buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4573 uint32_t size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4574 } _OrthancPluginComputeHash;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4575
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4576 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4577 * @brief Compute an MD5 hash.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4578 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4579 * This functions computes the MD5 cryptographic hash of the given memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4580 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4581 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4582 * @param buffer The source memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4583 * @param size The size in bytes of the source buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4584 * @return The NULL value in case of error, or a string containing the cryptographic hash.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4585 * This string must be freed by OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4586 * @ingroup Toolbox
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4587 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4588 ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeMd5(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4589 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4590 const void* buffer,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4591 uint32_t size)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4592 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4593 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4594
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4595 _OrthancPluginComputeHash params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4596 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4597 params.buffer = buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4598 params.size = size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4599
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4600 if (context->InvokeService(context, _OrthancPluginService_ComputeMd5, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4601 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4602 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4603 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4604 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4605 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4606 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4607 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4608 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4609 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4610
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4611
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4612 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4613 * @brief Compute a SHA-1 hash.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4614 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4615 * This functions computes the SHA-1 cryptographic hash of the given memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4616 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4617 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4618 * @param buffer The source memory buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4619 * @param size The size in bytes of the source buffer.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4620 * @return The NULL value in case of error, or a string containing the cryptographic hash.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4621 * This string must be freed by OrthancPluginFreeString().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4622 * @ingroup Toolbox
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4623 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4624 ORTHANC_PLUGIN_INLINE char* OrthancPluginComputeSha1(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4625 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4626 const void* buffer,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4627 uint32_t size)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4628 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4629 char* result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4630
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4631 _OrthancPluginComputeHash params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4632 params.result = &result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4633 params.buffer = buffer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4634 params.size = size;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4635
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4636 if (context->InvokeService(context, _OrthancPluginService_ComputeSha1, &params) != OrthancPluginErrorCode_Success)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4637 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4638 /* Error */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4639 return NULL;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4640 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4641 else
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4642 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4643 return result;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4644 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4645 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4646
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4647
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4648
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4649 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4650 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4651 OrthancPluginDictionaryEntry* target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4652 const char* name;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4653 } _OrthancPluginLookupDictionary;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4654
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4655 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4656 * @brief Get information about the given DICOM tag.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4657 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4658 * This functions makes a lookup in the dictionary of DICOM tags
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4659 * that are known to Orthanc, and returns information about this
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4660 * tag. The tag can be specified using its human-readable name
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4661 * (e.g. "PatientName") or a set of two hexadecimal numbers
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4662 * (e.g. "0010-0020").
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4663 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4664 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4665 * @param target Where to store the information about the tag.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4666 * @param name The name of the DICOM tag.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4667 * @return 0 if success, other value if error.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4668 * @ingroup Toolbox
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4669 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4670 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginLookupDictionary(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4671 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4672 OrthancPluginDictionaryEntry* target,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4673 const char* name)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4674 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4675 _OrthancPluginLookupDictionary params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4676 params.target = target;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4677 params.name = name;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4678 return context->InvokeService(context, _OrthancPluginService_LookupDictionary, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4679 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4680
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4681
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4682
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4683 typedef struct
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4684 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4685 OrthancPluginRestOutput* output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4686 const char* answer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4687 uint32_t answerSize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4688 uint32_t headersCount;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4689 const char* const* headersKeys;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4690 const char* const* headersValues;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4691 } _OrthancPluginSendMultipartItem2;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4692
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4693 /**
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4694 * @brief Send an item as a part of some HTTP multipart answer, with custom headers.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4695 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4696 * This function sends an item as a part of some HTTP multipart
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4697 * answer that was initiated by OrthancPluginStartMultipartAnswer(). In addition to
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4698 * OrthancPluginSendMultipartItem(), this function will set HTTP header associated
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4699 * with the item.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4700 *
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4701 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4702 * @param output The HTTP connection to the client application.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4703 * @param answer Pointer to the memory buffer containing the item.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4704 * @param answerSize Number of bytes of the item.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4705 * @param headersCount The number of HTTP headers.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4706 * @param headersKeys Array containing the keys of the HTTP headers.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4707 * @param headersValues Array containing the values of the HTTP headers.
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4708 * @return 0 if success, or the error code if failure (this notably happens
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4709 * if the connection is closed by the client).
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4710 * @see OrthancPluginSendMultipartItem()
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4711 * @ingroup REST
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4712 **/
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4713 ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginSendMultipartItem2(
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4714 OrthancPluginContext* context,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4715 OrthancPluginRestOutput* output,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4716 const char* answer,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4717 uint32_t answerSize,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4718 uint32_t headersCount,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4719 const char* const* headersKeys,
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4720 const char* const* headersValues)
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4721 {
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4722 _OrthancPluginSendMultipartItem2 params;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4723 params.output = output;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4724 params.answer = answer;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4725 params.answerSize = answerSize;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4726 params.headersCount = headersCount;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4727 params.headersKeys = headersKeys;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4728 params.headersValues = headersValues;
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4729
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4730 return context->InvokeService(context, _OrthancPluginService_SendMultipartItem2, &params);
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4731 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4732
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4733
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4734 #ifdef __cplusplus
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4735 }
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4736 #endif
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4737
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4738
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4739 /** @} */
d1806b4e4839 moving OrthancStone/Samples/ as Applications/Samples/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4740